repo_name
stringlengths
6
100
path
stringlengths
4
294
copies
stringclasses
981 values
size
stringlengths
4
6
content
stringlengths
606
896k
license
stringclasses
15 values
input_ids
listlengths
1.02k
1.02k
labels
listlengths
1.02k
1.02k
attention_mask
listlengths
1.02k
1.02k
gurneyalex/odoo
addons/hr_holidays/models/mail_channel.py
7
1538
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models class Channel(models.Model): _inherit = 'mail.channel' def partner_info(self, all_partners, direct_partners): partner_infos = super(Channel, self).partner_info(all_partners, direct_partners) # only search for leave out_of_office_message if im_status is on leave partners_on_leave = [partner_id for partner_id in direct_partners.ids if 'leave' in partner_infos[partner_id]['im_status']] if partners_on_leave: now = fields.Datetime.now() self.env.cr.execute('''SELECT res_users.partner_id as partner_id, hr_leave.date_to as date_to FROM res_users JOIN hr_leave ON hr_leave.user_id = res_users.id AND hr_leave.state not in ('cancel', 'refuse') AND res_users.active = 't' AND hr_leave.date_from <= %s AND hr_leave.date_to >= %s AND res_users.partner_id in %s''', (now, now, tuple(partners_on_leave))) out_of_office_infos = dict(((res['partner_id'], res) for res in self.env.cr.dictfetchall())) for partner_id, out_of_office_info in out_of_office_infos.items(): partner_infos[partner_id]['out_of_office_date_end'] = out_of_office_info['date_to'] return partner_infos
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, 28811, 492, 2986, 12, 1504, 12, 1709, 421, 199, 533, 17270, 8, 992, 14, 1685, 304, 272, 485, 6486, 275, 283, 1198, 14, 2775, 7, 339, 347, 5854, 63, 815, 8, 277, 12, 1006, 63, 23385, 12, 4125, 63, 23385, 304, 267, 5854, 63, 14195, 275, 1613, 8, 5358, 12, 291, 680, 3899, 63, 815, 8, 452, 63, 23385, 12, 4125, 63, 23385, 9, 267, 327, 1454, 2754, 367, 10137, 734, 63, 1618, 63, 18812, 63, 1188, 340, 3416, 63, 1205, 365, 641, 10137, 267, 18943, 63, 265, 63, 12422, 275, 359, 3899, 63, 344, 367, 5854, 63, 344, 315, 4125, 63, 23385, 14, 1580, 340, 283, 12422, 7, 315, 5854, 63, 14195, 59, 3899, 63, 344, 2733, 1017, 63, 1205, 6538, 267, 340, 18943, 63, 265, 63, 12422, 26, 288, 3063, 275, 1504, 14, 19636, 14, 2131, 342, 288, 291, 14, 1813, 14, 1556, 14, 2526, 10505, 4859, 522, 63, 3707, 14, 3899, 63, 344, 465, 5854, 63, 344, 12, 16140, 63, 12422, 14, 602, 63, 475, 465, 1434, 63, 475, 1816, 4442, 522, 63, 3707, 1816, 10593, 16140, 63, 12422, 5258, 16140, 63, 12422, 14, 751, 63, 344, 275, 522, 63, 3707, 14, 344, 1816, 2401, 16140, 63, 12422, 14, 929, 440, 315, 661, 6406, 297, 283, 1121, 1180, 358, 1816, 2401, 522, 63, 3707, 14, 2682, 275, 283, 84, 7, 1816, 2401, 16140, 63, 12422, 14, 602, 63, 504, 2695, 450, 83, 1816, 2401, 16140, 63, 12422, 14, 602, 63, 475, 2356, 450, 83, 1816, 2401, 522, 63, 3707, 14, 3899, 63, 344, 315, 450, 83, 18108, 334, 2131, 12, 3063, 12, 2008, 8, 23385, 63, 265, 63, 12422, 1724, 288, 734, 63, 1618, 63, 18812, 63, 14195, 275, 1211, 12925, 470, 459, 3899, 63, 344, 995, 522, 9, 367, 522, 315, 291, 14, 1813, 14, 1556, 14, 807, 10174, 4059, 288, 367, 5854, 63, 344, 12, 734, 63, 1618, 63, 18812, 63, 815, 315, 734, 63, 1618, 63, 18812, 63, 14195, 14, 1744, 837, 355, 5854, 63, 14195, 59, 3899, 63, 344, 2733, 548, 63, 1618, 63, 18812, 63, 602, 63, 500, 418, 275, 734, 63, 1618, 63, 18812, 63, 815, 459, 602, 63, 475, 418, 267, 372, 5854, 63, 14195, 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 ]
[ 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, 28811, 492, 2986, 12, 1504, 12, 1709, 421, 199, 533, 17270, 8, 992, 14, 1685, 304, 272, 485, 6486, 275, 283, 1198, 14, 2775, 7, 339, 347, 5854, 63, 815, 8, 277, 12, 1006, 63, 23385, 12, 4125, 63, 23385, 304, 267, 5854, 63, 14195, 275, 1613, 8, 5358, 12, 291, 680, 3899, 63, 815, 8, 452, 63, 23385, 12, 4125, 63, 23385, 9, 267, 327, 1454, 2754, 367, 10137, 734, 63, 1618, 63, 18812, 63, 1188, 340, 3416, 63, 1205, 365, 641, 10137, 267, 18943, 63, 265, 63, 12422, 275, 359, 3899, 63, 344, 367, 5854, 63, 344, 315, 4125, 63, 23385, 14, 1580, 340, 283, 12422, 7, 315, 5854, 63, 14195, 59, 3899, 63, 344, 2733, 1017, 63, 1205, 6538, 267, 340, 18943, 63, 265, 63, 12422, 26, 288, 3063, 275, 1504, 14, 19636, 14, 2131, 342, 288, 291, 14, 1813, 14, 1556, 14, 2526, 10505, 4859, 522, 63, 3707, 14, 3899, 63, 344, 465, 5854, 63, 344, 12, 16140, 63, 12422, 14, 602, 63, 475, 465, 1434, 63, 475, 1816, 4442, 522, 63, 3707, 1816, 10593, 16140, 63, 12422, 5258, 16140, 63, 12422, 14, 751, 63, 344, 275, 522, 63, 3707, 14, 344, 1816, 2401, 16140, 63, 12422, 14, 929, 440, 315, 661, 6406, 297, 283, 1121, 1180, 358, 1816, 2401, 522, 63, 3707, 14, 2682, 275, 283, 84, 7, 1816, 2401, 16140, 63, 12422, 14, 602, 63, 504, 2695, 450, 83, 1816, 2401, 16140, 63, 12422, 14, 602, 63, 475, 2356, 450, 83, 1816, 2401, 522, 63, 3707, 14, 3899, 63, 344, 315, 450, 83, 18108, 334, 2131, 12, 3063, 12, 2008, 8, 23385, 63, 265, 63, 12422, 1724, 288, 734, 63, 1618, 63, 18812, 63, 14195, 275, 1211, 12925, 470, 459, 3899, 63, 344, 995, 522, 9, 367, 522, 315, 291, 14, 1813, 14, 1556, 14, 807, 10174, 4059, 288, 367, 5854, 63, 344, 12, 734, 63, 1618, 63, 18812, 63, 815, 315, 734, 63, 1618, 63, 18812, 63, 14195, 14, 1744, 837, 355, 5854, 63, 14195, 59, 3899, 63, 344, 2733, 548, 63, 1618, 63, 18812, 63, 602, 63, 500, 418, 275, 734, 63, 1618, 63, 18812, 63, 815, 459, 602, 63, 475, 418, 267, 372, 5854, 63, 14195, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
RayMick/scikit-learn
sklearn/covariance/outlier_detection.py
208
6917
""" Class for outlier detection. This class provides a framework for outlier detection. It consists in several methods that can be added to a covariance estimator in order to assess the outlying-ness of the observations of a data set. Such a "outlier detector" object is proposed constructed from a robust covariance estimator (the Minimum Covariance Determinant). """ # Author: Virgile Fritsch <virgile.fritsch@inria.fr> # # License: BSD 3 clause import warnings import numpy as np import scipy as sp from . import MinCovDet from ..base import ClassifierMixin from ..utils.validation import check_is_fitted class OutlierDetectionMixin(object): """Set of methods for outliers detection with covariance estimators. Parameters ---------- contamination : float, 0. < contamination < 0.5 The amount of contamination of the data set, i.e. the proportion of outliers in the data set. Notes ----- Outlier detection from covariance estimation may break or not perform well in high-dimensional settings. In particular, one will always take care to work with ``n_samples > n_features ** 2``. """ def __init__(self, contamination=0.1): self.contamination = contamination def decision_function(self, X, raw_values=False): """Compute the decision function of the given observations. Parameters ---------- X : array-like, shape (n_samples, n_features) raw_values : bool Whether or not to consider raw Mahalanobis distances as the decision function. Must be False (default) for compatibility with the others outlier detection tools. Returns ------- decision : array-like, shape (n_samples, ) The values of the decision function for each observations. It is equal to the Mahalanobis distances if `raw_values` is True. By default (``raw_values=True``), it is equal to the cubic root of the shifted Mahalanobis distances. In that case, the threshold for being an outlier is 0, which ensures a compatibility with other outlier detection tools such as the One-Class SVM. """ check_is_fitted(self, 'threshold_') mahal_dist = self.mahalanobis(X) if raw_values: decision = mahal_dist else: check_is_fitted(self, 'threshold_') transformed_mahal_dist = mahal_dist ** 0.33 decision = self.threshold_ ** 0.33 - transformed_mahal_dist return decision def predict(self, X): """Outlyingness of observations in X according to the fitted model. Parameters ---------- X : array-like, shape = (n_samples, n_features) Returns ------- is_outliers : array, shape = (n_samples, ), dtype = bool For each observations, tells whether or not it should be considered as an outlier according to the fitted model. threshold : float, The values of the less outlying point's decision function. """ check_is_fitted(self, 'threshold_') is_inlier = -np.ones(X.shape[0], dtype=int) if self.contamination is not None: values = self.decision_function(X, raw_values=True) is_inlier[values <= self.threshold_] = 1 else: raise NotImplementedError("You must provide a contamination rate.") return is_inlier @property def threshold(self): warnings.warn(("The threshold attribute is renamed to threshold_ from " "0.16 onwards and will be removed in 0.18"), DeprecationWarning, stacklevel=1) return getattr(self, 'threshold_', None) class EllipticEnvelope(ClassifierMixin, OutlierDetectionMixin, MinCovDet): """An object for detecting outliers in a Gaussian distributed dataset. Read more in the :ref:`User Guide <outlier_detection>`. Attributes ---------- `contamination` : float, 0. < contamination < 0.5 The amount of contamination of the data set, i.e. the proportion of \ outliers in the data set. location_ : array-like, shape (n_features,) Estimated robust location covariance_ : array-like, shape (n_features, n_features) Estimated robust covariance matrix precision_ : array-like, shape (n_features, n_features) Estimated pseudo inverse matrix. (stored only if store_precision is True) support_ : array-like, shape (n_samples,) A mask of the observations that have been used to compute the robust estimates of location and shape. Parameters ---------- store_precision : bool Specify if the estimated precision is stored. assume_centered : Boolean If True, the support of robust location and covariance estimates is computed, and a covariance estimate is recomputed from it, without centering the data. Useful to work with data whose mean is significantly equal to zero but is not exactly zero. If False, the robust location and covariance are directly computed with the FastMCD algorithm without additional treatment. support_fraction : float, 0 < support_fraction < 1 The proportion of points to be included in the support of the raw MCD estimate. Default is ``None``, which implies that the minimum value of support_fraction will be used within the algorithm: `[n_sample + n_features + 1] / 2`. contamination : float, 0. < contamination < 0.5 The amount of contamination of the data set, i.e. the proportion of outliers in the data set. See Also -------- EmpiricalCovariance, MinCovDet Notes ----- Outlier detection from covariance estimation may break or not perform well in high-dimensional settings. In particular, one will always take care to work with ``n_samples > n_features ** 2``. References ---------- .. [1] Rousseeuw, P.J., Van Driessen, K. "A fast algorithm for the minimum covariance determinant estimator" Technometrics 41(3), 212 (1999) """ def __init__(self, store_precision=True, assume_centered=False, support_fraction=None, contamination=0.1, random_state=None): MinCovDet.__init__(self, store_precision=store_precision, assume_centered=assume_centered, support_fraction=support_fraction, random_state=random_state) OutlierDetectionMixin.__init__(self, contamination=contamination) def fit(self, X, y=None): MinCovDet.fit(self, X) self.threshold_ = sp.stats.scoreatpercentile( self.dist_, 100. * (1. - self.contamination)) return self
bsd-3-clause
[ 624, 199, 2543, 367, 734, 5697, 15212, 14, 199, 199, 2765, 1021, 6571, 282, 10059, 367, 734, 5697, 15212, 14, 2779, 18581, 315, 199, 261, 422, 279, 3102, 626, 883, 506, 3483, 370, 282, 13263, 8943, 315, 1865, 370, 199, 305, 5480, 314, 734, 6670, 13, 4171, 402, 314, 19739, 402, 282, 666, 663, 14, 199, 16912, 282, 298, 548, 5697, 17842, 2, 909, 365, 14075, 14701, 687, 282, 23399, 199, 15024, 8943, 334, 1589, 22466, 1849, 6221, 1487, 2704, 867, 680, 199, 199, 624, 199, 3, 6529, 26, 812, 723, 71, 441, 31712, 1086, 335, 665, 1042, 71, 441, 14, 25876, 1086, 335, 32, 262, 23714, 14, 4391, 30, 199, 3, 199, 3, 844, 26, 6289, 650, 8502, 199, 199, 646, 3598, 199, 646, 2680, 465, 980, 199, 646, 7026, 465, 2249, 199, 504, 1275, 492, 10195, 967, 86, 21097, 199, 504, 2508, 1095, 492, 8465, 5541, 4256, 199, 504, 2508, 1208, 14, 6136, 492, 1104, 63, 374, 63, 21903, 421, 199, 533, 6219, 5697, 31198, 4256, 8, 785, 304, 272, 408, 1084, 402, 3102, 367, 734, 14035, 15212, 543, 13263, 23155, 14, 339, 3897, 272, 4143, 272, 13770, 455, 3155, 520, 2069, 12, 378, 14, 665, 13770, 455, 3155, 665, 378, 14, 21, 267, 710, 5982, 402, 13770, 455, 3155, 402, 314, 666, 663, 12, 284, 14, 69, 14, 314, 24382, 267, 402, 734, 14035, 315, 314, 666, 663, 14, 339, 8144, 272, 9063, 272, 6219, 5697, 15212, 687, 13263, 27156, 1443, 2059, 503, 440, 272, 5147, 5521, 315, 4721, 13, 13014, 2202, 14, 1010, 6770, 12, 1373, 911, 272, 3544, 5452, 10296, 370, 1736, 543, 1124, 78, 63, 3356, 690, 302, 63, 3179, 1011, 499, 4345, 339, 408, 272, 347, 636, 826, 721, 277, 12, 13770, 455, 3155, 29, 16, 14, 17, 304, 267, 291, 14, 11096, 455, 3155, 275, 13770, 455, 3155, 339, 347, 14692, 63, 1593, 8, 277, 12, 1323, 12, 3066, 63, 1459, 29, 797, 304, 267, 408, 8564, 314, 14692, 805, 402, 314, 1627, 19739, 14, 398, 3897, 267, 4143, 267, 1323, 520, 1625, 13, 2930, 12, 2215, 334, 78, 63, 3356, 12, 302, 63, 3179, 9, 398, 3066, 63, 1459, 520, 2155, 288, 7480, 503, 440, 370, 11201, 3066, 603, 11326, 279, 290, 2873, 374, 15108, 465, 314, 288, 14692, 805, 14, 9498, 506, 756, 334, 885, 9, 367, 7163, 288, 543, 314, 11789, 734, 5697, 15212, 7249, 14, 398, 1803, 267, 5514, 267, 14692, 520, 1625, 13, 2930, 12, 2215, 334, 78, 63, 3356, 12, 776, 288, 710, 1338, 402, 314, 14692, 805, 367, 1924, 19739, 14, 288, 2779, 365, 4472, 370, 314, 603, 11326, 279, 290, 2873, 374, 15108, 340, 658, 1773, 63, 1459, 64, 288, 365, 715, 14, 4885, 849, 15693, 1773, 63, 1459, 29, 549, 1040, 395, 652, 365, 4472, 288, 370, 314, 22217, 530, 1738, 402, 314, 31915, 603, 11326, 279, 290, 2873, 374, 15108, 14, 288, 1010, 626, 1930, 12, 314, 8765, 367, 3769, 376, 734, 5697, 365, 378, 12, 1314, 288, 15620, 282, 7163, 543, 1163, 734, 5697, 15212, 7249, 288, 4066, 465, 314, 7309, 13, 2543, 428, 6849, 14, 398, 408, 267, 1104, 63, 374, 63, 21903, 8, 277, 12, 283, 7227, 15452, 267, 610, 19785, 63, 2686, 275, 291, 14, 391, 19785, 290, 2873, 374, 8, 56, 9, 267, 340, 3066, 63, 1459, 26, 288, 14692, 275, 610, 19785, 63, 2686, 267, 587, 26, 288, 1104, 63, 374, 63, 21903, 8, 277, 12, 283, 7227, 15452, 288, 14834, 63, 391, 19785, 63, 2686, 275, 610, 19785, 63, 2686, 1011, 378, 14, 1153, 288, 14692, 275, 291, 14, 7227, 63, 1011, 378, 14, 1153, 446, 14834, 63, 391, 19785, 63, 2686, 398, 372, 14692, 339, 347, 12610, 8, 277, 12, 1323, 304, 267, 408, 2204, 6670, 4171, 402, 19739, 315, 1323, 7182, 370, 314, 26093, 1402, 14, 398, 3897, 267, 4143, 267, 1323, 520, 1625, 13, 2930, 12, 2215, 275, 334, 78, 63, 3356, 12, 302, 63, 3179, 9, 398, 1803, 267, 5514, 267, 365, 63, 28622, 520, 1625, 12, 2215, 275, 334, 78, 63, 3356, 12, 2318, 2152, 275, 2155, 288, 2104, 1924, 19739, 12, 26544, 3775, 503, 440, 652, 1077, 506, 8652, 288, 465, 376, 734, 5697, 7182, 370, 314, 26093, 1402, 14, 398, 8765, 520, 2069, 12, 288, 710, 1338, 402, 314, 6656, 734, 6670, 2376, 1159, 14692, 805, 14, 398, 408, 267, 1104, 63, 374, 63, 21903, 8, 277, 12, 283, 7227, 15452, 267, 365, 63, 262, 5697, 275, 446, 1590, 14, 4548, 8, 56, 14, 1392, 59, 16, 467, 2152, 29, 442, 9, 267, 340, 291, 14, 11096, 455, 3155, 365, 440, 488, 26, 288, 1338, 275, 291, 14, 16622, 63, 1593, 8, 56, 12, 3066, 63, 1459, 29, 549, 9, 288, 365, 63, 262, 5697, 59, 1459, 2695, 291, 14, 7227, 24601, 275, 413, 267, 587, 26, 288, 746, 4279, 480, 5556, 1471, 5647, 282, 13770, 455, 3155, 6634, 2685, 398, 372, 365, 63, 262, 5697, 339, 768, 1829, 272, 347, 8765, 8, 277, 304, 267, 3598, 14, 4050, 9313, 1918, 8765, 2225, 365, 17864, 370, 8765, 63, 687, 298, 2432, 298, 16, 14, 975, 641, 4751, 436, 911, 506, 4829, 315, 378, 14, 1085, 1288, 1993, 13413, 12, 13232, 29, 17, 9, 267, 372, 2519, 8, 277, 12, 283, 7227, 14474, 488, 9, 421, 199, 533, 27761, 764, 28278, 8, 8508, 4256, 12, 6219, 5697, 31198, 4256, 12, 10195, 967, 86, 21097, 304, 272, 408, 2493, 909, 367, 9696, 316, 734, 14035, 315, 282, 17131, 1854, 4789, 14, 339, 5574, 1655, 315, 314, 520, 1121, 1705, 1899, 15423, 665, 548, 5697, 63, 11934, 14943, 339, 9382, 272, 4143, 272, 658, 11096, 455, 3155, 64, 520, 2069, 12, 378, 14, 665, 13770, 455, 3155, 665, 378, 14, 21, 489, 710, 5982, 402, 13770, 455, 3155, 402, 314, 666, 663, 12, 284, 14, 69, 14, 314, 24382, 402, 971, 489, 734, 14035, 315, 314, 666, 663, 14, 339, 2909, 63, 520, 1625, 13, 2930, 12, 2215, 334, 78, 63, 3179, 4258, 267, 15896, 12754, 23399, 2909, 339, 13263, 63, 520, 1625, 13, 2930, 12, 2215, 334, 78, 63, 3179, 12, 302, 63, 3179, 9, 267, 15896, 12754, 23399, 13263, 3634, 339, 7151, 63 ]
[ 199, 2543, 367, 734, 5697, 15212, 14, 199, 199, 2765, 1021, 6571, 282, 10059, 367, 734, 5697, 15212, 14, 2779, 18581, 315, 199, 261, 422, 279, 3102, 626, 883, 506, 3483, 370, 282, 13263, 8943, 315, 1865, 370, 199, 305, 5480, 314, 734, 6670, 13, 4171, 402, 314, 19739, 402, 282, 666, 663, 14, 199, 16912, 282, 298, 548, 5697, 17842, 2, 909, 365, 14075, 14701, 687, 282, 23399, 199, 15024, 8943, 334, 1589, 22466, 1849, 6221, 1487, 2704, 867, 680, 199, 199, 624, 199, 3, 6529, 26, 812, 723, 71, 441, 31712, 1086, 335, 665, 1042, 71, 441, 14, 25876, 1086, 335, 32, 262, 23714, 14, 4391, 30, 199, 3, 199, 3, 844, 26, 6289, 650, 8502, 199, 199, 646, 3598, 199, 646, 2680, 465, 980, 199, 646, 7026, 465, 2249, 199, 504, 1275, 492, 10195, 967, 86, 21097, 199, 504, 2508, 1095, 492, 8465, 5541, 4256, 199, 504, 2508, 1208, 14, 6136, 492, 1104, 63, 374, 63, 21903, 421, 199, 533, 6219, 5697, 31198, 4256, 8, 785, 304, 272, 408, 1084, 402, 3102, 367, 734, 14035, 15212, 543, 13263, 23155, 14, 339, 3897, 272, 4143, 272, 13770, 455, 3155, 520, 2069, 12, 378, 14, 665, 13770, 455, 3155, 665, 378, 14, 21, 267, 710, 5982, 402, 13770, 455, 3155, 402, 314, 666, 663, 12, 284, 14, 69, 14, 314, 24382, 267, 402, 734, 14035, 315, 314, 666, 663, 14, 339, 8144, 272, 9063, 272, 6219, 5697, 15212, 687, 13263, 27156, 1443, 2059, 503, 440, 272, 5147, 5521, 315, 4721, 13, 13014, 2202, 14, 1010, 6770, 12, 1373, 911, 272, 3544, 5452, 10296, 370, 1736, 543, 1124, 78, 63, 3356, 690, 302, 63, 3179, 1011, 499, 4345, 339, 408, 272, 347, 636, 826, 721, 277, 12, 13770, 455, 3155, 29, 16, 14, 17, 304, 267, 291, 14, 11096, 455, 3155, 275, 13770, 455, 3155, 339, 347, 14692, 63, 1593, 8, 277, 12, 1323, 12, 3066, 63, 1459, 29, 797, 304, 267, 408, 8564, 314, 14692, 805, 402, 314, 1627, 19739, 14, 398, 3897, 267, 4143, 267, 1323, 520, 1625, 13, 2930, 12, 2215, 334, 78, 63, 3356, 12, 302, 63, 3179, 9, 398, 3066, 63, 1459, 520, 2155, 288, 7480, 503, 440, 370, 11201, 3066, 603, 11326, 279, 290, 2873, 374, 15108, 465, 314, 288, 14692, 805, 14, 9498, 506, 756, 334, 885, 9, 367, 7163, 288, 543, 314, 11789, 734, 5697, 15212, 7249, 14, 398, 1803, 267, 5514, 267, 14692, 520, 1625, 13, 2930, 12, 2215, 334, 78, 63, 3356, 12, 776, 288, 710, 1338, 402, 314, 14692, 805, 367, 1924, 19739, 14, 288, 2779, 365, 4472, 370, 314, 603, 11326, 279, 290, 2873, 374, 15108, 340, 658, 1773, 63, 1459, 64, 288, 365, 715, 14, 4885, 849, 15693, 1773, 63, 1459, 29, 549, 1040, 395, 652, 365, 4472, 288, 370, 314, 22217, 530, 1738, 402, 314, 31915, 603, 11326, 279, 290, 2873, 374, 15108, 14, 288, 1010, 626, 1930, 12, 314, 8765, 367, 3769, 376, 734, 5697, 365, 378, 12, 1314, 288, 15620, 282, 7163, 543, 1163, 734, 5697, 15212, 7249, 288, 4066, 465, 314, 7309, 13, 2543, 428, 6849, 14, 398, 408, 267, 1104, 63, 374, 63, 21903, 8, 277, 12, 283, 7227, 15452, 267, 610, 19785, 63, 2686, 275, 291, 14, 391, 19785, 290, 2873, 374, 8, 56, 9, 267, 340, 3066, 63, 1459, 26, 288, 14692, 275, 610, 19785, 63, 2686, 267, 587, 26, 288, 1104, 63, 374, 63, 21903, 8, 277, 12, 283, 7227, 15452, 288, 14834, 63, 391, 19785, 63, 2686, 275, 610, 19785, 63, 2686, 1011, 378, 14, 1153, 288, 14692, 275, 291, 14, 7227, 63, 1011, 378, 14, 1153, 446, 14834, 63, 391, 19785, 63, 2686, 398, 372, 14692, 339, 347, 12610, 8, 277, 12, 1323, 304, 267, 408, 2204, 6670, 4171, 402, 19739, 315, 1323, 7182, 370, 314, 26093, 1402, 14, 398, 3897, 267, 4143, 267, 1323, 520, 1625, 13, 2930, 12, 2215, 275, 334, 78, 63, 3356, 12, 302, 63, 3179, 9, 398, 1803, 267, 5514, 267, 365, 63, 28622, 520, 1625, 12, 2215, 275, 334, 78, 63, 3356, 12, 2318, 2152, 275, 2155, 288, 2104, 1924, 19739, 12, 26544, 3775, 503, 440, 652, 1077, 506, 8652, 288, 465, 376, 734, 5697, 7182, 370, 314, 26093, 1402, 14, 398, 8765, 520, 2069, 12, 288, 710, 1338, 402, 314, 6656, 734, 6670, 2376, 1159, 14692, 805, 14, 398, 408, 267, 1104, 63, 374, 63, 21903, 8, 277, 12, 283, 7227, 15452, 267, 365, 63, 262, 5697, 275, 446, 1590, 14, 4548, 8, 56, 14, 1392, 59, 16, 467, 2152, 29, 442, 9, 267, 340, 291, 14, 11096, 455, 3155, 365, 440, 488, 26, 288, 1338, 275, 291, 14, 16622, 63, 1593, 8, 56, 12, 3066, 63, 1459, 29, 549, 9, 288, 365, 63, 262, 5697, 59, 1459, 2695, 291, 14, 7227, 24601, 275, 413, 267, 587, 26, 288, 746, 4279, 480, 5556, 1471, 5647, 282, 13770, 455, 3155, 6634, 2685, 398, 372, 365, 63, 262, 5697, 339, 768, 1829, 272, 347, 8765, 8, 277, 304, 267, 3598, 14, 4050, 9313, 1918, 8765, 2225, 365, 17864, 370, 8765, 63, 687, 298, 2432, 298, 16, 14, 975, 641, 4751, 436, 911, 506, 4829, 315, 378, 14, 1085, 1288, 1993, 13413, 12, 13232, 29, 17, 9, 267, 372, 2519, 8, 277, 12, 283, 7227, 14474, 488, 9, 421, 199, 533, 27761, 764, 28278, 8, 8508, 4256, 12, 6219, 5697, 31198, 4256, 12, 10195, 967, 86, 21097, 304, 272, 408, 2493, 909, 367, 9696, 316, 734, 14035, 315, 282, 17131, 1854, 4789, 14, 339, 5574, 1655, 315, 314, 520, 1121, 1705, 1899, 15423, 665, 548, 5697, 63, 11934, 14943, 339, 9382, 272, 4143, 272, 658, 11096, 455, 3155, 64, 520, 2069, 12, 378, 14, 665, 13770, 455, 3155, 665, 378, 14, 21, 489, 710, 5982, 402, 13770, 455, 3155, 402, 314, 666, 663, 12, 284, 14, 69, 14, 314, 24382, 402, 971, 489, 734, 14035, 315, 314, 666, 663, 14, 339, 2909, 63, 520, 1625, 13, 2930, 12, 2215, 334, 78, 63, 3179, 4258, 267, 15896, 12754, 23399, 2909, 339, 13263, 63, 520, 1625, 13, 2930, 12, 2215, 334, 78, 63, 3179, 12, 302, 63, 3179, 9, 267, 15896, 12754, 23399, 13263, 3634, 339, 7151, 63, 0 ]
[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 ]
kordless/zoto-server
aztk/plugins/Paypal.py
1
7615
""" plugins/Paypal.py Author: Trey Stout Date Added: Mon Jul 24 15:29:48 CDT 2006 New interface to the same old shit... """ ## STD LIBS from md5 import md5 from datetime import date, datetime from xml.dom import minidom from pprint import pprint, pformat from math import floor import time ## OUR LIBS from AZTKAPI import AZTKAPI from decorators import stack from PaymentPlugin import PaymentPlugin import errors, aztk_config, validation ## 3RD PARTY LIBS from twisted.internet.defer import Deferred, DeferredList from twisted.internet import ssl from twisted.web import client import SOAPpy class Paypal(AZTKAPI, PaymentPlugin): enable_node = True def start(self): self.log.info("start called on paypal plugin") if aztk_config.setup.get('site', 'environment') in ['sandbox', 'development', 'staging']: self.log.info("using sandbox info for paypal") self.host = self._cfg_sandbox_host self.port = self._cfg_sandbox_port self.url = self._cfg_sandbox_url self.api_username = self._cfg_sandbox_username self.api_password = self._cfg_sandbox_password self.private_ssl_key = self._cfg_sandbox_private_key_file self.public_ssl_key = self._cfg_sandbox_public_key_file else: self.log.info("using production info for paypal") self.host = self._cfg_production_host self.port = self._cfg_production_port self.url = self._cfg_production_url self.api_username = self._cfg_production_username self.api_password = self._cfg_production_password self.private_ssl_key = self._cfg_production_private_key_file self.public_ssl_key = self._cfg_production_public_key_file @stack def random_txn_id(self): from random import shuffle import string chunks = list(string.ascii_uppercase+string.digits) shuffle(chunks) return "FAKE_%s" % ''.join(chunks[0:12]) @stack def _encode_for_shock_and_awe(self, user_info): new_dict = {} for key, value in user_info.items(): if isinstance(value, (str, unicode)): new_dict[key] = value.encode('utf-8') else: new_dict[key] = value return new_dict @stack def authorize_payment(self, user_info): """ run a payment across to paypal's SOAP API """ self.check_data(user_info) user_info = self._encode_for_shock_and_awe(user_info) self.log.info("running payment with this data: %s" % pformat(user_info)) if aztk_config.setup.get('site', 'environment') in ['sandbox', 'development', 'staging']: ## we can't use the sandbox unless someone actually logs into the sandbox website on paypal ## so just return a bunch of bogus crap self.log.info("Returning dummy data") return (0, { 'transaction_id': self.random_txn_id(), 'username': user_info['username'], 'amount': '29.95', 'avs_code': 'X', 'cvv2_code': 'M', 'processing_node': self.app.host, }) def handle_result(result): r = SOAPpy.parseSOAP(result) if r.DoDirectPaymentResponse.Ack == "Success": self.log.info(" - ") self.log.info("Received success from PayPal for %s" % (user_info['username']) ) self.log.info("%s" % result) payment_info = { 'transaction_id': r.DoDirectPaymentResponse.TransactionID, 'username': user_info['username'], 'amount': r.DoDirectPaymentResponse.Amount, 'avs_code': r.DoDirectPaymentResponse.AVSCode, 'cvv2_code': r.DoDirectPaymentResponse.CVV2Code, 'processing_node': self.app.host, } return (0, payment_info) else: self.log.info(" - ") if isinstance(r.DoDirectPaymentResponse.Errors, (list, tuple)): error_code = r.DoDirectPaymentResponse.Errors[0].ErrorCode long_message = r.DoDirectPaymentResponse.Errors[0].LongMessage else: error_code = r.DoDirectPaymentResponse.Errors.ErrorCode long_message = r.DoDirectPaymentResponse.Errors.LongMessage self.log.info("Did NOT receive success from PayPal: %s" % long_message) self.log.info("INFO: %s, %s" % (user_info['username'], self.app.host)) self.log.info("%s" % result) return (1, "%s: %s" % (error_code, long_message)) def handle_fail(fail): self.log.warning("Failed processing with PayPal: %s" % fail.getErrorMessage()) return (1, fail.getErrorMessage()) user_info['api_username'] = self.api_username user_info['api_password'] = self.api_password user_info['client_ip'] = '127.0.0.69' body = self.direct_payment_body % user_info self.log.info("BODY\n\n%s\n\n" % body) try: context = ssl.DefaultOpenSSLContextFactory(self.private_ssl_key, self.public_ssl_key) factory = client.HTTPClientFactory('https://%s%s' % (self.host, self.url), "POST", str(body), timeout=self._cfg_timeout, agent='Zoto AZTK2') except Exception, ex: self.log.warning("Failed to build SSL connection [%s]" % ex) d = Deferred() d.callback((1, 'Failed to build SSL connection [%s]' % ex)) return d d = factory.deferred d.addCallback(handle_result) d.addErrback(handle_fail) self.app.reactor.connectSSL(self.host, self.port, factory, context) return d direct_payment_body = """ <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns4="urn:ebay:apis:eBLBaseComponents" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Header> <RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:mustUnderstand="1"> <ns4:Credentials xmlns:ebl="urn:ebay:apis:eBLBaseComponents"> <ns4:Username xsi:type="xsd:string">%(api_username)s</ns4:Username> <ns4:Password xsi:type="xsd:string">%(api_password)s</ns4:Password> <ns4:Subject xsi:type="xsd:string"></ns4:Subject> </ns4:Credentials> </RequesterCredentials> </SOAP-ENV:Header> <SOAP-ENV:Body> <DoDirectPaymentReq xmlns="urn:ebay:api:PayPalAPI"> <DoDirectPaymentRequest> <ns4:Version xsi:type="xsd:string">2.1</ns4:Version> <ns4:DoDirectPaymentRequestDetails xmlns="urn:ebay:apis:eBLBaseComponents"> <PaymentAction>Sale</PaymentAction> <PaymentDetails> <OrderTotal xsi:type="xsd:string" currencyID="USD">%(cost)s</OrderTotal> <OrderDescription xsi:type="xsd:string">%(product_title)s</OrderDescription> <Custom xsi:type="xsd:string">%(username)s</Custom> </PaymentDetails> <CreditCard> <CreditCardType>%(card_type)s</CreditCardType> <CreditCardNumber xsi:type="xsd:string">%(card_number)s</CreditCardNumber> <ExpMonth xsi:type="xsd:int">%(card_expire_month)s</ExpMonth> <ExpYear xsi:type="xsd:int">%(card_expire_year)s</ExpYear> <CVV2 xsi:type="xsd:string">%(cvv2_code)s</CVV2> <CardOwner> <Payer>%(email)s</Payer> <PayerName> <FirstName>%(first_name)s</FirstName> <LastName>%(last_name)s</LastName> </PayerName> <Address> <Name xsi:type="xsd:string">Primary</Name> <Street1 xsi:type="xsd:string">%(address1)s</Street1> <Street2 xsi:type="xsd:string">%(address2)s</Street2> <CityName xsi:type="xsd:string">%(city)s</CityName> <StateOrProvince xsi:type="xsd:string">%(state)s</StateOrProvince> <Country xsi:type="xsd:string">%(country)s</Country> <PostalCode xsi:type="xsd:string">%(zip)s</PostalCode> </Address> </CardOwner> </CreditCard> <IPAddress xsi:type="xsd:string">%(client_ip)s</IPAddress> </ns4:DoDirectPaymentRequestDetails> </DoDirectPaymentRequest> </DoDirectPaymentReq> </SOAP-ENV:Body> </SOAP-ENV:Envelope> """
bsd-3-clause
[ 624, 199, 5265, 15, 10517, 21516, 14, 647, 199, 199, 5949, 26, 377, 17885, 9785, 337, 199, 2506, 16230, 26, 10953, 1603, 348, 5504, 4114, 26, 1398, 26, 2006, 445, 7438, 8315, 199, 199, 4665, 3217, 370, 314, 2011, 2269, 1033, 390, 1396, 199, 624, 199, 199, 309, 30118, 25764, 51, 199, 504, 6128, 21, 492, 6128, 21, 199, 504, 2197, 492, 1434, 12, 2197, 199, 504, 2748, 14, 4556, 492, 19165, 199, 504, 10933, 492, 10933, 12, 30843, 199, 504, 3473, 492, 19841, 199, 646, 900, 199, 199, 309, 593, 1230, 25764, 51, 199, 504, 437, 58, 15263, 3735, 492, 437, 58, 15263, 3735, 199, 504, 20419, 492, 3464, 199, 504, 25523, 5061, 492, 25523, 5061, 199, 646, 2552, 12, 24978, 2663, 63, 888, 12, 6411, 199, 199, 309, 650, 15543, 10263, 2099, 25764, 51, 199, 504, 7390, 14, 4901, 14, 11610, 492, 17448, 12, 17448, 1296, 199, 504, 7390, 14, 4901, 492, 6149, 199, 504, 7390, 14, 2520, 492, 1890, 199, 646, 26805, 647, 199, 199, 533, 15911, 21516, 8, 17613, 15263, 3735, 12, 25523, 5061, 304, 199, 198, 4296, 63, 932, 275, 715, 421, 198, 318, 1343, 8, 277, 304, 507, 198, 277, 14, 793, 14, 815, 480, 928, 2797, 641, 691, 22006, 3589, 531, 507, 198, 692, 24978, 2663, 63, 888, 14, 2758, 14, 362, 360, 2124, 297, 283, 5418, 358, 315, 788, 16647, 297, 283, 31688, 297, 283, 26840, 2565, 686, 198, 277, 14, 793, 14, 815, 480, 4941, 19699, 2256, 367, 691, 22006, 531, 686, 198, 277, 14, 1102, 275, 291, 423, 4128, 63, 16647, 63, 1102, 686, 198, 277, 14, 719, 275, 291, 423, 4128, 63, 16647, 63, 719, 686, 198, 277, 14, 633, 275, 291, 423, 4128, 63, 16647, 63, 633, 686, 198, 277, 14, 1246, 63, 2473, 275, 291, 423, 4128, 63, 16647, 63, 2473, 686, 198, 277, 14, 1246, 63, 2060, 275, 291, 423, 4128, 63, 16647, 63, 2060, 686, 198, 277, 14, 4239, 63, 4266, 63, 498, 275, 291, 423, 4128, 63, 16647, 63, 4239, 63, 498, 63, 493, 686, 198, 277, 14, 3455, 63, 4266, 63, 498, 275, 291, 423, 4128, 63, 16647, 63, 3455, 63, 498, 63, 493, 507, 198, 2836, 26, 686, 198, 277, 14, 793, 14, 815, 480, 4941, 9920, 2256, 367, 691, 22006, 531, 686, 198, 277, 14, 1102, 275, 291, 423, 4128, 63, 10777, 63, 1102, 686, 198, 277, 14, 719, 275, 291, 423, 4128, 63, 10777, 63, 719, 686, 198, 277, 14, 633, 275, 291, 423, 4128, 63, 10777, 63, 633, 686, 198, 277, 14, 1246, 63, 2473, 275, 291, 423, 4128, 63, 10777, 63, 2473, 686, 198, 277, 14, 1246, 63, 2060, 275, 291, 423, 4128, 63, 10777, 63, 2060, 686, 198, 277, 14, 4239, 63, 4266, 63, 498, 275, 291, 423, 4128, 63, 10777, 63, 4239, 63, 498, 63, 493, 686, 198, 277, 14, 3455, 63, 4266, 63, 498, 275, 291, 423, 4128, 63, 10777, 63, 3455, 63, 498, 63, 493, 421, 198, 32, 2340, 199, 198, 318, 2196, 63, 18174, 63, 344, 8, 277, 304, 507, 198, 504, 2196, 492, 13031, 507, 198, 646, 1059, 507, 198, 10660, 275, 769, 8, 875, 14, 4371, 63, 26831, 11, 875, 14, 7022, 9, 507, 198, 11777, 8, 10660, 9, 507, 198, 1107, 298, 14623, 4970, 83, 2, 450, 6522, 904, 8, 10660, 59, 16, 26, 713, 566, 421, 198, 32, 2340, 199, 198, 318, 485, 2143, 63, 509, 63, 13927, 346, 63, 460, 63, 65, 1129, 8, 277, 12, 922, 63, 815, 304, 507, 198, 1222, 63, 807, 275, 1052, 507, 198, 509, 790, 12, 574, 315, 922, 63, 815, 14, 1744, 837, 686, 198, 692, 1228, 8, 585, 12, 334, 495, 12, 2649, 2298, 1585, 198, 1222, 63, 807, 59, 498, 61, 275, 574, 14, 2143, 360, 1624, 13, 24, 358, 686, 198, 2836, 26, 1585, 198, 1222, 63, 807, 59, 498, 61, 275, 574, 507, 198, 1107, 892, 63, 807, 421, 198, 32, 2340, 199, 198, 318, 20210, 63, 7948, 8, 277, 12, 922, 63, 815, 304, 507, 198, 624, 507, 198, 1065, 282, 11628, 9371, 370, 691, 22006, 1159, 26805, 3261, 507, 198, 624, 507, 198, 277, 14, 1074, 63, 576, 8, 751, 63, 815, 9, 507, 198, 751, 63, 815, 275, 291, 423, 2143, 63, 509, 63, 13927, 346, 63, 460, 63, 65, 1129, 8, 751, 63, 815, 9, 507, 198, 277, 14, 793, 14, 815, 480, 5720, 11628, 543, 642, 666, 26, 450, 83, 2, 450, 30843, 8, 751, 63, 815, 430, 421, 507, 198, 692, 24978, 2663, 63, 888, 14, 2758, 14, 362, 360, 2124, 297, 283, 5418, 358, 315, 788, 16647, 297, 283, 31688, 297, 283, 26840, 2565, 686, 198, 309, 781, 883, 1133, 675, 314, 19699, 7444, 17122, 5965, 9610, 1901, 314, 19699, 10691, 641, 691, 22006, 686, 198, 309, 880, 2951, 372, 282, 22219, 402, 23703, 286, 1330, 686, 198, 277, 14, 793, 14, 815, 480, 1767, 316, 7283, 666, 531, 686, 198, 1107, 334, 16, 12, 469, 1871, 198, 1133, 1320, 1287, 63, 344, 356, 291, 14, 2355, 63, 18174, 63, 344, 1062, 1871, 198, 7, 2473, 356, 922, 63, 815, 459, 2473, 995, 1871, 198, 7, 4606, 356, 283, 1398, 14, 2720, 297, 1871, 198, 7, 1214, 83, 63, 600, 356, 283, 56, 297, 1871, 198, 7, 5107, 86, 18, 63, 600, 356, 283, 45, 297, 1871, 198, 7, 6338, 63, 932, 356, 291, 14, 571, 14, 1102, 12, 1585, 198, 1552, 2742, 198, 318, 2429, 63, 1099, 8, 1099, 304, 686, 198, 82, 275, 26805, 647, 14, 1122, 4118, 1282, 8, 1099, 9, 686, 198, 692, 519, 14, 2585, 16281, 22374, 2364, 14, 9940, 508, 298, 8300, 582, 1585, 198, 277, 14, 793, 14, 815, 480, 446, 6099, 1585, 198, 277, 14, 793, 14, 815, 480, 9392, 3182, 687, 15911, 24666, 367, 450, 83, 2, 450, 334, 751, 63, 815, 459, 2473, 1105, 776, 1585, 198, 277, 14, 793, 14, 815, 3647, 83, 2, 450, 754, 9, 1871, 1585, 198, 7948, 63, 815, 275, 469, 1871, 198, 1133, 1320, 1287, 63, 344, 356, 519, 14, 2585, 16281, 22374, 2364, 14, 10161, 998, 12, 1871, 198, 7, 2473, 356, 922, 63, 815, 459, 2473 ]
[ 199, 5265, 15, 10517, 21516, 14, 647, 199, 199, 5949, 26, 377, 17885, 9785, 337, 199, 2506, 16230, 26, 10953, 1603, 348, 5504, 4114, 26, 1398, 26, 2006, 445, 7438, 8315, 199, 199, 4665, 3217, 370, 314, 2011, 2269, 1033, 390, 1396, 199, 624, 199, 199, 309, 30118, 25764, 51, 199, 504, 6128, 21, 492, 6128, 21, 199, 504, 2197, 492, 1434, 12, 2197, 199, 504, 2748, 14, 4556, 492, 19165, 199, 504, 10933, 492, 10933, 12, 30843, 199, 504, 3473, 492, 19841, 199, 646, 900, 199, 199, 309, 593, 1230, 25764, 51, 199, 504, 437, 58, 15263, 3735, 492, 437, 58, 15263, 3735, 199, 504, 20419, 492, 3464, 199, 504, 25523, 5061, 492, 25523, 5061, 199, 646, 2552, 12, 24978, 2663, 63, 888, 12, 6411, 199, 199, 309, 650, 15543, 10263, 2099, 25764, 51, 199, 504, 7390, 14, 4901, 14, 11610, 492, 17448, 12, 17448, 1296, 199, 504, 7390, 14, 4901, 492, 6149, 199, 504, 7390, 14, 2520, 492, 1890, 199, 646, 26805, 647, 199, 199, 533, 15911, 21516, 8, 17613, 15263, 3735, 12, 25523, 5061, 304, 199, 198, 4296, 63, 932, 275, 715, 421, 198, 318, 1343, 8, 277, 304, 507, 198, 277, 14, 793, 14, 815, 480, 928, 2797, 641, 691, 22006, 3589, 531, 507, 198, 692, 24978, 2663, 63, 888, 14, 2758, 14, 362, 360, 2124, 297, 283, 5418, 358, 315, 788, 16647, 297, 283, 31688, 297, 283, 26840, 2565, 686, 198, 277, 14, 793, 14, 815, 480, 4941, 19699, 2256, 367, 691, 22006, 531, 686, 198, 277, 14, 1102, 275, 291, 423, 4128, 63, 16647, 63, 1102, 686, 198, 277, 14, 719, 275, 291, 423, 4128, 63, 16647, 63, 719, 686, 198, 277, 14, 633, 275, 291, 423, 4128, 63, 16647, 63, 633, 686, 198, 277, 14, 1246, 63, 2473, 275, 291, 423, 4128, 63, 16647, 63, 2473, 686, 198, 277, 14, 1246, 63, 2060, 275, 291, 423, 4128, 63, 16647, 63, 2060, 686, 198, 277, 14, 4239, 63, 4266, 63, 498, 275, 291, 423, 4128, 63, 16647, 63, 4239, 63, 498, 63, 493, 686, 198, 277, 14, 3455, 63, 4266, 63, 498, 275, 291, 423, 4128, 63, 16647, 63, 3455, 63, 498, 63, 493, 507, 198, 2836, 26, 686, 198, 277, 14, 793, 14, 815, 480, 4941, 9920, 2256, 367, 691, 22006, 531, 686, 198, 277, 14, 1102, 275, 291, 423, 4128, 63, 10777, 63, 1102, 686, 198, 277, 14, 719, 275, 291, 423, 4128, 63, 10777, 63, 719, 686, 198, 277, 14, 633, 275, 291, 423, 4128, 63, 10777, 63, 633, 686, 198, 277, 14, 1246, 63, 2473, 275, 291, 423, 4128, 63, 10777, 63, 2473, 686, 198, 277, 14, 1246, 63, 2060, 275, 291, 423, 4128, 63, 10777, 63, 2060, 686, 198, 277, 14, 4239, 63, 4266, 63, 498, 275, 291, 423, 4128, 63, 10777, 63, 4239, 63, 498, 63, 493, 686, 198, 277, 14, 3455, 63, 4266, 63, 498, 275, 291, 423, 4128, 63, 10777, 63, 3455, 63, 498, 63, 493, 421, 198, 32, 2340, 199, 198, 318, 2196, 63, 18174, 63, 344, 8, 277, 304, 507, 198, 504, 2196, 492, 13031, 507, 198, 646, 1059, 507, 198, 10660, 275, 769, 8, 875, 14, 4371, 63, 26831, 11, 875, 14, 7022, 9, 507, 198, 11777, 8, 10660, 9, 507, 198, 1107, 298, 14623, 4970, 83, 2, 450, 6522, 904, 8, 10660, 59, 16, 26, 713, 566, 421, 198, 32, 2340, 199, 198, 318, 485, 2143, 63, 509, 63, 13927, 346, 63, 460, 63, 65, 1129, 8, 277, 12, 922, 63, 815, 304, 507, 198, 1222, 63, 807, 275, 1052, 507, 198, 509, 790, 12, 574, 315, 922, 63, 815, 14, 1744, 837, 686, 198, 692, 1228, 8, 585, 12, 334, 495, 12, 2649, 2298, 1585, 198, 1222, 63, 807, 59, 498, 61, 275, 574, 14, 2143, 360, 1624, 13, 24, 358, 686, 198, 2836, 26, 1585, 198, 1222, 63, 807, 59, 498, 61, 275, 574, 507, 198, 1107, 892, 63, 807, 421, 198, 32, 2340, 199, 198, 318, 20210, 63, 7948, 8, 277, 12, 922, 63, 815, 304, 507, 198, 624, 507, 198, 1065, 282, 11628, 9371, 370, 691, 22006, 1159, 26805, 3261, 507, 198, 624, 507, 198, 277, 14, 1074, 63, 576, 8, 751, 63, 815, 9, 507, 198, 751, 63, 815, 275, 291, 423, 2143, 63, 509, 63, 13927, 346, 63, 460, 63, 65, 1129, 8, 751, 63, 815, 9, 507, 198, 277, 14, 793, 14, 815, 480, 5720, 11628, 543, 642, 666, 26, 450, 83, 2, 450, 30843, 8, 751, 63, 815, 430, 421, 507, 198, 692, 24978, 2663, 63, 888, 14, 2758, 14, 362, 360, 2124, 297, 283, 5418, 358, 315, 788, 16647, 297, 283, 31688, 297, 283, 26840, 2565, 686, 198, 309, 781, 883, 1133, 675, 314, 19699, 7444, 17122, 5965, 9610, 1901, 314, 19699, 10691, 641, 691, 22006, 686, 198, 309, 880, 2951, 372, 282, 22219, 402, 23703, 286, 1330, 686, 198, 277, 14, 793, 14, 815, 480, 1767, 316, 7283, 666, 531, 686, 198, 1107, 334, 16, 12, 469, 1871, 198, 1133, 1320, 1287, 63, 344, 356, 291, 14, 2355, 63, 18174, 63, 344, 1062, 1871, 198, 7, 2473, 356, 922, 63, 815, 459, 2473, 995, 1871, 198, 7, 4606, 356, 283, 1398, 14, 2720, 297, 1871, 198, 7, 1214, 83, 63, 600, 356, 283, 56, 297, 1871, 198, 7, 5107, 86, 18, 63, 600, 356, 283, 45, 297, 1871, 198, 7, 6338, 63, 932, 356, 291, 14, 571, 14, 1102, 12, 1585, 198, 1552, 2742, 198, 318, 2429, 63, 1099, 8, 1099, 304, 686, 198, 82, 275, 26805, 647, 14, 1122, 4118, 1282, 8, 1099, 9, 686, 198, 692, 519, 14, 2585, 16281, 22374, 2364, 14, 9940, 508, 298, 8300, 582, 1585, 198, 277, 14, 793, 14, 815, 480, 446, 6099, 1585, 198, 277, 14, 793, 14, 815, 480, 9392, 3182, 687, 15911, 24666, 367, 450, 83, 2, 450, 334, 751, 63, 815, 459, 2473, 1105, 776, 1585, 198, 277, 14, 793, 14, 815, 3647, 83, 2, 450, 754, 9, 1871, 1585, 198, 7948, 63, 815, 275, 469, 1871, 198, 1133, 1320, 1287, 63, 344, 356, 519, 14, 2585, 16281, 22374, 2364, 14, 10161, 998, 12, 1871, 198, 7, 2473, 356, 922, 63, 815, 459, 2473, 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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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
mammique/django
django/contrib/auth/tests/decorators.py
102
1600
from django.contrib.auth.decorators import login_required from django.contrib.auth.tests.views import AuthViewsTestCase from django.contrib.auth.tests.utils import skipIfCustomUser @skipIfCustomUser class LoginRequiredTestCase(AuthViewsTestCase): """ Tests the login_required decorators """ urls = 'django.contrib.auth.tests.urls' def testCallable(self): """ Check that login_required is assignable to callable objects. """ class CallableView(object): def __call__(self, *args, **kwargs): pass login_required(CallableView()) def testView(self): """ Check that login_required is assignable to normal views. """ def normal_view(request): pass login_required(normal_view) def testLoginRequired(self, view_url='/login_required/', login_url='/login/'): """ Check that login_required works on a simple view wrapped in a login_required decorator. """ response = self.client.get(view_url) self.assertEqual(response.status_code, 302) self.assertTrue(login_url in response['Location']) self.login() response = self.client.get(view_url) self.assertEqual(response.status_code, 200) def testLoginRequiredNextUrl(self): """ Check that login_required works on a simple view wrapped in a login_required decorator with a login_url set. """ self.testLoginRequired(view_url='/login_required_login_url/', login_url='/somewhere/')
bsd-3-clause
[ 504, 1639, 14, 2828, 14, 1178, 14, 11582, 492, 4676, 63, 2427, 199, 504, 1639, 14, 2828, 14, 1178, 14, 2219, 14, 4196, 492, 3590, 21180, 1746, 199, 504, 1639, 14, 2828, 14, 1178, 14, 2219, 14, 1208, 492, 3372, 3917, 31482, 421, 199, 32, 15118, 31482, 199, 533, 16430, 8030, 1746, 8, 2817, 21180, 1746, 304, 272, 408, 272, 6496, 314, 4676, 63, 2427, 20419, 272, 408, 272, 8187, 275, 283, 1176, 14, 2828, 14, 1178, 14, 2219, 14, 3603, 7, 339, 347, 511, 16410, 8, 277, 304, 267, 408, 267, 2670, 626, 4676, 63, 2427, 365, 5090, 461, 370, 4550, 2251, 14, 267, 408, 267, 1021, 16975, 2768, 8, 785, 304, 288, 347, 636, 1250, 721, 277, 12, 627, 589, 12, 1011, 958, 304, 355, 986, 267, 4676, 63, 2427, 8, 16410, 2768, 1012, 339, 347, 511, 2768, 8, 277, 304, 267, 408, 267, 2670, 626, 4676, 63, 2427, 365, 5090, 461, 370, 3293, 6858, 14, 267, 408, 267, 347, 3293, 63, 1345, 8, 1069, 304, 288, 986, 267, 4676, 63, 2427, 8, 3302, 63, 1345, 9, 339, 347, 511, 8880, 8030, 8, 277, 12, 2455, 63, 633, 8805, 2886, 63, 2427, 3678, 4676, 63, 633, 8805, 2886, 26985, 267, 408, 267, 2670, 626, 4676, 63, 2427, 5419, 641, 282, 3486, 2455, 8072, 315, 282, 267, 4676, 63, 2427, 7531, 14, 267, 408, 267, 1177, 275, 291, 14, 1258, 14, 362, 8, 1345, 63, 633, 9, 267, 291, 14, 629, 8, 1310, 14, 1205, 63, 600, 12, 11485, 9, 267, 291, 14, 1815, 8, 2886, 63, 633, 315, 1177, 459, 6592, 1105, 267, 291, 14, 2886, 342, 267, 1177, 275, 291, 14, 1258, 14, 362, 8, 1345, 63, 633, 9, 267, 291, 14, 629, 8, 1310, 14, 1205, 63, 600, 12, 1926, 9, 339, 347, 511, 8880, 8030, 5765, 6417, 8, 277, 304, 267, 408, 267, 2670, 626, 4676, 63, 2427, 5419, 641, 282, 3486, 2455, 8072, 315, 282, 267, 4676, 63, 2427, 7531, 543, 282, 4676, 63, 633, 663, 14, 267, 408, 267, 291, 14, 396, 8880, 8030, 8, 1345, 63, 633, 8805, 2886, 63, 2427, 63, 2886, 63, 633, 3678, 288, 4676, 63, 633, 8805, 3972, 4509, 6217, 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 ]
[ 1639, 14, 2828, 14, 1178, 14, 11582, 492, 4676, 63, 2427, 199, 504, 1639, 14, 2828, 14, 1178, 14, 2219, 14, 4196, 492, 3590, 21180, 1746, 199, 504, 1639, 14, 2828, 14, 1178, 14, 2219, 14, 1208, 492, 3372, 3917, 31482, 421, 199, 32, 15118, 31482, 199, 533, 16430, 8030, 1746, 8, 2817, 21180, 1746, 304, 272, 408, 272, 6496, 314, 4676, 63, 2427, 20419, 272, 408, 272, 8187, 275, 283, 1176, 14, 2828, 14, 1178, 14, 2219, 14, 3603, 7, 339, 347, 511, 16410, 8, 277, 304, 267, 408, 267, 2670, 626, 4676, 63, 2427, 365, 5090, 461, 370, 4550, 2251, 14, 267, 408, 267, 1021, 16975, 2768, 8, 785, 304, 288, 347, 636, 1250, 721, 277, 12, 627, 589, 12, 1011, 958, 304, 355, 986, 267, 4676, 63, 2427, 8, 16410, 2768, 1012, 339, 347, 511, 2768, 8, 277, 304, 267, 408, 267, 2670, 626, 4676, 63, 2427, 365, 5090, 461, 370, 3293, 6858, 14, 267, 408, 267, 347, 3293, 63, 1345, 8, 1069, 304, 288, 986, 267, 4676, 63, 2427, 8, 3302, 63, 1345, 9, 339, 347, 511, 8880, 8030, 8, 277, 12, 2455, 63, 633, 8805, 2886, 63, 2427, 3678, 4676, 63, 633, 8805, 2886, 26985, 267, 408, 267, 2670, 626, 4676, 63, 2427, 5419, 641, 282, 3486, 2455, 8072, 315, 282, 267, 4676, 63, 2427, 7531, 14, 267, 408, 267, 1177, 275, 291, 14, 1258, 14, 362, 8, 1345, 63, 633, 9, 267, 291, 14, 629, 8, 1310, 14, 1205, 63, 600, 12, 11485, 9, 267, 291, 14, 1815, 8, 2886, 63, 633, 315, 1177, 459, 6592, 1105, 267, 291, 14, 2886, 342, 267, 1177, 275, 291, 14, 1258, 14, 362, 8, 1345, 63, 633, 9, 267, 291, 14, 629, 8, 1310, 14, 1205, 63, 600, 12, 1926, 9, 339, 347, 511, 8880, 8030, 5765, 6417, 8, 277, 304, 267, 408, 267, 2670, 626, 4676, 63, 2427, 5419, 641, 282, 3486, 2455, 8072, 315, 282, 267, 4676, 63, 2427, 7531, 543, 282, 4676, 63, 633, 663, 14, 267, 408, 267, 291, 14, 396, 8880, 8030, 8, 1345, 63, 633, 8805, 2886, 63, 2427, 63, 2886, 63, 633, 3678, 288, 4676, 63, 633, 8805, 3972, 4509, 6217, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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 OpenStack Foundation. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import abc from neutron.api import extensions from neutron.api.v2 import base from neutron.api.v2 import resource from neutron.common import constants from neutron.extensions import agent from neutron.extensions import loadbalancer from neutron import manager from neutron.plugins.common import constants as plugin_const from neutron import policy from neutron import wsgi LOADBALANCER_POOL = 'loadbalancer-pool' LOADBALANCER_POOLS = LOADBALANCER_POOL + 's' LOADBALANCER_AGENT = 'loadbalancer-agent' class PoolSchedulerController(wsgi.Controller): def index(self, request, **kwargs): lbaas_plugin = manager.NeutronManager.get_service_plugins().get( plugin_const.LOADBALANCER) if not lbaas_plugin: return {'pools': []} policy.enforce(request.context, "get_%s" % LOADBALANCER_POOLS, {}, plugin=lbaas_plugin) return lbaas_plugin.list_pools_on_lbaas_agent( request.context, kwargs['agent_id']) class LbaasAgentHostingPoolController(wsgi.Controller): def index(self, request, **kwargs): lbaas_plugin = manager.NeutronManager.get_service_plugins().get( plugin_const.LOADBALANCER) if not lbaas_plugin: return policy.enforce(request.context, "get_%s" % LOADBALANCER_AGENT, {}, plugin=lbaas_plugin) return lbaas_plugin.get_lbaas_agent_hosting_pool( request.context, kwargs['pool_id']) class Lbaas_agentscheduler(extensions.ExtensionDescriptor): """Extension class supporting LBaaS agent scheduler. """ @classmethod def get_name(cls): return "Loadbalancer Agent Scheduler" @classmethod def get_alias(cls): return constants.LBAAS_AGENT_SCHEDULER_EXT_ALIAS @classmethod def get_description(cls): return "Schedule pools among lbaas agents" @classmethod def get_namespace(cls): return "http://docs.openstack.org/ext/lbaas_agent_scheduler/api/v1.0" @classmethod def get_updated(cls): return "2013-02-07T10:00:00-00:00" @classmethod def get_resources(cls): """Returns Ext Resources.""" exts = [] parent = dict(member_name="agent", collection_name="agents") controller = resource.Resource(PoolSchedulerController(), base.FAULT_MAP) exts.append(extensions.ResourceExtension( LOADBALANCER_POOLS, controller, parent)) parent = dict(member_name="pool", collection_name="pools") controller = resource.Resource(LbaasAgentHostingPoolController(), base.FAULT_MAP) exts.append(extensions.ResourceExtension( LOADBALANCER_AGENT, controller, parent, path_prefix=plugin_const. COMMON_PREFIXES[plugin_const.LOADBALANCER])) return exts def get_extended_resources(self, version): return {} class NoEligibleLbaasAgent(loadbalancer.NoEligibleBackend): message = _("No eligible loadbalancer agent found " "for pool %(pool_id)s.") class NoActiveLbaasAgent(agent.AgentNotFound): message = _("No active loadbalancer agent found " "for pool %(pool_id)s.") class LbaasAgentSchedulerPluginBase(object): """REST API to operate the lbaas agent scheduler. All of method must be in an admin context. """ @abc.abstractmethod def list_pools_on_lbaas_agent(self, context, id): pass @abc.abstractmethod def get_lbaas_agent_hosting_pool(self, context, pool_id): pass
apache-2.0
[ 3, 1898, 334, 67, 9, 6171, 14260, 2752, 14, 199, 3, 2900, 4481, 4644, 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, 13022, 199, 199, 504, 8224, 14, 1246, 492, 5478, 199, 504, 8224, 14, 1246, 14, 86, 18, 492, 1300, 199, 504, 8224, 14, 1246, 14, 86, 18, 492, 2073, 199, 504, 8224, 14, 2330, 492, 5262, 199, 504, 8224, 14, 5359, 492, 6631, 199, 504, 8224, 14, 5359, 492, 2248, 11841, 199, 504, 8224, 492, 5256, 199, 504, 8224, 14, 5265, 14, 2330, 492, 5262, 465, 3589, 63, 1297, 199, 504, 8224, 492, 4592, 199, 504, 8224, 492, 12464, 199, 199, 7405, 31232, 879, 35, 540, 63, 19693, 275, 283, 26615, 13, 2293, 7, 199, 7405, 31232, 879, 35, 540, 63, 19693, 51, 275, 3412, 1554, 31232, 879, 35, 540, 63, 19693, 435, 283, 83, 7, 199, 7405, 31232, 879, 35, 540, 63, 14565, 275, 283, 26615, 13, 4054, 7, 421, 199, 533, 15553, 11251, 7506, 8, 6508, 14, 7506, 304, 272, 347, 1478, 8, 277, 12, 1056, 12, 1011, 958, 304, 267, 634, 2470, 305, 63, 2718, 275, 5256, 14, 20915, 2988, 14, 362, 63, 1364, 63, 5265, 1252, 362, 8, 288, 3589, 63, 1297, 14, 7405, 31232, 879, 35, 540, 9, 267, 340, 440, 634, 2470, 305, 63, 2718, 26, 288, 372, 791, 12406, 356, 23455, 398, 4592, 14, 19817, 8, 1069, 14, 1100, 12, 2432, 298, 362, 4970, 83, 2, 450, 3412, 1554, 31232, 879, 35, 540, 63, 19693, 51, 12, 2432, 5479, 2432, 3589, 29, 76, 2470, 305, 63, 2718, 9, 267, 372, 634, 2470, 305, 63, 2718, 14, 513, 63, 12406, 63, 265, 63, 76, 2470, 305, 63, 4054, 8, 288, 1056, 14, 1100, 12, 2074, 459, 4054, 63, 344, 1105, 421, 199, 533, 491, 2470, 305, 7788, 4965, 316, 5453, 7506, 8, 6508, 14, 7506, 304, 272, 347, 1478, 8, 277, 12, 1056, 12, 1011, 958, 304, 267, 634, 2470, 305, 63, 2718, 275, 5256, 14, 20915, 2988, 14, 362, 63, 1364, 63, 5265, 1252, 362, 8, 288, 3589, 63, 1297, 14, 7405, 31232, 879, 35, 540, 9, 267, 340, 440, 634, 2470, 305, 63, 2718, 26, 288, 372, 398, 4592, 14, 19817, 8, 1069, 14, 1100, 12, 2432, 298, 362, 4970, 83, 2, 450, 3412, 1554, 31232, 879, 35, 540, 63, 14565, 12, 2432, 5479, 2432, 3589, 29, 76, 2470, 305, 63, 2718, 9, 267, 372, 634, 2470, 305, 63, 2718, 14, 362, 63, 76, 2470, 305, 63, 4054, 63, 29138, 63, 2293, 8, 288, 1056, 14, 1100, 12, 2074, 459, 2293, 63, 344, 1105, 421, 199, 533, 491, 2470, 305, 63, 4054, 8874, 8, 5359, 14, 6382, 4311, 304, 272, 408, 6382, 1021, 21038, 491, 34, 2158, 51, 6631, 11899, 14, 272, 408, 339, 768, 3744, 272, 347, 664, 63, 354, 8, 1886, 304, 267, 372, 298, 6200, 11841, 19866, 32051, 2, 339, 768, 3744, 272, 347, 664, 63, 3620, 8, 1886, 304, 267, 372, 5262, 14, 44, 4134, 1179, 63, 14565, 63, 27944, 1293, 540, 63, 2472, 63, 12644, 339, 768, 3744, 272, 347, 664, 63, 1802, 8, 1886, 304, 267, 372, 298, 15535, 20092, 16885, 634, 2470, 305, 22867, 2, 339, 768, 3744, 272, 347, 664, 63, 3251, 8, 1886, 304, 267, 372, 298, 1014, 921, 4757, 14, 8512, 14, 1308, 15, 832, 15, 76, 2470, 305, 63, 4054, 63, 8874, 15, 1246, 15, 86, 17, 14, 16, 2, 339, 768, 3744, 272, 347, 664, 63, 5334, 8, 1886, 304, 267, 372, 298, 6965, 13, 996, 13, 1780, 52, 709, 26, 383, 26, 383, 13, 383, 26, 383, 2, 339, 768, 3744, 272, 347, 664, 63, 4435, 8, 1886, 304, 267, 408, 3407, 7255, 26250, 1041, 267, 27688, 275, 942, 267, 1676, 275, 1211, 8, 1114, 63, 354, 628, 4054, 401, 1993, 3245, 63, 354, 628, 14250, 531, 398, 7614, 275, 2073, 14, 4031, 8, 5453, 11251, 7506, 1062, 4318, 1300, 14, 2794, 63, 5443, 9, 267, 27688, 14, 740, 8, 5359, 14, 4031, 6382, 8, 288, 3412, 1554, 31232, 879, 35, 540, 63, 19693, 51, 12, 7614, 12, 1676, 430, 398, 1676, 275, 1211, 8, 1114, 63, 354, 628, 2293, 401, 1993, 3245, 63, 354, 628, 12406, 531, 398, 7614, 275, 2073, 14, 4031, 8, 44, 2470, 305, 7788, 4965, 316, 5453, 7506, 1062, 4318, 1300, 14, 2794, 63, 5443, 9, 267, 27688, 14, 740, 8, 5359, 14, 4031, 6382, 8, 288, 3412, 1554, 31232, 879, 35, 540, 63, 14565, 12, 7614, 12, 1676, 12, 288, 931, 63, 1861, 29, 2718, 63, 1297, 14, 288, 11293, 615, 63, 6351, 654, 59, 2718, 63, 1297, 14, 7405, 31232, 879, 35, 540, 2459, 267, 372, 27688, 339, 347, 664, 63, 10525, 63, 4435, 8, 277, 12, 1015, 304, 267, 372, 1052, 421, 199, 533, 3091, 37, 317, 28297, 44, 2470, 305, 7788, 8, 26615, 14, 1944, 37, 317, 28297, 8447, 304, 272, 1245, 275, 3824, 1944, 28214, 28297, 2248, 11841, 6631, 1911, 298, 355, 298, 509, 4203, 2818, 2293, 63, 344, 9, 83, 2685, 421, 199, 533, 3091, 7472, 44, 2470, 305, 7788, 8, 4054, 14, 7788, 4667, 304, 272, 1245, 275, 3824, 1944, 4702, 2248, 11841, 6631, 1911, 298, 355, 298, 509, 4203, 2818, 2293, 63, 344, 9, 83, 2685, 421, 199, 533, 491, 2470, 305, 7788, 11251, 5061, 1563, 8, 785, 304, 272, 408, 15740, 3261, 370, 19218, 314, 634, 2470, 305, 6631, 11899, 14, 339 ]
[ 1898, 334, 67, 9, 6171, 14260, 2752, 14, 199, 3, 2900, 4481, 4644, 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, 13022, 199, 199, 504, 8224, 14, 1246, 492, 5478, 199, 504, 8224, 14, 1246, 14, 86, 18, 492, 1300, 199, 504, 8224, 14, 1246, 14, 86, 18, 492, 2073, 199, 504, 8224, 14, 2330, 492, 5262, 199, 504, 8224, 14, 5359, 492, 6631, 199, 504, 8224, 14, 5359, 492, 2248, 11841, 199, 504, 8224, 492, 5256, 199, 504, 8224, 14, 5265, 14, 2330, 492, 5262, 465, 3589, 63, 1297, 199, 504, 8224, 492, 4592, 199, 504, 8224, 492, 12464, 199, 199, 7405, 31232, 879, 35, 540, 63, 19693, 275, 283, 26615, 13, 2293, 7, 199, 7405, 31232, 879, 35, 540, 63, 19693, 51, 275, 3412, 1554, 31232, 879, 35, 540, 63, 19693, 435, 283, 83, 7, 199, 7405, 31232, 879, 35, 540, 63, 14565, 275, 283, 26615, 13, 4054, 7, 421, 199, 533, 15553, 11251, 7506, 8, 6508, 14, 7506, 304, 272, 347, 1478, 8, 277, 12, 1056, 12, 1011, 958, 304, 267, 634, 2470, 305, 63, 2718, 275, 5256, 14, 20915, 2988, 14, 362, 63, 1364, 63, 5265, 1252, 362, 8, 288, 3589, 63, 1297, 14, 7405, 31232, 879, 35, 540, 9, 267, 340, 440, 634, 2470, 305, 63, 2718, 26, 288, 372, 791, 12406, 356, 23455, 398, 4592, 14, 19817, 8, 1069, 14, 1100, 12, 2432, 298, 362, 4970, 83, 2, 450, 3412, 1554, 31232, 879, 35, 540, 63, 19693, 51, 12, 2432, 5479, 2432, 3589, 29, 76, 2470, 305, 63, 2718, 9, 267, 372, 634, 2470, 305, 63, 2718, 14, 513, 63, 12406, 63, 265, 63, 76, 2470, 305, 63, 4054, 8, 288, 1056, 14, 1100, 12, 2074, 459, 4054, 63, 344, 1105, 421, 199, 533, 491, 2470, 305, 7788, 4965, 316, 5453, 7506, 8, 6508, 14, 7506, 304, 272, 347, 1478, 8, 277, 12, 1056, 12, 1011, 958, 304, 267, 634, 2470, 305, 63, 2718, 275, 5256, 14, 20915, 2988, 14, 362, 63, 1364, 63, 5265, 1252, 362, 8, 288, 3589, 63, 1297, 14, 7405, 31232, 879, 35, 540, 9, 267, 340, 440, 634, 2470, 305, 63, 2718, 26, 288, 372, 398, 4592, 14, 19817, 8, 1069, 14, 1100, 12, 2432, 298, 362, 4970, 83, 2, 450, 3412, 1554, 31232, 879, 35, 540, 63, 14565, 12, 2432, 5479, 2432, 3589, 29, 76, 2470, 305, 63, 2718, 9, 267, 372, 634, 2470, 305, 63, 2718, 14, 362, 63, 76, 2470, 305, 63, 4054, 63, 29138, 63, 2293, 8, 288, 1056, 14, 1100, 12, 2074, 459, 2293, 63, 344, 1105, 421, 199, 533, 491, 2470, 305, 63, 4054, 8874, 8, 5359, 14, 6382, 4311, 304, 272, 408, 6382, 1021, 21038, 491, 34, 2158, 51, 6631, 11899, 14, 272, 408, 339, 768, 3744, 272, 347, 664, 63, 354, 8, 1886, 304, 267, 372, 298, 6200, 11841, 19866, 32051, 2, 339, 768, 3744, 272, 347, 664, 63, 3620, 8, 1886, 304, 267, 372, 5262, 14, 44, 4134, 1179, 63, 14565, 63, 27944, 1293, 540, 63, 2472, 63, 12644, 339, 768, 3744, 272, 347, 664, 63, 1802, 8, 1886, 304, 267, 372, 298, 15535, 20092, 16885, 634, 2470, 305, 22867, 2, 339, 768, 3744, 272, 347, 664, 63, 3251, 8, 1886, 304, 267, 372, 298, 1014, 921, 4757, 14, 8512, 14, 1308, 15, 832, 15, 76, 2470, 305, 63, 4054, 63, 8874, 15, 1246, 15, 86, 17, 14, 16, 2, 339, 768, 3744, 272, 347, 664, 63, 5334, 8, 1886, 304, 267, 372, 298, 6965, 13, 996, 13, 1780, 52, 709, 26, 383, 26, 383, 13, 383, 26, 383, 2, 339, 768, 3744, 272, 347, 664, 63, 4435, 8, 1886, 304, 267, 408, 3407, 7255, 26250, 1041, 267, 27688, 275, 942, 267, 1676, 275, 1211, 8, 1114, 63, 354, 628, 4054, 401, 1993, 3245, 63, 354, 628, 14250, 531, 398, 7614, 275, 2073, 14, 4031, 8, 5453, 11251, 7506, 1062, 4318, 1300, 14, 2794, 63, 5443, 9, 267, 27688, 14, 740, 8, 5359, 14, 4031, 6382, 8, 288, 3412, 1554, 31232, 879, 35, 540, 63, 19693, 51, 12, 7614, 12, 1676, 430, 398, 1676, 275, 1211, 8, 1114, 63, 354, 628, 2293, 401, 1993, 3245, 63, 354, 628, 12406, 531, 398, 7614, 275, 2073, 14, 4031, 8, 44, 2470, 305, 7788, 4965, 316, 5453, 7506, 1062, 4318, 1300, 14, 2794, 63, 5443, 9, 267, 27688, 14, 740, 8, 5359, 14, 4031, 6382, 8, 288, 3412, 1554, 31232, 879, 35, 540, 63, 14565, 12, 7614, 12, 1676, 12, 288, 931, 63, 1861, 29, 2718, 63, 1297, 14, 288, 11293, 615, 63, 6351, 654, 59, 2718, 63, 1297, 14, 7405, 31232, 879, 35, 540, 2459, 267, 372, 27688, 339, 347, 664, 63, 10525, 63, 4435, 8, 277, 12, 1015, 304, 267, 372, 1052, 421, 199, 533, 3091, 37, 317, 28297, 44, 2470, 305, 7788, 8, 26615, 14, 1944, 37, 317, 28297, 8447, 304, 272, 1245, 275, 3824, 1944, 28214, 28297, 2248, 11841, 6631, 1911, 298, 355, 298, 509, 4203, 2818, 2293, 63, 344, 9, 83, 2685, 421, 199, 533, 3091, 7472, 44, 2470, 305, 7788, 8, 4054, 14, 7788, 4667, 304, 272, 1245, 275, 3824, 1944, 4702, 2248, 11841, 6631, 1911, 298, 355, 298, 509, 4203, 2818, 2293, 63, 344, 9, 83, 2685, 421, 199, 533, 491, 2470, 305, 7788, 11251, 5061, 1563, 8, 785, 304, 272, 408, 15740, 3261, 370, 19218, 314, 634, 2470, 305, 6631, 11899, 14, 339, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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 ]
emory-libraries/readux
readux/books/tests/views.py
1
42006
from datetime import datetime, timedelta from django.contrib.auth import get_user_model from django.core.paginator import Paginator from django.core.urlresolvers import reverse from django.http import HttpResponse from django.template.defaultfilters import filesizeformat from django.test import TestCase import json from mock import Mock, patch, NonCallableMock, NonCallableMagicMock, \ MagicMock, call from urllib import unquote from readux.annotations.models import Annotation from readux.books.models import SolrVolume, Volume, Page, SolrPage from readux.books import sitemaps, views, view_helpers, forms from readux.utils import absolutize_url class BookViewsTest(TestCase): # borrowing fixture & test accounts from readux.annotations.tests fixtures = ['test_annotation_data.json'] user_credentials = { 'user': {'username': 'testuser', 'password': 'testing'}, 'superuser': {'username': 'testsuper', 'password': 'superme'} } # sample datastream profile xml xml_profile = '''<datastreamProfile xmlns="http://www.fedora.info/definitions/1/0/management/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.fedora.info/definitions/1/0/management/ http://www.fedora.info/definitions/1/0/datastreamProfile.xsd" pid="synctest:1" dsID="DC"> <dsLabel>Dublin Core Record for this object</dsLabel> <dsVersionID>DC1.0</dsVersionID> <dsCreateDate>2016-02-10T16:36:25.913Z</dsCreateDate> <dsState>A</dsState> <dsMIME>text/xml</dsMIME> <dsFormatURI>http://www.openarchives.org/OAI/2.0/oai_dc/</dsFormatURI> <dsControlGroup>X</dsControlGroup> <dsSize>379</dsSize> <dsVersionable>true</dsVersionable> <dsInfoType/> <dsLocation>synctest:1+DC+DC1.0</dsLocation> <dsLocationType/> <dsChecksumType>MD5</dsChecksumType> <dsChecksum>cc0db0ef0fcd559065a788a22442d3c7</dsChecksum> </datastreamProfile>''' @patch('readux.books.views.VolumePdf.repository_class') @patch('eulfedora.views._raw_datastream') def test_pdf(self, mockraw_ds, mockrepo_class): mockobj = Mock() mockobj.pid = 'vol:1' mockobj.label = 'ocm30452349_1908' mockrepo = mockrepo_class.return_value mockrepo.get_object.return_value = mockobj # get datastream called by etag/last-modified methods mockrepo.api.getDatastream.return_value.content = self.xml_profile mockrepo.api.getDatastream.return_value.url = 'http://fedora.co/objects/ds' # to support for last modified conditional mockobj.pdf.created = datetime.now() # mockrepo.api.getDatastreamDissemination.return_value = # mockobj.getDatastreamObject.return_value.created = mockobj.pdf.created # class-based view handling requires an actual response mockraw_ds.return_value = HttpResponse() pdf_url = reverse('books:pdf', kwargs={'pid': mockobj.pid}) response = self.client.get(pdf_url) # only check custom logic implemented here, via mocks # (not testing eulfedora.views.raw_datastream logic) self.assertEqual(mockraw_ds.return_value, response, 'result of fedora raw_datastream should be returned') # can't check full call args because we can't match request args, kwargs = mockraw_ds.call_args # second arg should be pid self.assertEqual(mockobj.pid, args[1]) # third arg should be datstream id self.assertEqual(Volume.pdf.id, args[2]) # digital object class should be specified self.assertEqual(mockrepo, kwargs['repo']) self.assertEqual({'Content-Disposition': 'filename="%s.pdf"' % mockobj.label}, kwargs['headers']) # volume with a space in the label mockobj.label = 'ocm30452349_1908 V0.1' response = self.client.get(pdf_url) args, kwargs = mockraw_ds.call_args content_disposition = kwargs['headers']['Content-Disposition'] self.assertEqual('filename="%s.pdf"' % mockobj.label.replace(' ', '-'), content_disposition, 'content disposition filename should not include spaces even if label does') # if object doesn't exist, 404 (don't error on generating headers) mockobj.exists = False response = self.client.get(pdf_url) expected, got = 404, response.status_code self.assertEqual(expected, got, 'expected %s for %s when there is a fedora error, got %s' % \ (expected, pdf_url, got)) @patch('readux.books.views.Paginator', spec=Paginator) @patch('readux.books.views.solr_interface') @patch('readux.books.views.VolumeSearch.paginate_queryset') def test_search(self, mockqs_paginate, mocksolr_interface, mockpaginator): mockpage = NonCallableMock() search_url = reverse('books:search') # NOTE: pagination now happens in django's class-based view, # so must be mocked there mockqs_paginate.return_value = (mockpaginator.return_value, mockpage, [], False) # no search terms - invalid form response = self.client.get(search_url) self.assertContains(response, 'Please enter one or more search terms') mocksolr = mocksolr_interface.return_value # simulate sunburnt's fluid interface mocksolr.query.return_value = mocksolr.query for method in ['query', 'facet_by', 'sort_by', 'field_limit', 'exclude', 'filter', 'join', 'paginate', 'results_as', 'facet_query']: getattr(mocksolr.query, method).return_value = mocksolr.query # set up mock results for collection query and facet counts solr_result = NonCallableMagicMock(spec_set=['__iter__', 'facet_counts']) # *only* mock iter, to avoid weirdness with django templates & callables solr_result.__iter__.return_value = [ SolrVolume(**{'pid': 'vol:1', 'title': 'Lecoq, the detective', 'pdf_size': 1024}), SolrVolume(**{'pid': 'vol:2', 'title': 'Mabel Meredith', 'pdf_size': 34665}), ] mocksolr.query.__iter__.return_value = iter(solr_result) mocksolr.count.return_value = 2 # mock facets # solr_result.facet_counts.facet_fields = { # 'collection_label_facet': [('Civil War Literature', 2), ('Yellowbacks', 4)] # } # use a noncallable for the pagination result that is used in the template # because passing callables into django templates does weird things mockpaginator.return_value.page.return_value = mockpage results = NonCallableMagicMock(spec=['__iter__', 'facet_counts', '__len__']) results.__iter__.return_value = iter(solr_result) results.facet_counts.facet_fields = { 'collection_label_facet': [('Emory Yearbooks', 1), ('Yellowbacks', 4)] } results.__len__.return_value = 2 mockpage.object_list = results mockpage.has_other_pages = False mockpage.paginator.count = 2 mockpage.paginator.page_range = [1] mockpaginator.return_value.count = 2 mockpaginator.return_value.page_range = [1] mockqs_paginate.return_value = (mockpaginator.return_value, mockpage, results, True) # query with search terms response = self.client.get(search_url, {'keyword': 'yellowbacks'}) mocksolr.query.filter.assert_called_with(content_model=Volume.VOLUME_CMODEL_PATTERN) # because of creator/title search boosting, actual query is a little difficult to test mocksolr.Q.assert_any_call('yellowbacks') mocksolr.Q.assert_any_call(creator='yellowbacks') mocksolr.Q.assert_any_call(title='yellowbacks') # not sure how to test query on Q|Q**3|Q**3 mocksolr.query.field_limit.assert_called_with(SolrVolume.necessary_fields, score=True) # check that unapi / zotero harvest is enabled self.assertContains(response, '<link rel="unapi-server" type="application/xml" title="unAPI" href="%s" />' % \ reverse('books:unapi'), html=True, msg_prefix='link to unAPI server URL should be specified in header') # check that items are displayed for item in solr_result: self.assertContains(response, item['title'], msg_prefix='title should be displayed') self.assertContains(response, unquote(reverse('books:pdf', kwargs={'pid': item['pid']})), msg_prefix='link to pdf should be included in response') self.assertContains(response, '<abbr class="unapi-id" title="%s"></abbr>' % item['pid'], msg_prefix='unapi item id for %s should be included to allow zotero harvest' \ % item['pid']) # pdf size self.assertContains(response, filesizeformat(item['pdf_size']), msg_prefix='PDF size should be displayed in human-readable format') # check that collection facets are displayed / linked for coll, count in results.facet_counts.facet_fields['collection_label_facet']: self.assertContains(response, coll, msg_prefix='collection facet label should be displayed on search results page') # not a very definitive test, but at least check the number is displayed self.assertContains(response, count, msg_prefix='collection facet count should be displayed on search results page') self.assertContains(response, '?keyword=yellowbacks&amp;collection=%s' % coll.replace(' ', '%20'), msg_prefix='response should include link to search filtered by collection facet') # multiple terms and phrase response = self.client.get(search_url, {'keyword': 'yellowbacks "lecoq the detective" mystery'}) for term in ['yellowbacks', 'lecoq the detective', 'mystery']: mocksolr.Q.assert_any_call(term) # filtered by collection response = self.client.get(search_url, {'keyword': 'lecoq', 'collection': 'Yellowbacks'}) mocksolr.query.query.assert_any_call(collection_label='"%s"' % 'Yellowbacks') ## annotation totals # empty annotation total in context for anonymous user self.assertEqual({}, response.context['annotated_volumes']) # check that annotation total is retrieved for ONLY logged in users with patch('readux.books.views.Volume') as mockvolclass: response = self.client.get(search_url, {'keyword': 'lecoq', 'collection': 'Yellowbacks'}) mockvolclass.volume_annotation_count.assert_not_called() User = get_user_model() testuser = User.objects.get(username=self.user_credentials['user']['username']) self.client.login(**self.user_credentials['user']) response = self.client.get(search_url, {'keyword': 'lecoq', 'collection': 'Yellowbacks'}) mockvolclass.volume_annotation_count.assert_called_with(testuser) @patch('readux.books.views.VolumeText.repository_class') #TypeInferringRepository') def test_text(self, mockrepo_class): mockobj = Mock() mockobj.pid = 'vol:1' mockobj.label = 'ocm30452349_1908' # has to return a datetime (and not a mock) for last-modified conditional mockobj.getDatastreamObject.return_value.created = datetime.now() mockrepo = mockrepo_class.return_value mockrepo.get_object.return_value = mockobj # get datastream called by etag/last-modified methods mockrepo.api.getDatastream.return_value.content = self.xml_profile mockrepo.api.getDatastream.return_value.url = 'http://fedora.co/objects/ds' mockobj.get_fulltext.return_value = 'sample text content' # to support for last modified conditional mockobj.ocr.created = datetime.now() text_url = reverse('books:text', kwargs={'pid': mockobj.pid}) response = self.client.get(text_url) self.assertEqual(mockobj.get_fulltext.return_value, response.content, 'volume full text should be returned as response content') self.assertEqual(response['Content-Type'], "text/plain") self.assertEqual(response['Content-Disposition'], 'filename="%s.txt"' % mockobj.label) # various 404 conditions # - no ocr mockobj.fulltext_available = False response = self.client.get(text_url) self.assertEqual(404, response.status_code, 'text view should 404 if fultext is not available') # - not a volume mockobj.has_requisite_content_models = False mockobj.ocr.exists = True response = self.client.get(text_url) self.assertEqual(404, response.status_code, 'text view should 404 if object is not a Volume') # - object doesn't exist mockobj.exists = False mockobj.has_requisite_content_models = True response = self.client.get(text_url) self.assertEqual(404, response.status_code, 'text view should 404 if object does not exist') @patch('readux.books.views.Repository') def test_unapi(self, mockrepo): unapi_url = reverse('books:unapi') # no params - should list available formats response = self.client.get(unapi_url) self.assertEqual('application/xml', response['content-type'], 'response should be returned as xml') self.assertContains(response, '<formats>', msg_prefix='request with no parameters should return all formats') # volume formats only for now formats = Volume.unapi_formats for fmt_name, fmt_info in formats.iteritems(): self.assertContains(response, '<format name="%s" type="%s"' \ % (fmt_name, fmt_info['type']), msg_prefix='formats should include %s' % fmt_name) mockobj = Mock() mockobj.pid = 'vol:1' mockobj.label = 'ocm30452349_1908' mockobj.unapi_formats = Volume.unapi_formats # actual rdf dc logic tested elsewhere mockobj.rdf_dc.return_value = 'sample bogus rdf for testing purposes' mockrepo.return_value.get_object.return_value = mockobj # request with id but no format response = self.client.get(unapi_url, {'id': mockobj.pid}) self.assertEqual('application/xml', response['content-type'], 'response should be returned as xml') self.assertContains(response, '<formats id="%s">' % mockobj.pid, msg_prefix='request with id specified should return formats for that id') # volume formats only for now for fmt_name, fmt_info in formats.iteritems(): self.assertContains(response, '<format name="%s" type="%s"' \ % (fmt_name, fmt_info['type']), msg_prefix='formats should include %s' % fmt_name) # request with id and format response = self.client.get(unapi_url, {'id': mockobj.pid, 'format': 'rdf_dc'}) self.assertEqual(formats['rdf_dc']['type'], response['content-type'], 'response content-type should be set based on requested format') self.assertEqual(mockobj.rdf_dc.return_value, response.content, 'response content should be set based on result of method corresponding to requested format') @patch('readux.books.views.Repository') def test_volume(self, mockrepo): mockobj = NonCallableMock() mockobj.pid = 'vol:1' mockobj.title = 'Lecoq, the detective' mockobj.volume = 'V.1' mockobj.date = ['1801'] mockobj.creator = ['Gaboriau, Emile'] mockobj.book.dc.content.description_list = [ 'Translation of: Monsieur Lecoq.', 'Victorian yellowbacks + paperbacks, 1849-1905' ] mockobj.book.dc.content.publisher = 'London : Vizetelly' mockobj.book.volume_set = [mockobj, NonCallableMock(pid='vol:2')] mockobj.pdf_size = 1024 mockobj.has_pages = False mockobj.is_a_volume = True mockrepo.return_value.get_object.return_value = mockobj # to support for last modified conditional mockobj.ocr.created = datetime.now() vol_url = reverse('books:volume', kwargs={'pid': mockobj.pid}) response = self.client.get(vol_url) self.assertContains(response, mockobj.title, msg_prefix='response should include title') self.assertContains(response, mockobj.volume, msg_prefix='response should include volume label') self.assertContains(response, mockobj.date[0], msg_prefix='response should include date') self.assertContains(response, mockobj.creator[0], msg_prefix='response should include creator') for desc in mockobj.book.dc.content.description_list: self.assertContains(response, desc, msg_prefix='response should include dc:description') self.assertContains(response, mockobj.book.dc.content.publisher, msg_prefix='response should include publisher') self.assertContains(response, reverse('books:pdf', kwargs={'pid': mockobj.pid}), msg_prefix='response should include link to pdf') # related volumes self.assertContains(response, 'Related volumes', msg_prefix='response should include related volumes when present') self.assertContains(response, reverse('books:volume', kwargs={'pid': mockobj.book.volume_set[0].pid}), msg_prefix='response should link to related volumes') # pdf size self.assertContains(response, filesizeformat(mockobj.pdf_size), msg_prefix='PDF size should be displayed in human-readable format') # no pages loaded, should not include volume search or read online self.assertNotContains(response, 'Read online', msg_prefix='volume without pages loaded should not display read online option') # NOTE: href needed to differentiate from cover url, which starts the same self.assertNotContains(response, 'href="%s"' % reverse('books:pages', kwargs={'pid': mockobj.pid}), msg_prefix='volume without pages loaded should not have link to read online') self.assertNotContains(response, '<form id="volume-search" ', msg_prefix='volume without pages loaded should not have volume search') # annotation total passed to context self.assert_('annotated_volumes' not in response.context, 'annotation count should not be set for volumes without pages') # simulate volume with pages loaded mockobj.has_pages = True # to test annotation count mockobj.get_absolute_url.return_value = '/books/vol:1/' mockobj.annotation_count.return_value = 5 response = self.client.get(vol_url) # *should* include volume search and read online self.assertContains(response, 'Read online', msg_prefix='volume with pages loaded should display read online option') self.assertContains(response, reverse('books:pages', kwargs={'pid': mockobj.pid}), msg_prefix='volume with pages loaded should have link to read online') self.assertContains(response, '<form id="volume-search" ', msg_prefix='volume without pages loaded should have volume search') # annotation total passed to context self.assertEqual({mockobj.get_absolute_url(): 5}, response.context['annotated_volumes'], 'annotation count should be set for volumes with pages') mockobj.annotation_count.return_value = 0 response = self.client.get(vol_url) self.assert_('annotated_volumes' not in response.context, 'annotation count should not be set in context when it is zero') # non-existent should 404 mockobj.exists = False response = self.client.get(vol_url) expected, got = 404, response.status_code self.assertEqual(expected, got, 'expected %s for %s when object does not exist, got %s' % \ (expected, vol_url, got)) # exists but isn't a volume - should also 404 mockobj.exists = True mockobj.is_a_volume = False response = self.client.get(vol_url) expected, got = 404, response.status_code self.assertEqual(expected, got, 'expected %s for %s when object is not a volume, got %s' % \ (expected, vol_url, got)) @patch('readux.books.views.Repository') @patch('readux.books.views.Paginator', spec=Paginator) @patch('readux.books.views.solr_interface') def test_volume_page_search(self, mocksolr_interface, mockpaginator, mockrepo): mockobj = NonCallableMock() mockobj.pid = 'vol:1' mockobj.title = 'Lecoq, the detective' mockobj.date = ['1801'] mockrepo.return_value.get_object.return_value = mockobj mocksolr = mocksolr_interface.return_value # simulate sunburnt's fluid interface mocksolr.query.return_value = mocksolr.query for method in ['query', 'facet_by', 'sort_by', 'field_limit', 'highlight', 'exclude', 'filter', 'join', 'paginate', 'results_as']: getattr(mocksolr.query, method).return_value = mocksolr.query # set up mock results for collection query and facet counts solr_result = NonCallableMagicMock(spec_set=['__iter__', 'facet_counts']) # *only* mock iter, to avoid weirdness with django templates & callables solr_results = [ SolrPage(**{'pid': 'page:1', 'page_order': '1', 'score': 0.5, 'solr_highlights': {'page_text': ['snippet with search term']}, 'identifier': ['http://testpid.co/ark:/1234/11/']}), SolrPage(**{'pid': 'page:233', 'page_order': '123', 'score': 0.02, 'solr_highlights': {'page_text': ['sample text result from content']}, 'identifier': ['http://testpid.co/ark:/1234/22/']}), ] solr_result.__iter__.return_value = solr_results mocksolr.query.__iter__.return_value = iter(solr_result) mocksolr.count.return_value = 2 mockpage = NonCallableMock() mockpaginator.return_value.page.return_value = mockpage results = NonCallableMagicMock(spec=['__iter__', 'facet_counts', 'highlighting']) results.__iter__.return_value = iter(solr_result) mockpage.object_list = results mockpage.has_other_pages = False mockpage.paginator.count = 2 mockpage.paginator.page_range = [1] # patch in highlighting - apparent change in sunburnt behavior results.highlighting = { 'page:1': {'page_text': ['snippet with search term']}, 'page:233': {'page_text': ['sample text result from content']} } vol_url = reverse('books:volume', kwargs={'pid': mockobj.pid}) response = self.client.get(vol_url, {'keyword': 'determine'}) self.assertEqual(response.templates[0].name, views.VolumeDetail.search_template_name, 'volume search template should be used for valid search submission') for page in iter(solr_result): self.assertContains(response, reverse('books:page-image', kwargs={'vol_pid': mockobj.pid, 'pid': page.pid, 'mode': 'mini-thumbnail'}), msg_prefix='search results should include mini page thumbnail url') self.assertContains(response, "Page %(page_order)s" % page, msg_prefix='search results should include page number') self.assertContains(response, page['score'], msg_prefix='search results should display page relevance score') self.assertContains(response, reverse('books:page', kwargs={'vol_pid': mockobj.pid, 'pid': page['pid']}), msg_prefix='search results should link to full page view') self.assertContains(response, '... %s ...' % page['solr_highlights']['page_text'][0], msg_prefix='solr snippets should display when available') # ajax request with patch('readux.books.views.VolumeDetail.get_context_data') as mock_ctx: results = NonCallableMagicMock(spec=['__iter__', 'facet_counts', 'highlighting']) results.__iter__.return_value = iter(solr_result) results.highlighting = { solr_results[0].pid: { 'page_text': 'sample highlighting snippet' }, solr_results[1].pid: { 'page_text': 'another highlighting snippet' } } mockpage = NonCallableMagicMock(spec=['__iter__']) mockpage.object_list = results mock_ctx.return_value = { 'pages': mockpage, } response = self.client.get(vol_url, {'keyword': 'determine'}, HTTP_X_REQUESTED_WITH='XMLHttpRequest') self.assertEqual('application/json', response['content-type']) data = json.loads(response.content) for idx in range(len(data)): self.assertEqual(solr_results[idx].pid, data[idx]['pid']) self.assertEqual('p. %s' % solr_results[idx]['page_order'], data[idx]['label']) self.assertEqual(reverse('books:page-image', kwargs={'vol_pid': mockobj.pid, 'pid': solr_results[idx].pid, 'mode': 'mini-thumbnail'}), data[idx]['thumbnail']) self.assertEqual(results.highlighting[solr_results[idx].pid]['page_text'], data[idx]['highlights']) @patch('readux.books.views.Repository') @patch('readux.books.views.Paginator', spec=Paginator) # @patch('readux.books.views.solr_interface') # def test_volume_pages(self, mocksolr_interface, mockpaginator, mockrepo): def test_volume_pages(self, mockpaginator, mockrepo): mockvol = NonCallableMock(spec=Volume) mockvol.pid = 'vol:1' mockvol.title = 'Lecoq, the detective' mockvol.date = ['1801'] # second object retrieved from fedora is page, for layout mockvol.width = 150 mockvol.height = 200 # volume url needed to identify annotations for pages in this volume mockvol.get_absolute_url.return_value = reverse('books:volume', kwargs={'pid': mockvol.pid}) mockrepo.return_value.get_object.return_value = mockvol mockvol.find_solr_pages = MagicMock() mockvol.find_solr_pages.return_value.count = 3 mockvol.find_solr_pages.__len__.return_value = 3 mockpage = Mock(width=640, height=400) mockvol.pages = [mockpage] vol_page_url = reverse('books:pages', kwargs={'pid': mockvol.pid}) response = self.client.get(vol_page_url) # volume method should be used to find pages self.assert_(call() in mockvol.find_solr_pages.call_args_list) # volume should be set in context self.assert_(mockvol, response.context['vol']) # annotated pages should be empty for anonymous user self.assertEqual({}, response.context['annotated_pages']) # log in as a regular user self.client.login(**self.user_credentials['user']) testuser = get_user_model().objects.get(username=self.user_credentials['user']['username']) page1_url = reverse('books:page', kwargs={'vol_pid': mockvol.pid, 'pid': 'page:1'}) page2_url = reverse('books:page', kwargs={'vol_pid': mockvol.pid, 'pid': 'page:2'}) page3_url = reverse('books:page', kwargs={'vol_pid': mockvol.pid, 'pid': 'page:3'}) mockvol.page_annotation_count.return_value = { absolutize_url(page1_url): 5, absolutize_url(page2_url): 2, page3_url: 13 } response = self.client.get(vol_page_url) mockvol.page_annotation_count.assert_called_with(testuser) annotated_pages = response.context['annotated_pages'] # counts should be preserved; urls should be non-absolute # whether they started that way or not self.assertEqual(5, annotated_pages[absolutize_url(page1_url)]) self.assertEqual(2, annotated_pages[absolutize_url(page2_url)]) self.assertEqual(13, annotated_pages[page3_url]) @patch('readux.books.views.TypeInferringRepository') def test_view_page(self, mockrepo): mockobj = Mock() mockobj.pid = 'page:1' mockobj.volume.pid = 'vol:1' mockrepo.return_value.get_object.return_value = mockobj url = reverse('books:page', kwargs={'vol_pid': mockobj.volume.pid, 'pid': mockobj.pid}) # doesn't exist mockobj.exists = False response = self.client.get(url) self.assertEqual(404, response.status_code, 'page view should 404 when object doesn\'t exist') # exists but not a page object mockobj.exists = True response = self.client.get(url) self.assertEqual(404, response.status_code, 'page view should 404 when object isn\'t a Page object') # page object mockobj = NonCallableMagicMock(spec=Page) mockobj.pid = 'page:5' mockobj.page_order = 5 mockobj.display_label = 'Page 5' mockobj.volume.pid = 'vol:1' # first test without tei mockobj.tei = NonCallableMock() # non-magic mock, to simplify template logic mockobj.tei.exists = False # uses solr to find adjacent pages solr_result = NonCallableMagicMock(spec_set=['__iter__']) # *only* mock iter, to avoid weirdness with django templates & callables nearby_pages = [ {'pid': 'page:4', 'page_order': '4'}, {'pid': 'page:5', 'page_order': '5'}, {'pid': 'page:5', 'page_order': '6'}, ] solr_result.__iter__.return_value = nearby_pages mocksolr_query = MagicMock() mocksolr_query.__iter__.return_value = iter(solr_result) mocksolr_query.__len__.return_value = 3 # cheating here, since we know what index should be requested... mocksolr_query.__getitem__.return_value = nearby_pages[2] mocksolr_query.query.return_value = mocksolr_query mockobj.volume.find_solr_pages.return_value = mocksolr_query mockrepo.return_value.get_object.return_value = mockobj response = self.client.get(url) # test expected context variables self.assertEqual(mockobj, response.context['page'], 'page object should be set in context') self.assertEqual(nearby_pages[0], response.context['prev'], 'previous page should be selected from solr result and set in context') self.assertEqual(nearby_pages[2], response.context['next'], 'next page should be selected from solr result and set in context') self.assertEqual(1, response.context['page_chunk'], 'chunk of paginated pages should be calculated and set in context') self.assertNotContains(response, reverse('books:page-tei', kwargs={'vol_pid': mockobj.volume.pid, 'pid': mockobj.pid}), msg_prefix='page without tei should NOT link to tei in header') # TODO: # - test metadata in header (twitter/og fields) # - test page image, deep zoom content, title display, etc # test with tei available mockobj.tei.exists = True mockobj.tei.content.page.width = 2000 mockobj.tei.content.page.height = 1500 # for now, simulate no ocr content mockobj.tei.content.lines = [] response = self.client.get(url) # scale from original page size (long edge) to display size (1000) self.assertEqual(0.5, response.context['scale'], 'page scale should be calculated and set in context') # TODO: test tei text content display? # FIXME: for some reason, the mocks are not being processed # correctly and even though the view can access the volume pid, # the template has this: # TypeInferringRepository().get_object().volume.__getitem__()'%20id='4568359696'%3E/pages/page:5/tei/" /> # Test is disabled until this issue can be fixed. # self.assertContains(response, # '<link rel="alternate" type="text/xml" href="%s" />' % \ # reverse('books:page-tei', # kwargs={'vol_pid': mockobj.volume.pid, 'pid': mockobj.pid}), # html=True, # msg_prefix='page with tei should link to tei in header') @patch('readux.books.views.PageTei.repository_class') def test_page_tei(self, mockrepo_class): mockobj = Mock() mockobj.exists = True mockobj.pid = 'page:1' mockobj.volume.pid = 'vol:1' mockds = mockobj.getDatastreamObject.return_value mockds.exists = True mockds.created = datetime.now() mockds.info.size = 100 mockrepo = mockrepo_class.return_value mockrepo = mockrepo_class.return_value mockrepo.get_object.return_value = mockobj # get datastream called by etag/last-modified methods mockrepo.api.getDatastream.return_value.content = self.xml_profile mockrepo.api.getDatastream.return_value.url = 'http://fedora.co/objects/ds' # required so raw_ds view can update with local headers mockrepo.api.getDatastreamDissemination.return_value.headers = {} url = reverse('books:page-tei', kwargs={'vol_pid': mockobj.volume.pid, 'pid': mockobj.pid}) response = self.client.get(url) # class-based view, can no longer test parameters to raw_datastream # only custom logic is the header, and configuration self.assertEqual('filename="%s_tei.xml"' % mockobj.pid.replace(':', '-'), response['content-disposition'], 'tei response should have a content-disposition header set') mockrepo.api.getDatastreamDissemination.assert_called_with(mockobj.pid, Page.tei.id, asOfDateTime=None, rqst_headers={}, stream=True) @patch('readux.books.views.TypeInferringRepository') def test_page_redirect(self, mockrepo): mockobj = Mock() mockobj.pid = 'page:1' mockobj.volume.pid = 'vol:1' mockrepo.return_value.get_object.return_value = mockobj url = reverse('books:old-pageurl-redirect', kwargs={'pid': mockobj.pid, 'path': ''}) # doesn't exist mockobj.exists = False response = self.client.get(url) self.assertEqual(404, response.status_code, 'page redirect view should 404 when object doesn\'t exist') # exists but not a page object mockobj.exists = True response = self.client.get(url) self.assertEqual(404, response.status_code, 'page redirect view should 404 when object isn\'t a Page object') # page object mockobj = Mock(spec=Page) mockobj.pid = 'page:5' mockobj.volume.pid = 'vol:1' mockobj.exists = True mockrepo.return_value.get_object.return_value = mockobj response = self.client.get(url, follow=False) url_args = { 'kwargs': { 'vol_pid': mockobj.volume.pid, 'pid': mockobj.pid } } self.assertEqual(301, response.status_code, 'page redirect view should return a permanent redirect') self.assertEqual('http://testserver%s' % \ reverse('books:page', **url_args), response['location']) # test a couple of sub page urls url = reverse('books:old-pageurl-redirect', kwargs={'pid': mockobj.pid, 'path': 'tei/'}) response = self.client.get(url, follow=False) self.assertEqual(301, response.status_code, 'page redirect view should return a permanent redirect') self.assertEqual('http://testserver%s' % \ reverse('books:page-tei', **url_args), response['location']) url = reverse('books:old-pageurl-redirect', kwargs={'pid': mockobj.pid, 'path': 'ocr/'}) response = self.client.get(url, follow=False) self.assertEqual(301, response.status_code, 'page redirect view should return a permanent redirect') self.assertEqual('http://testserver%s' % \ reverse('books:page-ocr', **url_args), response['location']) @patch('readux.books.sitemaps.solr_interface') def test_sitemaps(self, mocksolr_interface): # minimal test, just to check that sitemaps render without error response = self.client.get(reverse('sitemap-index')) self.assertContains(response, 'sitemapindex') response = self.client.get(reverse('sitemap', kwargs={'section': 'volumes'})) self.assertContains(response, '<urlset') @patch('readux.books.views.Repository') def test_volume_export(self, mockrepo): mockobj = NonCallableMock() mockobj.pid = 'vol:1' mockobj.title = 'Lecoq, the detective' mockobj.volume = 'V.1' mockobj.date = ['1801'] mockrepo.return_value.get_object.return_value = mockobj # to support for last modified conditional mockobj.ocr.created = datetime.now() # anonymous export_url = reverse('books:webexport', kwargs={'pid': mockobj.pid}) response = self.client.get(export_url) self.assertContains(response, '''<div class="alert alert-warning">Export functionality is only available to logged in users.</div>''', msg_prefix='Anonymous user should see warning when viewing export page', html=True) # log in as a regular user self.client.login(**self.user_credentials['user']) response = self.client.get(export_url) self.assert_('export_form' in response.context, 'export form should be set in response context for logged in user') self.assertContains(response, 'Export to GitHub requires a GitHub account.', msg_prefix='user should see a warning about github account') ## tests for view helpers class ViewHelpersTest(TestCase): @patch('readux.books.view_helpers.Repository') @patch('readux.books.view_helpers.solr_interface') def test_volume_pages_modified(self, mocksolr_interface, mockrepo): mockvol = Mock(pid='vol:1') mockrepo.return_value.get_object.return_value = mockvol mockrequest = Mock() mockrequest.user.is_authenticated.return_value = False # no solr results mockresult = MagicMock() mocksolr_interface.return_value.query.return_value.sort_by.return_value.field_limit.return_value = mockresult mockresult.count.return_value = 0 lastmod = view_helpers.volume_pages_modified(mockrequest, 'vol:1') self.assertEqual(None, lastmod) # only solr result mockresult.count.return_value = 1 yesterday = datetime.now() - timedelta(days=1) mockresult.__getitem__.return_value = {'timestamp': yesterday} lastmod = view_helpers.volume_pages_modified(mockrequest, 'vol:1') self.assertEqual(yesterday, lastmod) # test with both solr and annotations for logged in user mockvol.get_absolute_url.return_value = reverse('books:volume', kwargs={'pid': mockvol.pid}) mockrequest.user.is_authenticated.return_value = True mockrequest.user.username = 'tester' testuser = get_user_model()(username='tester') testuser.save() anno = Annotation.objects.create(user=testuser, uri=reverse('books:page', kwargs={'vol_pid': mockvol.pid, 'pid': 'page:3'}), extra_data=json.dumps({})) mockvol.annotations.return_value = Annotation.objects.filter(uri__contains=mockvol.get_absolute_url()) lastmod = view_helpers.volume_pages_modified(mockrequest, 'vol:1') self.assertEqual(anno.created, lastmod) class SitemapTestCase(TestCase): @patch('readux.books.sitemaps.solr_interface') def test_volume_sitemap(self, mocksolr_interface): vol_sitemap = sitemaps.VolumeSitemap() mocksolr = mocksolr_interface.return_value # check for expected solr query vol_sitemap.items() mocksolr.query.assert_called_with(content_model=Volume.VOLUME_CMODEL_PATTERN) mocksolr.query.return_value.field_limit.assert_called_with(['pid', 'last_modified']) @patch('readux.books.sitemaps.solr_interface') def test_volume_page_sitemap(self, mocksolr_interface): volpage_sitemap = sitemaps.VolumePageSitemap() mocksolr = mocksolr_interface.return_value # check for expected solr query volpage_sitemap.items() mocksolr.query.assert_called_with(content_model=Page.PAGE_CMODEL_PATTERN) mocksolr.query.return_value.field_limit.assert_called_with(['pid', 'last_modified', 'isConstituentOf']) class BookSearchTest(TestCase): def test_search_terms(self): form = forms.BookSearch({'keyword': 'term "exact phrase" term2'}) self.assertTrue(form.is_valid()) terms = form.search_terms() self.assert_('term' in terms) self.assert_('term2' in terms) self.assert_('exact phrase' in terms) # test searching on page ark ark = 'http://testpid.library.emory.edu/ark:/25593/pwtbb' form = forms.BookSearch({'keyword': ark}) self.assertTrue(form.is_valid()) terms = form.search_terms() self.assertEqual([ark], terms)
apache-2.0
[ 504, 2197, 492, 2197, 12, 6871, 199, 504, 1639, 14, 2828, 14, 1178, 492, 664, 63, 751, 63, 1238, 199, 504, 1639, 14, 1018, 14, 22073, 492, 28006, 8566, 199, 504, 1639, 14, 1018, 14, 16522, 492, 3837, 199, 504, 1639, 14, 1014, 492, 6183, 199, 504, 1639, 14, 1160, 14, 885, 4273, 492, 23858, 908, 199, 504, 1639, 14, 396, 492, 7640, 199, 646, 2022, 199, 504, 1683, 492, 4420, 12, 3371, 12, 10172, 16410, 3346, 12, 10172, 16410, 11988, 12, 971, 272, 10079, 12, 1240, 199, 504, 4011, 492, 14342, 199, 199, 504, 1586, 2521, 14, 11270, 14, 992, 492, 30793, 199, 504, 1586, 2521, 14, 8858, 14, 992, 492, 17991, 82, 6464, 12, 15018, 12, 10331, 12, 17991, 82, 3276, 199, 504, 1586, 2521, 14, 8858, 492, 4770, 8919, 12, 6858, 12, 2455, 63, 7546, 12, 4513, 199, 504, 1586, 2521, 14, 1208, 492, 2853, 393, 935, 806, 63, 633, 421, 199, 533, 8944, 21180, 774, 8, 1746, 304, 272, 327, 330, 19598, 316, 10949, 1253, 511, 12639, 687, 1586, 2521, 14, 11270, 14, 2219, 272, 15188, 275, 788, 396, 63, 9340, 63, 576, 14, 1001, 418, 272, 922, 63, 6942, 275, 469, 267, 283, 751, 356, 791, 2473, 356, 283, 21029, 297, 283, 2060, 356, 283, 4776, 2267, 267, 283, 11434, 356, 791, 2473, 356, 283, 396, 4792, 297, 283, 2060, 356, 283, 4792, 278, 936, 272, 789, 339, 327, 2690, 666, 1745, 4690, 2748, 272, 2748, 63, 2913, 275, 28827, 576, 1745, 5736, 9604, 628, 1014, 921, 1544, 14, 28803, 14, 815, 15, 15388, 15, 17, 15, 16, 15, 8110, 6687, 9604, 26, 10515, 628, 1014, 921, 1544, 14, 87, 19, 14, 1308, 15, 8339, 15, 32565, 2, 9604, 26, 88, 338, 628, 1014, 921, 1544, 14, 87, 19, 14, 1308, 15, 8339, 15, 32565, 13, 842, 2, 671, 338, 26, 3629, 6592, 628, 1014, 921, 1544, 14, 28803, 14, 815, 15, 15388, 15, 17, 15, 16, 15, 8110, 15, 1455, 921, 1544, 14, 28803, 14, 815, 15, 15388, 15, 17, 15, 16, 15, 576, 1745, 5736, 14, 10515, 2, 4422, 628, 5186, 396, 26, 17, 2, 6364, 998, 628, 5196, 1743, 199, 28, 795, 4314, 30, 36, 456, 472, 11672, 12651, 367, 642, 909, 1108, 795, 4314, 30, 199, 28, 795, 3353, 998, 30, 5196, 17, 14, 16, 1108, 795, 3353, 998, 30, 199, 28, 795, 2499, 2506, 30, 9261, 13, 996, 13, 709, 52, 975, 26, 1344, 26, 821, 14, 25, 969, 58, 1108, 795, 2499, 2506, 30, 199, 28, 795, 2223, 30, 33, 1108, 795, 2223, 30, 199, 28, 795, 17057, 30, 505, 15, 1652, 1108, 795, 17057, 30, 199, 28, 795, 3484, 7639, 30, 1014, 921, 1544, 14, 1490, 28067, 14, 1308, 15, 47, 7730, 15, 18, 14, 16, 15, 28475, 63, 3833, 15, 1108, 795, 3484, 7639, 30, 199, 28, 795, 3717, 2448, 30, 56, 1108, 795, 3717, 2448, 30, 199, 28, 795, 2320, 30, 12015, 1108, 795, 2320, 30, 199, 28, 795, 3353, 461, 30, 2052, 1108, 795, 3353, 461, 30, 199, 28, 795, 2354, 804, 3133, 199, 28, 795, 6592, 30, 5186, 396, 26, 17, 11, 5196, 11, 5196, 17, 14, 16, 1108, 795, 6592, 30, 199, 28, 795, 6592, 804, 3133, 199, 28, 795, 17394, 804, 30, 5127, 21, 1108, 795, 17394, 804, 30, 199, 28, 795, 17394, 30, 2055, 16, 697, 16, 2829, 16, 29873, 17257, 21254, 65, 29831, 65, 1081, 24338, 68, 19, 67, 23, 1108, 795, 17394, 30, 199, 1108, 576, 1745, 5736, 26934, 339, 768, 2068, 360, 739, 2521, 14, 8858, 14, 4196, 14, 6464, 48, 1587, 14, 8421, 63, 533, 358, 272, 768, 2068, 360, 16913, 276, 379, 11131, 14, 4196, 423, 1773, 63, 576, 1745, 358, 272, 347, 511, 63, 5607, 8, 277, 12, 1683, 1773, 63, 795, 12, 1683, 3417, 63, 533, 304, 267, 1683, 1113, 275, 4420, 342, 267, 1683, 1113, 14, 3150, 275, 283, 5650, 26, 17, 7, 267, 1683, 1113, 14, 1302, 275, 283, 679, 77, 8533, 2528, 11991, 63, 1167, 2036, 7, 267, 1683, 3417, 275, 1683, 3417, 63, 533, 14, 1107, 63, 585, 267, 1683, 3417, 14, 362, 63, 785, 14, 1107, 63, 585, 275, 1683, 1113, 267, 327, 664, 666, 1745, 2797, 701, 13677, 15, 2019, 13, 5540, 3102, 267, 1683, 3417, 14, 1246, 14, 29276, 1745, 14, 1107, 63, 585, 14, 1317, 275, 291, 14, 1652, 63, 2913, 267, 1683, 3417, 14, 1246, 14, 29276, 1745, 14, 1107, 63, 585, 14, 633, 275, 283, 1014, 921, 28803, 14, 331, 15, 1462, 15, 795, 7, 398, 327, 370, 2291, 367, 2061, 6042, 12303, 267, 1683, 1113, 14, 5607, 14, 3966, 275, 2197, 14, 2131, 342, 267, 327, 1683, 3417, 14, 1246, 14, 29276, 1745, 2825, 261, 827, 425, 14, 1107, 63, 585, 275, 267, 327, 1683, 1113, 14, 29276, 1745, 1692, 14, 1107, 63, 585, 14, 3966, 275, 1683, 1113, 14, 5607, 14, 3966, 398, 327, 1021, 13, 6788, 2455, 7252, 5074, 376, 3503, 1177, 267, 1683, 1773, 63, 795, 14, 1107, 63, 585, 275, 6183, 342, 398, 11249, 63, 633, 275, 3837, 360, 8858, 26, 5607, 297, 2074, 3713, 3150, 356, 1683, 1113, 14, 3150, 1552, 267, 1177, 275, 291, 14, 1258, 14, 362, 8, 5607, 63, 633, 9, 398, 327, 1454, 1104, 3537, 9661, 6366, 2348, 12, 4799, 26500, 267, 327, 334, 1397, 5343, 325, 85, 276, 379, 11131, 14, 4196, 14, 1773, 63, 576, 1745, 9661, 9, 267, 291, 14, 629, 8, 1805, 1773, 63, 795, 14, 1107, 63, 585, 12, 1177, 12, 288, 283, 1099, 402, 23036, 11131, 3066, 63, 576, 1745, 1077, 506, 2138, 358, 398, 327, 883, 1133, 1104, 2615, 1240, 1249, 2952, 781, 883, 1133, 1336, 1056, 267, 1249, 12, 2074, 275, 1683, 1773, 63, 795, 14, 1250, 63, 589, 398, 327, 3499, 1680, 1077, 506, 4422, 267, 291, 14, 629, 8, 1805, 1113, 14, 3150, 12, 1249, 59, 17, 566, 267, 327, 10919, 1680, 1077, 506, 6394, 1745, 1305, 267, 291, 14, 629, 8, 6464, 14, 5607, 14, 344, 12, 1249, 59, 18, 566, 267, 327, 20545, 909, 1021, 1077, 506, 2013, 267, 291, 14, 629, 8, 1805, 3417, 12, 2074, 459, 3417, 1105, 267, 291, 14, 629, 3252, 2714 ]
[ 2197, 492, 2197, 12, 6871, 199, 504, 1639, 14, 2828, 14, 1178, 492, 664, 63, 751, 63, 1238, 199, 504, 1639, 14, 1018, 14, 22073, 492, 28006, 8566, 199, 504, 1639, 14, 1018, 14, 16522, 492, 3837, 199, 504, 1639, 14, 1014, 492, 6183, 199, 504, 1639, 14, 1160, 14, 885, 4273, 492, 23858, 908, 199, 504, 1639, 14, 396, 492, 7640, 199, 646, 2022, 199, 504, 1683, 492, 4420, 12, 3371, 12, 10172, 16410, 3346, 12, 10172, 16410, 11988, 12, 971, 272, 10079, 12, 1240, 199, 504, 4011, 492, 14342, 199, 199, 504, 1586, 2521, 14, 11270, 14, 992, 492, 30793, 199, 504, 1586, 2521, 14, 8858, 14, 992, 492, 17991, 82, 6464, 12, 15018, 12, 10331, 12, 17991, 82, 3276, 199, 504, 1586, 2521, 14, 8858, 492, 4770, 8919, 12, 6858, 12, 2455, 63, 7546, 12, 4513, 199, 504, 1586, 2521, 14, 1208, 492, 2853, 393, 935, 806, 63, 633, 421, 199, 533, 8944, 21180, 774, 8, 1746, 304, 272, 327, 330, 19598, 316, 10949, 1253, 511, 12639, 687, 1586, 2521, 14, 11270, 14, 2219, 272, 15188, 275, 788, 396, 63, 9340, 63, 576, 14, 1001, 418, 272, 922, 63, 6942, 275, 469, 267, 283, 751, 356, 791, 2473, 356, 283, 21029, 297, 283, 2060, 356, 283, 4776, 2267, 267, 283, 11434, 356, 791, 2473, 356, 283, 396, 4792, 297, 283, 2060, 356, 283, 4792, 278, 936, 272, 789, 339, 327, 2690, 666, 1745, 4690, 2748, 272, 2748, 63, 2913, 275, 28827, 576, 1745, 5736, 9604, 628, 1014, 921, 1544, 14, 28803, 14, 815, 15, 15388, 15, 17, 15, 16, 15, 8110, 6687, 9604, 26, 10515, 628, 1014, 921, 1544, 14, 87, 19, 14, 1308, 15, 8339, 15, 32565, 2, 9604, 26, 88, 338, 628, 1014, 921, 1544, 14, 87, 19, 14, 1308, 15, 8339, 15, 32565, 13, 842, 2, 671, 338, 26, 3629, 6592, 628, 1014, 921, 1544, 14, 28803, 14, 815, 15, 15388, 15, 17, 15, 16, 15, 8110, 15, 1455, 921, 1544, 14, 28803, 14, 815, 15, 15388, 15, 17, 15, 16, 15, 576, 1745, 5736, 14, 10515, 2, 4422, 628, 5186, 396, 26, 17, 2, 6364, 998, 628, 5196, 1743, 199, 28, 795, 4314, 30, 36, 456, 472, 11672, 12651, 367, 642, 909, 1108, 795, 4314, 30, 199, 28, 795, 3353, 998, 30, 5196, 17, 14, 16, 1108, 795, 3353, 998, 30, 199, 28, 795, 2499, 2506, 30, 9261, 13, 996, 13, 709, 52, 975, 26, 1344, 26, 821, 14, 25, 969, 58, 1108, 795, 2499, 2506, 30, 199, 28, 795, 2223, 30, 33, 1108, 795, 2223, 30, 199, 28, 795, 17057, 30, 505, 15, 1652, 1108, 795, 17057, 30, 199, 28, 795, 3484, 7639, 30, 1014, 921, 1544, 14, 1490, 28067, 14, 1308, 15, 47, 7730, 15, 18, 14, 16, 15, 28475, 63, 3833, 15, 1108, 795, 3484, 7639, 30, 199, 28, 795, 3717, 2448, 30, 56, 1108, 795, 3717, 2448, 30, 199, 28, 795, 2320, 30, 12015, 1108, 795, 2320, 30, 199, 28, 795, 3353, 461, 30, 2052, 1108, 795, 3353, 461, 30, 199, 28, 795, 2354, 804, 3133, 199, 28, 795, 6592, 30, 5186, 396, 26, 17, 11, 5196, 11, 5196, 17, 14, 16, 1108, 795, 6592, 30, 199, 28, 795, 6592, 804, 3133, 199, 28, 795, 17394, 804, 30, 5127, 21, 1108, 795, 17394, 804, 30, 199, 28, 795, 17394, 30, 2055, 16, 697, 16, 2829, 16, 29873, 17257, 21254, 65, 29831, 65, 1081, 24338, 68, 19, 67, 23, 1108, 795, 17394, 30, 199, 1108, 576, 1745, 5736, 26934, 339, 768, 2068, 360, 739, 2521, 14, 8858, 14, 4196, 14, 6464, 48, 1587, 14, 8421, 63, 533, 358, 272, 768, 2068, 360, 16913, 276, 379, 11131, 14, 4196, 423, 1773, 63, 576, 1745, 358, 272, 347, 511, 63, 5607, 8, 277, 12, 1683, 1773, 63, 795, 12, 1683, 3417, 63, 533, 304, 267, 1683, 1113, 275, 4420, 342, 267, 1683, 1113, 14, 3150, 275, 283, 5650, 26, 17, 7, 267, 1683, 1113, 14, 1302, 275, 283, 679, 77, 8533, 2528, 11991, 63, 1167, 2036, 7, 267, 1683, 3417, 275, 1683, 3417, 63, 533, 14, 1107, 63, 585, 267, 1683, 3417, 14, 362, 63, 785, 14, 1107, 63, 585, 275, 1683, 1113, 267, 327, 664, 666, 1745, 2797, 701, 13677, 15, 2019, 13, 5540, 3102, 267, 1683, 3417, 14, 1246, 14, 29276, 1745, 14, 1107, 63, 585, 14, 1317, 275, 291, 14, 1652, 63, 2913, 267, 1683, 3417, 14, 1246, 14, 29276, 1745, 14, 1107, 63, 585, 14, 633, 275, 283, 1014, 921, 28803, 14, 331, 15, 1462, 15, 795, 7, 398, 327, 370, 2291, 367, 2061, 6042, 12303, 267, 1683, 1113, 14, 5607, 14, 3966, 275, 2197, 14, 2131, 342, 267, 327, 1683, 3417, 14, 1246, 14, 29276, 1745, 2825, 261, 827, 425, 14, 1107, 63, 585, 275, 267, 327, 1683, 1113, 14, 29276, 1745, 1692, 14, 1107, 63, 585, 14, 3966, 275, 1683, 1113, 14, 5607, 14, 3966, 398, 327, 1021, 13, 6788, 2455, 7252, 5074, 376, 3503, 1177, 267, 1683, 1773, 63, 795, 14, 1107, 63, 585, 275, 6183, 342, 398, 11249, 63, 633, 275, 3837, 360, 8858, 26, 5607, 297, 2074, 3713, 3150, 356, 1683, 1113, 14, 3150, 1552, 267, 1177, 275, 291, 14, 1258, 14, 362, 8, 5607, 63, 633, 9, 398, 327, 1454, 1104, 3537, 9661, 6366, 2348, 12, 4799, 26500, 267, 327, 334, 1397, 5343, 325, 85, 276, 379, 11131, 14, 4196, 14, 1773, 63, 576, 1745, 9661, 9, 267, 291, 14, 629, 8, 1805, 1773, 63, 795, 14, 1107, 63, 585, 12, 1177, 12, 288, 283, 1099, 402, 23036, 11131, 3066, 63, 576, 1745, 1077, 506, 2138, 358, 398, 327, 883, 1133, 1104, 2615, 1240, 1249, 2952, 781, 883, 1133, 1336, 1056, 267, 1249, 12, 2074, 275, 1683, 1773, 63, 795, 14, 1250, 63, 589, 398, 327, 3499, 1680, 1077, 506, 4422, 267, 291, 14, 629, 8, 1805, 1113, 14, 3150, 12, 1249, 59, 17, 566, 267, 327, 10919, 1680, 1077, 506, 6394, 1745, 1305, 267, 291, 14, 629, 8, 6464, 14, 5607, 14, 344, 12, 1249, 59, 18, 566, 267, 327, 20545, 909, 1021, 1077, 506, 2013, 267, 291, 14, 629, 8, 1805, 3417, 12, 2074, 459, 3417, 1105, 267, 291, 14, 629, 3252, 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1, 1, 1, 1 ]
shw700/latrace-plus
frontend/la2html.py
1
15468
#!/usr/bin/python import sys import re color_map = [ "silver", "aquamarine", "tan", "skyblue", "plum", "yellowgreen", "moccasin" ] def get_color_level(n): return color_map[n % len(color_map)] def enstyle_parameters(s): result = "" if s == "" or s == "void": return "<b>void</b>" nexti = s.find("=") while (nexti != -1): argname = s[:nexti-1].strip() result += "<b>{}</b> = ".format(argname) remainder = s[nexti+1:].strip() if remainder.startswith('"'): endstr = remainder[1:].find('"') if endstr == -1: result += "[decoding error]" return result value = '"<i>{}</i>"'.format(remainder[1:endstr+1]) s = remainder[endstr+2:] result += value nexti = s.find("=") continue else: endval = remainder.find(",") if endval == -1: value = remainder s = "" else: value = remainder[0:endval] s = remainder[endval:] isDigit = False try: int(value) isDigit = True except: try: int(value, 16) isDigit = True except: pass if value == "true" or value == "false" or value == "NULL": result += "<b>{}</b>".format(value) elif value.startswith("fn@"): result += '<b>fn@ </b><p style="color:green" class="narrow_p">{}</p>'.format(value[3:]) elif not isDigit: pind = value.find("+") if pind != -1: result += '<p style="color:brown" class="narrow_p">{}</p>'.format(value[0:pind]) result += "<b>+</b>{}".format(value[pind+1:]) else: result += '<p style="color:brown" class="narrow_p">{}</p>'.format(value) elif not value.startswith('"'): result += '<p style="color:blue" class="narrow_p">{}</p>'.format(value) else: result += value if s.startswith(","): result += "<b>,</b> " s = s[1:] nexti = s.find("=") return result def get_indent(line): count = 0 for i in line: if i != ' ': break count += 1 return count def emit_html_header(): h = "<html>" h += "<head>" h += "<title>latrace output</title>" h += '<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>' h += "<script>" h += "$(document).ready(function(){" h += '$("#toggle_tid").click(function(){' h += ' console.log("Toggling TID display");' h += ' $(".label_tid").not("#toggle_tid").not(".toggle_button").toggle();' h += "});" h += '$("#toggle_src_lib").click(function(){' h += ' console.log("Toggling source library display");' h += ' $(".label_src_lib").not("#toggle_src_lib").toggle();' h += "});" h += '$("#toggle_dst_lib").click(function(){' h += ' console.log("Toggling dest library display");' h += ' $(".label_dst_lib").not("#toggle_dst_lib").toggle();' h += "});" h += '$(".label_expander").click(function(){' h += ' console.log("Toggling expansion");' h += ' $(this).parent().parent().children(".func_call").not($(this)).slideToggle();' h += "});" h += '$(".label_src_lib").not("#toggle_src_lib").click(function(){' h += ' console.log("Hiding references to source library");' h += ' var selector = ".label_src_lib[xlib=\'\" + $(this).attr("xlib") + \"\']";' h += ' console.log("SELECTOR: " + selector);' h += ' $(selector).not("#toggle_src_lib").parent().parent().toggle();' h += ' $(selector).removeClass("enabled").addClass("disabled");' h += "});" h += '$(".label_funcname").dblclick(function(){' h += ' console.log("Hiding references to function name: " + $(this).attr("xfunc"));' h += ' var selector = ".label_funcname[xfunc=\'\" + $(this).attr("xfunc") + \"\']";' h += ' console.log("SELECTOR: " + selector);' h += ' $(selector).not(".toggle_func").parent().parent().slideToggle();' h += ' if ($(selector).hasClass("enabled"))' h += ' $(selector).removeClass("enabled").addClass("disabled");' h += ' else' h += ' $(selector).removeClass("disabled").addClass("enabled");' h += "});" h += '$(".toggle_tid").dblclick(function(){' h += ' console.log("Hiding TID contents for: " + $(this).attr("xtid"));' h += ' var selector = ".label_tid[xtid=\'\" + $(this).attr("xtid") + \"\']";' h += ' console.log("SELECTOR: " + selector);' h += ' $(selector).not(".toggle_button").parent().parent().find(".func_call").toggle();' h += ' $(this).removeClass("enabled").addClass("disabled");' h += "});" h += '$("#toggle_all_funcs").dblclick(function(){' h += ' console.log("Toggling all visible functions");' h += ' $(".func_call").toggle();' h += ' if ($(this).hasClass("enabled")) {' h += ' $(".toggle_func").removeClass("enabled").addClass("disabled");' h += ' $(this).removeClass("enabled").addClass("disabled");' h += ' } else {' h += ' $(".toggle_func").removeClass("disabled").addClass("enabled");' h += ' $(this).removeClass("disabled").addClass("enabled");' h += ' }' h += "});" h += "});" h += "</script>" h += "<style>" h += "html *" h += "{" h += " font-size: 1em !important;" h += " font-family: Arial !important;" h += "}" h += ".func_call { padding-left: 0px; padding-top: 5px; padding-bottom: 5px; margin-bottom: 5px; border: 1px dotted black; border-left: 1px dotted black; border-right: none; margin-bottom: 0px; }" h += ".label_src_lib { display: inline-block; cursor: hand; background-color: orange; border: 1px solid black; padding: 3px; font-size: 75%; float: right; }" h += ".label_dst_lib { display: inline-block; cursor: hand; background-color: brown; border: 1px solid black; padding: 3px; font-size: 75% }" h += ".label_tid { display: inline-block; cursor: hand; background-color: yellow; border: 1px solid black; padding: 3px; font-size: 75%; font-weight: bold; }" h += ".label_funcname { display: inline-block; cursor: hand; font-weight: bold; border: 1px dotted gray; padding: 3px; padding-left: 5px; padding-right: 5px; }" h += ".label_fparams { display: inline-block; background-color: silver; padding: 1px; }" h += ".label_remainder { display: inline-block; color: gray; }" h += ".label_result { display: inline-block; background-color: red; border: 1px solid black; padding-left: 10px; padding-right: 10px; margin-left: 5px; font-weight: bold; font-size: 125%; float: right; margin-right: 50px; }" h += ".label_expander { display: inline-block; cursor: hand; background-color: gray; border: 1px solid black; padding: 3px; margin-left: 5px; margin-right: 2px; font-weight: bold; font-size: 75%; }" h += ".label_console { display: inline-block; background-color: black; color: white; padding: 5px; width: 100%; padding-top: 5px; padding-bottom: 5px; }" h += ".side_bar { display: inline-block; margin-right: 10px; width: 200px; }" h += ".func_bar { display: inline-block; margin-right: 10px; width: 50%; }" h += ".func_indent { display: inline-block; background-color: gray; margin-right: 2px; }" h += ".toggle_button { display: inline-block; cursor: hand; margin-left: 3px; margin-right: 3px; margin-bottom: 2px; padding: 3px; }" h += ".toggle_func { margin-left: 2px; margin-right: 2px; margin-bottom: 2px; }" h += ".enabled { background-color: lime; }" h += ".disabled { background-color: red; }" h += ".narrow_p { -webkit-margin-before: 0em; -webkit-margin-after: 0em; display: inline-block; }" h += ".div_ind_0 { padding-left: 4px; }" h += "</style>" h += "</head>" h += "<body>" return h def emit_html_footer(): h = "</body>" h += "</html>" return h if len(sys.argv) != 2: sys.stderr.write("Error: requires an input file\n"); sys.exit(-1) lines = open(sys.argv[1], "r").read().splitlines() user_struct_transformers = [] user_func_transformers = [] user_intercepts = [] all_functions = [] all_functions_map = {} all_libraries = [] all_tids = [] # borrowed from stack exchange ansi_escape = re.compile(r'(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]') line_no = 0 first_indent = next_indent = indent_inc = indent_level = 0 last_indent = 0 main_tid = 0 first = 1 header = emit_html_header() body = "" for line in lines: set_xfrm_func = set_xfrm_struct = set_u_int = False # body += "LINE: ", line # line = line.join([i if ord(i) >= ' ' else '' for i in line]) line = ansi_escape.sub('', line).strip() if line.startswith("Adding user struct transformer function"): set_xfrm_struct = True elif line.startswith("Adding user transformer function for function"): set_xfrm_func = True elif line.startswith("Adding user intercept function"): set_u_int = True if set_xfrm_func or set_xfrm_struct or set_u_int: pind = str.find(line, ":") if pind == -1: continue param = line[pind+1:].strip() if param.endswith("()"): param = param[:-2] if set_xfrm_func: user_func_transformers.append(param) elif set_xfrm_struct: user_struct_transformers.append(param) else: user_intercepts.append(param) continue words = line.split(" ") if len(words) < 2: continue try: tid = int(words[0]) except: body += '<div class="label_console">{}</div><br>'.format(line) continue all_tids.append(tid) all_tids = sorted(set(all_tids)) if (main_tid == 0): main_tid = tid line = " ".join(words[1:]) if line_no == 0: first_indent = get_indent(line) # header += "FIRST INDENT: ", first_indent line_no += 1 indent = get_indent(line) if (first_indent > 0) and (next_indent == 0): if (indent > first_indent): next_indent = indent indent_inc = next_indent - first_indent # body += "NEXT INDENT: {} / {}".format(next_indent, indent_inc) if (indent_inc > 0): indent_level = (indent - first_indent) /indent_inc else: indent_level = 0 line = line.strip() ltoks = str.split(line, '(') func_name = ltoks[0] func_params = "(".join(ltoks[1:]) aftoks = str.split(func_params, ')') func_params = aftoks[0] remainder = ")".join(aftoks[1:]) result = "" lib_name = "" ftoks = str.split(func_name, ":") if len(ftoks) == 2: lib_name = ftoks[0] func_name = ftoks[1] elif (len(ftoks) >= 2) and (func_name.find("[") != -1) and (func_name.find("]") != -1): lidx = func_name.find("[") ridx = func_name.find("]") remainder = func_name[lidx+1:ridx] lib_name = ftoks[0] func_name = func_name[func_name.find(":")+1:lidx-1] elif (len(ftoks) > 2) and (not ftoks[0].startswith("}")): lib_name = ftoks[0] func_name = ":".join(ftoks[1:]) one_liner = False eqidx = remainder.find(" = ") if eqidx != -1: result = remainder[eqidx+3:] remainder = remainder[0:eqidx-1] one_liner = True if first: first = False # elif indent_level == last_indent: # body += "</div>" prefix, func_indent = "", "" i = 0 while i < indent_level: prefix += "+" func_indent += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" i += 1 func_indent = '<div class="func_indent">{}</div>'.format(func_indent) # prefix += '<div class="label_expander"><b>+</b></div>' prefix = '<div class="label_expander"><b>{}+</b></div>'.format(indent_level) if result != "": result_str = "<b> </b><div class=\"label_result\">=&nbsp;&nbsp;&nbsp;{}</div>".format(result) else: result_str = "<br>" if remainder != "": remainder = remainder.strip() if remainder.startswith("["): remainder = remainder[1:] if remainder.find("]") != -1: remainder = remainder[:remainder.find("]")] remainder_str = '<div class="label_dst_lib" xlib="{}">{}</div>'.format(remainder, remainder) else: remainder_str = "" func_params_str = '<div class="label_fparams">{}</div>'.format(enstyle_parameters(func_params)) if lib_name == "": lib_name_str = "" else: lib_name_str = '<div class="label_src_lib" xlib="{}">{}</div>'.format(lib_name, lib_name) if lib_name == "" and func_name.startswith("}"): body += '<div class="side_bar"><div class="label_tid" xtid="{}">{}</div> {} </div> <div class="label_result">[continued] <b>{}</b></div><br>'.format(tid, tid, prefix, func_name[2:]) body += "</div></div>" else: if func_name.startswith("["): func_name = func_name[1:] div_class = "div_ind_{}".format(indent_level) body += '<div style="background-color: {};" class="{} func_call">'.format(get_color_level(indent_level), div_class) body += '<div class="side_bar"><div class="label_tid" xtid="{}">{}</div> {}{} </div><div class="func_bar">{}<div class="label_funcname" xfunc="{}">{}</div> ({})</div> {} {}'.format(tid, tid, prefix, lib_name_str, func_indent, func_name, func_name, func_params_str, remainder_str, result_str) all_functions.append(func_name) all_functions.sort() if (remainder != "") and (remainder.find(" ") == -1): all_functions_map[func_name] = remainder all_libraries.append(remainder) all_libraries.sort() if one_liner: body += "</div>" if indent_level < last_indent: body += "</div>" last_indent = indent_level user_func_transformers.sort() user_struct_transformers.sort() user_intercepts.sort() header += "<br><b>Loaded function transformers: {}</b><br>".format(len(user_func_transformers)) for f in user_func_transformers: header += '<div class="toggle_func label_funcname enabled" xfunc="{}">{}()</div>'.format(f, f) header += "<br><br>" header += "<b>Loaded struct transformers: {}</b><br>".format(len(user_struct_transformers)) header += "\t{}<br><br>".format(", ".join(user_struct_transformers)) header += "<b>Loaded function intercepts: {}</b><br>".format(len(user_intercepts)) for f in user_intercepts: header += '<div class="toggle_func label_funcname enabled" xfunc="{}">{}()</div>'.format(f, f) header += "<br><br>" all_functions = sorted(set(all_functions)) header += "<b>All called functions: {} unique</b><br>".format(len(all_functions)) header += '<div style="border: 1px solid black;" id="toggle_all_funcs" class="toggle_button toggle_func enabled">{}</div>'.format("Toggle all functions") header += "<br><br>" all_libraries = sorted(set(all_libraries)) header += "<b>In a total of {} libraries</b><br>".format(len(all_libraries)) for l in all_libraries: header += '<div style="float: none; font-size: 100%;" class="label_src_lib toggle_button" xlib="{}">{}</div>'.format(l, l) header += "<br><br>" functions_left = all_functions #while len(functions_left) > 0: for l in all_libraries: header += '<div style="display: inline-block; font-size: 100%; margin-right: 15px; " class="label_dst_lib toggle_button"><u>{}</u></div>'.format(l) for f in functions_left: if (f in all_functions_map) and (all_functions_map[f] == l): header += '<div class="toggle_func label_funcname enabled" xfunc="{}">{}()</div>'.format(f, f) # functions_left.remove(f) header += "<br><br>" #for f in all_functions: # header += '<div class="toggle_func label_funcname enabled" xfunc="{}">{}()</div>'.format(f, f) header += "<br><br>" header += "<b>Available thread IDs: {}</b><br>".format(len(all_tids)) for t in all_tids: header += '<div class="label_tid toggle_tid toggle_button enabled" xtid="{}">{}</div>'.format(t, t) header += "<br><br>" header += "<br><br>" header += '<div id="toggle_tid" class="label_tid toggle_button">{}</div>'.format("Display TIDS") header += '<div style="float: none;" id="toggle_src_lib" class="label_src_lib toggle_button">{}</div>'.format("Display source lib names") header += '<div id="toggle_dst_lib" class="label_dst_lib toggle_button">{}</div>'.format("Display dst lib names") header += '<div style="padding: 1px; border: 1px solid black; cursor: hand;" id="toggle_fparams" class="label_fparams toggle_button">{}</div>'.format("Display function parameters") header += "<br><br><br>" # header += '</div><div class="toggle_func label_funcname enabled" xfunc="{}">{}()</div>'.format(f, f) # header += "<br><br>" print header print body print emit_html_footer()
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1548, 199, 199, 646, 984, 199, 646, 295, 421, 199, 2326, 63, 1130, 275, 359, 298, 20329, 422, 401, 298, 65, 392, 455, 285, 1132, 401, 298, 12990, 401, 298, 12267, 6304, 401, 298, 1168, 453, 401, 298, 14514, 7731, 401, 298, 573, 2055, 24202, 2, 1622, 421, 199, 318, 664, 63, 2326, 63, 1896, 8, 78, 304, 199, 198, 1107, 3164, 63, 1130, 59, 78, 450, 822, 8, 2326, 63, 1130, 1874, 199, 199, 318, 655, 2487, 63, 3214, 8, 83, 304, 199, 198, 1099, 275, 3087, 421, 198, 692, 308, 508, 3087, 503, 308, 508, 298, 1647, 582, 507, 198, 1107, 3886, 66, 30, 1647, 1108, 66, 4335, 421, 198, 14743, 280, 275, 308, 14, 1623, 480, 23758, 421, 198, 6710, 334, 14743, 280, 1137, 446, 17, 304, 507, 198, 1273, 354, 275, 308, 1491, 14743, 280, 13, 17, 1055, 1913, 342, 507, 198, 1099, 847, 3886, 66, 30, 2440, 1108, 66, 30, 275, 3680, 908, 8, 1273, 354, 9, 507, 198, 23850, 275, 308, 59, 14743, 280, 11, 17, 11455, 1913, 342, 2742, 198, 692, 15748, 14, 2460, 14088, 735, 686, 198, 500, 495, 275, 15748, 59, 17, 11455, 1623, 25441, 686, 198, 692, 1284, 495, 508, 446, 17, 26, 1585, 198, 1099, 847, 7369, 12796, 1125, 8480, 1585, 198, 1107, 754, 6319, 198, 585, 275, 5522, 28, 73, 30, 2440, 1108, 73, 4335, 1370, 908, 8, 23850, 59, 17, 26, 500, 495, 11, 17, 566, 686, 198, 83, 275, 15748, 59, 500, 495, 11, 18, 2938, 686, 198, 1099, 847, 574, 686, 198, 14743, 280, 275, 308, 14, 1623, 480, 23758, 686, 198, 6958, 507, 198, 2836, 26, 686, 198, 500, 637, 275, 15748, 14, 1623, 20324, 6319, 198, 692, 1284, 637, 508, 446, 17, 26, 1585, 198, 585, 275, 15748, 1585, 198, 83, 275, 3087, 686, 198, 2836, 26, 1585, 198, 585, 275, 15748, 59, 16, 26, 500, 637, 61, 1585, 198, 83, 275, 15748, 59, 500, 637, 2938, 2742, 198, 374, 17107, 390, 275, 756, 2742, 198, 893, 26, 686, 198, 442, 8, 585, 9, 686, 198, 374, 17107, 390, 275, 715, 507, 198, 2590, 26, 686, 198, 893, 26, 1585, 198, 442, 8, 585, 12, 3193, 9, 1585, 198, 374, 17107, 390, 275, 715, 686, 198, 2590, 26, 1585, 198, 1529, 421, 507, 198, 692, 574, 508, 298, 2052, 2, 503, 574, 508, 298, 3910, 2, 503, 574, 508, 298, 8084, 582, 686, 198, 1099, 847, 3886, 66, 30, 2440, 1108, 66, 23167, 908, 8, 585, 9, 507, 198, 4164, 574, 14, 2460, 480, 2324, 32, 2349, 686, 198, 1099, 847, 2650, 66, 30, 2324, 32, 3068, 66, 2535, 80, 3449, 628, 2326, 26, 7731, 2, 1021, 628, 15485, 63, 80, 1743, 2440, 1108, 80, 22936, 908, 8, 585, 59, 19, 5728, 507, 198, 4164, 440, 365, 17107, 390, 26, 686, 198, 80, 688, 275, 574, 14, 1623, 480, 21425, 686, 198, 692, 299, 688, 1137, 446, 17, 26, 1585, 198, 1099, 847, 2650, 80, 3449, 628, 2326, 26, 27133, 2, 1021, 628, 15485, 63, 80, 1743, 2440, 1108, 80, 22936, 908, 8, 585, 59, 16, 26, 80, 688, 566, 1585, 198, 1099, 847, 3886, 66, 30, 11, 1108, 66, 30, 13536, 908, 8, 585, 59, 80, 688, 11, 17, 5728, 686, 198, 2836, 26, 1585, 198, 1099, 847, 2650, 80, 3449, 628, 2326, 26, 27133, 2, 1021, 628, 15485, 63, 80, 1743, 2440, 1108, 80, 22936, 908, 8, 585, 9, 507, 198, 4164, 440, 574, 14, 2460, 14088, 735, 686, 198, 1099, 847, 2650, 80, 3449, 628, 2326, 26, 6304, 2, 1021, 628, 15485, 63, 80, 1743, 2440, 1108, 80, 22936, 908, 8, 585, 9, 507, 198, 2836, 26, 686, 198, 1099, 847, 574, 2742, 198, 692, 308, 14, 2460, 8, 2266, 304, 686, 198, 1099, 847, 3886, 66, 6244, 1108, 66, 30, 298, 686, 198, 83, 275, 308, 59, 17, 2938, 2742, 198, 14743, 280, 275, 308, 14, 1623, 480, 23758, 421, 198, 1107, 754, 199, 199, 318, 664, 63, 3724, 8, 604, 304, 199, 198, 835, 275, 378, 421, 198, 509, 284, 315, 1004, 26, 507, 198, 692, 284, 1137, 283, 7596, 686, 198, 4785, 507, 198, 835, 847, 413, 421, 198, 1107, 2338, 199, 199, 318, 8689, 63, 1360, 63, 1291, 837, 199, 198, 72, 275, 3886, 1360, 4335, 199, 198, 72, 847, 3886, 2993, 4335, 199, 198, 72, 847, 3886, 1213, 30, 4452, 5986, 1072, 1108, 1213, 4335, 199, 198, 72, 847, 2650, 1579, 2928, 628, 2859, 921, 12774, 14, 17533, 14, 957, 15, 12774, 15, 8450, 15, 22324, 15, 19, 14, 18, 14, 17, 15, 22324, 14, 827, 14, 3596, 10070, 1579, 3524, 199, 198, 72, 847, 3886, 1579, 4335, 199, 198, 72, 847, 25714, 3554, 680, 2179, 8, 1593, 342, 6641, 199, 198, 72, 847, 4505, 10064, 13396, 63, 5700, 3471, 4891, 8, 1593, 342, 1445, 199, 198, 72, 847, 283, 198, 198, 6614, 14, 793, 480, 52, 24798, 2983, 377, 998, 2929, 3547, 7, 199, 198, 72, 847, 283, 198, 198, 4, 9520, 1302, 63, 5700, 3471, 1397, 10064, 13396, 63, 5700, 3471, 1397, 9520, 13396, 63, 3887, 3471, 13396, 7303, 7, 199, 198, 72, 847, 298, 1552, 9426, 199, 198, 72, 847, 4505, 10064, 13396, 63, 2164, 63, 773, 3471, 4891, 8, 1593, 342, 1445, 199, 198, 72, 847, 283, 198, 198, 6614, 14, 793, 480, 52, 24798, 2983, 1350, 3555, 2929, 3547, 7, 199, 198, 72, 847, 283, 198, 198, 4, 9520, 1302, 63, 2164, 63, 773, 3471, 1397, 10064, 13396, 63, 2164, 63, 773, 3471, 13396, 7303, 7, 199, 198, 72, 847, 298, 1552, 9426, 199, 198, 72, 847, 4505, 10064, 13396, 63, 5119, 63, 773, 3471, 4891, 8, 1593, 342, 1445, 199, 198, 72, 847, 283, 198, 198, 6614, 14, 793, 480, 52, 24798, 2983, 2053, 3555, 2929, 3547, 7, 199, 198, 72, 847, 283, 198, 198, 4, 9520, 1302, 63, 5119, 63, 773, 3471, 1397, 10064, 13396, 63, 5119, 63, 773, 3471, 13396, 7303, 7, 199, 198, 72, 847, 298, 1552, 9426, 199, 198, 72, 847, 4505, 9520, 1302, 63, 1474, 11438, 3471, 4891, 8, 1593, 342, 1445, 199, 198, 72, 847, 283, 198, 198, 6614, 14, 793, 480 ]
[ 2647, 15, 1393, 15, 1548, 199, 199, 646, 984, 199, 646, 295, 421, 199, 2326, 63, 1130, 275, 359, 298, 20329, 422, 401, 298, 65, 392, 455, 285, 1132, 401, 298, 12990, 401, 298, 12267, 6304, 401, 298, 1168, 453, 401, 298, 14514, 7731, 401, 298, 573, 2055, 24202, 2, 1622, 421, 199, 318, 664, 63, 2326, 63, 1896, 8, 78, 304, 199, 198, 1107, 3164, 63, 1130, 59, 78, 450, 822, 8, 2326, 63, 1130, 1874, 199, 199, 318, 655, 2487, 63, 3214, 8, 83, 304, 199, 198, 1099, 275, 3087, 421, 198, 692, 308, 508, 3087, 503, 308, 508, 298, 1647, 582, 507, 198, 1107, 3886, 66, 30, 1647, 1108, 66, 4335, 421, 198, 14743, 280, 275, 308, 14, 1623, 480, 23758, 421, 198, 6710, 334, 14743, 280, 1137, 446, 17, 304, 507, 198, 1273, 354, 275, 308, 1491, 14743, 280, 13, 17, 1055, 1913, 342, 507, 198, 1099, 847, 3886, 66, 30, 2440, 1108, 66, 30, 275, 3680, 908, 8, 1273, 354, 9, 507, 198, 23850, 275, 308, 59, 14743, 280, 11, 17, 11455, 1913, 342, 2742, 198, 692, 15748, 14, 2460, 14088, 735, 686, 198, 500, 495, 275, 15748, 59, 17, 11455, 1623, 25441, 686, 198, 692, 1284, 495, 508, 446, 17, 26, 1585, 198, 1099, 847, 7369, 12796, 1125, 8480, 1585, 198, 1107, 754, 6319, 198, 585, 275, 5522, 28, 73, 30, 2440, 1108, 73, 4335, 1370, 908, 8, 23850, 59, 17, 26, 500, 495, 11, 17, 566, 686, 198, 83, 275, 15748, 59, 500, 495, 11, 18, 2938, 686, 198, 1099, 847, 574, 686, 198, 14743, 280, 275, 308, 14, 1623, 480, 23758, 686, 198, 6958, 507, 198, 2836, 26, 686, 198, 500, 637, 275, 15748, 14, 1623, 20324, 6319, 198, 692, 1284, 637, 508, 446, 17, 26, 1585, 198, 585, 275, 15748, 1585, 198, 83, 275, 3087, 686, 198, 2836, 26, 1585, 198, 585, 275, 15748, 59, 16, 26, 500, 637, 61, 1585, 198, 83, 275, 15748, 59, 500, 637, 2938, 2742, 198, 374, 17107, 390, 275, 756, 2742, 198, 893, 26, 686, 198, 442, 8, 585, 9, 686, 198, 374, 17107, 390, 275, 715, 507, 198, 2590, 26, 686, 198, 893, 26, 1585, 198, 442, 8, 585, 12, 3193, 9, 1585, 198, 374, 17107, 390, 275, 715, 686, 198, 2590, 26, 1585, 198, 1529, 421, 507, 198, 692, 574, 508, 298, 2052, 2, 503, 574, 508, 298, 3910, 2, 503, 574, 508, 298, 8084, 582, 686, 198, 1099, 847, 3886, 66, 30, 2440, 1108, 66, 23167, 908, 8, 585, 9, 507, 198, 4164, 574, 14, 2460, 480, 2324, 32, 2349, 686, 198, 1099, 847, 2650, 66, 30, 2324, 32, 3068, 66, 2535, 80, 3449, 628, 2326, 26, 7731, 2, 1021, 628, 15485, 63, 80, 1743, 2440, 1108, 80, 22936, 908, 8, 585, 59, 19, 5728, 507, 198, 4164, 440, 365, 17107, 390, 26, 686, 198, 80, 688, 275, 574, 14, 1623, 480, 21425, 686, 198, 692, 299, 688, 1137, 446, 17, 26, 1585, 198, 1099, 847, 2650, 80, 3449, 628, 2326, 26, 27133, 2, 1021, 628, 15485, 63, 80, 1743, 2440, 1108, 80, 22936, 908, 8, 585, 59, 16, 26, 80, 688, 566, 1585, 198, 1099, 847, 3886, 66, 30, 11, 1108, 66, 30, 13536, 908, 8, 585, 59, 80, 688, 11, 17, 5728, 686, 198, 2836, 26, 1585, 198, 1099, 847, 2650, 80, 3449, 628, 2326, 26, 27133, 2, 1021, 628, 15485, 63, 80, 1743, 2440, 1108, 80, 22936, 908, 8, 585, 9, 507, 198, 4164, 440, 574, 14, 2460, 14088, 735, 686, 198, 1099, 847, 2650, 80, 3449, 628, 2326, 26, 6304, 2, 1021, 628, 15485, 63, 80, 1743, 2440, 1108, 80, 22936, 908, 8, 585, 9, 507, 198, 2836, 26, 686, 198, 1099, 847, 574, 2742, 198, 692, 308, 14, 2460, 8, 2266, 304, 686, 198, 1099, 847, 3886, 66, 6244, 1108, 66, 30, 298, 686, 198, 83, 275, 308, 59, 17, 2938, 2742, 198, 14743, 280, 275, 308, 14, 1623, 480, 23758, 421, 198, 1107, 754, 199, 199, 318, 664, 63, 3724, 8, 604, 304, 199, 198, 835, 275, 378, 421, 198, 509, 284, 315, 1004, 26, 507, 198, 692, 284, 1137, 283, 7596, 686, 198, 4785, 507, 198, 835, 847, 413, 421, 198, 1107, 2338, 199, 199, 318, 8689, 63, 1360, 63, 1291, 837, 199, 198, 72, 275, 3886, 1360, 4335, 199, 198, 72, 847, 3886, 2993, 4335, 199, 198, 72, 847, 3886, 1213, 30, 4452, 5986, 1072, 1108, 1213, 4335, 199, 198, 72, 847, 2650, 1579, 2928, 628, 2859, 921, 12774, 14, 17533, 14, 957, 15, 12774, 15, 8450, 15, 22324, 15, 19, 14, 18, 14, 17, 15, 22324, 14, 827, 14, 3596, 10070, 1579, 3524, 199, 198, 72, 847, 3886, 1579, 4335, 199, 198, 72, 847, 25714, 3554, 680, 2179, 8, 1593, 342, 6641, 199, 198, 72, 847, 4505, 10064, 13396, 63, 5700, 3471, 4891, 8, 1593, 342, 1445, 199, 198, 72, 847, 283, 198, 198, 6614, 14, 793, 480, 52, 24798, 2983, 377, 998, 2929, 3547, 7, 199, 198, 72, 847, 283, 198, 198, 4, 9520, 1302, 63, 5700, 3471, 1397, 10064, 13396, 63, 5700, 3471, 1397, 9520, 13396, 63, 3887, 3471, 13396, 7303, 7, 199, 198, 72, 847, 298, 1552, 9426, 199, 198, 72, 847, 4505, 10064, 13396, 63, 2164, 63, 773, 3471, 4891, 8, 1593, 342, 1445, 199, 198, 72, 847, 283, 198, 198, 6614, 14, 793, 480, 52, 24798, 2983, 1350, 3555, 2929, 3547, 7, 199, 198, 72, 847, 283, 198, 198, 4, 9520, 1302, 63, 2164, 63, 773, 3471, 1397, 10064, 13396, 63, 2164, 63, 773, 3471, 13396, 7303, 7, 199, 198, 72, 847, 298, 1552, 9426, 199, 198, 72, 847, 4505, 10064, 13396, 63, 5119, 63, 773, 3471, 4891, 8, 1593, 342, 1445, 199, 198, 72, 847, 283, 198, 198, 6614, 14, 793, 480, 52, 24798, 2983, 2053, 3555, 2929, 3547, 7, 199, 198, 72, 847, 283, 198, 198, 4, 9520, 1302, 63, 5119, 63, 773, 3471, 1397, 10064, 13396, 63, 5119, 63, 773, 3471, 13396, 7303, 7, 199, 198, 72, 847, 298, 1552, 9426, 199, 198, 72, 847, 4505, 9520, 1302, 63, 1474, 11438, 3471, 4891, 8, 1593, 342, 1445, 199, 198, 72, 847, 283, 198, 198, 6614, 14, 793, 480, 0 ]
[ 1, 1, 1,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/DRR-datacenter
geonode/upload/upload.py
9
21107
######################################################################### # # Copyright (C) 2012 OpenPlans # # 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/>. # ######################################################################### """ Provide views and business logic of doing an upload. The upload process may be multi step so views are all handled internally here by the view function. The pattern to support separation of view/logic is each step in the upload process is suffixed with "_step". The view for that step is suffixed with "_step_view". The goal of separation of view/logic is to support various programmatic uses of this API. The logic steps should not accept request objects or return response objects. State is stored in a UploaderSession object stored in the user's session. This needs to be made more stateful by adding a model. """ from geonode.layers.utils import get_valid_layer_name from geonode.layers.metadata import set_metadata from geonode.layers.models import Layer from geonode import GeoNodeException from geonode.people.utils import get_default_user from geonode.upload.models import Upload from geonode.upload import signals from geonode.upload.utils import create_geoserver_db_featurestore from geonode.geoserver.helpers import gs_catalog, gs_uploader, ogc_server_settings from geonode.geoserver.helpers import set_time_info import geoserver from geoserver.resource import Coverage from geoserver.resource import FeatureType from gsimporter import BadRequest from django.conf import settings from django.db.models import Max from django.contrib.auth import get_user_model import shutil import os.path import logging import uuid logger = logging.getLogger(__name__) class UploadException(Exception): '''A handled exception meant to be presented to the user''' @staticmethod def from_exc(msg, ex): args = [msg] args.extend(ex.args) return UploadException(*args) class LayerNotReady(Exception): pass class UploaderSession(object): """All objects held must be able to survive a good pickling""" # the gsimporter session object import_session = None # if provided, this file will be uploaded to geoserver and set as # the default import_sld_file = None # location of any temporary uploaded files tempdir = None # the main uploaded file, zip, shp, tif, etc. base_file = None # the name to try to give the layer name = None # blob of permissions JSON permissions = None # store most recently configured time transforms to support deleting time_transforms = None # defaults to REPLACE if not provided. Accepts APPEND, too update_mode = None # Import to GeoGig repository geogig = None # GeoGig Repository to import to geogig_store = None # Configure Time for this Layer time = None # the title given to the layer layer_title = None # the abstract layer_abstract = None # track the most recently completed upload step completed_step = None # the upload type - see the _pages dict in views upload_type = None # time related info - need to store here until geoserver layer exists time_info = None def __init__(self, **kw): for k, v in kw.items(): if hasattr(self, k): setattr(self, k, v) else: raise Exception('not handled : %s' % k) def cleanup(self): """do what we should at the given state of the upload""" pass def upload(name, base_file, user=None, time_attribute=None, time_transform_type=None, end_time_attribute=None, end_time_transform_type=None, presentation_strategy=None, precision_value=None, precision_step=None, use_big_date=False, overwrite=False): if user is None: user = get_default_user() if isinstance(user, basestring): user = get_user_model().objects.get(username=user) import_session = save_step(user, name, base_file, overwrite) upload_session = UploaderSession( base_file=base_file, name=name, import_session=import_session, layer_abstract="", layer_title=name, permissions=None ) time_step(upload_session, time_attribute, time_transform_type, presentation_strategy, precision_value, precision_step, end_time_attribute=end_time_attribute, end_time_transform_type=end_time_transform_type, time_format=None, srs=None, use_big_date=use_big_date) run_import(upload_session, async=False) final_step(upload_session, user) def _log(msg, *args): logger.info(msg, *args) def save_step(user, layer, spatial_files, overwrite=True): _log('Uploading layer: [%s], files [%s]', layer, spatial_files) if len(spatial_files) > 1: # we only support more than one file if they're rasters for mosaicing if not all( [f.file_type.layer_type == 'coverage' for f in spatial_files]): raise UploadException( "Please upload only one type of file at a time") name = get_valid_layer_name(layer, overwrite) _log('Name for layer: [%s]', name) if not spatial_files: raise UploadException("Unable to recognize the uploaded file(s)") the_layer_type = spatial_files[0].file_type.layer_type # Check if the store exists in geoserver try: store = gs_catalog.get_store(name) except geoserver.catalog.FailedRequestError as e: # There is no store, ergo the road is clear pass else: # If we get a store, we do the following: resources = store.get_resources() # Is it empty? if len(resources) == 0: # What should we do about that empty store? if overwrite: # We can just delete it and recreate it later. store.delete() else: msg = ( 'The layer exists and the overwrite parameter is %s' % overwrite) raise GeoNodeException(msg) else: # If our resource is already configured in the store it # needs to have the right resource type for resource in resources: if resource.name == name: assert overwrite, "Name already in use and overwrite is False" existing_type = resource.resource_type if existing_type != the_layer_type: msg = ( 'Type of uploaded file %s (%s) does not match type ' 'of existing resource type %s' % (name, the_layer_type, existing_type)) _log(msg) raise GeoNodeException(msg) if the_layer_type not in ( FeatureType.resource_type, Coverage.resource_type): raise Exception( 'Expected the layer type to be a FeatureType or Coverage, not %s' % the_layer_type) _log('Uploading %s', the_layer_type) error_msg = None try: # importer tracks ids by autoincrement but is prone to corruption # which potentially may reset the id - hopefully prevent this... next_id = Upload.objects.all().aggregate(Max('import_id')).values()[0] next_id = next_id + 1 if next_id else 1 # save record of this whether valid or not - will help w/ debugging upload = Upload.objects.create( user=user, name=name, state=Upload.STATE_INVALID, upload_dir=spatial_files.dirname) # @todo settings for use_url or auto detection if geoserver is # on same host import_session = gs_uploader.upload_files( spatial_files.all_files(), use_url=False, import_id=next_id, mosaic=len(spatial_files) > 1) upload.import_id = import_session.id upload.save() # any unrecognized tasks/files must be deleted or we can't proceed import_session.delete_unrecognized_tasks() if not import_session.tasks: error_msg = 'No valid upload files could be found' elif import_session.tasks[0].state == 'NO_FORMAT': error_msg = 'There may be a problem with the data provided - ' \ 'we could not identify it' if len(import_session.tasks) > 1: error_msg = "Only a single upload is supported at the moment" if not error_msg and import_session.tasks: task = import_session.tasks[0] # single file tasks will have just a file entry if hasattr(task, 'files'): # @todo gsimporter - test this if not all([hasattr(f, 'timestamp') for f in task.source.files]): error_msg = ( "Not all timestamps could be recognized." "Please ensure your files contain the correct formats.") if error_msg: upload.state = upload.STATE_INVALID upload.save() # @todo once the random tmp9723481758915 type of name is not # around, need to track the name computed above, for now, the # target store name can be used except Exception as e: logger.exception('Error creating import session') raise e if error_msg: raise UploadException(error_msg) else: _log("Finished upload of [%s] to GeoServer without errors.", name) return import_session def run_import(upload_session, async): """Run the import, possibly asynchronously. Returns the target datastore. """ import_session = upload_session.import_session import_session = gs_uploader.get_session(import_session.id) task = import_session.tasks[0] if import_session.state == 'INCOMPLETE': if task.state != 'ERROR': raise Exception('unknown item state: %s' % task.state) # if a target datastore is configured, ensure the datastore exists # in geoserver and set the uploader target appropriately if ogc_server_settings.GEOGIG_ENABLED and upload_session.geogig is True \ and task.target.store_type != 'coverageStore': target = create_geoserver_db_featurestore( store_type='geogig', store_name=upload_session.geogig_store) _log( 'setting target datastore %s %s', target.name, target.workspace.name) task.set_target(target.name, target.workspace.name) elif ogc_server_settings.datastore_db and task.target.store_type != 'coverageStore': target = create_geoserver_db_featurestore() _log( 'setting target datastore %s %s', target.name, target.workspace.name) task.set_target(target.name, target.workspace.name) else: target = task.target if upload_session.update_mode: _log('setting updateMode to %s', upload_session.update_mode) task.set_update_mode(upload_session.update_mode) _log('running import session') # run async if using a database import_session.commit(async) # @todo check status of import session - it may fail, but due to protocol, # this will not be reported during the commit return target def time_step(upload_session, time_attribute, time_transform_type, presentation_strategy, precision_value, precision_step, end_time_attribute=None, end_time_transform_type=None, end_time_format=None, time_format=None): ''' time_attribute - name of attribute to use as time time_transform_type - name of transform. either DateFormatTransform or IntegerFieldToDateTransform time_format - optional string format end_time_attribute - optional name of attribute to use as end time end_time_transform_type - optional name of transform. either DateFormatTransform or IntegerFieldToDateTransform end_time_format - optional string format presentation_strategy - LIST, DISCRETE_INTERVAL, CONTINUOUS_INTERVAL precision_value - number precision_step - year, month, day, week, etc. ''' transforms = [] def build_time_transform(att, type, format): trans = {'type': type, 'field': att} if format: trans['format'] = format return trans def build_att_remap_transform(att): # @todo the target is so ugly it should be obvious return {'type': 'AttributeRemapTransform', 'field': att, 'target': 'org.geotools.data.postgis.PostGISDialect$XDate'} use_big_date = getattr(settings, 'USE_BIG_DATE', False) and not upload_session.geogig if time_attribute: if time_transform_type: transforms.append( build_time_transform( time_attribute, time_transform_type, time_format ) ) if end_time_attribute and end_time_transform_type: transforms.append( build_time_transform( end_time_attribute, end_time_transform_type, end_time_format ) ) # this must go after the remapping transform to ensure the # type change is applied if use_big_date: transforms.append(build_att_remap_transform(time_attribute)) if end_time_attribute: transforms.append( build_att_remap_transform(end_time_attribute) ) transforms.append({ 'type': 'CreateIndexTransform', 'field': time_attribute }) # the time_info will be used in the last step to configure the # layer in geoserver - the dict matches the arguments of the # set_time_info helper function upload_session.time_info = dict( attribute=time_attribute, end_attribute=end_time_attribute, presentation=presentation_strategy, precision_value=precision_value, precision_step=precision_step ) if upload_session.time_transforms: upload_session.import_session.tasks[0].remove_transforms( upload_session.time_transforms ) if transforms: logger.info('Setting transforms %s' % transforms) upload_session.import_session.tasks[0].add_transforms(transforms) try: upload_session.time_transforms = transforms except BadRequest as br: raise UploadException.from_exc('Error configuring time:', br) upload_session.import_session.tasks[0].save_transforms() def csv_step(upload_session, lat_field, lng_field): import_session = upload_session.import_session task = import_session.tasks[0] transform = {'type': 'AttributesToPointGeometryTransform', 'latField': lat_field, 'lngField': lng_field, } task.layer.set_srs('EPSG:4326') task.remove_transforms([transform], by_field='type', save=False) task.add_transforms([transform], save=False) task.save_transforms() def srs_step(upload_session, srs): layer = upload_session.import_session.tasks[0].layer srs = srs.strip().upper() if not srs.startswith("EPSG:"): srs = "EPSG:%s" % srs logger.info('Setting SRS to %s', srs) layer.set_srs(srs) def final_step(upload_session, user): from geonode.geoserver.helpers import get_sld_for import_session = upload_session.import_session _log('Reloading session %s to check validity', import_session.id) import_session = import_session.reload() upload_session.import_session = import_session # the importer chooses an available featuretype name late in the game need # to verify the resource.name otherwise things will fail. This happens # when the same data is uploaded a second time and the default name is # chosen cat = gs_catalog cat._cache.clear() # Create the style and assign it to the created resource # FIXME: Put this in gsconfig.py task = import_session.tasks[0] # @todo see above in save_step, regarding computed unique name name = task.layer.name _log('Getting from catalog [%s]', name) publishing = cat.get_layer(name) if not publishing: raise LayerNotReady("Expected to find layer named '%s' in geoserver" % name) _log('Creating style for [%s]', name) # get_files will not find the sld if it doesn't match the base name # so we've worked around that in the view - if provided, it will be here if upload_session.import_sld_file: _log('using provided sld file') base_file = upload_session.base_file sld_file = base_file[0].sld_files[0] f = open(sld_file, 'r') sld = f.read() f.close() else: sld = get_sld_for(publishing) if sld is not None: try: cat.create_style(name, sld) except geoserver.catalog.ConflictingDataError as e: msg = 'There was already a style named %s in GeoServer, cannot overwrite: "%s"' % ( name, str(e)) # what are we doing with this var? # style = cat.get_style(name) logger.warn(msg) e.args = (msg,) # FIXME: Should we use the fully qualified typename? publishing.default_style = cat.get_style(name) _log('default style set to %s', name) cat.save(publishing) _log('Creating Django record for [%s]', name) target = task.target typename = task.get_target_layer_name() layer_uuid = str(uuid.uuid1()) title = upload_session.layer_title abstract = upload_session.layer_abstract # @todo hacking - any cached layers might cause problems (maybe # delete hook on layer should fix this?) cat._cache.clear() defaults = dict(store=target.name, storeType=target.store_type, typename=typename, workspace=target.workspace_name, title=title, uuid=layer_uuid, abstract=abstract or '', owner=user,) _log('record defaults: %s', defaults) saved_layer, created = Layer.objects.get_or_create( name=task.layer.name, defaults=defaults ) # Should we throw a clearer error here? assert saved_layer is not None # @todo if layer was not created, need to ensure upload target is # same as existing target _log('layer was created : %s', created) if created: saved_layer.set_default_permissions() # Create the points of contact records for the layer _log('Creating points of contact records for [%s]', name) saved_layer.poc = user saved_layer.metadata_author = user # look for xml xml_file = upload_session.base_file[0].xml_files if xml_file: saved_layer.metadata_uploaded = True # get model properties from XML vals, keywords = set_metadata(open(xml_file[0]).read()) # set taggit keywords saved_layer.keywords.add(*keywords) # set model properties for (key, value) in vals.items(): if key == "spatial_representation_type": # value = SpatialRepresentationType.objects.get(identifier=value) pass else: setattr(saved_layer, key, value) saved_layer.save() # Set default permissions on the newly created layer # FIXME: Do this as part of the post_save hook permissions = upload_session.permissions _log('Setting default permissions for [%s]', name) if permissions is not None: saved_layer.set_permissions(permissions) if upload_session.tempdir and os.path.exists(upload_session.tempdir): shutil.rmtree(upload_session.tempdir) upload = Upload.objects.get(import_id=import_session.id) upload.layer = saved_layer upload.complete = True upload.save() if upload_session.time_info: set_time_info(saved_layer, **upload_session.time_info) signals.upload_complete.send(sender=final_step, layer=saved_layer) return saved_layer
gpl-3.0
[ 3949, 3, 199, 3, 199, 3, 1898, 334, 35, 9, 6029, 3232, 3714, 796, 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, 624, 199, 25107, 6858, 436, 26440, 9661, 402, 9689, 376, 5802, 14, 199, 199, 1918, 5802, 2112, 1443, 506, 3510, 3650, 880, 6858, 787, 1006, 8860, 14448, 2348, 199, 991, 314, 2455, 805, 14, 199, 199, 1918, 3851, 370, 2291, 4216, 425, 402, 2455, 15, 15370, 365, 1924, 3650, 315, 314, 5802, 199, 1412, 365, 4739, 379, 543, 2668, 2926, 1674, 710, 2455, 367, 626, 3650, 365, 4739, 379, 543, 199, 2, 63, 2926, 63, 1345, 1674, 710, 14850, 402, 4216, 425, 402, 2455, 15, 15370, 365, 370, 2291, 7750, 199, 6815, 3889, 4440, 402, 642, 3261, 14, 710, 9661, 7124, 1077, 440, 4729, 1056, 2251, 199, 269, 372, 1177, 2251, 14, 199, 199, 2223, 365, 5489, 315, 282, 4949, 3422, 4434, 909, 5489, 315, 314, 922, 1159, 2351, 14, 199, 2765, 4839, 370, 506, 6326, 1655, 1174, 1893, 701, 7791, 282, 1402, 14, 199, 624, 199, 504, 2312, 29118, 14, 4359, 14, 1208, 492, 664, 63, 1078, 63, 1897, 63, 354, 199, 504, 2312, 29118, 14, 4359, 14, 2343, 492, 663, 63, 2343, 199, 504, 2312, 29118, 14, 4359, 14, 992, 492, 11915, 199, 504, 2312, 29118, 492, 8875, 1716, 1726, 199, 504, 2312, 29118, 14, 13562, 14, 1208, 492, 664, 63, 885, 63, 751, 199, 504, 2312, 29118, 14, 5064, 14, 992, 492, 19149, 199, 504, 2312, 29118, 14, 5064, 492, 10166, 199, 504, 2312, 29118, 14, 5064, 14, 1208, 492, 1218, 63, 6721, 1000, 63, 697, 63, 4445, 1617, 199, 504, 2312, 29118, 14, 6721, 1000, 14, 7546, 492, 8763, 63, 7959, 12, 8763, 63, 13671, 12, 312, 9493, 63, 1000, 63, 1751, 199, 504, 2312, 29118, 14, 6721, 1000, 14, 7546, 492, 663, 63, 521, 63, 815, 199, 199, 646, 8509, 1000, 199, 504, 8509, 1000, 14, 1927, 492, 1849, 3652, 199, 504, 8509, 1000, 14, 1927, 492, 13407, 804, 199, 504, 486, 11184, 3968, 492, 8857, 2017, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 697, 14, 992, 492, 8228, 199, 504, 1639, 14, 2828, 14, 1178, 492, 664, 63, 751, 63, 1238, 199, 199, 646, 5145, 199, 646, 747, 14, 515, 199, 646, 2050, 199, 646, 5377, 199, 199, 2921, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 533, 19149, 1726, 8, 1726, 304, 339, 1449, 33, 8860, 1919, 18329, 370, 506, 26568, 370, 314, 922, 2344, 339, 768, 4639, 272, 347, 687, 63, 2804, 8, 1328, 12, 444, 304, 267, 1249, 275, 359, 1328, 61, 267, 1249, 14, 2880, 8, 476, 14, 589, 9, 267, 372, 19149, 1726, 2031, 589, 9, 421, 199, 533, 11915, 1763, 17960, 8, 1726, 304, 272, 986, 421, 199, 533, 4949, 3422, 4434, 8, 785, 304, 339, 408, 2422, 2251, 23608, 1471, 506, 7688, 370, 6296, 433, 432, 282, 6954, 24394, 624, 339, 327, 314, 486, 11184, 3968, 2351, 909, 272, 492, 63, 1730, 275, 488, 339, 327, 340, 2741, 12, 642, 570, 911, 506, 14238, 370, 8509, 1000, 436, 663, 465, 272, 327, 314, 849, 272, 492, 63, 83, 1447, 63, 493, 275, 488, 339, 327, 2909, 402, 1263, 7937, 14238, 1584, 272, 21628, 275, 488, 339, 327, 314, 2446, 14238, 570, 12, 3482, 12, 1033, 80, 12, 3367, 70, 12, 5423, 14, 272, 1300, 63, 493, 275, 488, 339, 327, 314, 536, 370, 862, 370, 8120, 314, 4045, 272, 536, 275, 488, 339, 327, 9182, 402, 3443, 4840, 272, 3443, 275, 488, 339, 327, 3877, 4750, 23568, 7526, 900, 18501, 370, 2291, 13794, 272, 900, 63, 15133, 275, 488, 339, 327, 4243, 370, 5363, 23068, 340, 440, 2741, 14, 15506, 83, 19525, 3902, 12, 4634, 272, 1678, 63, 632, 275, 488, 339, 327, 3161, 370, 8875, 39, 528, 7611, 272, 2312, 974, 528, 275, 488, 339, 327, 8875, 39, 528, 24426, 370, 492, 370, 272, 2312, 974, 528, 63, 1617, 275, 488, 339, 327, 15453, 4703, 367, 642, 11915, 272, 900, 275, 488, 339, 327, 314, 2538, 1627, 370, 314, 4045, 272, 4045, 63, 1213, 275, 488, 339, 327, 314, 9006, 272, 4045, 63, 6198, 275, 488, 339, 327, 4426, 314, 4750, 23568, 9709, 5802, 3650, 272, 9709, 63, 2926, 275, 488, 339, 327, 314, 5802, 730, 446, 1937, 314, 485, 5856, 1211, 315, 6858, 272, 5802, 63, 466, 275, 488, 339, 327, 900, 4048, 2256, 446, 1929, 370, 3877, 2348, 5133, 8509, 1000, 4045, 3495, 272, 900, 63, 815, 275, 488, 339, 347, 636, 826, 721, 277, 12, 1011, 829, 304, 267, 367, 1022, 12, 373, 315, 4775, 14, 1744, 837, 288, 340, 2688, 8, 277, 12, 1022, 304, 355, 5371, 8, 277, 12, 1022, 12, 373, 9, 288, 587, 26, 355, 746, 2186, 360, 1397, 8860, 520, 450, 83, 7, 450, 1022, 9, 339, 347, 9058, 8, 277, 304, 267, 408, 1117, 4052, 781, 1077, 737, 314, 1627, 1174, 402, 314, 5802, 624, 267, 986, 421, 199, 318, 5802, 8, 354, 12, 1300, 63, 493, 12, 1779, 922, 29, 403, 12, 900, 63, 3215, 29, 403, 12, 1779, 900, 63, 4711, 63, 466, 29, 403, 12, 1779, 1284, 63, 521, 63, 3215, 29, 403, 12, 1284, 63, 521, 63, 4711, 63, 466, 29, 403, 12, 1779, 3451, 425, 63, 8590, 29, 403, 12, 7151 ]
[ 3, 199, 3, 199, 3, 1898, 334, 35, 9, 6029, 3232, 3714, 796, 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, 624, 199, 25107, 6858, 436, 26440, 9661, 402, 9689, 376, 5802, 14, 199, 199, 1918, 5802, 2112, 1443, 506, 3510, 3650, 880, 6858, 787, 1006, 8860, 14448, 2348, 199, 991, 314, 2455, 805, 14, 199, 199, 1918, 3851, 370, 2291, 4216, 425, 402, 2455, 15, 15370, 365, 1924, 3650, 315, 314, 5802, 199, 1412, 365, 4739, 379, 543, 2668, 2926, 1674, 710, 2455, 367, 626, 3650, 365, 4739, 379, 543, 199, 2, 63, 2926, 63, 1345, 1674, 710, 14850, 402, 4216, 425, 402, 2455, 15, 15370, 365, 370, 2291, 7750, 199, 6815, 3889, 4440, 402, 642, 3261, 14, 710, 9661, 7124, 1077, 440, 4729, 1056, 2251, 199, 269, 372, 1177, 2251, 14, 199, 199, 2223, 365, 5489, 315, 282, 4949, 3422, 4434, 909, 5489, 315, 314, 922, 1159, 2351, 14, 199, 2765, 4839, 370, 506, 6326, 1655, 1174, 1893, 701, 7791, 282, 1402, 14, 199, 624, 199, 504, 2312, 29118, 14, 4359, 14, 1208, 492, 664, 63, 1078, 63, 1897, 63, 354, 199, 504, 2312, 29118, 14, 4359, 14, 2343, 492, 663, 63, 2343, 199, 504, 2312, 29118, 14, 4359, 14, 992, 492, 11915, 199, 504, 2312, 29118, 492, 8875, 1716, 1726, 199, 504, 2312, 29118, 14, 13562, 14, 1208, 492, 664, 63, 885, 63, 751, 199, 504, 2312, 29118, 14, 5064, 14, 992, 492, 19149, 199, 504, 2312, 29118, 14, 5064, 492, 10166, 199, 504, 2312, 29118, 14, 5064, 14, 1208, 492, 1218, 63, 6721, 1000, 63, 697, 63, 4445, 1617, 199, 504, 2312, 29118, 14, 6721, 1000, 14, 7546, 492, 8763, 63, 7959, 12, 8763, 63, 13671, 12, 312, 9493, 63, 1000, 63, 1751, 199, 504, 2312, 29118, 14, 6721, 1000, 14, 7546, 492, 663, 63, 521, 63, 815, 199, 199, 646, 8509, 1000, 199, 504, 8509, 1000, 14, 1927, 492, 1849, 3652, 199, 504, 8509, 1000, 14, 1927, 492, 13407, 804, 199, 504, 486, 11184, 3968, 492, 8857, 2017, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 697, 14, 992, 492, 8228, 199, 504, 1639, 14, 2828, 14, 1178, 492, 664, 63, 751, 63, 1238, 199, 199, 646, 5145, 199, 646, 747, 14, 515, 199, 646, 2050, 199, 646, 5377, 199, 199, 2921, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 533, 19149, 1726, 8, 1726, 304, 339, 1449, 33, 8860, 1919, 18329, 370, 506, 26568, 370, 314, 922, 2344, 339, 768, 4639, 272, 347, 687, 63, 2804, 8, 1328, 12, 444, 304, 267, 1249, 275, 359, 1328, 61, 267, 1249, 14, 2880, 8, 476, 14, 589, 9, 267, 372, 19149, 1726, 2031, 589, 9, 421, 199, 533, 11915, 1763, 17960, 8, 1726, 304, 272, 986, 421, 199, 533, 4949, 3422, 4434, 8, 785, 304, 339, 408, 2422, 2251, 23608, 1471, 506, 7688, 370, 6296, 433, 432, 282, 6954, 24394, 624, 339, 327, 314, 486, 11184, 3968, 2351, 909, 272, 492, 63, 1730, 275, 488, 339, 327, 340, 2741, 12, 642, 570, 911, 506, 14238, 370, 8509, 1000, 436, 663, 465, 272, 327, 314, 849, 272, 492, 63, 83, 1447, 63, 493, 275, 488, 339, 327, 2909, 402, 1263, 7937, 14238, 1584, 272, 21628, 275, 488, 339, 327, 314, 2446, 14238, 570, 12, 3482, 12, 1033, 80, 12, 3367, 70, 12, 5423, 14, 272, 1300, 63, 493, 275, 488, 339, 327, 314, 536, 370, 862, 370, 8120, 314, 4045, 272, 536, 275, 488, 339, 327, 9182, 402, 3443, 4840, 272, 3443, 275, 488, 339, 327, 3877, 4750, 23568, 7526, 900, 18501, 370, 2291, 13794, 272, 900, 63, 15133, 275, 488, 339, 327, 4243, 370, 5363, 23068, 340, 440, 2741, 14, 15506, 83, 19525, 3902, 12, 4634, 272, 1678, 63, 632, 275, 488, 339, 327, 3161, 370, 8875, 39, 528, 7611, 272, 2312, 974, 528, 275, 488, 339, 327, 8875, 39, 528, 24426, 370, 492, 370, 272, 2312, 974, 528, 63, 1617, 275, 488, 339, 327, 15453, 4703, 367, 642, 11915, 272, 900, 275, 488, 339, 327, 314, 2538, 1627, 370, 314, 4045, 272, 4045, 63, 1213, 275, 488, 339, 327, 314, 9006, 272, 4045, 63, 6198, 275, 488, 339, 327, 4426, 314, 4750, 23568, 9709, 5802, 3650, 272, 9709, 63, 2926, 275, 488, 339, 327, 314, 5802, 730, 446, 1937, 314, 485, 5856, 1211, 315, 6858, 272, 5802, 63, 466, 275, 488, 339, 327, 900, 4048, 2256, 446, 1929, 370, 3877, 2348, 5133, 8509, 1000, 4045, 3495, 272, 900, 63, 815, 275, 488, 339, 347, 636, 826, 721, 277, 12, 1011, 829, 304, 267, 367, 1022, 12, 373, 315, 4775, 14, 1744, 837, 288, 340, 2688, 8, 277, 12, 1022, 304, 355, 5371, 8, 277, 12, 1022, 12, 373, 9, 288, 587, 26, 355, 746, 2186, 360, 1397, 8860, 520, 450, 83, 7, 450, 1022, 9, 339, 347, 9058, 8, 277, 304, 267, 408, 1117, 4052, 781, 1077, 737, 314, 1627, 1174, 402, 314, 5802, 624, 267, 986, 421, 199, 318, 5802, 8, 354, 12, 1300, 63, 493, 12, 1779, 922, 29, 403, 12, 900, 63, 3215, 29, 403, 12, 1779, 900, 63, 4711, 63, 466, 29, 403, 12, 1779, 1284, 63, 521, 63, 3215, 29, 403, 12, 1284, 63, 521, 63, 4711, 63, 466, 29, 403, 12, 1779, 3451, 425, 63, 8590, 29, 403, 12, 7151, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
adobecs5/urp2015
lib/python3.4/site-packages/pkg_resources/_vendor/packaging/_structures.py
906
1809
# Copyright 2014 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function class Infinity(object): def __repr__(self): return "Infinity" def __hash__(self): return hash(repr(self)) def __lt__(self, other): return False def __le__(self, other): return False def __eq__(self, other): return isinstance(other, self.__class__) def __ne__(self, other): return not isinstance(other, self.__class__) def __gt__(self, other): return True def __ge__(self, other): return True def __neg__(self): return NegativeInfinity Infinity = Infinity() class NegativeInfinity(object): def __repr__(self): return "-Infinity" def __hash__(self): return hash(repr(self)) def __lt__(self, other): return True def __le__(self, other): return True def __eq__(self, other): return isinstance(other, self.__class__) def __ne__(self, other): return not isinstance(other, self.__class__) def __gt__(self, other): return False def __ge__(self, other): return False def __neg__(self): return Infinity NegativeInfinity = NegativeInfinity()
apache-2.0
[ 3, 1898, 6927, 7529, 27075, 1933, 3043, 84, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 870, 63, 1593, 421, 199, 533, 1010, 9693, 8, 785, 304, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 298, 14660, 2, 339, 347, 636, 2227, 721, 277, 304, 267, 372, 2631, 8, 2722, 8, 277, 430, 339, 347, 636, 4116, 721, 277, 12, 1163, 304, 267, 372, 756, 339, 347, 636, 274, 721, 277, 12, 1163, 304, 267, 372, 756, 339, 347, 636, 4077, 721, 277, 12, 1163, 304, 267, 372, 1228, 8, 1848, 12, 291, 855, 533, 3368, 339, 347, 636, 685, 721, 277, 12, 1163, 304, 267, 372, 440, 1228, 8, 1848, 12, 291, 855, 533, 3368, 339, 347, 636, 3308, 721, 277, 12, 1163, 304, 267, 372, 715, 339, 347, 636, 303, 721, 277, 12, 1163, 304, 267, 372, 715, 339, 347, 636, 8705, 721, 277, 304, 267, 372, 32548, 14660, 199, 199, 14660, 275, 1010, 9693, 342, 421, 199, 533, 32548, 14660, 8, 785, 304, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 3905, 14660, 2, 339, 347, 636, 2227, 721, 277, 304, 267, 372, 2631, 8, 2722, 8, 277, 430, 339, 347, 636, 4116, 721, 277, 12, 1163, 304, 267, 372, 715, 339, 347, 636, 274, 721, 277, 12, 1163, 304, 267, 372, 715, 339, 347, 636, 4077, 721, 277, 12, 1163, 304, 267, 372, 1228, 8, 1848, 12, 291, 855, 533, 3368, 339, 347, 636, 685, 721, 277, 12, 1163, 304, 267, 372, 440, 1228, 8, 1848, 12, 291, 855, 533, 3368, 339, 347, 636, 3308, 721, 277, 12, 1163, 304, 267, 372, 756, 339, 347, 636, 303, 721, 277, 12, 1163, 304, 267, 372, 756, 339, 347, 636, 8705, 721, 277, 304, 267, 372, 1010, 9693, 199, 199, 15562, 14660, 275, 32548, 14660, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1898, 6927, 7529, 27075, 1933, 3043, 84, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 870, 63, 1593, 421, 199, 533, 1010, 9693, 8, 785, 304, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 298, 14660, 2, 339, 347, 636, 2227, 721, 277, 304, 267, 372, 2631, 8, 2722, 8, 277, 430, 339, 347, 636, 4116, 721, 277, 12, 1163, 304, 267, 372, 756, 339, 347, 636, 274, 721, 277, 12, 1163, 304, 267, 372, 756, 339, 347, 636, 4077, 721, 277, 12, 1163, 304, 267, 372, 1228, 8, 1848, 12, 291, 855, 533, 3368, 339, 347, 636, 685, 721, 277, 12, 1163, 304, 267, 372, 440, 1228, 8, 1848, 12, 291, 855, 533, 3368, 339, 347, 636, 3308, 721, 277, 12, 1163, 304, 267, 372, 715, 339, 347, 636, 303, 721, 277, 12, 1163, 304, 267, 372, 715, 339, 347, 636, 8705, 721, 277, 304, 267, 372, 32548, 14660, 199, 199, 14660, 275, 1010, 9693, 342, 421, 199, 533, 32548, 14660, 8, 785, 304, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 3905, 14660, 2, 339, 347, 636, 2227, 721, 277, 304, 267, 372, 2631, 8, 2722, 8, 277, 430, 339, 347, 636, 4116, 721, 277, 12, 1163, 304, 267, 372, 715, 339, 347, 636, 274, 721, 277, 12, 1163, 304, 267, 372, 715, 339, 347, 636, 4077, 721, 277, 12, 1163, 304, 267, 372, 1228, 8, 1848, 12, 291, 855, 533, 3368, 339, 347, 636, 685, 721, 277, 12, 1163, 304, 267, 372, 440, 1228, 8, 1848, 12, 291, 855, 533, 3368, 339, 347, 636, 3308, 721, 277, 12, 1163, 304, 267, 372, 756, 339, 347, 636, 303, 721, 277, 12, 1163, 304, 267, 372, 756, 339, 347, 636, 8705, 721, 277, 304, 267, 372, 1010, 9693, 199, 199, 15562, 14660, 275, 32548, 14660, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
i5o/openshot-sugar
ignacio/openshot/windows/AddToTimeline.py
3
13528
# OpenShot Video Editor is a program that creates, modifies, and edits video files. # Copyright (C) 2010 Jonathan Thomas # # This file is part of OpenShot Video Editor (http://launchpad.net/openshot/). # # OpenShot Video Editor 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. # # OpenShot Video Editor 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 OpenShot Video Editor. If not, see <http://www.gnu.org/licenses/>. import os import gtk import random from windows.SimpleGtkBuilderApp import SimpleGtkBuilderApp from windows import preferences, TreeFiles from classes import project, messagebox, timeline, files # init the foreign language from language import Language_Init class frmAddToTimeline(SimpleGtkBuilderApp): def __init__(self, path="AddToTimeline.ui", root="frmAddToTimeline", domain="OpenShot", form=None, project=None, selected_files=None, **kwargs): SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs) # Add language support _ = Language_Init.Translator(project).lang.gettext self._ = _ self.form = form self.project = project self.selected_files = selected_files self.transitions = {} self.frmAddToTimeline.show_all() # init the OpenShot files tree self.OSTreeFiles = TreeFiles.OpenShotTree(self.treeFiles, self.project) self.OSTreeFiles.set_project(self.project) self.model = self.treeFiles.get_model() # init the value of start_time with the play-head position self.txtStartTime.set_value(self.project.sequences[0].play_head_position) # refresh tree self.refresh() # Get default length of images imported_image_length = float(preferences.Settings.general["imported_image_length"]) max_transition_length = (imported_image_length / 2.0) - 0.1 # Set the upper limits of the transitions & fade length adjustment1 = gtk.Adjustment(value=2.0, lower=0.0, upper=max_transition_length, step_incr=0.5, page_incr=0.5, page_size=0.0) self.txtTransitionLength.configure(adjustment1, 0.5, 2) adjustment2 = gtk.Adjustment(value=2.0, lower=0.0, upper=max_transition_length, step_incr=0.5, page_incr=0.5, page_size=0.0) self.txtFadeLength.configure(adjustment2, 0.5, 2) # init all dropdowns self.init_fade() self.init_tracks() self.init_transitions() def init_transitions(self): # get translation object _ = self._ # init the transition length self.txtTransitionLength.set_value(2.0) model = self.cboTransition.get_model() model.clear() # Add the first transition self.cboTransition.append_text(_("No Transition")) self.cboTransition.append_text(_("Random Transition")) self.cboTransition.append_text(_("Dissolve")) self.transitions[_("Dissolve")] = "" # get a list of files in the OpenShot /transitions directory file_list = os.listdir(os.path.join(self.project.TRANSITIONS_DIR)) for fname in sorted(file_list): (dirName, file_name) = os.path.split(fname) (fileBaseName, fileExtension)=os.path.splitext(file_name) if fname == "icons": # ignore the 'icons' folder continue # get name of transition trans_name = fileBaseName.replace("_", " ").capitalize() # append profile to list self.cboTransition.append_text(_(trans_name)) self.transitions[_(trans_name)] = os.path.join(self.project.TRANSITIONS_DIR, fname) # set the default value self.set_dropdown_values(_("No Transition"), self.cboTransition) def init_tracks(self): # get translation object _ = self._ # validate that 2 tracks are present if len(self.project.sequences[0].tracks) == 0: # no tracks, so add 2 self.project.sequences[0].AddTrack(_("New Track 1")) self.project.sequences[0].AddTrack(_("New Track 2")) self.form.refresh() # show new tracks elif len(self.project.sequences[0].tracks) == 1: # only 1 track, so add another self.project.sequences[0].AddTrack(_("New Track")) self.form.refresh() # show new tracks counter = 0 for dropdown in [self.cboTrackA, self.cboTrackB]: model = dropdown.get_model() model.clear() # loop through export to options for track in self.project.sequences[0].tracks: # append profile to list dropdown.append_text(track.name) # set the default value self.set_dropdown_values(self.project.sequences[0].tracks[counter].name, dropdown) counter = counter + 1 def init_fade(self): # get translation object _ = self._ # init the transition length self.txtFadeLength.set_value(2.0) model = self.cboFade.get_model() model.clear() # loop through export to options for option in [_("No Fade"), _("Fade In"), _("Fade Out"), _("Fade In & Out")]: # append profile to list self.cboFade.append_text(option) # set the default value self.set_dropdown_values(_("No Fade"), self.cboFade) def init_animation(self): # get translation object _ = self._ model = self.cboAnimation.get_model() model.clear() # loop through export to options for option in [_("No Animation"), _("Zoom In (100% to 150%)"), _("Zoom In (50% to 100%)"), _("Zoom Out (100% to 50%)"), _("Zoom Out (150% to 100%)")]: # append profile to list self.cboAnimation.append_text(option) # set the default value self.set_dropdown_values(_("No Animation"), self.cboAnimation) def refresh(self): # clear the tree self.OSTreeFiles.store.clear() # Init the project files tree (with selected files) for item in self.selected_files: if isinstance(item, files.OpenShotFile): #format the file length field milliseconds = item.length * 1000 time = timeline.timeline().get_friendly_time(milliseconds) time_str = "%02d:%02d:%02d" % (time[2], time[3], time[4]) # get the thumbnail (or load default) pbThumb = item.get_thumbnail(51, 38) #find parent (if any) match_iter = None # get file name (dirName, fileName) = os.path.split(item.name) # Add row to tree self.OSTreeFiles.store.append(match_iter, [pbThumb, fileName, time_str, item.label, item.unique_id]) def on_btnCancel_clicked(self, widget, *args): print "on_btnCancel_clicked" self.frmAddToTimeline.destroy() def on_btnMoveUp_clicked(self, widget, *args): print "on_btnMoveUp_clicked" # Get the selection selection = self.treeFiles.get_selection() rows, selected = selection.get_selected_rows() # loop through selected files iters = [self.model.get_iter(path) for path in selected] for iter in iters: # get file object unique_id = self.model.get_value(iter, 4) file_object = self.project.project_folder.FindFileByID(unique_id) # move the item down old_position = self.selected_files.index(file_object) new_position = old_position - 1 self.selected_files.insert(new_position, self.selected_files.pop(old_position)) # refresh self.refresh() def on_btnMoveDown_clicked(self, widget, *args): print "on_btnMoveDown_clicked" # Get the selection selection = self.treeFiles.get_selection() rows, selected = selection.get_selected_rows() # loop through selected files iters = [self.model.get_iter(path) for path in selected] for iter in reversed(iters): # get file object unique_id = self.model.get_value(iter, 4) file_object = self.project.project_folder.FindFileByID(unique_id) # move the item down old_position = self.selected_files.index(file_object) new_position = old_position + 1 self.selected_files.insert(new_position, self.selected_files.pop(old_position)) # refresh self.refresh() def on_btnShuffle_clicked(self, widget, *args): print "on_btnShuffle_clicked" # shuffle the file list random.shuffle(self.selected_files) # refresh tree self.refresh() def on_btnRemove_clicked(self, widget, *args): print "on_btnRemove_clicked" # Get the selection selection = self.treeFiles.get_selection() rows, selected = selection.get_selected_rows() # loop through selected files iters = [self.model.get_iter(path) for path in selected] for iter in reversed(iters): # get file object unique_id = self.model.get_value(iter, 4) file_object = self.project.project_folder.FindFileByID(unique_id) # remove file self.selected_files.remove(file_object) # refresh tree self.refresh() def set_dropdown_values(self, value_to_set, combobox): # get reference to gettext _ = self._ model = combobox.get_model() iter = model.get_iter_first() while iter: # get the value of each item in the dropdown value = model.get_value(iter, 0) # check for the matching value if value_to_set == value: # set the item as active combobox.set_active_iter(iter) break # get the next item in the list iter = model.iter_next(iter) # break loop when no more dropdown items are found if iter is None and value_to_set not in self.invalid_codecs: self.invalid_codecs.append(value_to_set) break def on_btnAdd_clicked(self, widget, *args): print "on_btnAdd_clicked" # get reference to gettext _ = self._ # get settings new_clip = None start_time = self.txtStartTime.get_value() trackA_name = self.cboTrackA.get_active_text() trackA_object = None trackB_name = self.cboTrackB.get_active_text() trackB_object = None fade_name = self.cboFade.get_active_text() fade_length = self.txtFadeLength.get_value() transition_name = self.cboTransition.get_active_text() transition_file_path = None transition_length = self.txtTransitionLength.get_value() #animation = self.cboAnimation.get_active_text() use_transitions = True use_random = False if transition_name == _("No Transition"): # do not use a transition use_transitions = False elif transition_name == _("Random Transition"): # random transitions use_random = True else: # get the file path of the transition transition_file_path = self.transitions[transition_name] # get actual track objects for track in self.project.sequences[0].tracks: if trackA_name == track.name: trackA_object = track if trackB_name == track.name: trackB_object = track # Validate the the top track is above the bottom track if self.project.sequences[0].tracks.index(trackA_object) >= self.project.sequences[0].tracks.index(trackB_object): # Show error message messagebox.show(_("Validation Error!"), _("The top track must be higher than the bottom track.")) return # init the start position / time position = start_time location = "top" current_track = trackA_object # loop through all files (in tree order) for file in self.selected_files: # Get filename (dirName, fileName) = os.path.split(file.name) # Add clips to track 1 new_clip = current_track.AddClip(fileName, "Gold", position, float(0.0), float(file.length), file) # Apply Fade settings if fade_name == _("Fade In"): new_clip.audio_fade_in = True new_clip.video_fade_in = True new_clip.audio_fade_in_amount = fade_length new_clip.video_fade_in_amount = fade_length elif fade_name == _("Fade Out"): new_clip.audio_fade_out = True new_clip.video_fade_out = True new_clip.audio_fade_out_amount = fade_length new_clip.video_fade_out_amount = fade_length elif fade_name == _("Fade In & Out"): new_clip.audio_fade_in = True new_clip.video_fade_in = True new_clip.audio_fade_out = True new_clip.video_fade_out = True new_clip.audio_fade_in_amount = fade_length new_clip.audio_fade_out_amount = fade_length new_clip.video_fade_in_amount = fade_length new_clip.video_fade_out_amount = fade_length # increment position if use_transitions: # adjust the position based on the transition length position = position + new_clip.length() - transition_length else: position = position + new_clip.length() # Add transition (if needed) if use_transitions: # if a random transition, choose a random one if use_random: random_transition = random.choice(self.transitions.items()) transition_name = random_transition[0] transition_file_path = random_transition[1] # add the transition new_trans = trackA_object.AddTransition(transition_name, position, transition_length, transition_file_path) if location == "top": new_trans.reverse = True # change tracks (if needed) if use_transitions: if current_track == trackA_object: location = "bottom" current_track = trackB_object else: current_track = trackA_object location = "top" # Does timeline need to be expanded? if new_clip: self.form.expand_timeline(new_clip) #mark the project as modified self.project.set_project_modified(is_modified=True, refresh_xml=True, type="Added files to timeline") # close this window self.frmAddToTimeline.destroy() # refresh the main form & timeline self.form.refresh() def main(): frm_add_files = frmAddToTimeline() frm_add_files.run() if __name__ == "__main__": main()
gpl-3.0
[ 3, 198, 4299, 2662, 357, 15709, 30318, 365, 282, 2240, 626, 8491, 12, 26473, 12, 436, 7860, 1086, 3991, 1584, 14, 199, 3, 257, 1898, 334, 35, 9, 7129, 221, 1603, 265, 1619, 290, 27864, 199, 3, 199, 3, 198, 2765, 570, 365, 1777, 402, 3232, 2662, 357, 15709, 30318, 334, 1014, 921, 9850, 6226, 14, 846, 15, 1490, 2782, 15, 680, 199, 3, 199, 3, 198, 4299, 2662, 357, 15709, 30318, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 198, 390, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 198, 1589, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 198, 8, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 198, 4299, 2662, 357, 15709, 30318, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 198, 7911, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 198, 31461, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 198, 17732, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 198, 5556, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 198, 21632, 543, 3232, 2662, 357, 15709, 30318, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 646, 747, 199, 646, 8116, 199, 646, 2196, 199, 504, 10061, 14, 3184, 18891, 6437, 2640, 492, 5870, 18891, 6437, 2640, 199, 504, 10061, 492, 23453, 12, 12178, 5535, 199, 504, 3992, 492, 2199, 12, 1245, 1977, 12, 20780, 12, 1584, 199, 199, 3, 4205, 314, 11608, 2637, 199, 504, 2637, 492, 8466, 63, 9346, 421, 199, 533, 289, 5682, 1123, 1378, 27097, 8, 3184, 18891, 6437, 2640, 304, 421, 198, 318, 636, 826, 721, 277, 12, 931, 628, 1123, 1378, 27097, 14, 1907, 401, 1738, 628, 20095, 1123, 1378, 27097, 401, 2881, 628, 4299, 2662, 357, 401, 1824, 29, 403, 12, 2199, 29, 403, 12, 4895, 63, 1725, 29, 403, 12, 1011, 958, 304, 507, 198, 3184, 18891, 6437, 2640, 855, 826, 721, 277, 12, 747, 14, 515, 14, 904, 8, 1715, 14, 6379, 63, 3022, 12, 931, 395, 1738, 12, 2881, 12, 1011, 958, 9, 2742, 198, 3, 2654, 2637, 2291, 507, 198, 63, 275, 8466, 63, 9346, 14, 26059, 8, 1715, 680, 4159, 14, 5152, 507, 198, 277, 423, 275, 485, 2742, 198, 277, 14, 964, 275, 1824, 507, 198, 277, 14, 1715, 275, 2199, 507, 198, 277, 14, 5511, 63, 1725, 275, 4895, 63, 1725, 507, 198, 277, 14, 23062, 275, 1052, 507, 198, 277, 14, 20095, 1123, 1378, 27097, 14, 2384, 63, 452, 342, 9068, 198, 3, 4205, 314, 3232, 2662, 357, 1584, 3123, 507, 198, 277, 14, 47, 840, 850, 5535, 275, 12178, 5535, 14, 4299, 2662, 357, 3987, 8, 277, 14, 2350, 5535, 12, 291, 14, 1715, 9, 507, 198, 277, 14, 47, 840, 850, 5535, 14, 409, 63, 1715, 8, 277, 14, 1715, 9, 507, 198, 277, 14, 1238, 275, 291, 14, 2350, 5535, 14, 362, 63, 1238, 342, 9068, 198, 3, 4205, 314, 574, 402, 1343, 63, 521, 543, 314, 5232, 13, 2993, 3421, 507, 198, 277, 14, 2424, 25087, 14, 409, 63, 585, 8, 277, 14, 1715, 14, 13436, 59, 16, 1055, 2802, 63, 2993, 63, 3124, 9, 2742, 198, 3, 9236, 3123, 507, 198, 277, 14, 6635, 342, 2742, 198, 3, 2372, 849, 2582, 402, 5935, 507, 198, 17932, 63, 1569, 63, 1267, 275, 2069, 8, 18063, 14, 5268, 14, 10706, 905, 17932, 63, 1569, 63, 1267, 3135, 507, 198, 988, 63, 14143, 63, 1267, 275, 334, 17932, 63, 1569, 63, 1267, 1182, 499, 14, 16, 9, 446, 378, 14, 17, 9068, 198, 3, 2494, 314, 7008, 10976, 402, 314, 19077, 1253, 1433, 271, 2582, 507, 198, 21806, 17, 275, 8116, 14, 17977, 434, 8, 585, 29, 18, 14, 16, 12, 5117, 29, 16, 14, 16, 12, 7008, 29, 988, 63, 14143, 63, 1267, 12, 3650, 63, 19362, 29, 16, 14, 21, 12, 2034, 63, 19362, 29, 16, 14, 21, 12, 2034, 63, 890, 29, 16, 14, 16, 9, 507, 198, 277, 14, 2424, 21881, 4625, 14, 6472, 8, 21806, 17, 12, 378, 14, 21, 12, 499, 9, 9068, 198, 21806, 18, 275, 8116, 14, 17977, 434, 8, 585, 29, 18, 14, 16, 12, 5117, 29, 16, 14, 16, 12, 7008, 29, 988, 63, 14143, 63, 1267, 12, 3650, 63, 19362, 29, 16, 14, 21, 12, 2034, 63, 19362, 29, 16, 14, 21, 12, 2034, 63, 890, 29, 16, 14, 16, 9, 507, 198, 277, 14, 2424, 1906, 271, 4625, 14, 6472, 8, 21806, 18, 12, 378, 14, 21, 12, 499, 9, 9068, 198, 3, 4205, 1006, 5978, 68, 23311, 507, 198, 277, 14, 826, 63, 667, 271, 342, 507, 198, 277, 14, 826, 63, 16274, 342, 507, 198, 277, 14, 826, 63, 23062, 342, 686, 18118, 198, 318, 4205, 63, 23062, 8, 277, 304, 2742, 198, 3, 664, 7761, 909, 507, 198, 63, 275, 291, 423, 9068, 198, 3, 4205, 314, 14116, 2582, 507, 198, 277, 14, 2424, 21881, 4625, 14, 409, 63, 585, 8, 18, 14, 16, 9, 9068, 198, 1238, 275, 291, 14, 67, 656, 21881, 14, 362, 63, 1238, 342, 507, 198, 1238, 14, 3584, 342, 9068, 198, 3, 2654, 314, 1642, 14116, 507, 198, 277, 14, 67, 656, 21881, 14, 740, 63, 505, 6115, 1944, 19894, 1588, 2237, 507, 198, 277, 14, 67, 656, 21881, 14, 740, 63, 505, 6115, 3883, 19894, 1588, 2237, 507, 198, 277, 14, 67, 656, 21881, 14, 740, 63, 505, 6115, 2825, 11356, 2237, 507, 198, 277, 14, 23062, 13040, 480, 2825, 11356, 11323, 275, 3087, 9068, 198, 3, 664, 282, 769, 402, 1584, 315, 314, 3232, 2662, 357, 1182, 23062, 2082, 507, 198, 493, 63, 513, 275, 747, 14, 7374, 8, 736, 14, 515, 14, 904, 8, 277, 14, 1715, 14, 12191, 649, 2823, 63, 3022, 430, 2742, 198, 509, 6748, 315, 3355, 8, 493, 63, 513, 304, 26140, 198, 8, 694, 985, 12, 570, 63, 354, 9, 275, 747, 14, 515, 14, 1294, 8, 5252, 9, 686 ]
[ 198, 4299, 2662, 357, 15709, 30318, 365, 282, 2240, 626, 8491, 12, 26473, 12, 436, 7860, 1086, 3991, 1584, 14, 199, 3, 257, 1898, 334, 35, 9, 7129, 221, 1603, 265, 1619, 290, 27864, 199, 3, 199, 3, 198, 2765, 570, 365, 1777, 402, 3232, 2662, 357, 15709, 30318, 334, 1014, 921, 9850, 6226, 14, 846, 15, 1490, 2782, 15, 680, 199, 3, 199, 3, 198, 4299, 2662, 357, 15709, 30318, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 198, 390, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 198, 1589, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 198, 8, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 198, 4299, 2662, 357, 15709, 30318, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 198, 7911, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 198, 31461, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 198, 17732, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 198, 5556, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 198, 21632, 543, 3232, 2662, 357, 15709, 30318, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 646, 747, 199, 646, 8116, 199, 646, 2196, 199, 504, 10061, 14, 3184, 18891, 6437, 2640, 492, 5870, 18891, 6437, 2640, 199, 504, 10061, 492, 23453, 12, 12178, 5535, 199, 504, 3992, 492, 2199, 12, 1245, 1977, 12, 20780, 12, 1584, 199, 199, 3, 4205, 314, 11608, 2637, 199, 504, 2637, 492, 8466, 63, 9346, 421, 199, 533, 289, 5682, 1123, 1378, 27097, 8, 3184, 18891, 6437, 2640, 304, 421, 198, 318, 636, 826, 721, 277, 12, 931, 628, 1123, 1378, 27097, 14, 1907, 401, 1738, 628, 20095, 1123, 1378, 27097, 401, 2881, 628, 4299, 2662, 357, 401, 1824, 29, 403, 12, 2199, 29, 403, 12, 4895, 63, 1725, 29, 403, 12, 1011, 958, 304, 507, 198, 3184, 18891, 6437, 2640, 855, 826, 721, 277, 12, 747, 14, 515, 14, 904, 8, 1715, 14, 6379, 63, 3022, 12, 931, 395, 1738, 12, 2881, 12, 1011, 958, 9, 2742, 198, 3, 2654, 2637, 2291, 507, 198, 63, 275, 8466, 63, 9346, 14, 26059, 8, 1715, 680, 4159, 14, 5152, 507, 198, 277, 423, 275, 485, 2742, 198, 277, 14, 964, 275, 1824, 507, 198, 277, 14, 1715, 275, 2199, 507, 198, 277, 14, 5511, 63, 1725, 275, 4895, 63, 1725, 507, 198, 277, 14, 23062, 275, 1052, 507, 198, 277, 14, 20095, 1123, 1378, 27097, 14, 2384, 63, 452, 342, 9068, 198, 3, 4205, 314, 3232, 2662, 357, 1584, 3123, 507, 198, 277, 14, 47, 840, 850, 5535, 275, 12178, 5535, 14, 4299, 2662, 357, 3987, 8, 277, 14, 2350, 5535, 12, 291, 14, 1715, 9, 507, 198, 277, 14, 47, 840, 850, 5535, 14, 409, 63, 1715, 8, 277, 14, 1715, 9, 507, 198, 277, 14, 1238, 275, 291, 14, 2350, 5535, 14, 362, 63, 1238, 342, 9068, 198, 3, 4205, 314, 574, 402, 1343, 63, 521, 543, 314, 5232, 13, 2993, 3421, 507, 198, 277, 14, 2424, 25087, 14, 409, 63, 585, 8, 277, 14, 1715, 14, 13436, 59, 16, 1055, 2802, 63, 2993, 63, 3124, 9, 2742, 198, 3, 9236, 3123, 507, 198, 277, 14, 6635, 342, 2742, 198, 3, 2372, 849, 2582, 402, 5935, 507, 198, 17932, 63, 1569, 63, 1267, 275, 2069, 8, 18063, 14, 5268, 14, 10706, 905, 17932, 63, 1569, 63, 1267, 3135, 507, 198, 988, 63, 14143, 63, 1267, 275, 334, 17932, 63, 1569, 63, 1267, 1182, 499, 14, 16, 9, 446, 378, 14, 17, 9068, 198, 3, 2494, 314, 7008, 10976, 402, 314, 19077, 1253, 1433, 271, 2582, 507, 198, 21806, 17, 275, 8116, 14, 17977, 434, 8, 585, 29, 18, 14, 16, 12, 5117, 29, 16, 14, 16, 12, 7008, 29, 988, 63, 14143, 63, 1267, 12, 3650, 63, 19362, 29, 16, 14, 21, 12, 2034, 63, 19362, 29, 16, 14, 21, 12, 2034, 63, 890, 29, 16, 14, 16, 9, 507, 198, 277, 14, 2424, 21881, 4625, 14, 6472, 8, 21806, 17, 12, 378, 14, 21, 12, 499, 9, 9068, 198, 21806, 18, 275, 8116, 14, 17977, 434, 8, 585, 29, 18, 14, 16, 12, 5117, 29, 16, 14, 16, 12, 7008, 29, 988, 63, 14143, 63, 1267, 12, 3650, 63, 19362, 29, 16, 14, 21, 12, 2034, 63, 19362, 29, 16, 14, 21, 12, 2034, 63, 890, 29, 16, 14, 16, 9, 507, 198, 277, 14, 2424, 1906, 271, 4625, 14, 6472, 8, 21806, 18, 12, 378, 14, 21, 12, 499, 9, 9068, 198, 3, 4205, 1006, 5978, 68, 23311, 507, 198, 277, 14, 826, 63, 667, 271, 342, 507, 198, 277, 14, 826, 63, 16274, 342, 507, 198, 277, 14, 826, 63, 23062, 342, 686, 18118, 198, 318, 4205, 63, 23062, 8, 277, 304, 2742, 198, 3, 664, 7761, 909, 507, 198, 63, 275, 291, 423, 9068, 198, 3, 4205, 314, 14116, 2582, 507, 198, 277, 14, 2424, 21881, 4625, 14, 409, 63, 585, 8, 18, 14, 16, 9, 9068, 198, 1238, 275, 291, 14, 67, 656, 21881, 14, 362, 63, 1238, 342, 507, 198, 1238, 14, 3584, 342, 9068, 198, 3, 2654, 314, 1642, 14116, 507, 198, 277, 14, 67, 656, 21881, 14, 740, 63, 505, 6115, 1944, 19894, 1588, 2237, 507, 198, 277, 14, 67, 656, 21881, 14, 740, 63, 505, 6115, 3883, 19894, 1588, 2237, 507, 198, 277, 14, 67, 656, 21881, 14, 740, 63, 505, 6115, 2825, 11356, 2237, 507, 198, 277, 14, 23062, 13040, 480, 2825, 11356, 11323, 275, 3087, 9068, 198, 3, 664, 282, 769, 402, 1584, 315, 314, 3232, 2662, 357, 1182, 23062, 2082, 507, 198, 493, 63, 513, 275, 747, 14, 7374, 8, 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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 ]
jrrembert/django
tests/template_tests/test_context.py
166
5389
# -*- coding: utf-8 -*- from django.http import HttpRequest from django.template import ( Context, Engine, RequestContext, Template, Variable, VariableDoesNotExist, ) from django.template.context import RenderContext from django.test import RequestFactory, SimpleTestCase class ContextTests(SimpleTestCase): def test_context(self): c = Context({"a": 1, "b": "xyzzy"}) self.assertEqual(c["a"], 1) self.assertEqual(c.push(), {}) c["a"] = 2 self.assertEqual(c["a"], 2) self.assertEqual(c.get("a"), 2) self.assertEqual(c.pop(), {"a": 2}) self.assertEqual(c["a"], 1) self.assertEqual(c.get("foo", 42), 42) def test_push_context_manager(self): c = Context({"a": 1}) with c.push(): c['a'] = 2 self.assertEqual(c['a'], 2) self.assertEqual(c['a'], 1) with c.push(a=3): self.assertEqual(c['a'], 3) self.assertEqual(c['a'], 1) def test_update_context_manager(self): c = Context({"a": 1}) with c.update({}): c['a'] = 2 self.assertEqual(c['a'], 2) self.assertEqual(c['a'], 1) with c.update({'a': 3}): self.assertEqual(c['a'], 3) self.assertEqual(c['a'], 1) def test_setdefault(self): c = Context() x = c.setdefault('x', 42) self.assertEqual(x, 42) self.assertEqual(c['x'], 42) x = c.setdefault('x', 100) self.assertEqual(x, 42) self.assertEqual(c['x'], 42) def test_resolve_on_context_method(self): """ #17778 -- Variable shouldn't resolve RequestContext methods """ empty_context = Context() with self.assertRaises(VariableDoesNotExist): Variable('no_such_variable').resolve(empty_context) with self.assertRaises(VariableDoesNotExist): Variable('new').resolve(empty_context) self.assertEqual( Variable('new').resolve(Context({'new': 'foo'})), 'foo', ) def test_render_context(self): test_context = RenderContext({'fruit': 'papaya'}) # Test that push() limits access to the topmost dict test_context.push() test_context['vegetable'] = 'artichoke' self.assertEqual(list(test_context), ['vegetable']) self.assertNotIn('fruit', test_context) with self.assertRaises(KeyError): test_context['fruit'] self.assertIsNone(test_context.get('fruit')) def test_flatten_context(self): a = Context() a.update({'a': 2}) a.update({'b': 4}) a.update({'c': 8}) self.assertEqual(a.flatten(), { 'False': False, 'None': None, 'True': True, 'a': 2, 'b': 4, 'c': 8 }) def test_context_comparable(self): """ #21765 -- equality comparison should work """ test_data = {'x': 'y', 'v': 'z', 'd': {'o': object, 'a': 'b'}} self.assertEqual(Context(test_data), Context(test_data)) a = Context() b = Context() self.assertEqual(a, b) # update only a a.update({'a': 1}) self.assertNotEqual(a, b) # update both to check regression a.update({'c': 3}) b.update({'c': 3}) self.assertNotEqual(a, b) # make contexts equals again b.update({'a': 1}) self.assertEqual(a, b) def test_copy_request_context_twice(self): """ #24273 -- Copy twice shouldn't raise an exception """ RequestContext(HttpRequest()).new().new() class RequestContextTests(SimpleTestCase): def test_include_only(self): """ #15721 -- ``{% include %}`` and ``RequestContext`` should work together. """ engine = Engine(loaders=[ ('django.template.loaders.locmem.Loader', { 'child': '{{ var|default:"none" }}', }), ]) request = RequestFactory().get('/') ctx = RequestContext(request, {'var': 'parent'}) self.assertEqual(engine.from_string('{% include "child" %}').render(ctx), 'parent') self.assertEqual(engine.from_string('{% include "child" only %}').render(ctx), 'none') def test_stack_size(self): """ #7116 -- Optimize RequetsContext construction """ request = RequestFactory().get('/') ctx = RequestContext(request, {}) # The stack should now contain 3 items: # [builtins, supplied context, context processor, empty dict] self.assertEqual(len(ctx.dicts), 4) def test_context_comparable(self): # Create an engine without any context processors. test_data = {'x': 'y', 'v': 'z', 'd': {'o': object, 'a': 'b'}} # test comparing RequestContext to prevent problems if somebody # adds __eq__ in the future request = RequestFactory().get('/') self.assertEqual( RequestContext(request, dict_=test_data), RequestContext(request, dict_=test_data), ) def test_modify_context_and_render(self): template = Template('{{ foo }}') request = RequestFactory().get('/') context = RequestContext(request, {}) context['foo'] = 'foo' self.assertEqual(template.render(context), 'foo')
bsd-3-clause
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 504, 1639, 14, 1014, 492, 20730, 199, 504, 1639, 14, 1160, 492, 334, 272, 9470, 12, 12580, 12, 22538, 12, 5458, 12, 4905, 12, 4905, 7400, 12, 199, 9, 199, 504, 1639, 14, 1160, 14, 1100, 492, 17769, 2998, 199, 504, 1639, 14, 396, 492, 18638, 12, 24424, 421, 199, 533, 9470, 2925, 8, 17968, 304, 339, 347, 511, 63, 1100, 8, 277, 304, 267, 286, 275, 9470, 6333, 65, 582, 413, 12, 298, 66, 582, 298, 8568, 3605, 5984, 267, 291, 14, 629, 8, 67, 905, 65, 2255, 413, 9, 267, 291, 14, 629, 8, 67, 14, 5335, 1062, 5009, 267, 286, 905, 65, 937, 275, 499, 267, 291, 14, 629, 8, 67, 905, 65, 2255, 499, 9, 267, 291, 14, 629, 8, 67, 14, 362, 480, 65, 1288, 499, 9, 267, 291, 14, 629, 8, 67, 14, 1935, 1062, 2420, 65, 582, 499, 1552, 267, 291, 14, 629, 8, 67, 905, 65, 2255, 413, 9, 267, 291, 14, 629, 8, 67, 14, 362, 480, 1421, 401, 5685, 395, 5685, 9, 339, 347, 511, 63, 5335, 63, 1100, 63, 2609, 8, 277, 304, 267, 286, 275, 9470, 6333, 65, 582, 413, 1552, 267, 543, 286, 14, 5335, 837, 288, 286, 459, 65, 418, 275, 499, 288, 291, 14, 629, 8, 67, 459, 65, 995, 499, 9, 267, 291, 14, 629, 8, 67, 459, 65, 995, 413, 9, 398, 543, 286, 14, 5335, 8, 65, 29, 19, 304, 288, 291, 14, 629, 8, 67, 459, 65, 995, 650, 9, 267, 291, 14, 629, 8, 67, 459, 65, 995, 413, 9, 339, 347, 511, 63, 873, 63, 1100, 63, 2609, 8, 277, 304, 267, 286, 275, 9470, 6333, 65, 582, 413, 1552, 267, 543, 286, 14, 873, 24692, 304, 288, 286, 459, 65, 418, 275, 499, 288, 291, 14, 629, 8, 67, 459, 65, 995, 499, 9, 267, 291, 14, 629, 8, 67, 459, 65, 995, 413, 9, 398, 543, 286, 14, 873, 3252, 65, 356, 650, 22558, 288, 291, 14, 629, 8, 67, 459, 65, 995, 650, 9, 267, 291, 14, 629, 8, 67, 459, 65, 995, 413, 9, 339, 347, 511, 63, 5486, 8, 277, 304, 267, 286, 275, 9470, 342, 398, 671, 275, 286, 14, 5486, 360, 88, 297, 5685, 9, 267, 291, 14, 629, 8, 88, 12, 5685, 9, 267, 291, 14, 629, 8, 67, 459, 88, 995, 5685, 9, 398, 671, 275, 286, 14, 5486, 360, 88, 297, 2948, 9, 267, 291, 14, 629, 8, 88, 12, 5685, 9, 267, 291, 14, 629, 8, 67, 459, 88, 995, 5685, 9, 339, 347, 511, 63, 6983, 63, 265, 63, 1100, 63, 765, 8, 277, 304, 267, 408, 267, 327, 8881, 2277, 1553, 4905, 9296, 1133, 7512, 22538, 3102, 267, 408, 267, 2701, 63, 1100, 275, 9470, 342, 398, 543, 291, 14, 1855, 8, 2773, 7400, 304, 288, 4905, 360, 889, 63, 10180, 63, 1975, 1959, 6983, 8, 1667, 63, 1100, 9, 398, 543, 291, 14, 1855, 8, 2773, 7400, 304, 288, 4905, 360, 1222, 1959, 6983, 8, 1667, 63, 1100, 9, 398, 291, 14, 629, 8, 288, 4905, 360, 1222, 1959, 6983, 8, 2998, 3252, 1222, 356, 283, 1421, 936, 1826, 288, 283, 1421, 297, 267, 776, 339, 347, 511, 63, 3352, 63, 1100, 8, 277, 304, 267, 511, 63, 1100, 275, 17769, 2998, 3252, 4391, 4993, 356, 283, 387, 5989, 65, 3071, 398, 327, 1379, 626, 6675, 342, 10976, 2879, 370, 314, 2746, 2786, 1211, 267, 511, 63, 1100, 14, 5335, 342, 398, 511, 63, 1100, 459, 432, 362, 461, 418, 275, 283, 285, 280, 2239, 415, 7, 267, 291, 14, 629, 8, 513, 8, 396, 63, 1100, 395, 788, 432, 362, 461, 1105, 398, 291, 14, 8795, 360, 4391, 4993, 297, 511, 63, 1100, 9, 267, 543, 291, 14, 1855, 8, 10230, 304, 288, 511, 63, 1100, 459, 4391, 4993, 418, 267, 291, 14, 7702, 8, 396, 63, 1100, 14, 362, 360, 4391, 4993, 1333, 339, 347, 511, 63, 8487, 63, 1100, 8, 277, 304, 267, 282, 275, 9470, 342, 267, 282, 14, 873, 3252, 65, 356, 499, 1552, 267, 282, 14, 873, 3252, 66, 356, 841, 1552, 267, 282, 14, 873, 3252, 67, 356, 1695, 1552, 398, 291, 14, 629, 8, 65, 14, 8487, 1062, 469, 288, 283, 797, 356, 756, 12, 283, 403, 356, 488, 12, 283, 549, 356, 715, 12, 288, 283, 65, 356, 499, 12, 283, 66, 356, 841, 12, 283, 67, 356, 1695, 267, 3828, 339, 347, 511, 63, 1100, 63, 863, 19816, 8, 277, 304, 267, 408, 267, 327, 9335, 2182, 1553, 16612, 9132, 1077, 1736, 267, 408, 398, 511, 63, 576, 275, 791, 88, 356, 283, 89, 297, 283, 86, 356, 283, 90, 297, 283, 68, 356, 791, 79, 356, 909, 12, 283, 65, 356, 283, 66, 18620, 398, 291, 14, 629, 8, 2998, 8, 396, 63, 576, 395, 9470, 8, 396, 63, 576, 430, 398, 282, 275, 9470, 342, 267, 330, 275, 9470, 342, 267, 291, 14, 629, 8, 65, 12, 330, 9, 398, 327, 1678, 1454, 282, 267, 282, 14, 873, 3252, 65, 356, 413, 1552, 267, 291, 14, 7418, 8, 65, 12, 330, 9, 398, 327, 1678, 3865, 370, 1104, 10864, 267, 282, 14, 873, 3252, 67, 356, 650, 1552, 267, 330, 14, 873, 3252, 67, 356, 650, 1552, 267, 291, 14, 7418, 8, 65, 12, 330, 9, 398, 327, 1852, 18191, 18527, 4020, 267, 330, 14, 873, 3252, 65, 356, 413, 1552, 267, 291, 14, 629, 8, 65, 12, 330, 9, 339, 347, 511, 63, 1574, 63, 1069, 63, 1100, 63, 8122, 1885, 8, 277, 304, 267, 408, 267, 327, 1194, 15000, 1553, 11247, 13373, 9296, 1133, 746, 376, 1919, 267, 408, 267, 22538, 8, 10441, 8801, 1222, 1252, 1222, 342, 421, 199, 533, 22538, 2925, 8, 17968, 304, 339, 347, 511, 63, 2613, 63, 2118, 8, 277, 304, 267, 408, 267, 327, 10823, 2025, 1553, 1124, 3996, 2387, 3674, 1040, 436, 1124, 17679, 1040, 1077, 1736, 267, 10451, 14, 267, 408, 267, 6869, 275, 12580, 8, 16370, 1524, 288, 661, 1176, 14, 1160, 14, 16370, 14, 2102, 5286, 14, 5455, 297, 469, 355, 283, 1739, 356, 11400 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 504, 1639, 14, 1014, 492, 20730, 199, 504, 1639, 14, 1160, 492, 334, 272, 9470, 12, 12580, 12, 22538, 12, 5458, 12, 4905, 12, 4905, 7400, 12, 199, 9, 199, 504, 1639, 14, 1160, 14, 1100, 492, 17769, 2998, 199, 504, 1639, 14, 396, 492, 18638, 12, 24424, 421, 199, 533, 9470, 2925, 8, 17968, 304, 339, 347, 511, 63, 1100, 8, 277, 304, 267, 286, 275, 9470, 6333, 65, 582, 413, 12, 298, 66, 582, 298, 8568, 3605, 5984, 267, 291, 14, 629, 8, 67, 905, 65, 2255, 413, 9, 267, 291, 14, 629, 8, 67, 14, 5335, 1062, 5009, 267, 286, 905, 65, 937, 275, 499, 267, 291, 14, 629, 8, 67, 905, 65, 2255, 499, 9, 267, 291, 14, 629, 8, 67, 14, 362, 480, 65, 1288, 499, 9, 267, 291, 14, 629, 8, 67, 14, 1935, 1062, 2420, 65, 582, 499, 1552, 267, 291, 14, 629, 8, 67, 905, 65, 2255, 413, 9, 267, 291, 14, 629, 8, 67, 14, 362, 480, 1421, 401, 5685, 395, 5685, 9, 339, 347, 511, 63, 5335, 63, 1100, 63, 2609, 8, 277, 304, 267, 286, 275, 9470, 6333, 65, 582, 413, 1552, 267, 543, 286, 14, 5335, 837, 288, 286, 459, 65, 418, 275, 499, 288, 291, 14, 629, 8, 67, 459, 65, 995, 499, 9, 267, 291, 14, 629, 8, 67, 459, 65, 995, 413, 9, 398, 543, 286, 14, 5335, 8, 65, 29, 19, 304, 288, 291, 14, 629, 8, 67, 459, 65, 995, 650, 9, 267, 291, 14, 629, 8, 67, 459, 65, 995, 413, 9, 339, 347, 511, 63, 873, 63, 1100, 63, 2609, 8, 277, 304, 267, 286, 275, 9470, 6333, 65, 582, 413, 1552, 267, 543, 286, 14, 873, 24692, 304, 288, 286, 459, 65, 418, 275, 499, 288, 291, 14, 629, 8, 67, 459, 65, 995, 499, 9, 267, 291, 14, 629, 8, 67, 459, 65, 995, 413, 9, 398, 543, 286, 14, 873, 3252, 65, 356, 650, 22558, 288, 291, 14, 629, 8, 67, 459, 65, 995, 650, 9, 267, 291, 14, 629, 8, 67, 459, 65, 995, 413, 9, 339, 347, 511, 63, 5486, 8, 277, 304, 267, 286, 275, 9470, 342, 398, 671, 275, 286, 14, 5486, 360, 88, 297, 5685, 9, 267, 291, 14, 629, 8, 88, 12, 5685, 9, 267, 291, 14, 629, 8, 67, 459, 88, 995, 5685, 9, 398, 671, 275, 286, 14, 5486, 360, 88, 297, 2948, 9, 267, 291, 14, 629, 8, 88, 12, 5685, 9, 267, 291, 14, 629, 8, 67, 459, 88, 995, 5685, 9, 339, 347, 511, 63, 6983, 63, 265, 63, 1100, 63, 765, 8, 277, 304, 267, 408, 267, 327, 8881, 2277, 1553, 4905, 9296, 1133, 7512, 22538, 3102, 267, 408, 267, 2701, 63, 1100, 275, 9470, 342, 398, 543, 291, 14, 1855, 8, 2773, 7400, 304, 288, 4905, 360, 889, 63, 10180, 63, 1975, 1959, 6983, 8, 1667, 63, 1100, 9, 398, 543, 291, 14, 1855, 8, 2773, 7400, 304, 288, 4905, 360, 1222, 1959, 6983, 8, 1667, 63, 1100, 9, 398, 291, 14, 629, 8, 288, 4905, 360, 1222, 1959, 6983, 8, 2998, 3252, 1222, 356, 283, 1421, 936, 1826, 288, 283, 1421, 297, 267, 776, 339, 347, 511, 63, 3352, 63, 1100, 8, 277, 304, 267, 511, 63, 1100, 275, 17769, 2998, 3252, 4391, 4993, 356, 283, 387, 5989, 65, 3071, 398, 327, 1379, 626, 6675, 342, 10976, 2879, 370, 314, 2746, 2786, 1211, 267, 511, 63, 1100, 14, 5335, 342, 398, 511, 63, 1100, 459, 432, 362, 461, 418, 275, 283, 285, 280, 2239, 415, 7, 267, 291, 14, 629, 8, 513, 8, 396, 63, 1100, 395, 788, 432, 362, 461, 1105, 398, 291, 14, 8795, 360, 4391, 4993, 297, 511, 63, 1100, 9, 267, 543, 291, 14, 1855, 8, 10230, 304, 288, 511, 63, 1100, 459, 4391, 4993, 418, 267, 291, 14, 7702, 8, 396, 63, 1100, 14, 362, 360, 4391, 4993, 1333, 339, 347, 511, 63, 8487, 63, 1100, 8, 277, 304, 267, 282, 275, 9470, 342, 267, 282, 14, 873, 3252, 65, 356, 499, 1552, 267, 282, 14, 873, 3252, 66, 356, 841, 1552, 267, 282, 14, 873, 3252, 67, 356, 1695, 1552, 398, 291, 14, 629, 8, 65, 14, 8487, 1062, 469, 288, 283, 797, 356, 756, 12, 283, 403, 356, 488, 12, 283, 549, 356, 715, 12, 288, 283, 65, 356, 499, 12, 283, 66, 356, 841, 12, 283, 67, 356, 1695, 267, 3828, 339, 347, 511, 63, 1100, 63, 863, 19816, 8, 277, 304, 267, 408, 267, 327, 9335, 2182, 1553, 16612, 9132, 1077, 1736, 267, 408, 398, 511, 63, 576, 275, 791, 88, 356, 283, 89, 297, 283, 86, 356, 283, 90, 297, 283, 68, 356, 791, 79, 356, 909, 12, 283, 65, 356, 283, 66, 18620, 398, 291, 14, 629, 8, 2998, 8, 396, 63, 576, 395, 9470, 8, 396, 63, 576, 430, 398, 282, 275, 9470, 342, 267, 330, 275, 9470, 342, 267, 291, 14, 629, 8, 65, 12, 330, 9, 398, 327, 1678, 1454, 282, 267, 282, 14, 873, 3252, 65, 356, 413, 1552, 267, 291, 14, 7418, 8, 65, 12, 330, 9, 398, 327, 1678, 3865, 370, 1104, 10864, 267, 282, 14, 873, 3252, 67, 356, 650, 1552, 267, 330, 14, 873, 3252, 67, 356, 650, 1552, 267, 291, 14, 7418, 8, 65, 12, 330, 9, 398, 327, 1852, 18191, 18527, 4020, 267, 330, 14, 873, 3252, 65, 356, 413, 1552, 267, 291, 14, 629, 8, 65, 12, 330, 9, 339, 347, 511, 63, 1574, 63, 1069, 63, 1100, 63, 8122, 1885, 8, 277, 304, 267, 408, 267, 327, 1194, 15000, 1553, 11247, 13373, 9296, 1133, 746, 376, 1919, 267, 408, 267, 22538, 8, 10441, 8801, 1222, 1252, 1222, 342, 421, 199, 533, 22538, 2925, 8, 17968, 304, 339, 347, 511, 63, 2613, 63, 2118, 8, 277, 304, 267, 408, 267, 327, 10823, 2025, 1553, 1124, 3996, 2387, 3674, 1040, 436, 1124, 17679, 1040, 1077, 1736, 267, 10451, 14, 267, 408, 267, 6869, 275, 12580, 8, 16370, 1524, 288, 661, 1176, 14, 1160, 14, 16370, 14, 2102, 5286, 14, 5455, 297, 469, 355, 283, 1739, 356, 11400, 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, 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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 ]
veim/dpdk-16.11
examples/ip_pipeline/config/diagram-generator.py
4
12114
#!/usr/bin/env python # BSD LICENSE # # Copyright(c) 2016 Intel Corporation. All rights reserved. # 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 Intel Corporation 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. # # This script creates a visual representation for a configuration file used by # the DPDK ip_pipeline application. # # The input configuration file is translated to an output file in DOT syntax, # which is then used to create the image file using graphviz (www.graphviz.org). # from __future__ import print_function import argparse import re import os # # Command to generate the image file # DOT_COMMAND = 'dot -Gsize=20,30 -Tpng %s > %s' # # Layout of generated DOT file # DOT_INTRO = \ '#\n# Command to generate image file:\n# \t%s\n#\n\n' DOT_GRAPH_BEGIN = \ 'digraph g {\n graph [ splines = true rankdir = "LR" ]\n' DOT_NODE_LINK_RX = \ ' "%s RX" [ shape = box style = filled fillcolor = yellowgreen ]\n' DOT_NODE_LINK_TX = \ ' "%s TX" [ shape = box style = filled fillcolor = yellowgreen ]\n' DOT_NODE_KNI_RX = \ ' "%s RX" [ shape = box style = filled fillcolor = orange ]\n' DOT_NODE_KNI_TX = \ ' "%s TX" [ shape = box style = filled fillcolor = orange ]\n' DOT_NODE_TAP_RX = \ ' "%s RX" [ shape = box style = filled fillcolor = gold ]\n' DOT_NODE_TAP_TX = \ ' "%s TX" [ shape = box style = filled fillcolor = gold ]\n' DOT_NODE_SOURCE = \ ' "%s" [ shape = box style = filled fillcolor = darkgreen ]\n' DOT_NODE_SINK = \ ' "%s" [ shape = box style = filled fillcolor = peachpuff ]\n' DOT_NODE_PIPELINE = \ ' "%s" [ shape = box style = filled fillcolor = royalblue ]\n' DOT_EDGE_PKTQ = \ ' "%s" -> "%s" [ label = "%s" color = gray ]\n' DOT_GRAPH_END = \ '}\n' # Relationships between the graph nodes and the graph edges: # # Edge ID | Edge Label | Writer Node | Reader Node | Dependencies # --------+------------+-------------+---------------+-------------- # RXQx.y | RXQx.y | LINKx | PIPELINEz | LINKx # TXQx.y | TXQx.y | PIPELINEz | LINKx | LINKx # SWQx | SWQx | PIPELINEy | PIPELINEz | - # TMx | TMx | PIPELINEy | PIPELINEz | LINKx # KNIx RX | KNIx | KNIx RX | PIPELINEy | KNIx, LINKx # KNIx TX | KNIx | PIPELINEy | KNIx TX | KNIx, LINKx # TAPx RX | TAPx | TAPx RX | PIPELINEy | TAPx # TAPx TX | TAPx | PIPELINEy | TAPx TX | TAPx # SOURCEx | SOURCEx | SOURCEx | PIPELINEy | SOURCEx # SINKx | SINKx | PIPELINEy | SINKx | SINKx # # Parse the input configuration file to detect the graph nodes and edges # def process_config_file(cfgfile): edges = {} links = set() knis = set() taps = set() sources = set() sinks = set() pipelines = set() pipeline = '' dotfile = cfgfile + '.txt' imgfile = cfgfile + '.png' # # Read configuration file # lines = open(cfgfile, 'r') for line in lines: # Remove any leading and trailing white space characters line = line.strip() # Remove any comment at end of line line, sep, tail = line.partition(';') # Look for next "PIPELINE" section match = re.search(r'\[(PIPELINE\d+)\]', line) if match: pipeline = match.group(1) continue # Look for next "pktq_in" section entry match = re.search(r'pktq_in\s*=\s*(.+)', line) if match: pipelines.add(pipeline) for q in re.findall('\S+', match.group(1)): match_rxq = re.search(r'^RXQ(\d+)\.\d+$', q) match_swq = re.search(r'^SWQ\d+$', q) match_tm = re.search(r'^TM(\d+)$', q) match_kni = re.search(r'^KNI(\d+)$', q) match_tap = re.search(r'^TAP\d+$', q) match_source = re.search(r'^SOURCE\d+$', q) # Set ID for the current packet queue (graph edge) q_id = '' if match_rxq or match_swq or match_tm or match_source: q_id = q elif match_kni or match_tap: q_id = q + ' RX' else: print('Error: Unrecognized pktq_in element "%s"' % q) return # Add current packet queue to the set of graph edges if q_id not in edges: edges[q_id] = {} if 'label' not in edges[q_id]: edges[q_id]['label'] = q if 'readers' not in edges[q_id]: edges[q_id]['readers'] = [] if 'writers' not in edges[q_id]: edges[q_id]['writers'] = [] # Add reader for the new edge edges[q_id]['readers'].append(pipeline) # Check for RXQ if match_rxq: link = 'LINK' + str(match_rxq.group(1)) edges[q_id]['writers'].append(link + ' RX') links.add(link) continue # Check for SWQ if match_swq: continue # Check for TM if match_tm: link = 'LINK' + str(match_tm.group(1)) links.add(link) continue # Check for KNI if match_kni: link = 'LINK' + str(match_kni.group(1)) edges[q_id]['writers'].append(q_id) knis.add(q) links.add(link) continue # Check for TAP if match_tap: edges[q_id]['writers'].append(q_id) taps.add(q) continue # Check for SOURCE if match_source: edges[q_id]['writers'].append(q) sources.add(q) continue continue # Look for next "pktq_out" section entry match = re.search(r'pktq_out\s*=\s*(.+)', line) if match: for q in re.findall('\S+', match.group(1)): match_txq = re.search(r'^TXQ(\d+)\.\d+$', q) match_swq = re.search(r'^SWQ\d+$', q) match_tm = re.search(r'^TM(\d+)$', q) match_kni = re.search(r'^KNI(\d+)$', q) match_tap = re.search(r'^TAP(\d+)$', q) match_sink = re.search(r'^SINK(\d+)$', q) # Set ID for the current packet queue (graph edge) q_id = '' if match_txq or match_swq or match_tm or match_sink: q_id = q elif match_kni or match_tap: q_id = q + ' TX' else: print('Error: Unrecognized pktq_out element "%s"' % q) return # Add current packet queue to the set of graph edges if q_id not in edges: edges[q_id] = {} if 'label' not in edges[q_id]: edges[q_id]['label'] = q if 'readers' not in edges[q_id]: edges[q_id]['readers'] = [] if 'writers' not in edges[q_id]: edges[q_id]['writers'] = [] # Add writer for the new edge edges[q_id]['writers'].append(pipeline) # Check for TXQ if match_txq: link = 'LINK' + str(match_txq.group(1)) edges[q_id]['readers'].append(link + ' TX') links.add(link) continue # Check for SWQ if match_swq: continue # Check for TM if match_tm: link = 'LINK' + str(match_tm.group(1)) links.add(link) continue # Check for KNI if match_kni: link = 'LINK' + str(match_kni.group(1)) edges[q_id]['readers'].append(q_id) knis.add(q) links.add(link) continue # Check for TAP if match_tap: edges[q_id]['readers'].append(q_id) taps.add(q) continue # Check for SINK if match_sink: edges[q_id]['readers'].append(q) sinks.add(q) continue continue # # Write DOT file # print('Creating DOT file "%s" ...' % dotfile) dot_cmd = DOT_COMMAND % (dotfile, imgfile) file = open(dotfile, 'w') file.write(DOT_INTRO % dot_cmd) file.write(DOT_GRAPH_BEGIN) # Write the graph nodes to the DOT file for l in sorted(links): file.write(DOT_NODE_LINK_RX % l) file.write(DOT_NODE_LINK_TX % l) for k in sorted(knis): file.write(DOT_NODE_KNI_RX % k) file.write(DOT_NODE_KNI_TX % k) for t in sorted(taps): file.write(DOT_NODE_TAP_RX % t) file.write(DOT_NODE_TAP_TX % t) for s in sorted(sources): file.write(DOT_NODE_SOURCE % s) for s in sorted(sinks): file.write(DOT_NODE_SINK % s) for p in sorted(pipelines): file.write(DOT_NODE_PIPELINE % p) # Write the graph edges to the DOT file for q in sorted(edges.keys()): rw = edges[q] if 'writers' not in rw: print('Error: "%s" has no writer' % q) return if 'readers' not in rw: print('Error: "%s" has no reader' % q) return for w in rw['writers']: for r in rw['readers']: file.write(DOT_EDGE_PKTQ % (w, r, rw['label'])) file.write(DOT_GRAPH_END) file.close() # # Execute the DOT command to create the image file # print('Creating image file "%s" ...' % imgfile) if os.system('which dot > /dev/null'): print('Error: Unable to locate "dot" executable.' \ 'Please install the "graphviz" package (www.graphviz.org).') return os.system(dot_cmd) if __name__ == '__main__': parser = argparse.ArgumentParser(description=\ 'Create diagram for IP pipeline configuration file.') parser.add_argument( '-f', '--file', help='input configuration file (e.g. "ip_pipeline.cfg")', required=True) args = parser.parse_args() process_config_file(args.file)
gpl-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 257, 6289, 5113, 199, 3, 199, 3, 257, 1898, 8, 67, 9, 7800, 20619, 11098, 14, 2900, 4481, 4644, 14, 199, 3, 257, 2900, 4481, 4644, 14, 199, 3, 199, 3, 257, 10114, 436, 675, 315, 1350, 436, 3366, 4513, 12, 543, 503, 1928, 199, 3, 257, 7100, 12, 787, 8211, 2741, 626, 314, 2569, 3704, 199, 3, 257, 787, 7647, 26, 199, 3, 199, 3, 258, 627, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 3, 755, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 3, 258, 627, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 4248, 199, 3, 755, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 315, 199, 3, 755, 314, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 199, 3, 755, 4084, 14, 199, 3, 258, 627, 11443, 314, 536, 402, 20619, 11098, 6590, 314, 1561, 402, 2399, 199, 3, 755, 8417, 1443, 506, 1202, 370, 10692, 503, 10016, 7585, 7131, 199, 3, 755, 687, 642, 2032, 1928, 2488, 6791, 5313, 4983, 14, 199, 3, 199, 3, 257, 5749, 4141, 2281, 7049, 6515, 2334, 5877, 8164, 2401, 6483, 199, 3, 257, 298, 1179, 2281, 2, 2401, 1821, 7168, 1549, 5292, 2990, 12, 6931, 12, 5400, 2845, 199, 3, 257, 5471, 2296, 12, 2334, 5292, 2990, 1634, 3169, 2401, 3092, 2381, 199, 3, 257, 437, 3115, 3104, 9315, 9706, 14, 1621, 4825, 6461, 7000, 2334, 5877, 199, 3, 257, 11489, 1549, 6483, 6262, 7024, 2381, 1821, 8703, 12, 9168, 12, 9716, 12, 199, 3, 257, 8820, 12, 9836, 12, 1549, 9110, 6736, 334, 6446, 12, 5400, 2845, 199, 3, 257, 5471, 2296, 12, 9838, 1634, 9103, 9764, 1549, 9714, 27, 9102, 1634, 4815, 12, 199, 3, 257, 7126, 12, 1549, 9206, 27, 1549, 9748, 9831, 9, 9802, 9817, 2401, 5258, 1821, 199, 3, 257, 9815, 1634, 5603, 12, 7061, 1621, 7066, 12, 9644, 5603, 12, 1549, 7056, 199, 3, 257, 334, 6446, 9254, 1549, 7334, 9, 7043, 1621, 1821, 9683, 5738, 1634, 2334, 4815, 199, 3, 257, 1634, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 9726, 1634, 9712, 9784, 14, 199, 199, 3, 199, 3, 961, 2884, 8491, 282, 13104, 6025, 367, 282, 2897, 570, 1202, 701, 199, 3, 314, 577, 48, 10892, 3384, 63, 7379, 4223, 14, 199, 3, 199, 3, 710, 1324, 2897, 570, 365, 14598, 370, 376, 1072, 570, 315, 15854, 6302, 12, 199, 3, 1314, 365, 2066, 1202, 370, 1218, 314, 1834, 570, 1808, 3343, 17249, 334, 1544, 14, 2180, 17249, 14, 1308, 680, 199, 3, 199, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 646, 7534, 199, 646, 295, 199, 646, 747, 199, 199, 3, 199, 3, 5817, 370, 3550, 314, 1834, 570, 199, 3, 199, 13203, 63, 10761, 275, 283, 3287, 446, 39, 890, 29, 1165, 12, 1216, 446, 52, 4524, 450, 83, 690, 450, 83, 7, 199, 199, 3, 199, 3, 25604, 402, 4046, 15854, 570, 199, 3, 199, 13203, 63, 2919, 1092, 275, 971, 272, 3943, 60, 78, 3, 5817, 370, 3550, 1834, 570, 3427, 78, 3, 971, 84, 5, 83, 60, 78, 20262, 78, 60, 78, 7, 199, 13203, 63, 25302, 63, 15947, 275, 971, 272, 283, 328, 2180, 486, 9459, 78, 221, 3343, 359, 2249, 1278, 275, 2549, 6915, 694, 275, 298, 17665, 2, 1622, 60, 78, 7, 199, 13203, 63, 8063, 63, 7916, 63, 15361, 275, 971, 272, 283, 221, 2071, 83, 820, 56, 2, 359, 2215, 275, 5689, 3449, 275, 13457, 5554, 2326, 275, 31194, 7731, 1622, 60, 78, 7, 199, 13203, 63, 8063, 63, 7916, 63, 10051, 275, 971, 272, 283, 221, 2071, 83, 377, 56, 2, 359, 2215, 275, 5689, 3449, 275, 13457, 5554, 2326, 275, 31194, 7731, 1622, 60, 78, 7, 199, 13203, 63, 8063, 63, 43, 16730, 63, 15361, 275, 971, 272, 283, 221, 2071, 83, 820, 56, 2, 359, 2215, 275, 5689, 3449, 275, 13457, 5554, 2326, 275, 29713, 1622, 60, 78, 7, 199, 13203, 63, 8063, 63, 43, 16730, 63, 10051, 275, 971, 272, 283, 221, 2071, 83, 377, 56, 2, 359, 2215, 275, 5689, 3449, 275, 13457, 5554, 2326, 275, 29713, 1622, 60, 78, 7, 199, 13203, 63, 8063, 63, 52, 1282, 63, 15361, 275, 971, 272, 283, 221, 2071, 83, 820, 56, 2, 359, 2215, 275, 5689, 3449, 275, 13457, 5554, 2326, 275, 486, 1753, 1622, 60, 78, 7, 199, 13203, 63, 8063, 63, 52, 1282, 63, 10051, 275, 971, 272, 283, 221, 2071, 83, 377, 56, 2, 359, 2215, 275, 5689, 3449, 275, 13457, 5554, 2326, 275, 486, 1753, 1622, 60, 78, 7, 199, 13203, 63, 8063, 63, 10187, 275, 971, 272, 283, 221, 2071, 83, 2, 359, 2215, 275, 5689, 3449, 275, 13457, 5554, 2326, 275, 23531, 7731, 1622, 60, 78, 7, 199, 13203, 63, 8063, 63, 51, 12394, 275, 971, 272, 283, 221, 2071, 83, 2, 359, 2215, 275, 5689, 3449, 275, 13457, 5554, 2326, 275, 4837, 1225, 80, 3043, 1622, 60, 78, 7, 199, 13203, 63, 8063, 63, 6089, 6174, 275, 971, 272, 283, 221, 2071, 83, 2, 359, 2215, 275, 5689, 3449, 275, 13457, 5554, 2326, 275, 882, 31876, 6304, 1622, 60, 78, 7, 199, 13203, 63, 1149, 4962, 63, 8884, 52, 49, 275, 971, 272, 283, 221, 2071, 83, 2, 1035, 2071, 83, 2, 359, 1768, 275, 2071, 83, 2, 3164, 275, 21977, 1622, 60, 78, 7, 199, 13203, 63, 25302, 63, 3902, 275, 971, 272, 283, 4988, 78, 7, 199, 199, 3, 23230, 3319, 83, 3382, 314, 3343, 3380, 436, 314, 3343, 8207, 26, 199, 3, 199, 3, 25155, 2870, 1204, 25155, 10354, 1204, 24441, 5013, 1204, 23099, 5013, 257, 1204, 1487, 3209, 199, 3, 3001, 11, 4559, 11, 4559, 6793, 28423, 10965, 199, 3, 820, 56, 49, 88, 14, 89, 221, 1204, 820, 56, 49, 88, 14, 89, 258, 1204, 19774, 88, 755, 1204, 22773, 6174, 90, 258, 1204, 19774, 88, 199, 3, 377, 56, 49, 88, 14, 89, 221, 1204, 377, 56, 49, 88, 14, 89, 258, 1204, 22773, 6174, 90, 257, 1204, 19774, 88, 260, 1204, 19774, 88, 199, 3, 17548, 49, 88, 259, 1204, 17548, 49, 88, 755 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 257, 6289, 5113, 199, 3, 199, 3, 257, 1898, 8, 67, 9, 7800, 20619, 11098, 14, 2900, 4481, 4644, 14, 199, 3, 257, 2900, 4481, 4644, 14, 199, 3, 199, 3, 257, 10114, 436, 675, 315, 1350, 436, 3366, 4513, 12, 543, 503, 1928, 199, 3, 257, 7100, 12, 787, 8211, 2741, 626, 314, 2569, 3704, 199, 3, 257, 787, 7647, 26, 199, 3, 199, 3, 258, 627, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 3, 755, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 3, 258, 627, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 4248, 199, 3, 755, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 315, 199, 3, 755, 314, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 199, 3, 755, 4084, 14, 199, 3, 258, 627, 11443, 314, 536, 402, 20619, 11098, 6590, 314, 1561, 402, 2399, 199, 3, 755, 8417, 1443, 506, 1202, 370, 10692, 503, 10016, 7585, 7131, 199, 3, 755, 687, 642, 2032, 1928, 2488, 6791, 5313, 4983, 14, 199, 3, 199, 3, 257, 5749, 4141, 2281, 7049, 6515, 2334, 5877, 8164, 2401, 6483, 199, 3, 257, 298, 1179, 2281, 2, 2401, 1821, 7168, 1549, 5292, 2990, 12, 6931, 12, 5400, 2845, 199, 3, 257, 5471, 2296, 12, 2334, 5292, 2990, 1634, 3169, 2401, 3092, 2381, 199, 3, 257, 437, 3115, 3104, 9315, 9706, 14, 1621, 4825, 6461, 7000, 2334, 5877, 199, 3, 257, 11489, 1549, 6483, 6262, 7024, 2381, 1821, 8703, 12, 9168, 12, 9716, 12, 199, 3, 257, 8820, 12, 9836, 12, 1549, 9110, 6736, 334, 6446, 12, 5400, 2845, 199, 3, 257, 5471, 2296, 12, 9838, 1634, 9103, 9764, 1549, 9714, 27, 9102, 1634, 4815, 12, 199, 3, 257, 7126, 12, 1549, 9206, 27, 1549, 9748, 9831, 9, 9802, 9817, 2401, 5258, 1821, 199, 3, 257, 9815, 1634, 5603, 12, 7061, 1621, 7066, 12, 9644, 5603, 12, 1549, 7056, 199, 3, 257, 334, 6446, 9254, 1549, 7334, 9, 7043, 1621, 1821, 9683, 5738, 1634, 2334, 4815, 199, 3, 257, 1634, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 9726, 1634, 9712, 9784, 14, 199, 199, 3, 199, 3, 961, 2884, 8491, 282, 13104, 6025, 367, 282, 2897, 570, 1202, 701, 199, 3, 314, 577, 48, 10892, 3384, 63, 7379, 4223, 14, 199, 3, 199, 3, 710, 1324, 2897, 570, 365, 14598, 370, 376, 1072, 570, 315, 15854, 6302, 12, 199, 3, 1314, 365, 2066, 1202, 370, 1218, 314, 1834, 570, 1808, 3343, 17249, 334, 1544, 14, 2180, 17249, 14, 1308, 680, 199, 3, 199, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 646, 7534, 199, 646, 295, 199, 646, 747, 199, 199, 3, 199, 3, 5817, 370, 3550, 314, 1834, 570, 199, 3, 199, 13203, 63, 10761, 275, 283, 3287, 446, 39, 890, 29, 1165, 12, 1216, 446, 52, 4524, 450, 83, 690, 450, 83, 7, 199, 199, 3, 199, 3, 25604, 402, 4046, 15854, 570, 199, 3, 199, 13203, 63, 2919, 1092, 275, 971, 272, 3943, 60, 78, 3, 5817, 370, 3550, 1834, 570, 3427, 78, 3, 971, 84, 5, 83, 60, 78, 20262, 78, 60, 78, 7, 199, 13203, 63, 25302, 63, 15947, 275, 971, 272, 283, 328, 2180, 486, 9459, 78, 221, 3343, 359, 2249, 1278, 275, 2549, 6915, 694, 275, 298, 17665, 2, 1622, 60, 78, 7, 199, 13203, 63, 8063, 63, 7916, 63, 15361, 275, 971, 272, 283, 221, 2071, 83, 820, 56, 2, 359, 2215, 275, 5689, 3449, 275, 13457, 5554, 2326, 275, 31194, 7731, 1622, 60, 78, 7, 199, 13203, 63, 8063, 63, 7916, 63, 10051, 275, 971, 272, 283, 221, 2071, 83, 377, 56, 2, 359, 2215, 275, 5689, 3449, 275, 13457, 5554, 2326, 275, 31194, 7731, 1622, 60, 78, 7, 199, 13203, 63, 8063, 63, 43, 16730, 63, 15361, 275, 971, 272, 283, 221, 2071, 83, 820, 56, 2, 359, 2215, 275, 5689, 3449, 275, 13457, 5554, 2326, 275, 29713, 1622, 60, 78, 7, 199, 13203, 63, 8063, 63, 43, 16730, 63, 10051, 275, 971, 272, 283, 221, 2071, 83, 377, 56, 2, 359, 2215, 275, 5689, 3449, 275, 13457, 5554, 2326, 275, 29713, 1622, 60, 78, 7, 199, 13203, 63, 8063, 63, 52, 1282, 63, 15361, 275, 971, 272, 283, 221, 2071, 83, 820, 56, 2, 359, 2215, 275, 5689, 3449, 275, 13457, 5554, 2326, 275, 486, 1753, 1622, 60, 78, 7, 199, 13203, 63, 8063, 63, 52, 1282, 63, 10051, 275, 971, 272, 283, 221, 2071, 83, 377, 56, 2, 359, 2215, 275, 5689, 3449, 275, 13457, 5554, 2326, 275, 486, 1753, 1622, 60, 78, 7, 199, 13203, 63, 8063, 63, 10187, 275, 971, 272, 283, 221, 2071, 83, 2, 359, 2215, 275, 5689, 3449, 275, 13457, 5554, 2326, 275, 23531, 7731, 1622, 60, 78, 7, 199, 13203, 63, 8063, 63, 51, 12394, 275, 971, 272, 283, 221, 2071, 83, 2, 359, 2215, 275, 5689, 3449, 275, 13457, 5554, 2326, 275, 4837, 1225, 80, 3043, 1622, 60, 78, 7, 199, 13203, 63, 8063, 63, 6089, 6174, 275, 971, 272, 283, 221, 2071, 83, 2, 359, 2215, 275, 5689, 3449, 275, 13457, 5554, 2326, 275, 882, 31876, 6304, 1622, 60, 78, 7, 199, 13203, 63, 1149, 4962, 63, 8884, 52, 49, 275, 971, 272, 283, 221, 2071, 83, 2, 1035, 2071, 83, 2, 359, 1768, 275, 2071, 83, 2, 3164, 275, 21977, 1622, 60, 78, 7, 199, 13203, 63, 25302, 63, 3902, 275, 971, 272, 283, 4988, 78, 7, 199, 199, 3, 23230, 3319, 83, 3382, 314, 3343, 3380, 436, 314, 3343, 8207, 26, 199, 3, 199, 3, 25155, 2870, 1204, 25155, 10354, 1204, 24441, 5013, 1204, 23099, 5013, 257, 1204, 1487, 3209, 199, 3, 3001, 11, 4559, 11, 4559, 6793, 28423, 10965, 199, 3, 820, 56, 49, 88, 14, 89, 221, 1204, 820, 56, 49, 88, 14, 89, 258, 1204, 19774, 88, 755, 1204, 22773, 6174, 90, 258, 1204, 19774, 88, 199, 3, 377, 56, 49, 88, 14, 89, 221, 1204, 377, 56, 49, 88, 14, 89, 258, 1204, 22773, 6174, 90, 257, 1204, 19774, 88, 260, 1204, 19774, 88, 199, 3, 17548, 49, 88, 259, 1204, 17548, 49, 88, 755, 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 ]
michellab/SireUnitTests
unittests/SireIO/test_amberterms.py
1
5571
from Sire.IO import * from Sire.MM import * from Sire.Mol import * from Sire.CAS import * from Sire.Maths import * from nose.tools import assert_almost_equal rangen = RanGenerator() mol = MoleculeParser.read("../io/ose.top","../io/ose.crd") \ [MolWithResID(ResName("OSE"))].molecule() def _assert_expressions_equal(ex0, ex1, symbol): try: for i in range(0,100): values = {symbol:rangen.rand(-5.0,5.0)} assert_almost_equal( ex0.evaluate(values), ex1.evaluate(values) ) except Exception as e: print("FAILED: %s != %s" % (ex0,ex1)) raise e def test_bonds(verbose=False): bonds = mol.property("bond").potentials() for bond in bonds: pot = bond.function() amberbond = AmberBond(pot, Symbol("r")) if verbose: print("%s == %s ??" % (amberbond,pot)) _assert_expressions_equal( pot, amberbond.toExpression(Symbol("r")), Symbol("r") ) def test_angles(verbose=False): angles = mol.property("angle").potentials() for angle in angles: pot = angle.function() amberangle = AmberAngle(pot, Symbol("theta")) if verbose: print("%s == %s ??" % (amberangle,pot)) _assert_expressions_equal( pot, amberangle.toExpression(Symbol("theta")), Symbol("theta") ) def test_dihedrals(verbose=False): dihedrals = mol.property("dihedral").potentials() for dihedral in dihedrals: pot = dihedral.function() amberdihedral = AmberDihedral(pot, Symbol("phi")) if verbose: print("%s == %s ??" % (amberdihedral,pot)) _assert_expressions_equal( pot, amberdihedral.toExpression(Symbol("phi")), Symbol("phi") ) def test_impropers(verbose=False): impropers = mol.property("improper").potentials() for improper in impropers: pot = improper.function() amberdihedral = AmberDihedral(pot, Symbol("phi")) if verbose: print("%s == %s ??" % (amberdihedral,pot)) _assert_expressions_equal( pot, amberdihedral.toExpression(Symbol("phi")), Symbol("phi") ) def test_dihedral_forms(verbose=False): # The symbol for the expression. Phi = Symbol("Phi") # First test single terms expressions. # 1. Standard form. f = Expression(0.3 * (1 + Cos(4*Phi - 2.0))) # Functional form. d = AmberDihedral(f, Phi) # The Amber dihedral object. t = d[0] # The dihedral part (term). # Make sure k, periodicity, and phase are correct. assert_almost_equal(t.k(), 0.3) assert t.periodicity() == 4 assert_almost_equal(t.phase(), 2.0) # 2. Negative k. f = Expression(-0.3 * (1 + Cos(4*Phi - 2.0))) # Functional form. d = AmberDihedral(f, Phi) # The Amber dihedral object. t = d[0] # The dihedral part (term). # Make sure k, periodicity, and phase are correct. assert_almost_equal(t.k(), -0.3) assert t.periodicity() == 4 assert_almost_equal(t.phase(), 2.0) # 3. k [ 1 - cos(Phi - phase) ] f = Expression(0.3 * (1 - Cos(4*Phi - 2.0))) # Functional form. d = AmberDihedral(f, Phi) # The Amber dihedral object. t = d[0] # The dihedral part (term). # Make sure k, periodicity, and phase are correct. assert_almost_equal(t.k(), 0.3) assert t.periodicity() == 4 assert_almost_equal(t.phase(), 2.0 - pi) # Now check series expressions with different types of term. # A regular AMBER style dihedral series. All terms have positive cosine factors. f = Expression(0.3 * (1 + Cos(Phi)) + 0.8 * (1 + Cos(4 * Phi))) d = AmberDihedral(f, Phi) # Assert that the expression is the same. assert d.toExpression(Phi) == f # Try to create an AmberDihedral from a using terms with positive and # negative cosine factors. These appear in the CHARMM force field. f = Expression(0.3 * (1 + Cos(Phi)) - 0.8 * (1 + Cos(4 * Phi))) d = AmberDihedral(f, Phi) # Assert that the expression is the same. assert d.toExpression(Phi) == f # Try to create an AmberDihedral from a using terms with positive and # negative cosine factors, with the negative arising from a representation # of the form k [ 1 - Cos(Phi) ], rather than -k [ 1 + Cos(Phi) ]. These # can occur in Gromacs. f = Expression(0.3 * (1 + Cos(Phi)) + 0.8 * (1 - Cos(4 * Phi))) d = AmberDihedral(f, Phi) # Create a value object: Phi = 2.0. val = Values(SymbolValue(Phi.ID(), 2.0)) # Make sure both expressions evaluate to the same result. assert_almost_equal(f.evaluate(val), d.toExpression(Phi).evaluate(val)) # Try a three-term expression that mixes all formats. f = Expression(0.3 * (1 + Cos(Phi)) -1.2 * (1 + Cos(3 * Phi)) + 0.8 * (1 - Cos(4 * Phi))) d = AmberDihedral(f, Phi) assert_almost_equal(f.evaluate(val), d.toExpression(Phi).evaluate(val)) # Try a three-term expression with equal factors. f = Expression(0.3 * (1 + Cos(Phi)) -0.3 * (1 + Cos(3 * Phi)) + 0.3 * (1 - Cos(4 * Phi))) d = AmberDihedral(f, Phi) assert_almost_equal(f.evaluate(val), d.toExpression(Phi).evaluate(val)) if __name__ == "__main__": test_bonds(True) test_angles(True) test_dihedrals(True) test_dihedral_forms(True) test_impropers(True)
gpl-3.0
[ 504, 428, 3621, 14, 2090, 492, 627, 199, 504, 428, 3621, 14, 3218, 492, 627, 199, 504, 428, 3621, 14, 45, 393, 492, 627, 199, 504, 428, 3621, 14, 9777, 492, 627, 199, 504, 428, 3621, 14, 18568, 83, 492, 627, 199, 199, 504, 11354, 14, 2537, 492, 702, 63, 4398, 63, 1452, 199, 199, 82, 621, 287, 275, 820, 290, 7599, 342, 199, 199, 16924, 275, 3930, 14413, 2842, 14, 739, 480, 5093, 2308, 15, 3362, 14, 2119, 2266, 5093, 2308, 15, 3362, 14, 1556, 68, 531, 971, 267, 359, 45, 393, 3007, 1322, 998, 8, 1322, 985, 480, 47, 899, 2237, 1055, 26310, 342, 199, 199, 318, 485, 479, 63, 15264, 63, 1452, 8, 476, 16, 12, 444, 17, 12, 5272, 304, 272, 862, 26, 267, 367, 284, 315, 1425, 8, 16, 12, 1960, 304, 288, 1338, 275, 469, 5155, 26, 82, 621, 287, 14, 3759, 2801, 21, 14, 16, 12, 21, 14, 16, 6769, 953, 702, 63, 4398, 63, 1452, 8, 444, 16, 14, 7383, 8, 1459, 395, 444, 17, 14, 7383, 8, 1459, 9, 776, 272, 871, 2186, 465, 325, 26, 267, 870, 480, 12299, 26, 450, 83, 1137, 450, 83, 2, 450, 334, 476, 16, 12, 476, 17, 430, 267, 746, 325, 199, 199, 318, 511, 63, 27816, 8, 3832, 29, 797, 304, 272, 23672, 795, 275, 22956, 14, 1829, 480, 21410, 3471, 24668, 83, 342, 339, 367, 23119, 315, 23672, 795, 26, 267, 27701, 275, 23119, 14, 1593, 342, 267, 282, 976, 21410, 275, 437, 976, 34, 7835, 8, 14173, 12, 10080, 480, 82, 2237, 398, 340, 3376, 26, 1467, 870, 3647, 83, 508, 450, 83, 5805, 13472, 450, 334, 455, 605, 21410, 12, 14173, 430, 398, 485, 479, 63, 15264, 63, 1452, 8, 27701, 12, 282, 976, 21410, 14, 475, 9093, 8, 8169, 480, 82, 8150, 3521, 10080, 480, 82, 531, 776, 199, 199, 318, 511, 63, 13162, 8, 3832, 29, 797, 304, 272, 22597, 275, 22956, 14, 1829, 480, 4593, 3471, 24668, 83, 342, 339, 367, 9324, 315, 22597, 26, 267, 27701, 275, 9324, 14, 1593, 342, 267, 282, 976, 4593, 275, 437, 976, 16943, 8, 14173, 12, 10080, 480, 9337, 2237, 398, 340, 3376, 26, 1467, 870, 3647, 83, 508, 450, 83, 5805, 13472, 450, 334, 455, 605, 4593, 12, 14173, 430, 398, 485, 479, 63, 15264, 63, 1452, 8, 27701, 12, 282, 976, 4593, 14, 475, 9093, 8, 8169, 480, 9337, 8150, 3521, 10080, 480, 9337, 531, 776, 199, 199, 318, 511, 63, 328, 19985, 82, 2551, 8, 3832, 29, 797, 304, 272, 487, 19985, 82, 2551, 275, 22956, 14, 1829, 480, 328, 27425, 3471, 24668, 83, 342, 339, 367, 487, 27425, 315, 487, 19985, 82, 2551, 26, 267, 27701, 275, 487, 27425, 14, 1593, 342, 267, 282, 976, 328, 27425, 275, 437, 976, 1341, 27425, 8, 14173, 12, 10080, 480, 10909, 2237, 398, 340, 3376, 26, 1467, 870, 3647, 83, 508, 450, 83, 5805, 13472, 450, 334, 455, 605, 328, 27425, 12, 14173, 430, 398, 485, 479, 63, 15264, 63, 1452, 8, 27701, 12, 282, 976, 328, 27425, 14, 475, 9093, 8, 8169, 480, 10909, 8150, 3521, 10080, 480, 10909, 531, 776, 199, 199, 318, 511, 63, 3236, 9198, 83, 8, 3832, 29, 797, 304, 272, 1742, 9198, 83, 275, 22956, 14, 1829, 480, 3236, 9198, 3471, 24668, 83, 342, 339, 367, 1742, 9198, 315, 1742, 9198, 83, 26, 267, 27701, 275, 1742, 9198, 14, 1593, 342, 267, 282, 976, 328, 27425, 275, 437, 976, 1341, 27425, 8, 14173, 12, 10080, 480, 10909, 2237, 398, 340, 3376, 26, 1467, 870, 3647, 83, 508, 450, 83, 5805, 13472, 450, 334, 455, 605, 328, 27425, 12, 14173, 430, 398, 485, 479, 63, 15264, 63, 1452, 8, 27701, 12, 282, 976, 328, 27425, 14, 475, 9093, 8, 8169, 480, 10909, 8150, 3521, 10080, 480, 10909, 531, 776, 199, 318, 511, 63, 328, 27425, 63, 3351, 8, 3832, 29, 797, 304, 339, 327, 710, 5272, 367, 314, 3965, 14, 272, 510, 5812, 275, 10080, 480, 5663, 73, 531, 339, 327, 7758, 511, 2849, 2895, 8455, 14, 339, 327, 413, 14, 9739, 1824, 14, 272, 289, 275, 22013, 8, 16, 14, 19, 627, 334, 17, 435, 445, 736, 8, 20, 10, 5663, 73, 446, 499, 14, 16, 1724, 259, 327, 6801, 279, 1824, 14, 272, 366, 275, 437, 976, 1341, 27425, 8, 70, 12, 510, 5812, 9, 9668, 327, 710, 437, 976, 487, 27425, 909, 14, 272, 307, 275, 366, 59, 16, 61, 2476, 263, 327, 710, 487, 27425, 1777, 334, 5125, 680, 339, 327, 4155, 3238, 1022, 12, 1126, 2308, 328, 3690, 12, 436, 7669, 787, 3211, 14, 272, 702, 63, 4398, 63, 1452, 8, 84, 14, 75, 1062, 378, 14, 19, 9, 272, 702, 307, 14, 529, 2308, 328, 3690, 342, 508, 841, 272, 702, 63, 4398, 63, 1452, 8, 84, 14, 6971, 1062, 499, 14, 16, 9, 339, 327, 499, 14, 32548, 1022, 14, 272, 289, 275, 22013, 2801, 16, 14, 19, 627, 334, 17, 435, 445, 736, 8, 20, 10, 5663, 73, 446, 499, 14, 16, 1724, 257, 327, 6801, 279, 1824, 14, 272, 366, 275, 437, 976, 1341, 27425, 8, 70, 12, 510, 5812, 9, 9668, 327, 710, 437, 976, 487, 27425, 909, 14, 272, 307, 275, 366, 59, 16, 61, 2476, 263, 327, 710, 487, 27425, 1777, 334, 5125, 680, 339, 327, 4155, 3238, 1022, 12, 1126, 2308, 328, 3690, 12, 436, 7669, 787, 3211, 14, 272, 702, 63, 4398, 63, 1452, 8, 84, 14, 75, 1062, 446, 16, 14, 19, 9, 272, 702, 307, 14, 529, 2308, 328, 3690, 342, 508, 841, 272, 702, 63, 4398, 63, 1452, 8, 84, 14, 6971, 1062, 499, 14, 16, 9, 339, 327, 650, 14, 1022, 359, 413, 446, 9794, 8, 5663, 73, 446, 7669, 9, 1622, 272, 289, 275, 22013, 8, 16, 14, 19, 627, 334, 17, 446, 445, 736, 8, 20, 10, 5663, 73, 446, 499, 14, 16, 1724, 259, 327, 6801, 279, 1824, 14, 272, 366, 275, 437, 976, 1341, 27425, 8, 70, 12, 510, 5812, 9, 9668, 327, 710, 437, 976, 487, 27425, 909, 14, 272, 307, 275, 366, 59, 16, 61, 2476, 263, 327, 710, 487, 27425, 1777, 334, 5125 ]
[ 428, 3621, 14, 2090, 492, 627, 199, 504, 428, 3621, 14, 3218, 492, 627, 199, 504, 428, 3621, 14, 45, 393, 492, 627, 199, 504, 428, 3621, 14, 9777, 492, 627, 199, 504, 428, 3621, 14, 18568, 83, 492, 627, 199, 199, 504, 11354, 14, 2537, 492, 702, 63, 4398, 63, 1452, 199, 199, 82, 621, 287, 275, 820, 290, 7599, 342, 199, 199, 16924, 275, 3930, 14413, 2842, 14, 739, 480, 5093, 2308, 15, 3362, 14, 2119, 2266, 5093, 2308, 15, 3362, 14, 1556, 68, 531, 971, 267, 359, 45, 393, 3007, 1322, 998, 8, 1322, 985, 480, 47, 899, 2237, 1055, 26310, 342, 199, 199, 318, 485, 479, 63, 15264, 63, 1452, 8, 476, 16, 12, 444, 17, 12, 5272, 304, 272, 862, 26, 267, 367, 284, 315, 1425, 8, 16, 12, 1960, 304, 288, 1338, 275, 469, 5155, 26, 82, 621, 287, 14, 3759, 2801, 21, 14, 16, 12, 21, 14, 16, 6769, 953, 702, 63, 4398, 63, 1452, 8, 444, 16, 14, 7383, 8, 1459, 395, 444, 17, 14, 7383, 8, 1459, 9, 776, 272, 871, 2186, 465, 325, 26, 267, 870, 480, 12299, 26, 450, 83, 1137, 450, 83, 2, 450, 334, 476, 16, 12, 476, 17, 430, 267, 746, 325, 199, 199, 318, 511, 63, 27816, 8, 3832, 29, 797, 304, 272, 23672, 795, 275, 22956, 14, 1829, 480, 21410, 3471, 24668, 83, 342, 339, 367, 23119, 315, 23672, 795, 26, 267, 27701, 275, 23119, 14, 1593, 342, 267, 282, 976, 21410, 275, 437, 976, 34, 7835, 8, 14173, 12, 10080, 480, 82, 2237, 398, 340, 3376, 26, 1467, 870, 3647, 83, 508, 450, 83, 5805, 13472, 450, 334, 455, 605, 21410, 12, 14173, 430, 398, 485, 479, 63, 15264, 63, 1452, 8, 27701, 12, 282, 976, 21410, 14, 475, 9093, 8, 8169, 480, 82, 8150, 3521, 10080, 480, 82, 531, 776, 199, 199, 318, 511, 63, 13162, 8, 3832, 29, 797, 304, 272, 22597, 275, 22956, 14, 1829, 480, 4593, 3471, 24668, 83, 342, 339, 367, 9324, 315, 22597, 26, 267, 27701, 275, 9324, 14, 1593, 342, 267, 282, 976, 4593, 275, 437, 976, 16943, 8, 14173, 12, 10080, 480, 9337, 2237, 398, 340, 3376, 26, 1467, 870, 3647, 83, 508, 450, 83, 5805, 13472, 450, 334, 455, 605, 4593, 12, 14173, 430, 398, 485, 479, 63, 15264, 63, 1452, 8, 27701, 12, 282, 976, 4593, 14, 475, 9093, 8, 8169, 480, 9337, 8150, 3521, 10080, 480, 9337, 531, 776, 199, 199, 318, 511, 63, 328, 19985, 82, 2551, 8, 3832, 29, 797, 304, 272, 487, 19985, 82, 2551, 275, 22956, 14, 1829, 480, 328, 27425, 3471, 24668, 83, 342, 339, 367, 487, 27425, 315, 487, 19985, 82, 2551, 26, 267, 27701, 275, 487, 27425, 14, 1593, 342, 267, 282, 976, 328, 27425, 275, 437, 976, 1341, 27425, 8, 14173, 12, 10080, 480, 10909, 2237, 398, 340, 3376, 26, 1467, 870, 3647, 83, 508, 450, 83, 5805, 13472, 450, 334, 455, 605, 328, 27425, 12, 14173, 430, 398, 485, 479, 63, 15264, 63, 1452, 8, 27701, 12, 282, 976, 328, 27425, 14, 475, 9093, 8, 8169, 480, 10909, 8150, 3521, 10080, 480, 10909, 531, 776, 199, 199, 318, 511, 63, 3236, 9198, 83, 8, 3832, 29, 797, 304, 272, 1742, 9198, 83, 275, 22956, 14, 1829, 480, 3236, 9198, 3471, 24668, 83, 342, 339, 367, 1742, 9198, 315, 1742, 9198, 83, 26, 267, 27701, 275, 1742, 9198, 14, 1593, 342, 267, 282, 976, 328, 27425, 275, 437, 976, 1341, 27425, 8, 14173, 12, 10080, 480, 10909, 2237, 398, 340, 3376, 26, 1467, 870, 3647, 83, 508, 450, 83, 5805, 13472, 450, 334, 455, 605, 328, 27425, 12, 14173, 430, 398, 485, 479, 63, 15264, 63, 1452, 8, 27701, 12, 282, 976, 328, 27425, 14, 475, 9093, 8, 8169, 480, 10909, 8150, 3521, 10080, 480, 10909, 531, 776, 199, 318, 511, 63, 328, 27425, 63, 3351, 8, 3832, 29, 797, 304, 339, 327, 710, 5272, 367, 314, 3965, 14, 272, 510, 5812, 275, 10080, 480, 5663, 73, 531, 339, 327, 7758, 511, 2849, 2895, 8455, 14, 339, 327, 413, 14, 9739, 1824, 14, 272, 289, 275, 22013, 8, 16, 14, 19, 627, 334, 17, 435, 445, 736, 8, 20, 10, 5663, 73, 446, 499, 14, 16, 1724, 259, 327, 6801, 279, 1824, 14, 272, 366, 275, 437, 976, 1341, 27425, 8, 70, 12, 510, 5812, 9, 9668, 327, 710, 437, 976, 487, 27425, 909, 14, 272, 307, 275, 366, 59, 16, 61, 2476, 263, 327, 710, 487, 27425, 1777, 334, 5125, 680, 339, 327, 4155, 3238, 1022, 12, 1126, 2308, 328, 3690, 12, 436, 7669, 787, 3211, 14, 272, 702, 63, 4398, 63, 1452, 8, 84, 14, 75, 1062, 378, 14, 19, 9, 272, 702, 307, 14, 529, 2308, 328, 3690, 342, 508, 841, 272, 702, 63, 4398, 63, 1452, 8, 84, 14, 6971, 1062, 499, 14, 16, 9, 339, 327, 499, 14, 32548, 1022, 14, 272, 289, 275, 22013, 2801, 16, 14, 19, 627, 334, 17, 435, 445, 736, 8, 20, 10, 5663, 73, 446, 499, 14, 16, 1724, 257, 327, 6801, 279, 1824, 14, 272, 366, 275, 437, 976, 1341, 27425, 8, 70, 12, 510, 5812, 9, 9668, 327, 710, 437, 976, 487, 27425, 909, 14, 272, 307, 275, 366, 59, 16, 61, 2476, 263, 327, 710, 487, 27425, 1777, 334, 5125, 680, 339, 327, 4155, 3238, 1022, 12, 1126, 2308, 328, 3690, 12, 436, 7669, 787, 3211, 14, 272, 702, 63, 4398, 63, 1452, 8, 84, 14, 75, 1062, 446, 16, 14, 19, 9, 272, 702, 307, 14, 529, 2308, 328, 3690, 342, 508, 841, 272, 702, 63, 4398, 63, 1452, 8, 84, 14, 6971, 1062, 499, 14, 16, 9, 339, 327, 650, 14, 1022, 359, 413, 446, 9794, 8, 5663, 73, 446, 7669, 9, 1622, 272, 289, 275, 22013, 8, 16, 14, 19, 627, 334, 17, 446, 445, 736, 8, 20, 10, 5663, 73, 446, 499, 14, 16, 1724, 259, 327, 6801, 279, 1824, 14, 272, 366, 275, 437, 976, 1341, 27425, 8, 70, 12, 510, 5812, 9, 9668, 327, 710, 437, 976, 487, 27425, 909, 14, 272, 307, 275, 366, 59, 16, 61, 2476, 263, 327, 710, 487, 27425, 1777, 334, 5125, 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, 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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 ]
sszlm/MissionPlanner
Lib/shelve.py
59
8317
"""Manage shelves of pickled objects. A "shelf" is a persistent, dictionary-like object. The difference with dbm databases is that the values (not the keys!) in a shelf can be essentially arbitrary Python objects -- anything that the "pickle" module can handle. This includes most class instances, recursive data types, and objects containing lots of shared sub-objects. The keys are ordinary strings. To summarize the interface (key is a string, data is an arbitrary object): import shelve d = shelve.open(filename) # open, with (g)dbm filename -- no suffix d[key] = data # store data at key (overwrites old data if # using an existing key) data = d[key] # retrieve a COPY of the data at key (raise # KeyError if no such key) -- NOTE that this # access returns a *copy* of the entry! del d[key] # delete data stored at key (raises KeyError # if no such key) flag = d.has_key(key) # true if the key exists; same as "key in d" list = d.keys() # a list of all existing keys (slow!) d.close() # close it Dependent on the implementation, closing a persistent dictionary may or may not be necessary to flush changes to disk. Normally, d[key] returns a COPY of the entry. This needs care when mutable entries are mutated: for example, if d[key] is a list, d[key].append(anitem) does NOT modify the entry d[key] itself, as stored in the persistent mapping -- it only modifies the copy, which is then immediately discarded, so that the append has NO effect whatsoever. To append an item to d[key] in a way that will affect the persistent mapping, use: data = d[key] data.append(anitem) d[key] = data To avoid the problem with mutable entries, you may pass the keyword argument writeback=True in the call to shelve.open. When you use: d = shelve.open(filename, writeback=True) then d keeps a cache of all entries you access, and writes them all back to the persistent mapping when you call d.close(). This ensures that such usage as d[key].append(anitem) works as intended. However, using keyword argument writeback=True may consume vast amount of memory for the cache, and it may make d.close() very slow, if you access many of d's entries after opening it in this way: d has no way to check which of the entries you access are mutable and/or which ones you actually mutate, so it must cache, and write back at close, all of the entries that you access. You can call d.sync() to write back all the entries in the cache, and empty the cache (d.sync() also synchronizes the persistent dictionary on disk, if feasible). """ # Try using cPickle and cStringIO if available. try: from cPickle import Pickler, Unpickler except ImportError: from pickle import Pickler, Unpickler try: from cStringIO import StringIO except ImportError: from StringIO import StringIO import UserDict __all__ = ["Shelf","BsdDbShelf","DbfilenameShelf","open"] class _ClosedDict(UserDict.DictMixin): 'Marker for a closed dict. Access attempts raise a ValueError.' def closed(self, *args): raise ValueError('invalid operation on closed shelf') __getitem__ = __setitem__ = __delitem__ = keys = closed def __repr__(self): return '<Closed Dictionary>' class Shelf(UserDict.DictMixin): """Base class for shelf implementations. This is initialized with a dictionary-like object. See the module's __doc__ string for an overview of the interface. """ def __init__(self, dict, protocol=None, writeback=False): self.dict = dict if protocol is None: protocol = 0 self._protocol = protocol self.writeback = writeback self.cache = {} def keys(self): return self.dict.keys() def __len__(self): return len(self.dict) def has_key(self, key): return key in self.dict def __contains__(self, key): return key in self.dict def get(self, key, default=None): if key in self.dict: return self[key] return default def __getitem__(self, key): try: value = self.cache[key] except KeyError: f = StringIO(self.dict[key]) value = Unpickler(f).load() if self.writeback: self.cache[key] = value return value def __setitem__(self, key, value): if self.writeback: self.cache[key] = value f = StringIO() p = Pickler(f, self._protocol) p.dump(value) self.dict[key] = f.getvalue() def __delitem__(self, key): del self.dict[key] try: del self.cache[key] except KeyError: pass def close(self): self.sync() try: self.dict.close() except AttributeError: pass # Catch errors that may happen when close is called from __del__ # because CPython is in interpreter shutdown. try: self.dict = _ClosedDict() except (NameError, TypeError): self.dict = None def __del__(self): if not hasattr(self, 'writeback'): # __init__ didn't succeed, so don't bother closing return self.close() def sync(self): if self.writeback and self.cache: self.writeback = False for key, entry in self.cache.iteritems(): self[key] = entry self.writeback = True self.cache = {} if hasattr(self.dict, 'sync'): self.dict.sync() class BsdDbShelf(Shelf): """Shelf implementation using the "BSD" db interface. This adds methods first(), next(), previous(), last() and set_location() that have no counterpart in [g]dbm databases. The actual database must be opened using one of the "bsddb" modules "open" routines (i.e. bsddb.hashopen, bsddb.btopen or bsddb.rnopen) and passed to the constructor. See the module's __doc__ string for an overview of the interface. """ def __init__(self, dict, protocol=None, writeback=False): Shelf.__init__(self, dict, protocol, writeback) def set_location(self, key): (key, value) = self.dict.set_location(key) f = StringIO(value) return (key, Unpickler(f).load()) def next(self): (key, value) = self.dict.next() f = StringIO(value) return (key, Unpickler(f).load()) def previous(self): (key, value) = self.dict.previous() f = StringIO(value) return (key, Unpickler(f).load()) def first(self): (key, value) = self.dict.first() f = StringIO(value) return (key, Unpickler(f).load()) def last(self): (key, value) = self.dict.last() f = StringIO(value) return (key, Unpickler(f).load()) class DbfilenameShelf(Shelf): """Shelf implementation using the "anydbm" generic dbm interface. This is initialized with the filename for the dbm database. See the module's __doc__ string for an overview of the interface. """ def __init__(self, filename, flag='c', protocol=None, writeback=False): import anydbm Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback) def open(filename, flag='c', protocol=None, writeback=False): """Open a persistent dictionary for reading and writing. The filename parameter is the base filename for the underlying database. As a side-effect, an extension may be added to the filename and more than one file may be created. The optional flag parameter has the same interpretation as the flag parameter of anydbm.open(). The optional protocol parameter specifies the version of the pickle protocol (0, 1, or 2). See the module's __doc__ string for an overview of the interface. """ return DbfilenameShelf(filename, flag, protocol, writeback)
gpl-3.0
[ 624, 20588, 1033, 352, 2310, 402, 18731, 2251, 14, 2999, 199, 33, 298, 19195, 276, 2, 365, 282, 16149, 12, 2600, 13, 2930, 909, 14, 221, 710, 8865, 202, 199, 1045, 31093, 16219, 365, 626, 314, 1338, 334, 1397, 314, 2883, 21866, 315, 282, 21920, 276, 883, 202, 199, 1235, 28891, 9697, 2018, 2251, 1553, 7003, 626, 314, 298, 8092, 2, 202, 199, 578, 883, 2429, 14, 221, 961, 6952, 4750, 1021, 4454, 12, 9133, 666, 202, 199, 1313, 12, 436, 2251, 3035, 24213, 402, 5709, 1007, 13, 1462, 14, 221, 710, 2883, 202, 199, 1530, 24801, 3326, 14, 2999, 199, 1378, 22301, 314, 3217, 334, 498, 365, 282, 1059, 12, 666, 365, 376, 9697, 202, 199, 785, 304, 4341, 492, 1033, 15320, 1039, 366, 275, 1033, 15320, 14, 1490, 8, 1501, 9, 327, 1551, 12, 543, 334, 71, 9, 20666, 1788, 1553, 949, 4739, 4341, 366, 59, 498, 61, 275, 666, 257, 327, 3877, 666, 737, 790, 334, 1883, 16334, 2269, 666, 340, 8282, 327, 1808, 376, 3411, 790, 9, 1039, 666, 275, 366, 59, 498, 61, 257, 327, 8044, 282, 9357, 402, 314, 666, 737, 790, 334, 3730, 8282, 327, 4067, 340, 949, 4066, 790, 9, 1553, 6944, 626, 642, 8282, 327, 2879, 2529, 282, 627, 1574, 10, 402, 314, 2397, 1, 1039, 2150, 366, 59, 498, 61, 420, 327, 3145, 666, 5489, 737, 790, 334, 3536, 4067, 8282, 327, 340, 949, 4066, 790, 9, 1039, 3305, 275, 366, 14, 1989, 63, 498, 8, 498, 9, 257, 327, 2549, 340, 314, 790, 3495, 27, 2011, 465, 298, 498, 315, 366, 2, 1039, 769, 275, 366, 14, 1612, 342, 327, 282, 769, 402, 1006, 3411, 2883, 334, 14362, 21866, 4341, 366, 14, 1600, 342, 755, 327, 4002, 652, 2999, 199, 872, 5476, 641, 314, 4514, 12, 11261, 282, 16149, 2600, 1443, 202, 199, 269, 1443, 440, 506, 5784, 370, 8976, 4493, 370, 4543, 14, 2999, 199, 15548, 1183, 12, 366, 59, 498, 61, 2529, 282, 9357, 402, 314, 2397, 14, 221, 961, 4839, 10296, 1380, 202, 199, 17404, 4811, 787, 8567, 972, 26, 367, 2893, 12, 340, 366, 59, 498, 61, 365, 282, 769, 12, 1039, 366, 59, 498, 1055, 740, 8, 290, 1053, 9, 202, 199, 9105, 2845, 2811, 314, 2397, 366, 59, 498, 61, 6337, 12, 465, 5489, 315, 314, 16149, 202, 199, 4745, 1553, 652, 1454, 26473, 314, 1331, 12, 1314, 365, 2066, 9939, 202, 199, 6409, 12910, 12, 880, 626, 314, 5666, 965, 4825, 7763, 4052, 1152, 5907, 14, 221, 4005, 5666, 376, 202, 199, 1053, 370, 366, 59, 498, 61, 315, 282, 4340, 626, 911, 12787, 314, 16149, 4412, 12, 675, 26, 1039, 666, 275, 366, 59, 498, 61, 1039, 666, 14, 740, 8, 290, 1053, 9, 1039, 366, 59, 498, 61, 275, 666, 2999, 199, 1378, 5126, 314, 5160, 543, 17194, 4811, 12, 1265, 1443, 986, 314, 4252, 202, 199, 2094, 2218, 894, 29, 549, 315, 314, 1240, 370, 1033, 15320, 14, 1490, 14, 221, 3979, 1265, 675, 26, 1039, 366, 275, 1033, 15320, 14, 1490, 8, 1501, 12, 2218, 894, 29, 549, 9, 202, 199, 12726, 366, 18578, 282, 2581, 402, 1006, 4811, 1265, 2879, 12, 436, 14511, 3062, 1006, 1771, 202, 199, 475, 314, 16149, 4412, 1380, 1265, 1240, 366, 14, 1600, 1252, 221, 961, 15620, 626, 202, 199, 10180, 4503, 465, 366, 59, 498, 1055, 740, 8, 290, 1053, 9, 5419, 465, 11619, 14, 2999, 199, 18335, 5907, 12, 1808, 4252, 1423, 2218, 894, 29, 549, 1443, 9451, 373, 1810, 5982, 202, 199, 1618, 4402, 367, 314, 2581, 12, 436, 652, 1443, 1852, 366, 14, 1600, 342, 7437, 11999, 12, 340, 1265, 202, 199, 2732, 5002, 402, 366, 1159, 4811, 2410, 13618, 652, 315, 642, 4340, 26, 366, 965, 949, 4340, 370, 202, 199, 1074, 1314, 402, 314, 4811, 1265, 2879, 787, 17194, 436, 15, 269, 1314, 7869, 1265, 202, 199, 2442, 3163, 31173, 12, 880, 652, 1471, 2581, 12, 436, 2218, 1771, 737, 4002, 12, 1006, 402, 314, 202, 199, 3189, 626, 1265, 2879, 14, 221, 2047, 883, 1240, 366, 14, 5186, 342, 370, 2218, 1771, 1006, 314, 202, 199, 3189, 315, 314, 2581, 12, 436, 2701, 314, 2581, 334, 68, 14, 5186, 342, 2597, 15354, 6491, 202, 199, 1589, 16149, 2600, 641, 4543, 12, 340, 1964, 305, 7247, 680, 202, 199, 624, 2999, 199, 3, 7649, 1808, 17572, 436, 15073, 340, 2808, 14, 2999, 199, 893, 26, 1128, 687, 17572, 492, 16568, 1435, 12, 1910, 23468, 202, 199, 2590, 3545, 26, 1128, 687, 5927, 492, 16568, 1435, 12, 1910, 23468, 2999, 199, 893, 26, 1128, 687, 15073, 492, 5228, 202, 199, 2590, 3545, 26, 1128, 687, 5228, 492, 5228, 2999, 199, 646, 32241, 2999, 199, 363, 452, 363, 275, 2097, 31306, 276, 2266, 34, 3893, 8882, 31306, 276, 2266, 8882, 1501, 31306, 276, 2266, 1490, 937, 2999, 199, 533, 485, 15190, 2141, 8, 30088, 14, 2141, 4256, 304, 1128, 283, 12825, 367, 282, 6876, 1211, 14, 221, 11003, 12454, 746, 282, 1722, 3530, 2958, 347, 6876, 8, 277, 12, 627, 589, 304, 1039, 746, 1722, 360, 3197, 3439, 641, 6876, 21920, 276, 358, 1128, 636, 6095, 363, 275, 636, 8617, 363, 275, 636, 13228, 363, 275, 2883, 275, 6876, 2958, 347, 636, 2722, 721, 277, 304, 1039, 372, 2650, 15190, 11932, 3524, 2999, 199, 533, 428, 426, 276, 8, 30088, 14, 2141, 4256, 304, 1128, 408, 1563, 1021, 367, 21920, 276, 12591, 14, 2958, 961, 365, 10038, 543, 282, 2600, 13, 2930, 909, 14, 1128, 1666, 314, 859, 1159, 636, 1301, 363, 1059, 367, 376, 23503, 402, 314, 3217, 14, 1128, 408, 2958, 347, 636, 826, 721, 277, 12, 1211, 12, 4113, 29, 403, 12, 2218, 894, 29, 797, 304, 1039, 291, 14, 807, 275, 1211, 1039, 340, 4113, 365, 488, 26, 1675, 4113, 275, 378, 1039, 291, 423, 3922, 275, 4113, 1039, 291, 14, 952, 894, 275, 2218, 894, 1039, 291, 14, 1637, 275, 1052, 2958, 347, 2883, 8, 277, 304, 1039, 372, 291, 14, 807, 14, 1612, 342, 2958, 347, 636, 552, 721, 277, 304, 1039, 372, 822, 8, 277, 14, 807, 9, 2958, 347, 965, 63, 498, 8, 277, 12, 790, 304, 1039, 372, 790, 315, 291, 14, 807 ]
[ 20588, 1033, 352, 2310, 402, 18731, 2251, 14, 2999, 199, 33, 298, 19195, 276, 2, 365, 282, 16149, 12, 2600, 13, 2930, 909, 14, 221, 710, 8865, 202, 199, 1045, 31093, 16219, 365, 626, 314, 1338, 334, 1397, 314, 2883, 21866, 315, 282, 21920, 276, 883, 202, 199, 1235, 28891, 9697, 2018, 2251, 1553, 7003, 626, 314, 298, 8092, 2, 202, 199, 578, 883, 2429, 14, 221, 961, 6952, 4750, 1021, 4454, 12, 9133, 666, 202, 199, 1313, 12, 436, 2251, 3035, 24213, 402, 5709, 1007, 13, 1462, 14, 221, 710, 2883, 202, 199, 1530, 24801, 3326, 14, 2999, 199, 1378, 22301, 314, 3217, 334, 498, 365, 282, 1059, 12, 666, 365, 376, 9697, 202, 199, 785, 304, 4341, 492, 1033, 15320, 1039, 366, 275, 1033, 15320, 14, 1490, 8, 1501, 9, 327, 1551, 12, 543, 334, 71, 9, 20666, 1788, 1553, 949, 4739, 4341, 366, 59, 498, 61, 275, 666, 257, 327, 3877, 666, 737, 790, 334, 1883, 16334, 2269, 666, 340, 8282, 327, 1808, 376, 3411, 790, 9, 1039, 666, 275, 366, 59, 498, 61, 257, 327, 8044, 282, 9357, 402, 314, 666, 737, 790, 334, 3730, 8282, 327, 4067, 340, 949, 4066, 790, 9, 1553, 6944, 626, 642, 8282, 327, 2879, 2529, 282, 627, 1574, 10, 402, 314, 2397, 1, 1039, 2150, 366, 59, 498, 61, 420, 327, 3145, 666, 5489, 737, 790, 334, 3536, 4067, 8282, 327, 340, 949, 4066, 790, 9, 1039, 3305, 275, 366, 14, 1989, 63, 498, 8, 498, 9, 257, 327, 2549, 340, 314, 790, 3495, 27, 2011, 465, 298, 498, 315, 366, 2, 1039, 769, 275, 366, 14, 1612, 342, 327, 282, 769, 402, 1006, 3411, 2883, 334, 14362, 21866, 4341, 366, 14, 1600, 342, 755, 327, 4002, 652, 2999, 199, 872, 5476, 641, 314, 4514, 12, 11261, 282, 16149, 2600, 1443, 202, 199, 269, 1443, 440, 506, 5784, 370, 8976, 4493, 370, 4543, 14, 2999, 199, 15548, 1183, 12, 366, 59, 498, 61, 2529, 282, 9357, 402, 314, 2397, 14, 221, 961, 4839, 10296, 1380, 202, 199, 17404, 4811, 787, 8567, 972, 26, 367, 2893, 12, 340, 366, 59, 498, 61, 365, 282, 769, 12, 1039, 366, 59, 498, 1055, 740, 8, 290, 1053, 9, 202, 199, 9105, 2845, 2811, 314, 2397, 366, 59, 498, 61, 6337, 12, 465, 5489, 315, 314, 16149, 202, 199, 4745, 1553, 652, 1454, 26473, 314, 1331, 12, 1314, 365, 2066, 9939, 202, 199, 6409, 12910, 12, 880, 626, 314, 5666, 965, 4825, 7763, 4052, 1152, 5907, 14, 221, 4005, 5666, 376, 202, 199, 1053, 370, 366, 59, 498, 61, 315, 282, 4340, 626, 911, 12787, 314, 16149, 4412, 12, 675, 26, 1039, 666, 275, 366, 59, 498, 61, 1039, 666, 14, 740, 8, 290, 1053, 9, 1039, 366, 59, 498, 61, 275, 666, 2999, 199, 1378, 5126, 314, 5160, 543, 17194, 4811, 12, 1265, 1443, 986, 314, 4252, 202, 199, 2094, 2218, 894, 29, 549, 315, 314, 1240, 370, 1033, 15320, 14, 1490, 14, 221, 3979, 1265, 675, 26, 1039, 366, 275, 1033, 15320, 14, 1490, 8, 1501, 12, 2218, 894, 29, 549, 9, 202, 199, 12726, 366, 18578, 282, 2581, 402, 1006, 4811, 1265, 2879, 12, 436, 14511, 3062, 1006, 1771, 202, 199, 475, 314, 16149, 4412, 1380, 1265, 1240, 366, 14, 1600, 1252, 221, 961, 15620, 626, 202, 199, 10180, 4503, 465, 366, 59, 498, 1055, 740, 8, 290, 1053, 9, 5419, 465, 11619, 14, 2999, 199, 18335, 5907, 12, 1808, 4252, 1423, 2218, 894, 29, 549, 1443, 9451, 373, 1810, 5982, 202, 199, 1618, 4402, 367, 314, 2581, 12, 436, 652, 1443, 1852, 366, 14, 1600, 342, 7437, 11999, 12, 340, 1265, 202, 199, 2732, 5002, 402, 366, 1159, 4811, 2410, 13618, 652, 315, 642, 4340, 26, 366, 965, 949, 4340, 370, 202, 199, 1074, 1314, 402, 314, 4811, 1265, 2879, 787, 17194, 436, 15, 269, 1314, 7869, 1265, 202, 199, 2442, 3163, 31173, 12, 880, 652, 1471, 2581, 12, 436, 2218, 1771, 737, 4002, 12, 1006, 402, 314, 202, 199, 3189, 626, 1265, 2879, 14, 221, 2047, 883, 1240, 366, 14, 5186, 342, 370, 2218, 1771, 1006, 314, 202, 199, 3189, 315, 314, 2581, 12, 436, 2701, 314, 2581, 334, 68, 14, 5186, 342, 2597, 15354, 6491, 202, 199, 1589, 16149, 2600, 641, 4543, 12, 340, 1964, 305, 7247, 680, 202, 199, 624, 2999, 199, 3, 7649, 1808, 17572, 436, 15073, 340, 2808, 14, 2999, 199, 893, 26, 1128, 687, 17572, 492, 16568, 1435, 12, 1910, 23468, 202, 199, 2590, 3545, 26, 1128, 687, 5927, 492, 16568, 1435, 12, 1910, 23468, 2999, 199, 893, 26, 1128, 687, 15073, 492, 5228, 202, 199, 2590, 3545, 26, 1128, 687, 5228, 492, 5228, 2999, 199, 646, 32241, 2999, 199, 363, 452, 363, 275, 2097, 31306, 276, 2266, 34, 3893, 8882, 31306, 276, 2266, 8882, 1501, 31306, 276, 2266, 1490, 937, 2999, 199, 533, 485, 15190, 2141, 8, 30088, 14, 2141, 4256, 304, 1128, 283, 12825, 367, 282, 6876, 1211, 14, 221, 11003, 12454, 746, 282, 1722, 3530, 2958, 347, 6876, 8, 277, 12, 627, 589, 304, 1039, 746, 1722, 360, 3197, 3439, 641, 6876, 21920, 276, 358, 1128, 636, 6095, 363, 275, 636, 8617, 363, 275, 636, 13228, 363, 275, 2883, 275, 6876, 2958, 347, 636, 2722, 721, 277, 304, 1039, 372, 2650, 15190, 11932, 3524, 2999, 199, 533, 428, 426, 276, 8, 30088, 14, 2141, 4256, 304, 1128, 408, 1563, 1021, 367, 21920, 276, 12591, 14, 2958, 961, 365, 10038, 543, 282, 2600, 13, 2930, 909, 14, 1128, 1666, 314, 859, 1159, 636, 1301, 363, 1059, 367, 376, 23503, 402, 314, 3217, 14, 1128, 408, 2958, 347, 636, 826, 721, 277, 12, 1211, 12, 4113, 29, 403, 12, 2218, 894, 29, 797, 304, 1039, 291, 14, 807, 275, 1211, 1039, 340, 4113, 365, 488, 26, 1675, 4113, 275, 378, 1039, 291, 423, 3922, 275, 4113, 1039, 291, 14, 952, 894, 275, 2218, 894, 1039, 291, 14, 1637, 275, 1052, 2958, 347, 2883, 8, 277, 304, 1039, 372, 291, 14, 807, 14, 1612, 342, 2958, 347, 636, 552, 721, 277, 304, 1039, 372, 822, 8, 277, 14, 807, 9, 2958, 347, 965, 63, 498, 8, 277, 12, 790, 304, 1039, 372, 790, 315, 291, 14, 807, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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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 ]
pwplus/securedrop
securedrop/journalist.py
2
21258
# -*- coding: utf-8 -*- import sys import os from datetime import datetime import functools from flask import (Flask, request, render_template, send_file, redirect, flash, url_for, g, abort, session) from flask_wtf.csrf import CsrfProtect from flask.ext.assets import Environment from sqlalchemy.orm.exc import MultipleResultsFound, NoResultFound from sqlalchemy.exc import IntegrityError import config import version import crypto_util import store import template_filters from db import (db_session, Source, Journalist, Submission, Reply, SourceStar, get_one_or_else, NoResultFound, WrongPasswordException, BadTokenException, LoginThrottledException, InvalidPasswordLength) import worker app = Flask(__name__, template_folder=config.JOURNALIST_TEMPLATES_DIR) app.config.from_object(config.JournalistInterfaceFlaskConfig) CsrfProtect(app) assets = Environment(app) app.jinja_env.globals['version'] = version.__version__ if getattr(config, 'CUSTOM_HEADER_IMAGE', None): app.jinja_env.globals['header_image'] = config.CUSTOM_HEADER_IMAGE app.jinja_env.globals['use_custom_header_image'] = True else: app.jinja_env.globals['header_image'] = 'logo.png' app.jinja_env.globals['use_custom_header_image'] = False app.jinja_env.filters['datetimeformat'] = template_filters.datetimeformat @app.teardown_appcontext def shutdown_session(exception=None): """Automatically remove database sessions at the end of the request, or when the application shuts down""" db_session.remove() def get_source(sid): """Return a Source object, representing the database row, for the source with id `sid`""" source = None query = Source.query.filter(Source.filesystem_id == sid) source = get_one_or_else(query, app.logger, abort) return source @app.before_request def setup_g(): """Store commonly used values in Flask's special g object""" uid = session.get('uid', None) if uid: g.user = Journalist.query.get(uid) if request.method == 'POST': sid = request.form.get('sid') if sid: g.sid = sid g.source = get_source(sid) def logged_in(): # When a user is logged in, we push their user id (database primary key) # into the session. setup_g checks for this value, and if it finds it, # stores a reference to the user's Journalist object in g. # # This check is good for the edge case where a user is deleted but still # has an active session - we will not authenticate a user if they are not # in the database. return bool(g.get('user', None)) def login_required(func): @functools.wraps(func) def wrapper(*args, **kwargs): if not logged_in(): return redirect(url_for('login')) return func(*args, **kwargs) return wrapper def admin_required(func): @functools.wraps(func) def wrapper(*args, **kwargs): if logged_in() and g.user.is_admin: return func(*args, **kwargs) # TODO: sometimes this gets flashed 2x (Chrome only?) flash("You must be an administrator to access that page", "notification") return redirect(url_for('index')) return wrapper @app.route('/login', methods=('GET', 'POST')) def login(): if request.method == 'POST': try: user = Journalist.login(request.form['username'], request.form['password'], request.form['token']) except Exception as e: app.logger.error("Login for '{}' failed: {}".format( request.form['username'], e)) login_flashed_msg = "Login failed." if isinstance(e, LoginThrottledException): login_flashed_msg += " Please wait at least 60 seconds before logging in again." else: try: user = Journalist.query.filter_by( username=request.form['username']).one() if user.is_totp: login_flashed_msg += " Please wait for a new two-factor token before logging in again." except: pass flash(login_flashed_msg, "error") else: app.logger.info("Successful login for '{}' with token {}".format( request.form['username'], request.form['token'])) # Update access metadata user.last_access = datetime.utcnow() db_session.add(user) db_session.commit() session['uid'] = user.id return redirect(url_for('index')) return render_template("login.html") @app.route('/logout') def logout(): session.pop('uid', None) return redirect(url_for('index')) @app.route('/admin', methods=('GET', 'POST')) @admin_required def admin_index(): users = Journalist.query.all() return render_template("admin.html", users=users) @app.route('/admin/add', methods=('GET', 'POST')) @admin_required def admin_add_user(): if request.method == 'POST': form_valid = True username = request.form['username'] if len(username) == 0: form_valid = False flash("Missing username", "error") password = request.form['password'] password_again = request.form['password_again'] if password != password_again: form_valid = False flash("Passwords didn't match", "error") is_admin = bool(request.form.get('is_admin')) if form_valid: try: otp_secret = None if request.form.get('is_hotp', False): otp_secret = request.form.get('otp_secret', '') new_user = Journalist(username=username, password=password, is_admin=is_admin, otp_secret=otp_secret) db_session.add(new_user) db_session.commit() except InvalidPasswordLength: form_valid = False flash("Your password is too long (maximum length {} characters)".format( Journalist.MAX_PASSWORD_LEN), "error") except IntegrityError as e: form_valid = False if "username is not unique" in str(e): flash("That username is already in use", "error") else: flash("An error occurred saving this user to the database", "error") if form_valid: return redirect(url_for('admin_new_user_two_factor', uid=new_user.id)) return render_template("admin_add_user.html") @app.route('/admin/2fa', methods=('GET', 'POST')) @admin_required def admin_new_user_two_factor(): user = Journalist.query.get(request.args['uid']) if request.method == 'POST': token = request.form['token'] if user.verify_token(token): flash( "Two factor token successfully verified for user {}!".format( user.username), "notification") return redirect(url_for("admin_index")) else: flash("Two factor token failed to verify", "error") return render_template("admin_new_user_two_factor.html", user=user) @app.route('/admin/reset-2fa-totp', methods=['POST']) @admin_required def admin_reset_two_factor_totp(): uid = request.form['uid'] user = Journalist.query.get(uid) user.is_totp = True user.regenerate_totp_shared_secret() db_session.commit() return redirect(url_for('admin_new_user_two_factor', uid=uid)) @app.route('/admin/reset-2fa-hotp', methods=['POST']) @admin_required def admin_reset_two_factor_hotp(): uid = request.form['uid'] otp_secret = request.form.get('otp_secret', None) if otp_secret: user = Journalist.query.get(uid) user.set_hotp_secret(otp_secret) db_session.commit() return redirect(url_for('admin_new_user_two_factor', uid=uid)) else: return render_template('admin_edit_hotp_secret.html', uid=uid) @app.route('/admin/edit/<int:user_id>', methods=('GET', 'POST')) @admin_required def admin_edit_user(user_id): user = Journalist.query.get(user_id) if request.method == 'POST': if request.form['username'] != "": user.username = request.form['username'] if request.form['password'] != "": if request.form['password'] != request.form['password_again']: flash("Passwords didn't match", "error") return redirect(url_for("admin_edit_user", user_id=user_id)) try: user.set_password(request.form['password']) except InvalidPasswordLength: flash("Your password is too long " "(maximum length {} characters)".format( Journalist.MAX_PASSWORD_LEN), "error") return redirect(url_for("admin_edit_user", user_id=user_id)) user.is_admin = bool(request.form.get('is_admin')) try: db_session.add(user) db_session.commit() flash("Password successfully changed for user {} ".format( user.username), "notification" ) except Exception as e: db_session.rollback() if "username is not unique" in str(e): flash("That username is already in use", "notification") else: flash( "An unknown error occurred, please inform your administrator", "error") return render_template("admin_edit_user.html", user=user) @app.route('/admin/delete/<int:user_id>', methods=('POST',)) @admin_required def admin_delete_user(user_id): user = Journalist.query.get(user_id) db_session.delete(user) db_session.commit() return redirect(url_for('admin_index')) @app.route('/account', methods=('GET', 'POST')) @login_required def edit_account(): user = g.user if request.method == 'POST': if request.form['password'] != "": if request.form['password'] != request.form['password_again']: flash("Passwords didn't match", "error") return redirect(url_for("edit_account")) try: user.set_password(request.form['password']) except InvalidPasswordLength: flash("Your password is too long " "(maximum length {} characters)".format( Journalist.MAX_PASSWORD_LEN), "error") return redirect(url_for("edit_account")) try: db_session.add(user) db_session.commit() flash( "Password successfully changed!", "notification") except Exception as e: flash( "An unknown error occurred, please inform your administrator", "error") app.logger.error("Password change for '{}' failed: {}".format( user, e)) db_session.rollback() return render_template('edit_account.html') @app.route('/account/2fa', methods=('GET', 'POST')) @login_required def account_new_two_factor(): user = g.user if request.method == 'POST': token = request.form['token'] if user.verify_token(token): flash( "Two factor token successfully verified!", "notification") return redirect(url_for('edit_account')) else: flash("Two factor token failed to verify", "error") return render_template('account_new_two_factor.html', user=user) @app.route('/account/reset-2fa-totp', methods=['POST']) @login_required def account_reset_two_factor_totp(): user = g.user user.is_totp = True user.regenerate_totp_shared_secret() db_session.commit() return redirect(url_for('account_new_two_factor')) @app.route('/account/reset-2fa-hotp', methods=['POST']) @login_required def account_reset_two_factor_hotp(): user = g.user otp_secret = request.form.get('otp_secret', None) if otp_secret: user.set_hotp_secret(otp_secret) db_session.commit() return redirect(url_for('account_new_two_factor')) else: return render_template('account_edit_hotp_secret.html') def make_star_true(sid): source = get_source(sid) if source.star: source.star.starred = True else: source_star = SourceStar(source) db_session.add(source_star) def make_star_false(sid): source = get_source(sid) if not source.star: source_star = SourceStar(source) db_session.add(source_star) db_session.commit() source.star.starred = False @app.route('/col/add_star/<sid>', methods=('POST',)) @login_required def add_star(sid): make_star_true(sid) db_session.commit() return redirect(url_for('index')) @app.route("/col/remove_star/<sid>", methods=('POST',)) @login_required def remove_star(sid): make_star_false(sid) db_session.commit() return redirect(url_for('index')) @app.route('/') @login_required def index(): unstarred = [] starred = [] # Long SQLAlchemy statements look best when formatted according to # the Pocoo style guide, IMHO: # http://www.pocoo.org/internal/styleguide/ sources = Source.query.filter_by(pending=False) \ .order_by(Source.last_updated.desc()) \ .all() for source in sources: star = SourceStar.query.filter_by(source_id=source.id).first() if star and star.starred: starred.append(source) else: unstarred.append(source) source.num_unread = len( Submission.query.filter_by(source_id=source.id, downloaded=False).all()) return render_template('index.html', unstarred=unstarred, starred=starred) @app.route('/col/<sid>') @login_required def col(sid): source = get_source(sid) source.has_key = crypto_util.getkey(sid) return render_template("col.html", sid=sid, source=source) def delete_collection(source_id): # Delete the source's collection of submissions worker.enqueue(store.delete_source_directory, source_id) # Delete the source's reply keypair crypto_util.delete_reply_keypair(source_id) # Delete their entry in the db source = get_source(source_id) db_session.delete(source) db_session.commit() @app.route('/col/process', methods=('POST',)) @login_required def col_process(): actions = {'delete': col_delete, 'star': col_star, 'un-star': col_un_star} if 'cols_selected' not in request.form: return redirect(url_for('index')) # getlist is cgi.FieldStorage.getlist cols_selected = request.form.getlist('cols_selected') action = request.form['action'] if action not in actions: return abort(500) method = actions[action] return method(cols_selected) def col_star(cols_selected): for sid in cols_selected: make_star_true(sid) db_session.commit() return redirect(url_for('index')) def col_un_star(cols_selected): for source_id in cols_selected: make_star_false(source_id) db_session.commit() return redirect(url_for('index')) @app.route('/col/delete/<sid>', methods=('POST',)) @login_required def col_delete_single(sid): """deleting a single collection from its /col page""" source = get_source(sid) delete_collection(sid) flash( "%s's collection deleted" % (source.journalist_designation,), "notification") return redirect(url_for('index')) def col_delete(cols_selected): """deleting multiple collections from the index""" if len(cols_selected) < 1: flash("No collections selected to delete!", "error") else: for source_id in cols_selected: delete_collection(source_id) flash("%s %s deleted" % ( len(cols_selected), "collection" if len(cols_selected) == 1 else "collections" ), "notification") return redirect(url_for('index')) @app.route('/col/<sid>/<fn>') @login_required def doc(sid, fn): if '..' in fn or fn.startswith('/'): abort(404) try: Submission.query.filter( Submission.filename == fn).one().downloaded = True except NoResultFound as e: app.logger.error("Could not mark " + fn + " as downloaded: %s" % (e,)) db_session.commit() return send_file(store.path(sid, fn), mimetype="application/pgp-encrypted") @app.route('/reply', methods=('POST',)) @login_required def reply(): g.source.interaction_count += 1 filename = "{0}-{1}-reply.gpg".format(g.source.interaction_count, g.source.journalist_filename) crypto_util.encrypt(request.form['msg'], [crypto_util.getkey(g.sid), config.JOURNALIST_KEY], output=store.path(g.sid, filename)) reply = Reply(g.user, g.source, filename) db_session.add(reply) db_session.commit() flash("Thanks! Your reply has been stored.", "notification") return redirect(url_for('col', sid=g.sid)) @app.route('/regenerate-code', methods=('POST',)) @login_required def generate_code(): original_journalist_designation = g.source.journalist_designation g.source.journalist_designation = crypto_util.display_id() for item in g.source.collection: item.filename = store.rename_submission( g.sid, item.filename, g.source.journalist_filename) db_session.commit() flash( "The source '%s' has been renamed to '%s'" % (original_journalist_designation, g.source.journalist_designation), "notification") return redirect('/col/' + g.sid) @app.route('/download_unread/<sid>') @login_required def download_unread(sid): id = Source.query.filter(Source.filesystem_id == sid).one().id docs = Submission.query.filter( Submission.source_id == id, Submission.downloaded == False).all() return bulk_download(sid, docs) @app.route('/bulk', methods=('POST',)) @login_required def bulk(): action = request.form['action'] doc_names_selected = request.form.getlist('doc_names_selected') selected_docs = [doc for doc in g.source.collection if doc.filename in doc_names_selected] if selected_docs == []: if action == 'download': flash("No collections selected to download!", "error") elif action == 'delete' or action == 'confirm_delete': flash("No collections selected to delete!", "error") return redirect(url_for('col', sid=g.sid)) if action == 'download': return bulk_download(g.sid, selected_docs) elif action == 'delete': return bulk_delete(g.sid, selected_docs) elif action == 'confirm_delete': return confirm_bulk_delete(g.sid, selected_docs) else: abort(400) def confirm_bulk_delete(sid, items_selected): return render_template('delete.html', sid=sid, source=g.source, items_selected=items_selected) def bulk_delete(sid, items_selected): for item in items_selected: item_path = store.path(sid, item.filename) worker.enqueue(store.secure_unlink, item_path) db_session.delete(item) db_session.commit() flash( "Submission{} deleted.".format( "s" if len(items_selected) > 1 else ""), "notification") return redirect(url_for('col', sid=sid)) def bulk_download(sid, items_selected): source = get_source(sid) filenames = [store.path(sid, item.filename) for item in items_selected] # Mark the submissions that are about to be downloaded as such for item in items_selected: if isinstance(item, Submission): item.downloaded = True db_session.commit() zf = store.get_bulk_archive( filenames, zip_directory=source.journalist_filename) attachment_filename = "{}--{}.zip".format( source.journalist_filename, datetime.utcnow().strftime("%Y-%m-%d--%H-%M-%S")) return send_file(zf.name, mimetype="application/zip", attachment_filename=attachment_filename, as_attachment=True) @app.route('/flag', methods=('POST',)) @login_required def flag(): g.source.flagged = True db_session.commit() return render_template('flag.html', sid=g.sid, codename=g.source.journalist_designation) def write_pidfile(): pid = str(os.getpid()) with open(config.JOURNALIST_PIDFILE, 'w') as fp: fp.write(pid) if __name__ == "__main__": write_pidfile() debug = getattr(config, 'env', 'prod') != 'prod' app.run(debug=debug, host='0.0.0.0', port=8081)
agpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 646, 984, 199, 646, 747, 199, 504, 2197, 492, 2197, 199, 646, 9143, 199, 199, 504, 7209, 492, 334, 14182, 12, 1056, 12, 3795, 63, 1160, 12, 3222, 63, 493, 12, 4660, 12, 14775, 12, 673, 1166, 63, 509, 12, 486, 12, 12004, 12, 2351, 9, 199, 504, 7209, 63, 87, 3249, 14, 10088, 492, 22145, 3941, 919, 5302, 199, 504, 7209, 14, 832, 14, 12186, 492, 9711, 199, 504, 8335, 14, 1025, 14, 2804, 492, 14326, 6579, 3601, 12, 3091, 2889, 3601, 199, 504, 8335, 14, 2804, 492, 26864, 199, 199, 646, 1101, 199, 646, 1015, 199, 646, 13230, 63, 1974, 199, 646, 3877, 199, 646, 1978, 63, 4273, 199, 504, 1592, 492, 334, 697, 63, 1730, 12, 5800, 12, 22142, 631, 12, 4804, 2250, 12, 16000, 590, 12, 355, 5800, 23197, 12, 664, 63, 368, 63, 269, 63, 2836, 12, 3091, 2889, 3601, 12, 355, 30801, 6139, 1726, 12, 8857, 3264, 1726, 12, 355, 16430, 26192, 68, 1726, 12, 6378, 6139, 4625, 9, 199, 646, 7239, 199, 199, 571, 275, 16704, 3460, 354, 3108, 1978, 63, 3741, 29, 888, 14, 15465, 7648, 748, 6225, 63, 25437, 63, 3022, 9, 199, 571, 14, 888, 14, 504, 63, 785, 8, 888, 14, 25909, 631, 4267, 14182, 2028, 9, 199, 13912, 3941, 919, 5302, 8, 571, 9, 199, 199, 12186, 275, 9711, 8, 571, 9, 199, 199, 571, 14, 12264, 63, 1813, 14, 8473, 459, 1023, 418, 275, 1015, 855, 1023, 363, 199, 692, 2519, 8, 888, 12, 283, 20519, 63, 7311, 63, 9438, 297, 488, 304, 272, 1145, 14, 12264, 63, 1813, 14, 8473, 459, 1291, 63, 1569, 418, 275, 1101, 14, 20519, 63, 7311, 63, 9438, 272, 1145, 14, 12264, 63, 1813, 14, 8473, 459, 1180, 63, 4229, 63, 1291, 63, 1569, 418, 275, 715, 199, 2836, 26, 272, 1145, 14, 12264, 63, 1813, 14, 8473, 459, 1291, 63, 1569, 418, 275, 283, 9733, 14, 4524, 7, 272, 1145, 14, 12264, 63, 1813, 14, 8473, 459, 1180, 63, 4229, 63, 1291, 63, 1569, 418, 275, 756, 199, 199, 571, 14, 12264, 63, 1813, 14, 4273, 459, 2083, 908, 418, 275, 1978, 63, 4273, 14, 2083, 908, 421, 199, 32, 571, 14, 15236, 63, 571, 1100, 199, 318, 12842, 63, 1730, 8, 1971, 29, 403, 304, 272, 408, 3358, 17174, 2813, 3050, 12184, 737, 314, 1284, 402, 314, 1056, 12, 503, 272, 1380, 314, 4223, 1033, 14608, 3224, 624, 272, 1592, 63, 1730, 14, 2168, 342, 421, 199, 318, 664, 63, 1365, 8, 4148, 304, 272, 408, 1767, 282, 5800, 909, 12, 6144, 314, 3050, 1962, 12, 367, 314, 1350, 272, 543, 1305, 658, 4148, 64, 624, 272, 1350, 275, 488, 272, 1827, 275, 5800, 14, 1131, 14, 1541, 8, 2980, 14, 11381, 63, 344, 508, 15764, 9, 272, 1350, 275, 664, 63, 368, 63, 269, 63, 2836, 8, 1131, 12, 1145, 14, 2921, 12, 12004, 9, 339, 372, 1350, 421, 199, 32, 571, 14, 5182, 63, 1069, 199, 318, 3272, 63, 71, 837, 272, 408, 5502, 28829, 1202, 1338, 315, 16704, 1159, 4539, 486, 909, 624, 272, 1747, 275, 2351, 14, 362, 360, 1535, 297, 488, 9, 272, 340, 1747, 26, 267, 486, 14, 751, 275, 22142, 631, 14, 1131, 14, 362, 8, 1535, 9, 339, 340, 1056, 14, 765, 508, 283, 4030, 356, 267, 15764, 275, 1056, 14, 964, 14, 362, 360, 4148, 358, 267, 340, 15764, 26, 288, 486, 14, 4148, 275, 15764, 288, 486, 14, 1365, 275, 664, 63, 1365, 8, 4148, 9, 421, 199, 318, 10367, 63, 262, 837, 272, 327, 3979, 282, 922, 365, 10367, 315, 12, 781, 6675, 3932, 922, 1305, 334, 4659, 5062, 790, 9, 272, 327, 1901, 314, 2351, 14, 3272, 63, 71, 5920, 367, 642, 574, 12, 436, 340, 652, 17651, 652, 12, 272, 327, 14086, 282, 3659, 370, 314, 922, 1159, 22142, 631, 909, 315, 486, 14, 272, 327, 272, 327, 961, 1104, 365, 6954, 367, 314, 6275, 1930, 2382, 282, 922, 365, 5463, 1325, 5139, 272, 327, 965, 376, 4702, 2351, 446, 781, 911, 440, 12895, 282, 922, 340, 2985, 787, 440, 272, 327, 315, 314, 3050, 14, 272, 372, 2155, 8, 71, 14, 362, 360, 751, 297, 488, 430, 421, 199, 318, 4676, 63, 2427, 8, 1532, 304, 272, 768, 17869, 14, 13582, 8, 1532, 9, 272, 347, 4975, 2031, 589, 12, 1011, 958, 304, 267, 340, 440, 10367, 63, 262, 837, 288, 372, 4660, 8, 633, 63, 509, 360, 2886, 1333, 267, 372, 2562, 2031, 589, 12, 1011, 958, 9, 272, 372, 4975, 421, 199, 318, 4628, 63, 2427, 8, 1532, 304, 272, 768, 17869, 14, 13582, 8, 1532, 9, 272, 347, 4975, 2031, 589, 12, 1011, 958, 304, 267, 340, 10367, 63, 262, 342, 436, 486, 14, 751, 14, 374, 63, 2113, 26, 288, 372, 2562, 2031, 589, 12, 1011, 958, 9, 267, 327, 3254, 26, 15026, 642, 7545, 14775, 379, 499, 88, 334, 18083, 1454, 17076, 267, 14775, 480, 5556, 1471, 506, 376, 31056, 370, 2879, 626, 2034, 401, 1598, 298, 6761, 531, 267, 372, 4660, 8, 633, 63, 509, 360, 1080, 1333, 272, 372, 4975, 421, 199, 32, 571, 14, 4449, 2336, 2886, 297, 3102, 7782, 2970, 297, 283, 4030, 1333, 199, 318, 4676, 837, 272, 340, 1056, 14, 765, 508, 283, 4030, 356, 267, 862, 26, 288, 922, 275, 22142, 631, 14, 2886, 8, 1069, 14, 964, 459, 2473, 995, 2511, 1056, 14, 964, 459, 2060, 995, 2511, 1056, 14, 964, 459, 1418, 1105, 267, 871, 2186, 465, 325, 26, 288, 1145, 14, 2921, 14, 705, 480, 8880, 367, 19574, 3405, 26, 8352, 908, 8, 355, 1056, 14, 964, 459, 2473, 995, 325, 430, 288, 4676, 63, 11331, 379, 63, 1328, 275, 298, 8880, 3405, 2122, 953, 340, 1228, 8, 69, 12, 16430, 26192, 68, 1726, 304, 355, 4676, 63, 11331, 379, 63, 1328, 847, 298, 7754, 3618, 737, 5210, 5212, 4696, 2544, 2050, 315, 4020, 2122, 288, 587, 26, 355, 862, 26, 490, 922, 275, 22142, 631, 14, 1131, 14, 1541, 63, 991, 8, 717, 3434, 29, 1069, 14, 964, 459, 2473, 13227, 368, 342, 490, 340, 922, 14, 374, 63, 13280, 80, 26, 717, 4676 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 646, 984, 199, 646, 747, 199, 504, 2197, 492, 2197, 199, 646, 9143, 199, 199, 504, 7209, 492, 334, 14182, 12, 1056, 12, 3795, 63, 1160, 12, 3222, 63, 493, 12, 4660, 12, 14775, 12, 673, 1166, 63, 509, 12, 486, 12, 12004, 12, 2351, 9, 199, 504, 7209, 63, 87, 3249, 14, 10088, 492, 22145, 3941, 919, 5302, 199, 504, 7209, 14, 832, 14, 12186, 492, 9711, 199, 504, 8335, 14, 1025, 14, 2804, 492, 14326, 6579, 3601, 12, 3091, 2889, 3601, 199, 504, 8335, 14, 2804, 492, 26864, 199, 199, 646, 1101, 199, 646, 1015, 199, 646, 13230, 63, 1974, 199, 646, 3877, 199, 646, 1978, 63, 4273, 199, 504, 1592, 492, 334, 697, 63, 1730, 12, 5800, 12, 22142, 631, 12, 4804, 2250, 12, 16000, 590, 12, 355, 5800, 23197, 12, 664, 63, 368, 63, 269, 63, 2836, 12, 3091, 2889, 3601, 12, 355, 30801, 6139, 1726, 12, 8857, 3264, 1726, 12, 355, 16430, 26192, 68, 1726, 12, 6378, 6139, 4625, 9, 199, 646, 7239, 199, 199, 571, 275, 16704, 3460, 354, 3108, 1978, 63, 3741, 29, 888, 14, 15465, 7648, 748, 6225, 63, 25437, 63, 3022, 9, 199, 571, 14, 888, 14, 504, 63, 785, 8, 888, 14, 25909, 631, 4267, 14182, 2028, 9, 199, 13912, 3941, 919, 5302, 8, 571, 9, 199, 199, 12186, 275, 9711, 8, 571, 9, 199, 199, 571, 14, 12264, 63, 1813, 14, 8473, 459, 1023, 418, 275, 1015, 855, 1023, 363, 199, 692, 2519, 8, 888, 12, 283, 20519, 63, 7311, 63, 9438, 297, 488, 304, 272, 1145, 14, 12264, 63, 1813, 14, 8473, 459, 1291, 63, 1569, 418, 275, 1101, 14, 20519, 63, 7311, 63, 9438, 272, 1145, 14, 12264, 63, 1813, 14, 8473, 459, 1180, 63, 4229, 63, 1291, 63, 1569, 418, 275, 715, 199, 2836, 26, 272, 1145, 14, 12264, 63, 1813, 14, 8473, 459, 1291, 63, 1569, 418, 275, 283, 9733, 14, 4524, 7, 272, 1145, 14, 12264, 63, 1813, 14, 8473, 459, 1180, 63, 4229, 63, 1291, 63, 1569, 418, 275, 756, 199, 199, 571, 14, 12264, 63, 1813, 14, 4273, 459, 2083, 908, 418, 275, 1978, 63, 4273, 14, 2083, 908, 421, 199, 32, 571, 14, 15236, 63, 571, 1100, 199, 318, 12842, 63, 1730, 8, 1971, 29, 403, 304, 272, 408, 3358, 17174, 2813, 3050, 12184, 737, 314, 1284, 402, 314, 1056, 12, 503, 272, 1380, 314, 4223, 1033, 14608, 3224, 624, 272, 1592, 63, 1730, 14, 2168, 342, 421, 199, 318, 664, 63, 1365, 8, 4148, 304, 272, 408, 1767, 282, 5800, 909, 12, 6144, 314, 3050, 1962, 12, 367, 314, 1350, 272, 543, 1305, 658, 4148, 64, 624, 272, 1350, 275, 488, 272, 1827, 275, 5800, 14, 1131, 14, 1541, 8, 2980, 14, 11381, 63, 344, 508, 15764, 9, 272, 1350, 275, 664, 63, 368, 63, 269, 63, 2836, 8, 1131, 12, 1145, 14, 2921, 12, 12004, 9, 339, 372, 1350, 421, 199, 32, 571, 14, 5182, 63, 1069, 199, 318, 3272, 63, 71, 837, 272, 408, 5502, 28829, 1202, 1338, 315, 16704, 1159, 4539, 486, 909, 624, 272, 1747, 275, 2351, 14, 362, 360, 1535, 297, 488, 9, 272, 340, 1747, 26, 267, 486, 14, 751, 275, 22142, 631, 14, 1131, 14, 362, 8, 1535, 9, 339, 340, 1056, 14, 765, 508, 283, 4030, 356, 267, 15764, 275, 1056, 14, 964, 14, 362, 360, 4148, 358, 267, 340, 15764, 26, 288, 486, 14, 4148, 275, 15764, 288, 486, 14, 1365, 275, 664, 63, 1365, 8, 4148, 9, 421, 199, 318, 10367, 63, 262, 837, 272, 327, 3979, 282, 922, 365, 10367, 315, 12, 781, 6675, 3932, 922, 1305, 334, 4659, 5062, 790, 9, 272, 327, 1901, 314, 2351, 14, 3272, 63, 71, 5920, 367, 642, 574, 12, 436, 340, 652, 17651, 652, 12, 272, 327, 14086, 282, 3659, 370, 314, 922, 1159, 22142, 631, 909, 315, 486, 14, 272, 327, 272, 327, 961, 1104, 365, 6954, 367, 314, 6275, 1930, 2382, 282, 922, 365, 5463, 1325, 5139, 272, 327, 965, 376, 4702, 2351, 446, 781, 911, 440, 12895, 282, 922, 340, 2985, 787, 440, 272, 327, 315, 314, 3050, 14, 272, 372, 2155, 8, 71, 14, 362, 360, 751, 297, 488, 430, 421, 199, 318, 4676, 63, 2427, 8, 1532, 304, 272, 768, 17869, 14, 13582, 8, 1532, 9, 272, 347, 4975, 2031, 589, 12, 1011, 958, 304, 267, 340, 440, 10367, 63, 262, 837, 288, 372, 4660, 8, 633, 63, 509, 360, 2886, 1333, 267, 372, 2562, 2031, 589, 12, 1011, 958, 9, 272, 372, 4975, 421, 199, 318, 4628, 63, 2427, 8, 1532, 304, 272, 768, 17869, 14, 13582, 8, 1532, 9, 272, 347, 4975, 2031, 589, 12, 1011, 958, 304, 267, 340, 10367, 63, 262, 342, 436, 486, 14, 751, 14, 374, 63, 2113, 26, 288, 372, 2562, 2031, 589, 12, 1011, 958, 9, 267, 327, 3254, 26, 15026, 642, 7545, 14775, 379, 499, 88, 334, 18083, 1454, 17076, 267, 14775, 480, 5556, 1471, 506, 376, 31056, 370, 2879, 626, 2034, 401, 1598, 298, 6761, 531, 267, 372, 4660, 8, 633, 63, 509, 360, 1080, 1333, 272, 372, 4975, 421, 199, 32, 571, 14, 4449, 2336, 2886, 297, 3102, 7782, 2970, 297, 283, 4030, 1333, 199, 318, 4676, 837, 272, 340, 1056, 14, 765, 508, 283, 4030, 356, 267, 862, 26, 288, 922, 275, 22142, 631, 14, 2886, 8, 1069, 14, 964, 459, 2473, 995, 2511, 1056, 14, 964, 459, 2060, 995, 2511, 1056, 14, 964, 459, 1418, 1105, 267, 871, 2186, 465, 325, 26, 288, 1145, 14, 2921, 14, 705, 480, 8880, 367, 19574, 3405, 26, 8352, 908, 8, 355, 1056, 14, 964, 459, 2473, 995, 325, 430, 288, 4676, 63, 11331, 379, 63, 1328, 275, 298, 8880, 3405, 2122, 953, 340, 1228, 8, 69, 12, 16430, 26192, 68, 1726, 304, 355, 4676, 63, 11331, 379, 63, 1328, 847, 298, 7754, 3618, 737, 5210, 5212, 4696, 2544, 2050, 315, 4020, 2122, 288, 587, 26, 355, 862, 26, 490, 922, 275, 22142, 631, 14, 1131, 14, 1541, 63, 991, 8, 717, 3434, 29, 1069, 14, 964, 459, 2473, 13227, 368, 342, 490, 340, 922, 14, 374, 63, 13280, 80, 26, 717, 4676, 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, 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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, 1, 1, 1, 1, 1, 1, 1, 1 ]
pahaz/fabtools
fabtools/openvz/operations.py
1
3962
""" OpenVZ containers ================= """ from __future__ import with_statement from fabric.api import * def create(ctid, ostemplate=None, config=None, private=None, root=None, ipadd=None, hostname=None, **kwargs): """ Create an OpenVZ container. """ return _vzctl('create', ctid, ostemplate=ostemplate, config=config, private=private, root=root, ipadd=ipadd, hostname=hostname, **kwargs) def destroy(ctid_or_name): """ Destroy the container. """ return _vzctl('destroy', ctid_or_name) def set(ctid_or_name, save=True, **kwargs): """ Set container parameters. """ return _vzctl('set', ctid_or_name, save=save, **kwargs) def start(ctid_or_name, wait=False, force=False, **kwargs): """ Start the container. If *wait* is ``True``, wait until the container is up and running. .. warning:: ``wait=True`` is broken with vzctl 3.0.24 on Debian 6.0 (*squeeze*) """ return _vzctl('start', ctid_or_name, wait=wait, force=force, **kwargs) def stop(ctid_or_name, fast=False, **kwargs): """ Stop the container. """ return _vzctl('stop', ctid_or_name, fast=fast, **kwargs) def restart(ctid_or_name, wait=True, force=False, fast=False, **kwargs): """ Restart the container. """ return _vzctl('restart', ctid_or_name, wait=wait, force=force, fast=fast, **kwargs) def status(ctid_or_name): """ Get the status of the container. """ with settings(warn_only=True): return _vzctl('status', ctid_or_name) def running(ctid_or_name): """ Check if the container is running. """ return status(ctid_or_name).split(' ')[4] == 'running' def exists(ctid_or_name): """ Check if the container exists. """ with settings(hide('running', 'stdout', 'warnings'), warn_only=True): return status(ctid_or_name).succeeded def exec2(ctid_or_name, command): """ Run a command inside the container. :: import fabtools res = fabtools.openvz.exec2('foo', 'hostname') .. warning:: the command will be run as **root**. """ return sudo("vzctl exec2 %s '%s'" % (ctid_or_name, command)) def _vzctl(command, ctid_or_name, **kwargs): args = _expand_args(**kwargs) return sudo('vzctl %s %s %s' % (command, ctid_or_name, args)) def _expand_args(**kwargs): args = [] for k, v in kwargs.items(): if isinstance(v, bool): if v is True: args.append('--%s' % k) elif isinstance(v, (list, tuple)): for elem in v: args.append('--%s %s' % (k, elem)) elif v is not None: args.append('--%s %s' % (k, v)) return ' '.join(args) def download_template(name=None, url=None): """ Download an OpenVZ template. Example:: from fabtools.openvz import download_template # Use custom OS template download_template(url='http://example.com/templates/mybox.tar.gz') If no *url* is provided, the OS template will be downloaded from the `download.openvz.org <http://download.openvz.org/template/precreated/>`_ repository:: from fabtools.openvz import download_template # Use OS template from http://download.openvz.org/template/precreated/ download_template('debian-6.0-x86_64') """ if url is None: url = 'http://download.openvz.org/template/precreated/%s.tar.gz' % name with cd('/var/lib/vz/template/cache'): sudo('wget --progress=dot:mega "%s"' % url) def list_ctids(): """ Get the list of currently used CTIDs. """ with settings(hide('running', 'stdout')): res = sudo('vzlist -a -1') return map(int, res.splitlines()) def get_available_ctid(): """ Get an available CTID. """ current_ctids = list_ctids() if current_ctids: return max(current_ctids) + 1 else: return 1000
bsd-2-clause
[ 624, 199, 4299, 54, 58, 15333, 199, 1280, 29, 199, 624, 199, 504, 636, 2443, 363, 492, 543, 63, 6242, 199, 199, 504, 2630, 14, 1246, 492, 627, 421, 199, 318, 1218, 8, 67, 5700, 12, 747, 1160, 29, 403, 12, 1101, 29, 403, 12, 5726, 29, 403, 12, 1779, 1738, 29, 403, 12, 3384, 525, 29, 403, 12, 6246, 29, 403, 12, 1011, 958, 304, 272, 408, 272, 2790, 376, 3232, 54, 58, 3970, 14, 272, 408, 272, 372, 485, 31007, 8077, 360, 981, 297, 286, 5700, 12, 747, 1160, 29, 736, 1160, 12, 1101, 29, 888, 12, 267, 5726, 29, 4239, 12, 1738, 29, 1231, 12, 3384, 525, 29, 711, 525, 12, 6246, 29, 4269, 12, 1011, 958, 9, 421, 199, 318, 11972, 8, 67, 5700, 63, 269, 63, 354, 304, 272, 408, 272, 20547, 4813, 314, 3970, 14, 272, 408, 272, 372, 485, 31007, 8077, 360, 7237, 297, 286, 5700, 63, 269, 63, 354, 9, 421, 199, 318, 663, 8, 67, 5700, 63, 269, 63, 354, 12, 3354, 29, 549, 12, 1011, 958, 304, 272, 408, 272, 2494, 3970, 2633, 14, 272, 408, 272, 372, 485, 31007, 8077, 360, 409, 297, 286, 5700, 63, 269, 63, 354, 12, 3354, 29, 2117, 12, 1011, 958, 9, 421, 199, 318, 1343, 8, 67, 5700, 63, 269, 63, 354, 12, 3618, 29, 797, 12, 3542, 29, 797, 12, 1011, 958, 304, 272, 408, 272, 7707, 314, 3970, 14, 339, 982, 627, 2573, 10, 365, 1124, 549, 4542, 3618, 5133, 314, 3970, 365, 1536, 436, 3879, 14, 339, 2508, 5721, 447, 1124, 2573, 29, 549, 1040, 365, 10529, 543, 373, 90, 8077, 650, 14, 16, 14, 1194, 326, 641, 30445, 1227, 14, 16, 19943, 16597, 13278, 272, 408, 272, 372, 485, 31007, 8077, 360, 928, 297, 286, 5700, 63, 269, 63, 354, 12, 3618, 29, 2573, 12, 3542, 29, 3990, 12, 1011, 958, 9, 421, 199, 318, 3631, 8, 67, 5700, 63, 269, 63, 354, 12, 7377, 29, 797, 12, 1011, 958, 304, 272, 408, 272, 8015, 314, 3970, 14, 272, 408, 272, 372, 485, 31007, 8077, 360, 2379, 297, 286, 5700, 63, 269, 63, 354, 12, 7377, 29, 7015, 12, 1011, 958, 9, 421, 199, 318, 11004, 8, 67, 5700, 63, 269, 63, 354, 12, 3618, 29, 549, 12, 3542, 29, 797, 12, 7377, 29, 797, 12, 1011, 958, 304, 272, 408, 272, 799, 928, 314, 3970, 14, 272, 408, 272, 372, 485, 31007, 8077, 360, 10506, 297, 286, 5700, 63, 269, 63, 354, 12, 3618, 29, 2573, 12, 3542, 29, 3990, 12, 7377, 29, 7015, 12, 1011, 958, 9, 421, 199, 318, 2004, 8, 67, 5700, 63, 269, 63, 354, 304, 272, 408, 272, 2372, 314, 2004, 402, 314, 3970, 14, 272, 408, 272, 543, 2202, 8, 4050, 63, 2118, 29, 549, 304, 267, 372, 485, 31007, 8077, 360, 1205, 297, 286, 5700, 63, 269, 63, 354, 9, 421, 199, 318, 3879, 8, 67, 5700, 63, 269, 63, 354, 304, 272, 408, 272, 2670, 340, 314, 3970, 365, 3879, 14, 272, 408, 272, 372, 2004, 8, 67, 5700, 63, 269, 63, 354, 680, 1294, 360, 27618, 20, 61, 508, 283, 5720, 7, 421, 199, 318, 3495, 8, 67, 5700, 63, 269, 63, 354, 304, 272, 408, 272, 2670, 340, 314, 3970, 3495, 14, 272, 408, 272, 543, 2202, 8, 8191, 360, 5720, 297, 283, 2703, 297, 283, 5451, 659, 7987, 63, 2118, 29, 549, 304, 267, 372, 2004, 8, 67, 5700, 63, 269, 63, 354, 680, 20003, 421, 199, 318, 2146, 18, 8, 67, 5700, 63, 269, 63, 354, 12, 1414, 304, 272, 408, 272, 3378, 282, 1414, 6272, 314, 3970, 14, 339, 3800, 398, 492, 31507, 2537, 398, 522, 275, 31507, 2537, 14, 1490, 31007, 14, 1628, 18, 360, 1421, 297, 283, 4269, 358, 339, 2508, 5721, 447, 314, 1414, 911, 506, 1255, 465, 1011, 1231, 538, 14, 339, 408, 272, 372, 14682, 480, 31007, 8077, 2146, 18, 450, 83, 1543, 83, 4065, 450, 334, 67, 5700, 63, 269, 63, 354, 12, 1414, 430, 421, 199, 318, 485, 31007, 8077, 8, 1531, 12, 286, 5700, 63, 269, 63, 354, 12, 1011, 958, 304, 272, 1249, 275, 485, 4441, 63, 589, 3682, 958, 9, 272, 372, 14682, 360, 31007, 8077, 450, 83, 450, 83, 450, 83, 7, 450, 334, 1531, 12, 286, 5700, 63, 269, 63, 354, 12, 1249, 430, 421, 199, 318, 485, 4441, 63, 589, 3682, 958, 304, 272, 1249, 275, 942, 272, 367, 1022, 12, 373, 315, 2074, 14, 1744, 837, 267, 340, 1228, 8, 86, 12, 2155, 304, 288, 340, 373, 365, 715, 26, 355, 1249, 14, 740, 4517, 5, 83, 7, 450, 1022, 9, 267, 916, 1228, 8, 86, 12, 334, 513, 12, 2008, 2298, 288, 367, 6193, 315, 373, 26, 355, 1249, 14, 740, 4517, 5, 83, 450, 83, 7, 450, 334, 75, 12, 6193, 430, 267, 916, 373, 365, 440, 488, 26, 288, 1249, 14, 740, 4517, 5, 83, 450, 83, 7, 450, 334, 75, 12, 373, 430, 272, 372, 283, 1987, 904, 8, 589, 9, 421, 199, 318, 5235, 63, 1160, 8, 354, 29, 403, 12, 1166, 29, 403, 304, 272, 408, 272, 17955, 376, 3232, 54, 58, 1978, 14, 339, 5679, 447, 398, 687, 31507, 2537, 14, 1490, 31007, 492, 5235, 63, 1160, 398, 327, 3645, 3537, 4403, 1978, 267, 5235, 63, 1160, 8, 633, 534, 1014, 921, 2694, 14, 957, 15, 5876, 15, 1662, 1977, 14, 5369, 14, 6838, 358, 339, 982, 949, 627, 633, 10, 365, 2741, 12, 314, 4403, 1978, 911, 506, 13557, 687, 314, 272, 658, 4249, 14, 1490, 31007, 14, 1308, 665, 1014, 921, 4249, 14, 1490, 31007, 14, 1308, 15, 1160, 15, 657, 3966, 3133, 18417, 272, 7611, 447, 398, 687, 31507, 2537, 14, 1490, 31007, 492, 5235, 63, 1160, 398, 327, 3645, 4403, 1978, 687, 1455, 921, 4249, 14, 1490, 31007, 14, 1308, 15, 1160, 15, 657, 3966, 15, 267, 5235, 63, 1160, 360, 23204, 13, 22, 14, 16, 13, 88, 1184, 63, 772, 358, 339, 408, 272, 340, 1166, 365, 488, 26, 267, 1166, 275, 283, 1014, 921, 4249, 14, 1490, 31007, 14, 1308, 15, 1160, 15, 657, 3966, 3149, 83, 14, 5369, 14, 6838, 7 ]
[ 199, 4299, 54, 58, 15333, 199, 1280, 29, 199, 624, 199, 504, 636, 2443, 363, 492, 543, 63, 6242, 199, 199, 504, 2630, 14, 1246, 492, 627, 421, 199, 318, 1218, 8, 67, 5700, 12, 747, 1160, 29, 403, 12, 1101, 29, 403, 12, 5726, 29, 403, 12, 1779, 1738, 29, 403, 12, 3384, 525, 29, 403, 12, 6246, 29, 403, 12, 1011, 958, 304, 272, 408, 272, 2790, 376, 3232, 54, 58, 3970, 14, 272, 408, 272, 372, 485, 31007, 8077, 360, 981, 297, 286, 5700, 12, 747, 1160, 29, 736, 1160, 12, 1101, 29, 888, 12, 267, 5726, 29, 4239, 12, 1738, 29, 1231, 12, 3384, 525, 29, 711, 525, 12, 6246, 29, 4269, 12, 1011, 958, 9, 421, 199, 318, 11972, 8, 67, 5700, 63, 269, 63, 354, 304, 272, 408, 272, 20547, 4813, 314, 3970, 14, 272, 408, 272, 372, 485, 31007, 8077, 360, 7237, 297, 286, 5700, 63, 269, 63, 354, 9, 421, 199, 318, 663, 8, 67, 5700, 63, 269, 63, 354, 12, 3354, 29, 549, 12, 1011, 958, 304, 272, 408, 272, 2494, 3970, 2633, 14, 272, 408, 272, 372, 485, 31007, 8077, 360, 409, 297, 286, 5700, 63, 269, 63, 354, 12, 3354, 29, 2117, 12, 1011, 958, 9, 421, 199, 318, 1343, 8, 67, 5700, 63, 269, 63, 354, 12, 3618, 29, 797, 12, 3542, 29, 797, 12, 1011, 958, 304, 272, 408, 272, 7707, 314, 3970, 14, 339, 982, 627, 2573, 10, 365, 1124, 549, 4542, 3618, 5133, 314, 3970, 365, 1536, 436, 3879, 14, 339, 2508, 5721, 447, 1124, 2573, 29, 549, 1040, 365, 10529, 543, 373, 90, 8077, 650, 14, 16, 14, 1194, 326, 641, 30445, 1227, 14, 16, 19943, 16597, 13278, 272, 408, 272, 372, 485, 31007, 8077, 360, 928, 297, 286, 5700, 63, 269, 63, 354, 12, 3618, 29, 2573, 12, 3542, 29, 3990, 12, 1011, 958, 9, 421, 199, 318, 3631, 8, 67, 5700, 63, 269, 63, 354, 12, 7377, 29, 797, 12, 1011, 958, 304, 272, 408, 272, 8015, 314, 3970, 14, 272, 408, 272, 372, 485, 31007, 8077, 360, 2379, 297, 286, 5700, 63, 269, 63, 354, 12, 7377, 29, 7015, 12, 1011, 958, 9, 421, 199, 318, 11004, 8, 67, 5700, 63, 269, 63, 354, 12, 3618, 29, 549, 12, 3542, 29, 797, 12, 7377, 29, 797, 12, 1011, 958, 304, 272, 408, 272, 799, 928, 314, 3970, 14, 272, 408, 272, 372, 485, 31007, 8077, 360, 10506, 297, 286, 5700, 63, 269, 63, 354, 12, 3618, 29, 2573, 12, 3542, 29, 3990, 12, 7377, 29, 7015, 12, 1011, 958, 9, 421, 199, 318, 2004, 8, 67, 5700, 63, 269, 63, 354, 304, 272, 408, 272, 2372, 314, 2004, 402, 314, 3970, 14, 272, 408, 272, 543, 2202, 8, 4050, 63, 2118, 29, 549, 304, 267, 372, 485, 31007, 8077, 360, 1205, 297, 286, 5700, 63, 269, 63, 354, 9, 421, 199, 318, 3879, 8, 67, 5700, 63, 269, 63, 354, 304, 272, 408, 272, 2670, 340, 314, 3970, 365, 3879, 14, 272, 408, 272, 372, 2004, 8, 67, 5700, 63, 269, 63, 354, 680, 1294, 360, 27618, 20, 61, 508, 283, 5720, 7, 421, 199, 318, 3495, 8, 67, 5700, 63, 269, 63, 354, 304, 272, 408, 272, 2670, 340, 314, 3970, 3495, 14, 272, 408, 272, 543, 2202, 8, 8191, 360, 5720, 297, 283, 2703, 297, 283, 5451, 659, 7987, 63, 2118, 29, 549, 304, 267, 372, 2004, 8, 67, 5700, 63, 269, 63, 354, 680, 20003, 421, 199, 318, 2146, 18, 8, 67, 5700, 63, 269, 63, 354, 12, 1414, 304, 272, 408, 272, 3378, 282, 1414, 6272, 314, 3970, 14, 339, 3800, 398, 492, 31507, 2537, 398, 522, 275, 31507, 2537, 14, 1490, 31007, 14, 1628, 18, 360, 1421, 297, 283, 4269, 358, 339, 2508, 5721, 447, 314, 1414, 911, 506, 1255, 465, 1011, 1231, 538, 14, 339, 408, 272, 372, 14682, 480, 31007, 8077, 2146, 18, 450, 83, 1543, 83, 4065, 450, 334, 67, 5700, 63, 269, 63, 354, 12, 1414, 430, 421, 199, 318, 485, 31007, 8077, 8, 1531, 12, 286, 5700, 63, 269, 63, 354, 12, 1011, 958, 304, 272, 1249, 275, 485, 4441, 63, 589, 3682, 958, 9, 272, 372, 14682, 360, 31007, 8077, 450, 83, 450, 83, 450, 83, 7, 450, 334, 1531, 12, 286, 5700, 63, 269, 63, 354, 12, 1249, 430, 421, 199, 318, 485, 4441, 63, 589, 3682, 958, 304, 272, 1249, 275, 942, 272, 367, 1022, 12, 373, 315, 2074, 14, 1744, 837, 267, 340, 1228, 8, 86, 12, 2155, 304, 288, 340, 373, 365, 715, 26, 355, 1249, 14, 740, 4517, 5, 83, 7, 450, 1022, 9, 267, 916, 1228, 8, 86, 12, 334, 513, 12, 2008, 2298, 288, 367, 6193, 315, 373, 26, 355, 1249, 14, 740, 4517, 5, 83, 450, 83, 7, 450, 334, 75, 12, 6193, 430, 267, 916, 373, 365, 440, 488, 26, 288, 1249, 14, 740, 4517, 5, 83, 450, 83, 7, 450, 334, 75, 12, 373, 430, 272, 372, 283, 1987, 904, 8, 589, 9, 421, 199, 318, 5235, 63, 1160, 8, 354, 29, 403, 12, 1166, 29, 403, 304, 272, 408, 272, 17955, 376, 3232, 54, 58, 1978, 14, 339, 5679, 447, 398, 687, 31507, 2537, 14, 1490, 31007, 492, 5235, 63, 1160, 398, 327, 3645, 3537, 4403, 1978, 267, 5235, 63, 1160, 8, 633, 534, 1014, 921, 2694, 14, 957, 15, 5876, 15, 1662, 1977, 14, 5369, 14, 6838, 358, 339, 982, 949, 627, 633, 10, 365, 2741, 12, 314, 4403, 1978, 911, 506, 13557, 687, 314, 272, 658, 4249, 14, 1490, 31007, 14, 1308, 665, 1014, 921, 4249, 14, 1490, 31007, 14, 1308, 15, 1160, 15, 657, 3966, 3133, 18417, 272, 7611, 447, 398, 687, 31507, 2537, 14, 1490, 31007, 492, 5235, 63, 1160, 398, 327, 3645, 4403, 1978, 687, 1455, 921, 4249, 14, 1490, 31007, 14, 1308, 15, 1160, 15, 657, 3966, 15, 267, 5235, 63, 1160, 360, 23204, 13, 22, 14, 16, 13, 88, 1184, 63, 772, 358, 339, 408, 272, 340, 1166, 365, 488, 26, 267, 1166, 275, 283, 1014, 921, 4249, 14, 1490, 31007, 14, 1308, 15, 1160, 15, 657, 3966, 3149, 83, 14, 5369, 14, 6838, 7, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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ools bug by providing a fake Pyrex sys.path.insert(0, os.path.join(os.path.dirname(__file__), "fake_pyrex")) except ImportError: pass try: import pkg_resources try: pkg_resources.require("setuptools>=0.6c5") except pkg_resources.VersionConflict: from ez_setup import use_setuptools use_setuptools(version="0.6c5") #pkg_resources.require("Cython==0.9.6.10") from setuptools import setup extra_options["zip_safe"] = False except ImportError: # no setuptools installed from distutils.core import setup import versioninfo import setupinfo # override these and pass --static for a static build. See # doc/build.txt for more information. If you do not pass --static # changing this will have no effect. STATIC_INCLUDE_DIRS = [] STATIC_LIBRARY_DIRS = [] STATIC_CFLAGS = [] STATIC_BINARIES = [] # create lxml-version.h file svn_version = versioninfo.svn_version() versioninfo.create_version_h(svn_version) print("Building lxml version %s." % svn_version) OPTION_RUN_TESTS = setupinfo.has_option('run-tests') branch_link = """ After an official release of a new stable series, current bug fixes become available at http://codespeak.net/svn/lxml/branch/lxml-%(branch_version)s . Running ``easy_install lxml==%(branch_version)sbugfix`` will install this version from http://codespeak.net/svn/lxml/branch/lxml-%(branch_version)s#egg=lxml-%(branch_version)sbugfix """ if versioninfo.is_pre_release(): branch_link = "" extra_options.update(setupinfo.extra_setup_args()) setup( name = "lxml", version = versioninfo.version(), author="lxml dev team", author_email="lxml-dev@codespeak.net", maintainer="lxml dev team", maintainer_email="lxml-dev@codespeak.net", url="http://codespeak.net/lxml", download_url="http://pypi.python.org/packages/source/l/lxml/lxml-%s.tar.gz" % versioninfo.version(), description="Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.", long_description=((("""\ lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. It provides safe and convenient access to these libraries using the ElementTree API. It extends the ElementTree API significantly to offer support for XPath, RelaxNG, XML Schema, XSLT, C14N and much more. To contact the project, go to the `project home page <http://codespeak.net>`_ or see our bug tracker at https://launchpad.net/lxml In case you want to use the current in-development version of lxml, you can get it from the subversion repository at http://codespeak.net/svn/lxml/trunk . Running ``easy_install lxml==dev`` will install it from http://codespeak.net/svn/lxml/trunk#egg=lxml-dev """ + branch_link) % { "branch_version" : versioninfo.branch_version() }) + versioninfo.changes()), classifiers = [ versioninfo.dev_status(), 'Intended Audience :: Developers', 'Intended Audience :: Information Technology', 'License :: OSI Approved :: BSD License', 'Programming Language :: Cython', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.3', 'Programming Language :: Python :: 2.4', 'Programming Language :: Python :: 2.5', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.0', 'Programming Language :: C', 'Operating System :: OS Independent', 'Topic :: Text Processing :: Markup :: HTML', 'Topic :: Text Processing :: Markup :: XML', 'Topic :: Software Development :: Libraries :: Python Modules' ], package_dir = {'': 'src'}, packages = ['lxml', 'lxml.html'], ext_modules = setupinfo.ext_modules( STATIC_INCLUDE_DIRS, STATIC_LIBRARY_DIRS, STATIC_CFLAGS, STATIC_BINARIES), **extra_options ) if OPTION_RUN_TESTS: print("Running tests.") import test sys.exit( test.main(sys.argv[:1]) )
apache-2.0
[ 646, 984, 12, 747, 199, 199, 2911, 63, 1419, 275, 1052, 199, 199, 893, 26, 272, 492, 26741, 272, 327, 1443, 1929, 370, 1736, 6818, 9116, 6519, 701, 13070, 282, 4026, 1611, 15063, 272, 984, 14, 515, 14, 3176, 8, 16, 12, 747, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 298, 3183, 63, 647, 15063, 2237, 199, 2590, 3545, 26, 272, 986, 199, 199, 893, 26, 272, 492, 5496, 63, 4435, 272, 862, 26, 267, 5496, 63, 4435, 14, 4365, 480, 13623, 8119, 16, 14, 22, 67, 21, 531, 272, 871, 5496, 63, 4435, 14, 3353, 15919, 26, 267, 687, 325, 90, 63, 2758, 492, 675, 63, 13623, 267, 675, 63, 13623, 8, 1023, 628, 16, 14, 22, 67, 21, 531, 272, 327, 4600, 63, 4435, 14, 4365, 480, 9156, 898, 389, 16, 14, 25, 14, 22, 14, 709, 531, 272, 687, 9116, 492, 3272, 272, 2402, 63, 1419, 905, 3065, 63, 3489, 937, 275, 756, 199, 2590, 3545, 26, 272, 327, 949, 9116, 4903, 272, 687, 7065, 14, 1018, 492, 3272, 421, 199, 646, 1015, 815, 199, 646, 3272, 815, 199, 199, 3, 4278, 3520, 436, 986, 1553, 1986, 367, 282, 2955, 1900, 14, 1666, 199, 3, 1382, 15, 1506, 14, 2424, 367, 1655, 2556, 14, 982, 1265, 886, 440, 986, 1553, 1986, 199, 3, 13729, 642, 911, 1172, 949, 7763, 14, 199, 10449, 63, 18171, 63, 14455, 275, 942, 199, 10449, 63, 16983, 63, 14455, 275, 942, 199, 10449, 63, 14804, 275, 942, 199, 10449, 63, 9431, 25244, 275, 942, 199, 199, 3, 1218, 14490, 13, 1023, 14, 72, 570, 199, 6836, 63, 1023, 275, 1015, 815, 14, 6836, 63, 1023, 342, 199, 1023, 815, 14, 981, 63, 1023, 63, 72, 8, 6836, 63, 1023, 9, 199, 1361, 480, 16461, 14490, 1015, 450, 83, 2122, 450, 11327, 63, 1023, 9, 199, 199, 13352, 63, 9390, 63, 7569, 275, 3272, 815, 14, 1989, 63, 1422, 360, 1065, 13, 2219, 358, 199, 199, 4694, 63, 1073, 275, 408, 199, 10881, 376, 25410, 4683, 402, 282, 892, 17830, 6779, 12, 1453, 6519, 25079, 8649, 199, 4561, 737, 1455, 921, 6021, 8556, 14, 846, 15, 6836, 15, 22899, 15, 4694, 15, 22899, 13, 2840, 4694, 63, 1023, 9, 83, 1275, 199, 9602, 1124, 13581, 63, 3174, 14490, 389, 2840, 4694, 63, 1023, 9, 83, 1266, 970, 1040, 911, 3907, 642, 199, 1023, 687, 199, 1014, 921, 6021, 8556, 14, 846, 15, 6836, 15, 22899, 15, 4694, 15, 22899, 13, 2840, 4694, 63, 1023, 9, 83, 3, 5799, 29, 22899, 13, 2840, 4694, 63, 1023, 9, 83, 1266, 970, 199, 199, 624, 199, 199, 692, 1015, 815, 14, 374, 63, 657, 63, 3221, 837, 272, 5246, 63, 1073, 275, 3087, 421, 199, 2911, 63, 1419, 14, 873, 8, 2758, 815, 14, 2911, 63, 2758, 63, 589, 1012, 199, 199, 2758, 8, 272, 536, 275, 298, 22899, 401, 272, 1015, 275, 1015, 815, 14, 1023, 1062, 272, 4132, 628, 22899, 4866, 8099, 401, 272, 4132, 63, 2123, 628, 22899, 13, 2374, 32, 6021, 8556, 14, 846, 401, 272, 11075, 281, 628, 22899, 4866, 8099, 401, 272, 11075, 281, 63, 2123, 628, 22899, 13, 2374, 32, 6021, 8556, 14, 846, 401, 272, 1166, 628, 1014, 921, 6021, 8556, 14, 846, 15, 22899, 401, 272, 5235, 63, 633, 628, 1014, 921, 17343, 14, 1548, 14, 1308, 15, 5154, 15, 1365, 15, 76, 15, 22899, 15, 22899, 3295, 83, 14, 5369, 14, 6838, 2, 450, 1015, 815, 14, 1023, 1062, 339, 1369, 628, 6921, 1893, 436, 2018, 530, 4692, 6661, 3555, 29391, 15404, 18, 15, 773, 19324, 84, 543, 314, 13139, 3261, 4765, 339, 1846, 63, 1802, 31934, 21723, 199, 22899, 365, 282, 2018, 530, 12, 333, 1463, 11696, 367, 314, 15404, 18, 436, 1973, 19324, 84, 8363, 14, 221, 2779, 199, 20121, 5048, 436, 22700, 2879, 370, 3520, 8363, 1808, 314, 13139, 199, 3735, 14, 199, 199, 7940, 16879, 314, 13139, 3261, 16474, 590, 370, 19793, 2291, 367, 1323, 2042, 12, 199, 5640, 1219, 12259, 12, 4692, 13268, 12, 1323, 4929, 52, 12, 445, 1079, 46, 436, 8298, 1655, 14, 199, 199, 1378, 8966, 314, 2199, 12, 2621, 370, 314, 658, 1715, 5629, 2034, 199, 28, 1014, 921, 6021, 8556, 14, 846, 18740, 503, 1937, 4154, 6519, 15271, 737, 199, 2859, 921, 9850, 6226, 14, 846, 15, 22899, 199, 199, 607, 1930, 1265, 2934, 370, 675, 314, 1453, 315, 13, 31688, 1015, 402, 14490, 12, 1265, 883, 199, 362, 652, 687, 314, 1007, 1023, 7611, 737, 1455, 921, 6021, 8556, 14, 846, 15, 6836, 15, 22899, 15, 13409, 1275, 199, 9602, 1124, 13581, 63, 3174, 14490, 389, 2374, 1040, 911, 3907, 652, 687, 199, 1014, 921, 6021, 8556, 14, 846, 15, 6836, 15, 22899, 15, 13409, 3, 5799, 29, 22899, 13, 2374, 199, 199, 624, 435, 5246, 63, 1073, 9, 450, 469, 298, 4694, 63, 1023, 2, 520, 1015, 815, 14, 4694, 63, 1023, 342, 3828, 435, 1993, 1015, 815, 14, 6627, 4000, 272, 19137, 275, 359, 272, 1015, 815, 14, 2374, 63, 1205, 1062, 272, 283, 23910, 23975, 3800, 23493, 297, 272, 283, 23910, 23975, 3800, 17064, 21580, 297, 272, 283, 3761, 3800, 25718, 26330, 3800, 6289, 844, 297, 272, 283, 11411, 8466, 3800, 26741, 297, 272, 283, 11411, 8466, 3800, 2018, 3800, 499, 297, 272, 283, 11411, 8466, 3800, 2018, 3800, 499, 14, 19, 297, 272, 283, 11411, 8466, 3800, 2018, 3800, 499, 14, 20, 297, 272, 283, 11411, 8466, 3800, 2018, 3800, 499, 14, 21, 297, 272, 283, 11411, 8466, 3800, 2018, 3800, 499, 14, 22, 297, 272, 283, 11411, 8466, 3800, 2018, 3800, 650, 297, 272, 283, 11411, 8466, 3800, 2018, 3800, 650, 14, 16, 297, 272, 283, 11411, 8466, 3800, 445, 297, 272, 283, 23699, 6187, 3800, 4403, 1010, 7106, 297, 272, 283, 12157, 3800, 4516, 20157, 3800, 17504, 3800, 4163, 297, 272, 283, 12157, 3800, 4516, 20157, 3800, 17504, 3800, 4692, 297, 272, 283, 12157, 3800, 2290, 15290, 3800, 31454, 3800, 2018, 18167, 7, 272, 2156, 339, 2559, 63, 694, 275, 791, 356, 283, 2164, 2267, 272, 6117, 275, 788, 22899, 297, 283, 22899, 14, 1360, 995, 272, 1599, 63, 3112, 275, 3272, 815, 14, 832, 63, 3112 ]
[ 984, 12, 747, 199, 199, 2911, 63, 1419, 275, 1052, 199, 199, 893, 26, 272, 492, 26741, 272, 327, 1443, 1929, 370, 1736, 6818, 9116, 6519, 701, 13070, 282, 4026, 1611, 15063, 272, 984, 14, 515, 14, 3176, 8, 16, 12, 747, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 298, 3183, 63, 647, 15063, 2237, 199, 2590, 3545, 26, 272, 986, 199, 199, 893, 26, 272, 492, 5496, 63, 4435, 272, 862, 26, 267, 5496, 63, 4435, 14, 4365, 480, 13623, 8119, 16, 14, 22, 67, 21, 531, 272, 871, 5496, 63, 4435, 14, 3353, 15919, 26, 267, 687, 325, 90, 63, 2758, 492, 675, 63, 13623, 267, 675, 63, 13623, 8, 1023, 628, 16, 14, 22, 67, 21, 531, 272, 327, 4600, 63, 4435, 14, 4365, 480, 9156, 898, 389, 16, 14, 25, 14, 22, 14, 709, 531, 272, 687, 9116, 492, 3272, 272, 2402, 63, 1419, 905, 3065, 63, 3489, 937, 275, 756, 199, 2590, 3545, 26, 272, 327, 949, 9116, 4903, 272, 687, 7065, 14, 1018, 492, 3272, 421, 199, 646, 1015, 815, 199, 646, 3272, 815, 199, 199, 3, 4278, 3520, 436, 986, 1553, 1986, 367, 282, 2955, 1900, 14, 1666, 199, 3, 1382, 15, 1506, 14, 2424, 367, 1655, 2556, 14, 982, 1265, 886, 440, 986, 1553, 1986, 199, 3, 13729, 642, 911, 1172, 949, 7763, 14, 199, 10449, 63, 18171, 63, 14455, 275, 942, 199, 10449, 63, 16983, 63, 14455, 275, 942, 199, 10449, 63, 14804, 275, 942, 199, 10449, 63, 9431, 25244, 275, 942, 199, 199, 3, 1218, 14490, 13, 1023, 14, 72, 570, 199, 6836, 63, 1023, 275, 1015, 815, 14, 6836, 63, 1023, 342, 199, 1023, 815, 14, 981, 63, 1023, 63, 72, 8, 6836, 63, 1023, 9, 199, 1361, 480, 16461, 14490, 1015, 450, 83, 2122, 450, 11327, 63, 1023, 9, 199, 199, 13352, 63, 9390, 63, 7569, 275, 3272, 815, 14, 1989, 63, 1422, 360, 1065, 13, 2219, 358, 199, 199, 4694, 63, 1073, 275, 408, 199, 10881, 376, 25410, 4683, 402, 282, 892, 17830, 6779, 12, 1453, 6519, 25079, 8649, 199, 4561, 737, 1455, 921, 6021, 8556, 14, 846, 15, 6836, 15, 22899, 15, 4694, 15, 22899, 13, 2840, 4694, 63, 1023, 9, 83, 1275, 199, 9602, 1124, 13581, 63, 3174, 14490, 389, 2840, 4694, 63, 1023, 9, 83, 1266, 970, 1040, 911, 3907, 642, 199, 1023, 687, 199, 1014, 921, 6021, 8556, 14, 846, 15, 6836, 15, 22899, 15, 4694, 15, 22899, 13, 2840, 4694, 63, 1023, 9, 83, 3, 5799, 29, 22899, 13, 2840, 4694, 63, 1023, 9, 83, 1266, 970, 199, 199, 624, 199, 199, 692, 1015, 815, 14, 374, 63, 657, 63, 3221, 837, 272, 5246, 63, 1073, 275, 3087, 421, 199, 2911, 63, 1419, 14, 873, 8, 2758, 815, 14, 2911, 63, 2758, 63, 589, 1012, 199, 199, 2758, 8, 272, 536, 275, 298, 22899, 401, 272, 1015, 275, 1015, 815, 14, 1023, 1062, 272, 4132, 628, 22899, 4866, 8099, 401, 272, 4132, 63, 2123, 628, 22899, 13, 2374, 32, 6021, 8556, 14, 846, 401, 272, 11075, 281, 628, 22899, 4866, 8099, 401, 272, 11075, 281, 63, 2123, 628, 22899, 13, 2374, 32, 6021, 8556, 14, 846, 401, 272, 1166, 628, 1014, 921, 6021, 8556, 14, 846, 15, 22899, 401, 272, 5235, 63, 633, 628, 1014, 921, 17343, 14, 1548, 14, 1308, 15, 5154, 15, 1365, 15, 76, 15, 22899, 15, 22899, 3295, 83, 14, 5369, 14, 6838, 2, 450, 1015, 815, 14, 1023, 1062, 339, 1369, 628, 6921, 1893, 436, 2018, 530, 4692, 6661, 3555, 29391, 15404, 18, 15, 773, 19324, 84, 543, 314, 13139, 3261, 4765, 339, 1846, 63, 1802, 31934, 21723, 199, 22899, 365, 282, 2018, 530, 12, 333, 1463, 11696, 367, 314, 15404, 18, 436, 1973, 19324, 84, 8363, 14, 221, 2779, 199, 20121, 5048, 436, 22700, 2879, 370, 3520, 8363, 1808, 314, 13139, 199, 3735, 14, 199, 199, 7940, 16879, 314, 13139, 3261, 16474, 590, 370, 19793, 2291, 367, 1323, 2042, 12, 199, 5640, 1219, 12259, 12, 4692, 13268, 12, 1323, 4929, 52, 12, 445, 1079, 46, 436, 8298, 1655, 14, 199, 199, 1378, 8966, 314, 2199, 12, 2621, 370, 314, 658, 1715, 5629, 2034, 199, 28, 1014, 921, 6021, 8556, 14, 846, 18740, 503, 1937, 4154, 6519, 15271, 737, 199, 2859, 921, 9850, 6226, 14, 846, 15, 22899, 199, 199, 607, 1930, 1265, 2934, 370, 675, 314, 1453, 315, 13, 31688, 1015, 402, 14490, 12, 1265, 883, 199, 362, 652, 687, 314, 1007, 1023, 7611, 737, 1455, 921, 6021, 8556, 14, 846, 15, 6836, 15, 22899, 15, 13409, 1275, 199, 9602, 1124, 13581, 63, 3174, 14490, 389, 2374, 1040, 911, 3907, 652, 687, 199, 1014, 921, 6021, 8556, 14, 846, 15, 6836, 15, 22899, 15, 13409, 3, 5799, 29, 22899, 13, 2374, 199, 199, 624, 435, 5246, 63, 1073, 9, 450, 469, 298, 4694, 63, 1023, 2, 520, 1015, 815, 14, 4694, 63, 1023, 342, 3828, 435, 1993, 1015, 815, 14, 6627, 4000, 272, 19137, 275, 359, 272, 1015, 815, 14, 2374, 63, 1205, 1062, 272, 283, 23910, 23975, 3800, 23493, 297, 272, 283, 23910, 23975, 3800, 17064, 21580, 297, 272, 283, 3761, 3800, 25718, 26330, 3800, 6289, 844, 297, 272, 283, 11411, 8466, 3800, 26741, 297, 272, 283, 11411, 8466, 3800, 2018, 3800, 499, 297, 272, 283, 11411, 8466, 3800, 2018, 3800, 499, 14, 19, 297, 272, 283, 11411, 8466, 3800, 2018, 3800, 499, 14, 20, 297, 272, 283, 11411, 8466, 3800, 2018, 3800, 499, 14, 21, 297, 272, 283, 11411, 8466, 3800, 2018, 3800, 499, 14, 22, 297, 272, 283, 11411, 8466, 3800, 2018, 3800, 650, 297, 272, 283, 11411, 8466, 3800, 2018, 3800, 650, 14, 16, 297, 272, 283, 11411, 8466, 3800, 445, 297, 272, 283, 23699, 6187, 3800, 4403, 1010, 7106, 297, 272, 283, 12157, 3800, 4516, 20157, 3800, 17504, 3800, 4163, 297, 272, 283, 12157, 3800, 4516, 20157, 3800, 17504, 3800, 4692, 297, 272, 283, 12157, 3800, 2290, 15290, 3800, 31454, 3800, 2018, 18167, 7, 272, 2156, 339, 2559, 63, 694, 275, 791, 356, 283, 2164, 2267, 272, 6117, 275, 788, 22899, 297, 283, 22899, 14, 1360, 995, 272, 1599, 63, 3112, 275, 3272, 815, 14, 832, 63, 3112, 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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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 ]
poiati/django
django/conf/locale/id/formats.py
504
2135
# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # from __future__ import unicode_literals # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j N Y' DATETIME_FORMAT = "j N Y, G.i" TIME_FORMAT = 'G.i' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j F' SHORT_DATE_FORMAT = 'd-m-Y' SHORT_DATETIME_FORMAT = 'd-m-Y G.i' FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior DATE_INPUT_FORMATS = [ '%d-%m-%y', '%d/%m/%y', # '25-10-09', 25/10/09' '%d-%m-%Y', '%d/%m/%Y', # '25-10-2009', 25/10/2009' '%d %b %Y', # '25 Oct 2006', '%d %B %Y', # '25 October 2006' ] TIME_INPUT_FORMATS = [ '%H.%M.%S', # '14.30.59' '%H.%M', # '14.30' ] DATETIME_INPUT_FORMATS = [ '%d-%m-%Y %H.%M.%S', # '25-10-2009 14.30.59' '%d-%m-%Y %H.%M.%S.%f', # '25-10-2009 14.30.59.000200' '%d-%m-%Y %H.%M', # '25-10-2009 14.30' '%d-%m-%Y', # '25-10-2009' '%d-%m-%y %H.%M.%S', # '25-10-09' 14.30.59' '%d-%m-%y %H.%M.%S.%f', # '25-10-09' 14.30.59.000200' '%d-%m-%y %H.%M', # '25-10-09' 14.30' '%d-%m-%y', # '25-10-09'' '%m/%d/%y %H.%M.%S', # '10/25/06 14.30.59' '%m/%d/%y %H.%M.%S.%f', # '10/25/06 14.30.59.000200' '%m/%d/%y %H.%M', # '10/25/06 14.30' '%m/%d/%y', # '10/25/06' '%m/%d/%Y %H.%M.%S', # '25/10/2009 14.30.59' '%m/%d/%Y %H.%M.%S.%f', # '25/10/2009 14.30.59.000200' '%m/%d/%Y %H.%M', # '25/10/2009 14.30' '%m/%d/%Y', # '10/25/2009' ] DECIMAL_SEPARATOR = ',' THOUSAND_SEPARATOR = '.' NUMBER_GROUPING = 3
bsd-3-clause
[ 3, 1882, 2644, 26, 2774, 13, 24, 1882, 199, 3, 961, 570, 365, 1854, 1334, 314, 2011, 4190, 465, 314, 5634, 2559, 14, 199, 3, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 3, 710, 20841, 4807, 3326, 675, 314, 5634, 1434, 1475, 6302, 12, 199, 3, 1937, 1455, 921, 4757, 14, 14013, 14, 957, 15, 287, 15, 2374, 15, 1121, 15, 5876, 15, 10372, 12645, 602, 199, 5390, 63, 4807, 275, 283, 74, 653, 1488, 7, 199, 12488, 63, 4807, 275, 298, 74, 653, 1488, 12, 598, 14, 73, 2, 199, 4961, 63, 4807, 275, 283, 39, 14, 73, 7, 199, 19216, 63, 16413, 63, 4807, 275, 283, 38, 1488, 7, 199, 16413, 63, 11655, 63, 4807, 275, 283, 74, 481, 7, 199, 13003, 63, 5390, 63, 4807, 275, 283, 68, 13, 77, 13, 57, 7, 199, 13003, 63, 12488, 63, 4807, 275, 283, 68, 13, 77, 13, 57, 598, 14, 73, 7, 199, 12903, 63, 11655, 63, 3359, 63, 24929, 275, 413, 221, 327, 32740, 199, 199, 3, 710, 20841, 7321, 63, 14019, 3326, 675, 314, 2018, 14053, 1475, 6302, 12, 199, 3, 1937, 1455, 921, 4757, 14, 1548, 14, 1308, 15, 4342, 15, 2083, 14, 1360, 3, 6205, 13, 9866, 13, 17537, 199, 5390, 63, 7321, 63, 14019, 275, 359, 272, 1543, 68, 3295, 77, 3295, 89, 297, 1543, 68, 3149, 77, 3149, 89, 297, 3777, 327, 283, 821, 13, 709, 13, 1643, 297, 5661, 15, 709, 15, 1643, 7, 272, 1543, 68, 3295, 77, 3295, 57, 297, 1543, 68, 3149, 77, 3149, 57, 297, 3777, 327, 283, 821, 13, 709, 13, 8664, 297, 5661, 15, 709, 15, 8664, 7, 272, 1543, 68, 450, 66, 450, 57, 297, 12793, 327, 283, 821, 18365, 8315, 297, 272, 1543, 68, 450, 34, 450, 57, 297, 12793, 327, 283, 821, 18365, 22459, 8315, 7, 199, 61, 199, 199, 4961, 63, 7321, 63, 14019, 275, 359, 272, 1543, 40, 4111, 45, 4111, 51, 297, 12793, 327, 283, 1079, 14, 1216, 14, 1427, 7, 272, 1543, 40, 4111, 45, 297, 14960, 327, 283, 1079, 14, 1216, 7, 199, 61, 199, 199, 12488, 63, 7321, 63, 14019, 275, 359, 272, 1543, 68, 3295, 77, 3295, 57, 450, 40, 4111, 45, 4111, 51, 297, 4483, 327, 283, 821, 13, 709, 13, 8664, 4329, 14, 1216, 14, 1427, 7, 272, 1543, 68, 3295, 77, 3295, 57, 450, 40, 4111, 45, 4111, 51, 4111, 70, 297, 3777, 327, 283, 821, 13, 709, 13, 8664, 4329, 14, 1216, 14, 1427, 14, 25080, 7, 272, 1543, 68, 3295, 77, 3295, 57, 450, 40, 4111, 45, 297, 7861, 327, 283, 821, 13, 709, 13, 8664, 4329, 14, 1216, 7, 272, 1543, 68, 3295, 77, 3295, 57, 297, 12793, 327, 283, 821, 13, 709, 13, 8664, 7, 272, 1543, 68, 3295, 77, 3295, 89, 450, 40, 4111, 45, 4111, 51, 297, 4483, 327, 283, 821, 13, 709, 13, 1643, 7, 4329, 14, 1216, 14, 1427, 7, 272, 1543, 68, 3295, 77, 3295, 89, 450, 40, 4111, 45, 4111, 51, 4111, 70, 297, 3777, 327, 283, 821, 13, 709, 13, 1643, 7, 4329, 14, 1216, 14, 1427, 14, 25080, 7, 272, 1543, 68, 3295, 77, 3295, 89, 450, 40, 4111, 45, 297, 7861, 327, 283, 821, 13, 709, 13, 1643, 7, 4329, 14, 1216, 7, 272, 1543, 68, 3295, 77, 3295, 89, 297, 12793, 327, 283, 821, 13, 709, 13, 1643, 891, 272, 1543, 77, 3149, 68, 3149, 89, 450, 40, 4111, 45, 4111, 51, 297, 4483, 327, 283, 709, 15, 821, 15, 1690, 4329, 14, 1216, 14, 1427, 7, 272, 1543, 77, 3149, 68, 3149, 89, 450, 40, 4111, 45, 4111, 51, 4111, 70, 297, 3777, 327, 283, 709, 15, 821, 15, 1690, 4329, 14, 1216, 14, 1427, 14, 25080, 7, 272, 1543, 77, 3149, 68, 3149, 89, 450, 40, 4111, 45, 297, 7861, 327, 283, 709, 15, 821, 15, 1690, 4329, 14, 1216, 7, 272, 1543, 77, 3149, 68, 3149, 89, 297, 12793, 327, 283, 709, 15, 821, 15, 1690, 7, 272, 1543, 77, 3149, 68, 3149, 57, 450, 40, 4111, 45, 4111, 51, 297, 4483, 327, 283, 821, 15, 709, 15, 8664, 4329, 14, 1216, 14, 1427, 7, 272, 1543, 77, 3149, 68, 3149, 57, 450, 40, 4111, 45, 4111, 51, 4111, 70, 297, 3777, 327, 283, 821, 15, 709, 15, 8664, 4329, 14, 1216, 14, 1427, 14, 25080, 7, 272, 1543, 77, 3149, 68, 3149, 57, 450, 40, 4111, 45, 297, 7861, 327, 283, 821, 15, 709, 15, 8664, 4329, 14, 1216, 7, 272, 1543, 77, 3149, 68, 3149, 57, 297, 12793, 327, 283, 709, 15, 821, 15, 8664, 7, 199, 61, 199, 199, 23925, 63, 15828, 275, 13647, 199, 28714, 63, 15828, 275, 7815, 199, 9190, 63, 7823, 1206, 275, 650, 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 ]
[ 1882, 2644, 26, 2774, 13, 24, 1882, 199, 3, 961, 570, 365, 1854, 1334, 314, 2011, 4190, 465, 314, 5634, 2559, 14, 199, 3, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 3, 710, 20841, 4807, 3326, 675, 314, 5634, 1434, 1475, 6302, 12, 199, 3, 1937, 1455, 921, 4757, 14, 14013, 14, 957, 15, 287, 15, 2374, 15, 1121, 15, 5876, 15, 10372, 12645, 602, 199, 5390, 63, 4807, 275, 283, 74, 653, 1488, 7, 199, 12488, 63, 4807, 275, 298, 74, 653, 1488, 12, 598, 14, 73, 2, 199, 4961, 63, 4807, 275, 283, 39, 14, 73, 7, 199, 19216, 63, 16413, 63, 4807, 275, 283, 38, 1488, 7, 199, 16413, 63, 11655, 63, 4807, 275, 283, 74, 481, 7, 199, 13003, 63, 5390, 63, 4807, 275, 283, 68, 13, 77, 13, 57, 7, 199, 13003, 63, 12488, 63, 4807, 275, 283, 68, 13, 77, 13, 57, 598, 14, 73, 7, 199, 12903, 63, 11655, 63, 3359, 63, 24929, 275, 413, 221, 327, 32740, 199, 199, 3, 710, 20841, 7321, 63, 14019, 3326, 675, 314, 2018, 14053, 1475, 6302, 12, 199, 3, 1937, 1455, 921, 4757, 14, 1548, 14, 1308, 15, 4342, 15, 2083, 14, 1360, 3, 6205, 13, 9866, 13, 17537, 199, 5390, 63, 7321, 63, 14019, 275, 359, 272, 1543, 68, 3295, 77, 3295, 89, 297, 1543, 68, 3149, 77, 3149, 89, 297, 3777, 327, 283, 821, 13, 709, 13, 1643, 297, 5661, 15, 709, 15, 1643, 7, 272, 1543, 68, 3295, 77, 3295, 57, 297, 1543, 68, 3149, 77, 3149, 57, 297, 3777, 327, 283, 821, 13, 709, 13, 8664, 297, 5661, 15, 709, 15, 8664, 7, 272, 1543, 68, 450, 66, 450, 57, 297, 12793, 327, 283, 821, 18365, 8315, 297, 272, 1543, 68, 450, 34, 450, 57, 297, 12793, 327, 283, 821, 18365, 22459, 8315, 7, 199, 61, 199, 199, 4961, 63, 7321, 63, 14019, 275, 359, 272, 1543, 40, 4111, 45, 4111, 51, 297, 12793, 327, 283, 1079, 14, 1216, 14, 1427, 7, 272, 1543, 40, 4111, 45, 297, 14960, 327, 283, 1079, 14, 1216, 7, 199, 61, 199, 199, 12488, 63, 7321, 63, 14019, 275, 359, 272, 1543, 68, 3295, 77, 3295, 57, 450, 40, 4111, 45, 4111, 51, 297, 4483, 327, 283, 821, 13, 709, 13, 8664, 4329, 14, 1216, 14, 1427, 7, 272, 1543, 68, 3295, 77, 3295, 57, 450, 40, 4111, 45, 4111, 51, 4111, 70, 297, 3777, 327, 283, 821, 13, 709, 13, 8664, 4329, 14, 1216, 14, 1427, 14, 25080, 7, 272, 1543, 68, 3295, 77, 3295, 57, 450, 40, 4111, 45, 297, 7861, 327, 283, 821, 13, 709, 13, 8664, 4329, 14, 1216, 7, 272, 1543, 68, 3295, 77, 3295, 57, 297, 12793, 327, 283, 821, 13, 709, 13, 8664, 7, 272, 1543, 68, 3295, 77, 3295, 89, 450, 40, 4111, 45, 4111, 51, 297, 4483, 327, 283, 821, 13, 709, 13, 1643, 7, 4329, 14, 1216, 14, 1427, 7, 272, 1543, 68, 3295, 77, 3295, 89, 450, 40, 4111, 45, 4111, 51, 4111, 70, 297, 3777, 327, 283, 821, 13, 709, 13, 1643, 7, 4329, 14, 1216, 14, 1427, 14, 25080, 7, 272, 1543, 68, 3295, 77, 3295, 89, 450, 40, 4111, 45, 297, 7861, 327, 283, 821, 13, 709, 13, 1643, 7, 4329, 14, 1216, 7, 272, 1543, 68, 3295, 77, 3295, 89, 297, 12793, 327, 283, 821, 13, 709, 13, 1643, 891, 272, 1543, 77, 3149, 68, 3149, 89, 450, 40, 4111, 45, 4111, 51, 297, 4483, 327, 283, 709, 15, 821, 15, 1690, 4329, 14, 1216, 14, 1427, 7, 272, 1543, 77, 3149, 68, 3149, 89, 450, 40, 4111, 45, 4111, 51, 4111, 70, 297, 3777, 327, 283, 709, 15, 821, 15, 1690, 4329, 14, 1216, 14, 1427, 14, 25080, 7, 272, 1543, 77, 3149, 68, 3149, 89, 450, 40, 4111, 45, 297, 7861, 327, 283, 709, 15, 821, 15, 1690, 4329, 14, 1216, 7, 272, 1543, 77, 3149, 68, 3149, 89, 297, 12793, 327, 283, 709, 15, 821, 15, 1690, 7, 272, 1543, 77, 3149, 68, 3149, 57, 450, 40, 4111, 45, 4111, 51, 297, 4483, 327, 283, 821, 15, 709, 15, 8664, 4329, 14, 1216, 14, 1427, 7, 272, 1543, 77, 3149, 68, 3149, 57, 450, 40, 4111, 45, 4111, 51, 4111, 70, 297, 3777, 327, 283, 821, 15, 709, 15, 8664, 4329, 14, 1216, 14, 1427, 14, 25080, 7, 272, 1543, 77, 3149, 68, 3149, 57, 450, 40, 4111, 45, 297, 7861, 327, 283, 821, 15, 709, 15, 8664, 4329, 14, 1216, 7, 272, 1543, 77, 3149, 68, 3149, 57, 297, 12793, 327, 283, 709, 15, 821, 15, 8664, 7, 199, 61, 199, 199, 23925, 63, 15828, 275, 13647, 199, 28714, 63, 15828, 275, 7815, 199, 9190, 63, 7823, 1206, 275, 650, 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, 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, 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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 ]
britco/django-oscar-amazon-payments
sandbox/apps/basket/migrations/0003_auto__add_field_line_price_excl_tax.py
18
21828
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models from oscar.core.compat import AUTH_USER_MODEL, AUTH_USER_MODEL_NAME class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Line.price_excl_tax' db.add_column('basket_line', 'price_excl_tax', self.gf('django.db.models.fields.DecimalField')(null=True, max_digits=12, decimal_places=2), keep_default=False) def backwards(self, orm): # Deleting field 'Line.price_excl_tax' db.delete_column('basket_line', 'price_excl_tax') 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'}) }, AUTH_USER_MODEL: { 'Meta': {'object_name': AUTH_USER_MODEL_NAME}, 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) }, 'basket.basket': { 'Meta': {'object_name': 'Basket'}, 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'date_merged': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'date_submitted': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'owner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'baskets'", 'null': 'True', 'to': "orm['{0}']".format(AUTH_USER_MODEL)}), 'status': ('django.db.models.fields.CharField', [], {'default': "'Open'", 'max_length': '128'}), 'vouchers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['voucher.Voucher']", 'null': 'True', 'symmetrical': 'False'}) }, 'basket.line': { 'Meta': {'unique_together': "(('basket', 'line_reference'),)", 'object_name': 'Line'}, 'basket': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'lines'", 'to': "orm['basket.Basket']"}), 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'line_reference': ('django.db.models.fields.SlugField', [], {'max_length': '128', 'db_index': 'True'}), 'price_excl_tax': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '12', 'decimal_places': '2'}), 'price_incl_tax': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '12', 'decimal_places': '2'}), 'product': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'basket_lines'", 'to': "orm['catalogue.Product']"}), 'quantity': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}) }, 'basket.lineattribute': { 'Meta': {'object_name': 'LineAttribute'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'line': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attributes'", 'to': "orm['basket.Line']"}), 'option': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Option']"}), 'value': ('django.db.models.fields.CharField', [], {'max_length': '255'}) }, 'catalogue.attributeentity': { 'Meta': {'object_name': 'AttributeEntity'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}), 'type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'entities'", 'to': "orm['catalogue.AttributeEntityType']"}) }, 'catalogue.attributeentitytype': { 'Meta': {'object_name': 'AttributeEntityType'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}) }, 'catalogue.attributeoption': { 'Meta': {'object_name': 'AttributeOption'}, 'group': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'options'", 'to': "orm['catalogue.AttributeOptionGroup']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'option': ('django.db.models.fields.CharField', [], {'max_length': '255'}) }, 'catalogue.attributeoptiongroup': { 'Meta': {'object_name': 'AttributeOptionGroup'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}) }, 'catalogue.category': { 'Meta': {'ordering': "['full_name']", 'object_name': 'Category'}, 'depth': ('django.db.models.fields.PositiveIntegerField', [], {}), 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'full_name': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'db_index': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), 'numchild': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), 'path': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '1024', 'db_index': 'True'}) }, 'catalogue.option': { 'Meta': {'object_name': 'Option'}, 'code': ('django.db.models.fields.SlugField', [], {'max_length': '128', 'db_index': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'type': ('django.db.models.fields.CharField', [], {'default': "'Required'", 'max_length': '128'}) }, 'catalogue.product': { 'Meta': {'ordering': "['-date_created']", 'object_name': 'Product'}, 'attributes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['catalogue.ProductAttribute']", 'through': "orm['catalogue.ProductAttributeValue']", 'symmetrical': 'False'}), 'categories': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['catalogue.Category']", 'through': "orm['catalogue.ProductCategory']", 'symmetrical': 'False'}), 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'date_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}), 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_discountable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'variants'", 'null': 'True', 'to': "orm['catalogue.Product']"}), 'product_class': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ProductClass']", 'null': 'True'}), 'product_options': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['catalogue.Option']", 'symmetrical': 'False', 'blank': 'True'}), 'recommended_products': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['catalogue.Product']", 'symmetrical': 'False', 'through': "orm['catalogue.ProductRecommendation']", 'blank': 'True'}), 'related_products': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'relations'", 'blank': 'True', 'to': "orm['catalogue.Product']"}), 'score': ('django.db.models.fields.FloatField', [], {'default': '0.0', 'db_index': 'True'}), 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '255', 'db_index': 'True'}), 'status': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '128', 'null': 'True', 'blank': 'True'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'upc': ('django.db.models.fields.CharField', [], {'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) }, 'catalogue.productattribute': { 'Meta': {'ordering': "['code']", 'object_name': 'ProductAttribute'}, 'code': ('django.db.models.fields.SlugField', [], {'max_length': '128', 'db_index': 'True'}), 'entity_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.AttributeEntityType']", 'null': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'option_group': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.AttributeOptionGroup']", 'null': 'True', 'blank': 'True'}), 'product_class': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'attributes'", 'null': 'True', 'to': "orm['catalogue.ProductClass']"}), 'required': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'type': ('django.db.models.fields.CharField', [], {'default': "'text'", 'max_length': '20'}) }, 'catalogue.productattributevalue': { 'Meta': {'object_name': 'ProductAttributeValue'}, 'attribute': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ProductAttribute']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'product': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attribute_values'", 'to': "orm['catalogue.Product']"}), 'value_boolean': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'value_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), 'value_entity': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.AttributeEntity']", 'null': 'True', 'blank': 'True'}), 'value_float': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), 'value_integer': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'value_option': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.AttributeOption']", 'null': 'True', 'blank': 'True'}), 'value_richtext': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'value_text': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}) }, 'catalogue.productcategory': { 'Meta': {'ordering': "['-is_canonical']", 'object_name': 'ProductCategory'}, 'category': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Category']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_canonical': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}), 'product': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Product']"}) }, 'catalogue.productclass': { 'Meta': {'ordering': "['name']", 'object_name': 'ProductClass'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'options': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['catalogue.Option']", 'symmetrical': 'False', 'blank': 'True'}), 'requires_shipping': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}) }, 'catalogue.productrecommendation': { 'Meta': {'object_name': 'ProductRecommendation'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'primary': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'primary_recommendations'", 'to': "orm['catalogue.Product']"}), 'ranking': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '0'}), 'recommendation': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Product']"}) }, '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'}) }, 'offer.benefit': { 'Meta': {'object_name': 'Benefit'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'max_affected_items': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}), 'range': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['offer.Range']", 'null': 'True', 'blank': 'True'}), 'type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'value': ('oscar.models.fields.PositiveDecimalField', [], {'null': 'True', 'max_digits': '12', 'decimal_places': '2', 'blank': 'True'}) }, 'offer.condition': { 'Meta': {'object_name': 'Condition'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'range': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['offer.Range']"}), 'type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'value': ('oscar.models.fields.PositiveDecimalField', [], {'max_digits': '12', 'decimal_places': '2'}) }, 'offer.conditionaloffer': { 'Meta': {'ordering': "['-priority']", 'object_name': 'ConditionalOffer'}, 'benefit': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['offer.Benefit']"}), 'condition': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['offer.Condition']"}), 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}), 'num_orders': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), 'offer_type': ('django.db.models.fields.CharField', [], {'default': "'Site'", 'max_length': '128'}), 'priority': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'redirect_url': ('oscar.models.fields.ExtendedURLField', [], {'max_length': '200', 'blank': 'True'}), 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '128', 'unique': 'True', 'null': 'True', 'db_index': 'True'}), 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), 'total_discount': ('django.db.models.fields.DecimalField', [], {'default': "'0.00'", 'max_digits': '12', 'decimal_places': '2'}) }, 'offer.range': { 'Meta': {'object_name': 'Range'}, 'classes': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'classes'", 'blank': 'True', 'to': "orm['catalogue.ProductClass']"}), 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'excluded_products': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'excludes'", 'blank': 'True', 'to': "orm['catalogue.Product']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'included_categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'includes'", 'blank': 'True', 'to': "orm['catalogue.Category']"}), 'included_products': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'includes'", 'blank': 'True', 'to': "orm['catalogue.Product']"}), 'includes_all_products': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}) }, 'voucher.voucher': { 'Meta': {'object_name': 'Voucher'}, 'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), 'date_created': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'end_date': ('django.db.models.fields.DateField', [], {}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'num_basket_additions': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), 'num_orders': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), 'offers': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'vouchers'", 'symmetrical': 'False', 'to': "orm['offer.ConditionalOffer']"}), 'start_date': ('django.db.models.fields.DateField', [], {}), 'total_discount': ('django.db.models.fields.DecimalField', [], {'default': "'0.00'", 'max_digits': '12', 'decimal_places': '2'}), 'usage': ('django.db.models.fields.CharField', [], {'default': "'Multi-use'", 'max_length': '128'}) } } complete_apps = ['basket']
mit
[ 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, 504, 312, 22707, 14, 1018, 14, 5819, 492, 7560, 63, 3791, 63, 11429, 12, 7560, 63, 3791, 63, 11429, 63, 2339, 199, 199, 533, 12090, 8, 24822, 304, 339, 347, 17465, 8, 277, 12, 9813, 304, 2728, 327, 12934, 901, 283, 3049, 14, 4777, 63, 476, 429, 63, 5530, 7, 267, 1592, 14, 525, 63, 2301, 360, 18136, 63, 604, 297, 283, 4777, 63, 476, 429, 63, 5530, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 15975, 7533, 2307, 29, 549, 12, 1390, 63, 7022, 29, 713, 12, 6107, 63, 10696, 29, 18, 395, 4215, 63, 885, 29, 797, 9, 2378, 347, 8552, 8, 277, 12, 9813, 304, 2728, 327, 15920, 901, 283, 3049, 14, 4777, 63, 476, 429, 63, 5530, 7, 267, 1592, 14, 1807, 63, 2301, 360, 18136, 63, 604, 297, 283, 4777, 63, 476, 429, 63, 5530, 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, 7560, 63, 3791, 63, 11429, 26, 469, 288, 283, 3396, 356, 791, 785, 63, 354, 356, 7560, 63, 3791, 63, 11429, 63, 2339, 1386, 288, 283, 602, 63, 11806, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 297, 990, 791, 885, 356, 283, 2083, 14, 2083, 14, 2131, 1604, 288, 283, 2123, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 16577, 297, 990, 791, 988, 63, 1267, 356, 283, 2194, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 2246, 63, 354, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1216, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 2634, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 7624, 297, 990, 791, 475, 356, 298, 1025, 459, 1178, 14, 2448, 6256, 283, 10247, 356, 283, 797, 297, 283, 2500, 356, 283, 549, 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, 374, 63, 2682, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 5036, 297, 990, 791, 885, 356, 283, 549, 1604, 288, 283, 374, 63, 7018, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 5036, 297, 990, 791, 885, 356, 283, 797, 1604, 288, 283, 374, 63, 11434, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 5036, 297, 990, 791, 885, 356, 283, 797, 1604, 288, 283, 2019, 63, 2886, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 297, 990, 791, 885, 356, 283, 2083, 14, 2083, 14, 2131, 1604, 288, 283, 2019, 63, 354, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1216, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 2060, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 3933, 1604, 288, 283, 751, 63, 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, 1604, 288, 283, 2473, 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, 1216, 3071, 267, 1660, 267, 283, 18136, 14, 18136, 356, 469, 288, 283, 3396, 356, 791, 785, 63, 354, 356, 283, 34, 12351, 2267, 288, 283, 602, 63, 3966, 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, 602, 63, 15269, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 297, 990, 791, 2307, 356, 283, 549, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 602, 63, 23736, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 297, 990, 791, 2307, 356, 283, 549, 297, 283, 2500, 356, 283, 549, 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, 4597, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 297, 990, 791, 2407, 63, 354 ]
[ 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, 504, 312, 22707, 14, 1018, 14, 5819, 492, 7560, 63, 3791, 63, 11429, 12, 7560, 63, 3791, 63, 11429, 63, 2339, 199, 199, 533, 12090, 8, 24822, 304, 339, 347, 17465, 8, 277, 12, 9813, 304, 2728, 327, 12934, 901, 283, 3049, 14, 4777, 63, 476, 429, 63, 5530, 7, 267, 1592, 14, 525, 63, 2301, 360, 18136, 63, 604, 297, 283, 4777, 63, 476, 429, 63, 5530, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 15975, 7533, 2307, 29, 549, 12, 1390, 63, 7022, 29, 713, 12, 6107, 63, 10696, 29, 18, 395, 4215, 63, 885, 29, 797, 9, 2378, 347, 8552, 8, 277, 12, 9813, 304, 2728, 327, 15920, 901, 283, 3049, 14, 4777, 63, 476, 429, 63, 5530, 7, 267, 1592, 14, 1807, 63, 2301, 360, 18136, 63, 604, 297, 283, 4777, 63, 476, 429, 63, 5530, 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, 7560, 63, 3791, 63, 11429, 26, 469, 288, 283, 3396, 356, 791, 785, 63, 354, 356, 7560, 63, 3791, 63, 11429, 63, 2339, 1386, 288, 283, 602, 63, 11806, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 297, 990, 791, 885, 356, 283, 2083, 14, 2083, 14, 2131, 1604, 288, 283, 2123, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 16577, 297, 990, 791, 988, 63, 1267, 356, 283, 2194, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 2246, 63, 354, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1216, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 2634, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 7624, 297, 990, 791, 475, 356, 298, 1025, 459, 1178, 14, 2448, 6256, 283, 10247, 356, 283, 797, 297, 283, 2500, 356, 283, 549, 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, 374, 63, 2682, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 5036, 297, 990, 791, 885, 356, 283, 549, 1604, 288, 283, 374, 63, 7018, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 5036, 297, 990, 791, 885, 356, 283, 797, 1604, 288, 283, 374, 63, 11434, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 5036, 297, 990, 791, 885, 356, 283, 797, 1604, 288, 283, 2019, 63, 2886, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 297, 990, 791, 885, 356, 283, 2083, 14, 2083, 14, 2131, 1604, 288, 283, 2019, 63, 354, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1216, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 2060, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 3933, 1604, 288, 283, 751, 63, 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, 1604, 288, 283, 2473, 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, 1216, 3071, 267, 1660, 267, 283, 18136, 14, 18136, 356, 469, 288, 283, 3396, 356, 791, 785, 63, 354, 356, 283, 34, 12351, 2267, 288, 283, 602, 63, 3966, 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, 602, 63, 15269, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 297, 990, 791, 2307, 356, 283, 549, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 602, 63, 23736, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 297, 990, 791, 2307, 356, 283, 549, 297, 283, 2500, 356, 283, 549, 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, 4597, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 297, 990, 791, 2407, 63, 354, 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, 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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 ]
alianmohammad/pd-gem5
util/drampower_trace.py
23
4348
#!/usr/bin/env python # Copyright (c) 2014 ARM Limited # All rights reserved # # The license below extends only to copyright in the software and shall # not be construed as granting a license to any other intellectual # property including but not limited to intellectual property relating # to a hardware implementation of the functionality of the software # licensed hereunder. You may use the software subject to the license # terms below provided that you ensure that this notice is replicated # unmodified and in its entirety in all distributions of the software, # modified or unmodified, in source code or in binary form. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer; # redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution; # neither the name of the copyright holders 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. # # Authors: Andreas Hansson import sys import re import math # This utility script parses through the debug output looking for # lines printed by the DRAMPowerTrace debug flag. For all such lines, # it sorts the entries based on the timestamp and outputs it to a new # file in a format that DRAMPower accepts. def main(): if len(sys.argv) != 4: print "Usage: ", sys.argv[0], " <simout> <rank> <command output>" exit(-1) try: sim_in = open(sys.argv[1], 'r') except IOError: print "Failed to open ", sys.argv[1], " for reading" exit(-1) try: rank = int(sys.argv[2]) except ValueError: print "Failed to determine rank from ", sys.argv[2] exit(-1) try: cmd_out = open(sys.argv[3], 'w') except IOError: print "Failed to open ", sys.argv[3], " for writing" exit(-1) # Due to the out-of-order printing from the event-based DRAM # controller model, we need to sort the commands by time stamp. We # use the refresh as the ordering point history = [] # For each line in the debug trace output for line in sim_in: # Search for a line with the right format. At the moment this # is rather dangerous, and could be made more robust. if re.search('\d+: .*: \d+,[A-Z]+,\d+,\d+', line): cmd = line.split(' ')[-1] cmd_cycle, cmd_name, cmd_bank, cmd_rank = cmd.split(',') # only look at the commands for the specific rank if (int(cmd_rank) == rank): # Do the conversion to clock cycles so we can use it to # sort cmd_cycle = int(cmd_cycle) # Append this to the history history.append((cmd_cycle, cmd_name, cmd_bank)) # If we are refreshing, print the history and flush it if cmd_name == "REF": history.sort(key = lambda tup: tup[0]) for (c, n, b) in history: cmd_entry = "%d,%s,%s\n" % (c, n, b) cmd_out.write(cmd_entry) history = [] # We're done sim_in.close() cmd_out.close() if __name__ == "__main__": main()
bsd-3-clause
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 1898, 334, 67, 9, 6927, 27155, 23954, 199, 3, 2900, 4481, 4644, 199, 3, 199, 3, 710, 4190, 5084, 16879, 1454, 370, 4248, 315, 314, 2032, 436, 10989, 199, 3, 440, 506, 950, 431, 68, 465, 16085, 316, 282, 4190, 370, 1263, 1163, 27925, 1264, 1061, 199, 3, 3324, 5893, 1325, 440, 13988, 370, 27925, 1264, 1061, 3324, 4668, 1958, 199, 3, 370, 282, 14991, 4514, 402, 314, 9330, 402, 314, 2032, 199, 3, 18233, 2348, 7138, 14, 221, 2047, 1443, 675, 314, 2032, 5420, 370, 314, 4190, 199, 3, 2895, 5084, 2741, 626, 1265, 4868, 626, 642, 4245, 365, 32436, 199, 3, 24214, 436, 315, 2399, 8039, 369, 315, 1006, 10208, 402, 314, 2032, 12, 199, 3, 6042, 503, 24214, 12, 315, 1350, 1233, 503, 315, 3366, 1824, 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, 26771, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 3, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 27, 199, 3, 26771, 315, 3366, 1824, 1471, 9172, 314, 3432, 4248, 199, 3, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 315, 314, 199, 3, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 4084, 27, 199, 3, 15564, 314, 536, 402, 314, 4248, 31976, 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, 3, 199, 3, 6642, 26, 6061, 264, 305, 869, 290, 385, 265, 199, 199, 646, 984, 199, 646, 295, 199, 646, 3473, 199, 199, 3, 961, 11420, 2884, 19953, 4012, 314, 3105, 1072, 10023, 367, 199, 3, 2385, 12487, 701, 314, 577, 30839, 6921, 3921, 3105, 3305, 14, 2104, 1006, 4066, 2385, 12, 199, 3, 652, 30313, 314, 4811, 4079, 641, 314, 4913, 436, 4704, 652, 370, 282, 892, 199, 3, 570, 315, 282, 1475, 626, 577, 30839, 6921, 11479, 14, 199, 318, 2446, 837, 272, 340, 822, 8, 1274, 14, 3020, 9, 1137, 841, 26, 267, 870, 298, 7692, 26, 3872, 984, 14, 3020, 59, 16, 467, 298, 665, 5206, 548, 30, 665, 4648, 30, 665, 1531, 1072, 4335, 267, 4458, 2801, 17, 9, 339, 862, 26, 267, 4389, 63, 262, 275, 1551, 8, 1274, 14, 3020, 59, 17, 467, 283, 82, 358, 272, 871, 5925, 26, 267, 870, 298, 4276, 370, 1551, 3872, 984, 14, 3020, 59, 17, 467, 298, 367, 7664, 2, 267, 4458, 2801, 17, 9, 339, 862, 26, 267, 6915, 275, 1109, 8, 1274, 14, 3020, 59, 18, 566, 272, 871, 1722, 26, 267, 870, 298, 4276, 370, 6705, 6915, 687, 3872, 984, 14, 3020, 59, 18, 61, 267, 4458, 2801, 17, 9, 339, 862, 26, 267, 2088, 63, 548, 275, 1551, 8, 1274, 14, 3020, 59, 19, 467, 283, 87, 358, 272, 871, 5925, 26, 267, 870, 298, 4276, 370, 1551, 3872, 984, 14, 3020, 59, 19, 467, 298, 367, 3575, 2, 267, 4458, 2801, 17, 9, 339, 327, 25855, 370, 314, 734, 13, 1618, 13, 1648, 16116, 687, 314, 1566, 13, 6788, 577, 30839, 272, 327, 7614, 1402, 12, 781, 1929, 370, 4069, 314, 3718, 701, 900, 16206, 14, 2136, 272, 327, 675, 314, 9236, 465, 314, 7794, 2376, 272, 7994, 275, 942, 339, 327, 2104, 1924, 1004, 315, 314, 3105, 3307, 1072, 272, 367, 1004, 315, 4389, 63, 262, 26, 267, 327, 8730, 367, 282, 1004, 543, 314, 2451, 1475, 14, 2854, 314, 12427, 642, 267, 327, 365, 7830, 366, 21480, 12, 436, 4293, 506, 6326, 1655, 23399, 14, 267, 340, 295, 14, 1733, 2258, 68, 11, 26, 1275, 19429, 971, 68, 11, 14343, 33, 13, 58, 2807, 4202, 68, 11, 4202, 68, 7386, 1004, 304, 288, 2088, 275, 1004, 14, 1294, 360, 5320, 1988, 17, 61, 288, 2088, 63, 7612, 12, 2088, 63, 354, 12, 2088, 63, 9860, 12, 2088, 63, 4648, 275, 2088, 14, 1294, 11917, 953, 327, 1454, 3648, 737, 314, 3718, 367, 314, 2488, 6915, 288, 340, 334, 442, 8, 1760, 63, 4648, 9, 508, 6915, 304, 2234, 327, 4226, 314, 8603, 370, 12516, 19001, 880, 781, 883, 675, 652, 370, 355, 327, 4069, 355, 2088, 63, 7612, 275, 1109, 8, 1760, 63, 7612, 9, 2234, 327, 18726, 642, 370, 314, 7994, 355, 7994, 14, 740, 1332, 1760, 63, 7612, 12, 2088, 63, 354, 12, 2088, 63, 9860, 430, 2234, 327, 982, 781, 787, 9236, 316, 12, 870, 314, 7994, 436, 8976, 652, 355, 340, 2088, 63, 354, 508, 298, 8279, 582, 490, 7994, 14, 3191, 8, 498, 275, 2400, 16477, 26, 16477, 59, 16, 566, 490, 367, 334, 67, 12, 302, 12, 330, 9, 315, 7994, 26, 717, 2088, 63, 2373, 275, 2071, 68, 8719, 83, 8719, 83, 60, 78, 2, 450, 334, 67, 12, 302, 12, 330, 9, 717, 2088, 63, 548, 14, 952, 8, 1760, 63, 2373, 9, 4951, 7994, 275, 942, 339, 327, 2136, 3984, 4224, 272, 4389, 63, 262, 14, 1600, 342, 272, 2088, 63, 548, 14, 1600, 342, 199, 199 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 1898, 334, 67, 9, 6927, 27155, 23954, 199, 3, 2900, 4481, 4644, 199, 3, 199, 3, 710, 4190, 5084, 16879, 1454, 370, 4248, 315, 314, 2032, 436, 10989, 199, 3, 440, 506, 950, 431, 68, 465, 16085, 316, 282, 4190, 370, 1263, 1163, 27925, 1264, 1061, 199, 3, 3324, 5893, 1325, 440, 13988, 370, 27925, 1264, 1061, 3324, 4668, 1958, 199, 3, 370, 282, 14991, 4514, 402, 314, 9330, 402, 314, 2032, 199, 3, 18233, 2348, 7138, 14, 221, 2047, 1443, 675, 314, 2032, 5420, 370, 314, 4190, 199, 3, 2895, 5084, 2741, 626, 1265, 4868, 626, 642, 4245, 365, 32436, 199, 3, 24214, 436, 315, 2399, 8039, 369, 315, 1006, 10208, 402, 314, 2032, 12, 199, 3, 6042, 503, 24214, 12, 315, 1350, 1233, 503, 315, 3366, 1824, 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, 26771, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 3, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 27, 199, 3, 26771, 315, 3366, 1824, 1471, 9172, 314, 3432, 4248, 199, 3, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 315, 314, 199, 3, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 4084, 27, 199, 3, 15564, 314, 536, 402, 314, 4248, 31976, 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, 3, 199, 3, 6642, 26, 6061, 264, 305, 869, 290, 385, 265, 199, 199, 646, 984, 199, 646, 295, 199, 646, 3473, 199, 199, 3, 961, 11420, 2884, 19953, 4012, 314, 3105, 1072, 10023, 367, 199, 3, 2385, 12487, 701, 314, 577, 30839, 6921, 3921, 3105, 3305, 14, 2104, 1006, 4066, 2385, 12, 199, 3, 652, 30313, 314, 4811, 4079, 641, 314, 4913, 436, 4704, 652, 370, 282, 892, 199, 3, 570, 315, 282, 1475, 626, 577, 30839, 6921, 11479, 14, 199, 318, 2446, 837, 272, 340, 822, 8, 1274, 14, 3020, 9, 1137, 841, 26, 267, 870, 298, 7692, 26, 3872, 984, 14, 3020, 59, 16, 467, 298, 665, 5206, 548, 30, 665, 4648, 30, 665, 1531, 1072, 4335, 267, 4458, 2801, 17, 9, 339, 862, 26, 267, 4389, 63, 262, 275, 1551, 8, 1274, 14, 3020, 59, 17, 467, 283, 82, 358, 272, 871, 5925, 26, 267, 870, 298, 4276, 370, 1551, 3872, 984, 14, 3020, 59, 17, 467, 298, 367, 7664, 2, 267, 4458, 2801, 17, 9, 339, 862, 26, 267, 6915, 275, 1109, 8, 1274, 14, 3020, 59, 18, 566, 272, 871, 1722, 26, 267, 870, 298, 4276, 370, 6705, 6915, 687, 3872, 984, 14, 3020, 59, 18, 61, 267, 4458, 2801, 17, 9, 339, 862, 26, 267, 2088, 63, 548, 275, 1551, 8, 1274, 14, 3020, 59, 19, 467, 283, 87, 358, 272, 871, 5925, 26, 267, 870, 298, 4276, 370, 1551, 3872, 984, 14, 3020, 59, 19, 467, 298, 367, 3575, 2, 267, 4458, 2801, 17, 9, 339, 327, 25855, 370, 314, 734, 13, 1618, 13, 1648, 16116, 687, 314, 1566, 13, 6788, 577, 30839, 272, 327, 7614, 1402, 12, 781, 1929, 370, 4069, 314, 3718, 701, 900, 16206, 14, 2136, 272, 327, 675, 314, 9236, 465, 314, 7794, 2376, 272, 7994, 275, 942, 339, 327, 2104, 1924, 1004, 315, 314, 3105, 3307, 1072, 272, 367, 1004, 315, 4389, 63, 262, 26, 267, 327, 8730, 367, 282, 1004, 543, 314, 2451, 1475, 14, 2854, 314, 12427, 642, 267, 327, 365, 7830, 366, 21480, 12, 436, 4293, 506, 6326, 1655, 23399, 14, 267, 340, 295, 14, 1733, 2258, 68, 11, 26, 1275, 19429, 971, 68, 11, 14343, 33, 13, 58, 2807, 4202, 68, 11, 4202, 68, 7386, 1004, 304, 288, 2088, 275, 1004, 14, 1294, 360, 5320, 1988, 17, 61, 288, 2088, 63, 7612, 12, 2088, 63, 354, 12, 2088, 63, 9860, 12, 2088, 63, 4648, 275, 2088, 14, 1294, 11917, 953, 327, 1454, 3648, 737, 314, 3718, 367, 314, 2488, 6915, 288, 340, 334, 442, 8, 1760, 63, 4648, 9, 508, 6915, 304, 2234, 327, 4226, 314, 8603, 370, 12516, 19001, 880, 781, 883, 675, 652, 370, 355, 327, 4069, 355, 2088, 63, 7612, 275, 1109, 8, 1760, 63, 7612, 9, 2234, 327, 18726, 642, 370, 314, 7994, 355, 7994, 14, 740, 1332, 1760, 63, 7612, 12, 2088, 63, 354, 12, 2088, 63, 9860, 430, 2234, 327, 982, 781, 787, 9236, 316, 12, 870, 314, 7994, 436, 8976, 652, 355, 340, 2088, 63, 354, 508, 298, 8279, 582, 490, 7994, 14, 3191, 8, 498, 275, 2400, 16477, 26, 16477, 59, 16, 566, 490, 367, 334, 67, 12, 302, 12, 330, 9, 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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 ]
Asana/mypipe
avro/lang/py/test/test_protocol.py
58
12340
# 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. """ Test the protocol parsing logic. """ import unittest from avro import protocol class ExampleProtocol(object): def __init__(self, protocol_string, valid, name='', comment=''): self._protocol_string = protocol_string self._valid = valid self._name = name or protocol_string # default to schema_string for name self._comment = comment # read-only properties protocol_string = property(lambda self: self._protocol_string) valid = property(lambda self: self._valid) name = property(lambda self: self._name) # read/write properties def set_comment(self, new_comment): self._comment = new_comment comment = property(lambda self: self._comment, set_comment) # # Example Protocols # HELLO_WORLD = ExampleProtocol("""\ { "namespace": "com.acme", "protocol": "HelloWorld", "types": [ {"name": "Greeting", "type": "record", "fields": [ {"name": "message", "type": "string"}]}, {"name": "Curse", "type": "error", "fields": [ {"name": "message", "type": "string"}]} ], "messages": { "hello": { "request": [{"name": "greeting", "type": "Greeting" }], "response": "Greeting", "errors": ["Curse"] } } } """, True) EXAMPLES = [ HELLO_WORLD, ExampleProtocol("""\ {"namespace": "org.apache.avro.test", "protocol": "Simple", "types": [ {"name": "Kind", "type": "enum", "symbols": ["FOO","BAR","BAZ"]}, {"name": "MD5", "type": "fixed", "size": 16}, {"name": "TestRecord", "type": "record", "fields": [ {"name": "name", "type": "string", "order": "ignore"}, {"name": "kind", "type": "Kind", "order": "descending"}, {"name": "hash", "type": "MD5"} ] }, {"name": "TestError", "type": "error", "fields": [ {"name": "message", "type": "string"} ] } ], "messages": { "hello": { "request": [{"name": "greeting", "type": "string"}], "response": "string" }, "echo": { "request": [{"name": "record", "type": "TestRecord"}], "response": "TestRecord" }, "add": { "request": [{"name": "arg1", "type": "int"}, {"name": "arg2", "type": "int"}], "response": "int" }, "echoBytes": { "request": [{"name": "data", "type": "bytes"}], "response": "bytes" }, "error": { "request": [], "response": "null", "errors": ["TestError"] } } } """, True), ExampleProtocol("""\ {"namespace": "org.apache.avro.test.namespace", "protocol": "TestNamespace", "types": [ {"name": "org.apache.avro.test.util.MD5", "type": "fixed", "size": 16}, {"name": "TestRecord", "type": "record", "fields": [ {"name": "hash", "type": "org.apache.avro.test.util.MD5"} ] }, {"name": "TestError", "namespace": "org.apache.avro.test.errors", "type": "error", "fields": [ {"name": "message", "type": "string"} ] } ], "messages": { "echo": { "request": [{"name": "record", "type": "TestRecord"}], "response": "TestRecord" }, "error": { "request": [], "response": "null", "errors": ["org.apache.avro.test.errors.TestError"] } } } """, True), ExampleProtocol("""\ {"namespace": "org.apache.avro.test.namespace", "protocol": "TestImplicitNamespace", "types": [ {"name": "org.apache.avro.test.util.MD5", "type": "fixed", "size": 16}, {"name": "ReferencedRecord", "type": "record", "fields": [ {"name": "foo", "type": "string"} ] }, {"name": "TestRecord", "type": "record", "fields": [ {"name": "hash", "type": "org.apache.avro.test.util.MD5"}, {"name": "unqalified", "type": "ReferencedRecord"} ] }, {"name": "TestError", "type": "error", "fields": [ {"name": "message", "type": "string"} ] } ], "messages": { "echo": { "request": [{"name": "qualified", "type": "org.apache.avro.test.namespace.TestRecord"}], "response": "TestRecord" }, "error": { "request": [], "response": "null", "errors": ["org.apache.avro.test.namespace.TestError"] } } } """, True), ExampleProtocol("""\ {"namespace": "org.apache.avro.test.namespace", "protocol": "TestNamespaceTwo", "types": [ {"name": "org.apache.avro.test.util.MD5", "type": "fixed", "size": 16}, {"name": "ReferencedRecord", "type": "record", "namespace": "org.apache.avro.other.namespace", "fields": [ {"name": "foo", "type": "string"} ] }, {"name": "TestRecord", "type": "record", "fields": [ {"name": "hash", "type": "org.apache.avro.test.util.MD5"}, {"name": "qualified", "type": "org.apache.avro.other.namespace.ReferencedRecord"} ] }, {"name": "TestError", "type": "error", "fields": [ {"name": "message", "type": "string"} ] } ], "messages": { "echo": { "request": [{"name": "qualified", "type": "org.apache.avro.test.namespace.TestRecord"}], "response": "TestRecord" }, "error": { "request": [], "response": "null", "errors": ["org.apache.avro.test.namespace.TestError"] } } } """, True), ExampleProtocol("""\ {"namespace": "org.apache.avro.test.namespace", "protocol": "TestValidRepeatedName", "types": [ {"name": "org.apache.avro.test.util.MD5", "type": "fixed", "size": 16}, {"name": "ReferencedRecord", "type": "record", "namespace": "org.apache.avro.other.namespace", "fields": [ {"name": "foo", "type": "string"} ] }, {"name": "ReferencedRecord", "type": "record", "fields": [ {"name": "bar", "type": "double"} ] }, {"name": "TestError", "type": "error", "fields": [ {"name": "message", "type": "string"} ] } ], "messages": { "echo": { "request": [{"name": "qualified", "type": "ReferencedRecord"}], "response": "org.apache.avro.other.namespace.ReferencedRecord" }, "error": { "request": [], "response": "null", "errors": ["org.apache.avro.test.namespace.TestError"] } } } """, True), ExampleProtocol("""\ {"namespace": "org.apache.avro.test.namespace", "protocol": "TestInvalidRepeatedName", "types": [ {"name": "org.apache.avro.test.util.MD5", "type": "fixed", "size": 16}, {"name": "ReferencedRecord", "type": "record", "fields": [ {"name": "foo", "type": "string"} ] }, {"name": "ReferencedRecord", "type": "record", "fields": [ {"name": "bar", "type": "double"} ] }, {"name": "TestError", "type": "error", "fields": [ {"name": "message", "type": "string"} ] } ], "messages": { "echo": { "request": [{"name": "qualified", "type": "ReferencedRecord"}], "response": "org.apache.avro.other.namespace.ReferencedRecord" }, "error": { "request": [], "response": "null", "errors": ["org.apache.avro.test.namespace.TestError"] } } } """, False), ExampleProtocol("""\ {"namespace": "org.apache.avro.test", "protocol": "BulkData", "types": [], "messages": { "read": { "request": [], "response": "bytes" }, "write": { "request": [ {"name": "data", "type": "bytes"} ], "response": "null" } } } """, True), ExampleProtocol("""\ { "protocol" : "API", "namespace" : "xyz.api", "types" : [ { "type" : "enum", "name" : "Symbology", "namespace" : "xyz.api.product", "symbols" : [ "OPRA", "CUSIP", "ISIN", "SEDOL" ] }, { "type" : "record", "name" : "Symbol", "namespace" : "xyz.api.product", "fields" : [ { "name" : "symbology", "type" : "xyz.api.product.Symbology" }, { "name" : "symbol", "type" : "string" } ] }, { "type" : "record", "name" : "MultiSymbol", "namespace" : "xyz.api.product", "fields" : [ { "name" : "symbols", "type" : { "type" : "map", "values" : "xyz.api.product.Symbol" } } ] } ], "messages" : { } } """, True), ] VALID_EXAMPLES = [e for e in EXAMPLES if e.valid] class TestProtocol(unittest.TestCase): def test_parse(self): num_correct = 0 for example in EXAMPLES: try: protocol.parse(example.protocol_string) if example.valid: num_correct += 1 else: self.fail("Parsed invalid protocol: %s" % (example.name,)) except Exception, e: if not example.valid: num_correct += 1 else: self.fail("Coudl not parse valid protocol: %s" % (example.name,)) fail_msg = "Parse behavior correct on %d out of %d protocols." % \ (num_correct, len(EXAMPLES)) self.assertEqual(num_correct, len(EXAMPLES), fail_msg) def test_inner_namespace_set(self): print '' print 'TEST INNER NAMESPACE' print '===================' print '' proto = protocol.parse(HELLO_WORLD.protocol_string) self.assertEqual(proto.namespace, "com.acme") greeting_type = proto.types_dict['Greeting'] self.assertEqual(greeting_type.namespace, 'com.acme') def test_inner_namespace_not_rendered(self): proto = protocol.parse(HELLO_WORLD.protocol_string) self.assertEqual('com.acme.Greeting', proto.types[0].fullname) self.assertEqual('Greeting', proto.types[0].name) # but there shouldn't be 'namespace' rendered to json on the inner type self.assertFalse('namespace' in proto.to_json()['types'][0]) def test_valid_cast_to_string_after_parse(self): """ Test that the string generated by an Avro Protocol object is, in fact, a valid Avro protocol. """ print '' print 'TEST CAST TO STRING' print '===================' print '' num_correct = 0 for example in VALID_EXAMPLES: protocol_data = protocol.parse(example.protocol_string) try: try: protocol.parse(str(protocol_data)) debug_msg = "%s: STRING CAST SUCCESS" % example.name num_correct += 1 except: debug_msg = "%s: STRING CAST FAILURE" % example.name finally: print debug_msg fail_msg = "Cast to string success on %d out of %d protocols" % \ (num_correct, len(VALID_EXAMPLES)) self.assertEqual(num_correct, len(VALID_EXAMPLES), fail_msg) def test_equivalence_after_round_trip(self): """ 1. Given a string, parse it to get Avro protocol "original". 2. Serialize "original" to a string and parse that string to generate Avro protocol "round trip". 3. Ensure "original" and "round trip" protocols are equivalent. """ print '' print 'TEST ROUND TRIP' print '===============' print '' num_correct = 0 for example in VALID_EXAMPLES: original_protocol = protocol.parse(example.protocol_string) round_trip_protocol = protocol.parse(str(original_protocol)) if original_protocol == round_trip_protocol: num_correct += 1 debug_msg = "%s: ROUND TRIP SUCCESS" % example.name else: self.fail("Round trip failure: %s %s %s", (example.name, example.protocol_string, str(original_protocol))) fail_msg = "Round trip success on %d out of %d protocols" % \ (num_correct, len(VALID_EXAMPLES)) self.assertEqual(num_correct, len(VALID_EXAMPLES), fail_msg) if __name__ == '__main__': unittest.main()
apache-2.0
[ 3, 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 199, 3, 503, 1655, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 199, 3, 1854, 543, 642, 1736, 367, 4722, 2556, 199, 3, 12602, 4248, 12715, 14, 221, 710, 14857, 12378, 642, 570, 199, 3, 370, 1265, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 199, 3, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 199, 3, 543, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 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, 774, 314, 4113, 6057, 9661, 14, 199, 624, 199, 646, 2882, 199, 504, 2289, 293, 492, 4113, 199, 199, 533, 5679, 3658, 8, 785, 304, 523, 347, 636, 826, 721, 277, 12, 4113, 63, 875, 12, 1686, 12, 536, 4581, 3721, 9280, 272, 291, 423, 3922, 63, 875, 275, 4113, 63, 875, 272, 291, 423, 1078, 275, 1686, 272, 291, 423, 354, 275, 536, 503, 4113, 63, 875, 327, 849, 370, 4177, 63, 875, 367, 536, 272, 291, 423, 3349, 275, 3721, 819, 327, 1586, 13, 2118, 4382, 523, 4113, 63, 875, 275, 3324, 8, 2734, 291, 26, 291, 423, 3922, 63, 875, 9, 523, 1686, 275, 3324, 8, 2734, 291, 26, 291, 423, 1078, 9, 523, 536, 275, 3324, 8, 2734, 291, 26, 291, 423, 354, 9, 819, 327, 1586, 15, 952, 4382, 523, 347, 663, 63, 3349, 8, 277, 12, 892, 63, 3349, 304, 291, 423, 3349, 275, 892, 63, 3349, 523, 3721, 275, 3324, 8, 2734, 291, 26, 291, 423, 3349, 12, 663, 63, 3349, 9, 199, 199, 3, 199, 3, 5679, 2165, 475, 4574, 199, 3, 199, 24771, 1484, 63, 22125, 275, 5679, 3658, 21723, 199, 91, 523, 298, 3251, 582, 298, 957, 14, 18107, 401, 523, 298, 3922, 582, 298, 6257, 15943, 401, 819, 298, 1313, 582, 359, 272, 2420, 354, 582, 298, 39, 23457, 401, 298, 466, 582, 298, 3059, 401, 298, 955, 582, 359, 489, 2420, 354, 582, 298, 1188, 401, 298, 466, 582, 298, 875, 3570, 13888, 272, 2420, 354, 582, 298, 35, 1394, 401, 298, 466, 582, 298, 705, 401, 298, 955, 582, 359, 489, 2420, 354, 582, 298, 1188, 401, 298, 466, 582, 298, 875, 3570, 9420, 523, 2156, 819, 298, 3431, 582, 469, 272, 298, 5006, 582, 469, 489, 298, 1069, 582, 16870, 354, 582, 298, 71, 23457, 401, 298, 466, 582, 298, 39, 23457, 2, 19971, 489, 298, 1310, 582, 298, 39, 23457, 401, 489, 298, 2550, 582, 2097, 35, 1394, 937, 272, 789, 523, 789, 199, 93, 272, 10327, 715, 9, 199, 8918, 275, 359, 523, 25734, 1484, 63, 22125, 12, 523, 5679, 3658, 21723, 199, 6641, 3251, 582, 298, 1308, 14, 3796, 14, 1214, 293, 14, 396, 401, 199, 298, 3922, 582, 298, 3184, 401, 421, 298, 1313, 582, 359, 1362, 2420, 354, 582, 298, 13028, 401, 298, 466, 582, 298, 4869, 401, 298, 7450, 582, 2097, 13046, 2266, 13895, 2266, 4134, 58, 19057, 10813, 2420, 354, 582, 298, 5127, 21, 401, 298, 466, 582, 298, 5964, 401, 298, 890, 582, 3193, 1386, 10813, 2420, 354, 582, 298, 774, 5433, 401, 298, 466, 582, 298, 3059, 401, 489, 298, 955, 582, 359, 881, 2420, 354, 582, 298, 354, 401, 298, 466, 582, 298, 875, 401, 298, 1648, 582, 298, 4247, 6018, 881, 2420, 354, 582, 298, 5091, 401, 298, 466, 582, 298, 13028, 401, 298, 1648, 582, 298, 3257, 3219, 6018, 881, 2420, 354, 582, 298, 2227, 401, 298, 466, 582, 298, 5127, 21, 3570, 489, 1622, 1362, 1660, 10813, 2420, 354, 582, 298, 774, 547, 401, 298, 466, 582, 298, 705, 401, 298, 955, 582, 359, 268, 2420, 354, 582, 298, 1188, 401, 298, 466, 582, 298, 875, 3570, 489, 1622, 1362, 789, 421, 2156, 421, 298, 3431, 582, 469, 10813, 298, 5006, 582, 469, 268, 298, 1069, 582, 16870, 354, 582, 298, 71, 23457, 401, 298, 466, 582, 298, 875, 3570, 467, 268, 298, 1310, 582, 298, 875, 2, 1362, 1660, 10813, 298, 7878, 582, 469, 268, 298, 1069, 582, 16870, 354, 582, 298, 3059, 401, 298, 466, 582, 298, 774, 5433, 3570, 467, 268, 298, 1310, 582, 298, 774, 5433, 2, 1362, 1660, 10813, 298, 525, 582, 469, 268, 298, 1069, 582, 16870, 354, 582, 298, 1273, 17, 401, 298, 466, 582, 298, 442, 6018, 2420, 354, 582, 298, 1273, 18, 401, 298, 466, 582, 298, 442, 3570, 467, 268, 298, 1310, 582, 298, 442, 2, 1362, 1660, 10813, 298, 7878, 5571, 582, 469, 268, 298, 1069, 582, 16870, 354, 582, 298, 576, 401, 298, 466, 582, 298, 2394, 3570, 467, 268, 298, 1310, 582, 298, 2394, 2, 1362, 1660, 10813, 298, 705, 582, 469, 268, 298, 1069, 582, 990, 268, 298, 1310, 582, 298, 2307, 401, 268, 298, 2550, 582, 2097, 774, 547, 937, 1362, 789, 199, 789, 199, 199, 93, 272, 10327, 715, 395, 523, 5679, 3658, 21723, 199, 6641, 3251, 582, 298, 1308, 14, 3796, 14, 1214, 293, 14, 396, 14, 3251, 401, 199, 298, 3922, 582, 298, 774, 8814, 401, 421, 298, 1313, 582, 359, 1362, 2420, 354, 582, 298, 1308, 14, 3796, 14, 1214, 293, 14, 396, 14, 1974, 14, 5127, 21, 401, 298, 466, 582, 298, 5964, 401, 298, 890, 582, 3193, 1386, 1362, 2420, 354, 582, 298, 774, 5433, 401, 298, 466, 582, 298, 3059, 401, 489, 298, 955, 582, 359, 2420, 354, 582, 298, 2227, 401, 298, 466, 582, 298, 1308, 14, 3796, 14, 1214, 293, 14, 396, 14, 1974, 14, 5127, 21, 3570, 1622, 1362, 1660, 1362, 2420, 354, 582, 298, 774, 547, 401, 298, 3251, 582, 298, 1308, 14, 3796, 14, 1214, 293, 14, 396, 14 ]
[ 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, 774, 314, 4113, 6057, 9661, 14, 199, 624, 199, 646, 2882, 199, 504, 2289, 293, 492, 4113, 199, 199, 533, 5679, 3658, 8, 785, 304, 523, 347, 636, 826, 721, 277, 12, 4113, 63, 875, 12, 1686, 12, 536, 4581, 3721, 9280, 272, 291, 423, 3922, 63, 875, 275, 4113, 63, 875, 272, 291, 423, 1078, 275, 1686, 272, 291, 423, 354, 275, 536, 503, 4113, 63, 875, 327, 849, 370, 4177, 63, 875, 367, 536, 272, 291, 423, 3349, 275, 3721, 819, 327, 1586, 13, 2118, 4382, 523, 4113, 63, 875, 275, 3324, 8, 2734, 291, 26, 291, 423, 3922, 63, 875, 9, 523, 1686, 275, 3324, 8, 2734, 291, 26, 291, 423, 1078, 9, 523, 536, 275, 3324, 8, 2734, 291, 26, 291, 423, 354, 9, 819, 327, 1586, 15, 952, 4382, 523, 347, 663, 63, 3349, 8, 277, 12, 892, 63, 3349, 304, 291, 423, 3349, 275, 892, 63, 3349, 523, 3721, 275, 3324, 8, 2734, 291, 26, 291, 423, 3349, 12, 663, 63, 3349, 9, 199, 199, 3, 199, 3, 5679, 2165, 475, 4574, 199, 3, 199, 24771, 1484, 63, 22125, 275, 5679, 3658, 21723, 199, 91, 523, 298, 3251, 582, 298, 957, 14, 18107, 401, 523, 298, 3922, 582, 298, 6257, 15943, 401, 819, 298, 1313, 582, 359, 272, 2420, 354, 582, 298, 39, 23457, 401, 298, 466, 582, 298, 3059, 401, 298, 955, 582, 359, 489, 2420, 354, 582, 298, 1188, 401, 298, 466, 582, 298, 875, 3570, 13888, 272, 2420, 354, 582, 298, 35, 1394, 401, 298, 466, 582, 298, 705, 401, 298, 955, 582, 359, 489, 2420, 354, 582, 298, 1188, 401, 298, 466, 582, 298, 875, 3570, 9420, 523, 2156, 819, 298, 3431, 582, 469, 272, 298, 5006, 582, 469, 489, 298, 1069, 582, 16870, 354, 582, 298, 71, 23457, 401, 298, 466, 582, 298, 39, 23457, 2, 19971, 489, 298, 1310, 582, 298, 39, 23457, 401, 489, 298, 2550, 582, 2097, 35, 1394, 937, 272, 789, 523, 789, 199, 93, 272, 10327, 715, 9, 199, 8918, 275, 359, 523, 25734, 1484, 63, 22125, 12, 523, 5679, 3658, 21723, 199, 6641, 3251, 582, 298, 1308, 14, 3796, 14, 1214, 293, 14, 396, 401, 199, 298, 3922, 582, 298, 3184, 401, 421, 298, 1313, 582, 359, 1362, 2420, 354, 582, 298, 13028, 401, 298, 466, 582, 298, 4869, 401, 298, 7450, 582, 2097, 13046, 2266, 13895, 2266, 4134, 58, 19057, 10813, 2420, 354, 582, 298, 5127, 21, 401, 298, 466, 582, 298, 5964, 401, 298, 890, 582, 3193, 1386, 10813, 2420, 354, 582, 298, 774, 5433, 401, 298, 466, 582, 298, 3059, 401, 489, 298, 955, 582, 359, 881, 2420, 354, 582, 298, 354, 401, 298, 466, 582, 298, 875, 401, 298, 1648, 582, 298, 4247, 6018, 881, 2420, 354, 582, 298, 5091, 401, 298, 466, 582, 298, 13028, 401, 298, 1648, 582, 298, 3257, 3219, 6018, 881, 2420, 354, 582, 298, 2227, 401, 298, 466, 582, 298, 5127, 21, 3570, 489, 1622, 1362, 1660, 10813, 2420, 354, 582, 298, 774, 547, 401, 298, 466, 582, 298, 705, 401, 298, 955, 582, 359, 268, 2420, 354, 582, 298, 1188, 401, 298, 466, 582, 298, 875, 3570, 489, 1622, 1362, 789, 421, 2156, 421, 298, 3431, 582, 469, 10813, 298, 5006, 582, 469, 268, 298, 1069, 582, 16870, 354, 582, 298, 71, 23457, 401, 298, 466, 582, 298, 875, 3570, 467, 268, 298, 1310, 582, 298, 875, 2, 1362, 1660, 10813, 298, 7878, 582, 469, 268, 298, 1069, 582, 16870, 354, 582, 298, 3059, 401, 298, 466, 582, 298, 774, 5433, 3570, 467, 268, 298, 1310, 582, 298, 774, 5433, 2, 1362, 1660, 10813, 298, 525, 582, 469, 268, 298, 1069, 582, 16870, 354, 582, 298, 1273, 17, 401, 298, 466, 582, 298, 442, 6018, 2420, 354, 582, 298, 1273, 18, 401, 298, 466, 582, 298, 442, 3570, 467, 268, 298, 1310, 582, 298, 442, 2, 1362, 1660, 10813, 298, 7878, 5571, 582, 469, 268, 298, 1069, 582, 16870, 354, 582, 298, 576, 401, 298, 466, 582, 298, 2394, 3570, 467, 268, 298, 1310, 582, 298, 2394, 2, 1362, 1660, 10813, 298, 705, 582, 469, 268, 298, 1069, 582, 990, 268, 298, 1310, 582, 298, 2307, 401, 268, 298, 2550, 582, 2097, 774, 547, 937, 1362, 789, 199, 789, 199, 199, 93, 272, 10327, 715, 395, 523, 5679, 3658, 21723, 199, 6641, 3251, 582, 298, 1308, 14, 3796, 14, 1214, 293, 14, 396, 14, 3251, 401, 199, 298, 3922, 582, 298, 774, 8814, 401, 421, 298, 1313, 582, 359, 1362, 2420, 354, 582, 298, 1308, 14, 3796, 14, 1214, 293, 14, 396, 14, 1974, 14, 5127, 21, 401, 298, 466, 582, 298, 5964, 401, 298, 890, 582, 3193, 1386, 1362, 2420, 354, 582, 298, 774, 5433, 401, 298, 466, 582, 298, 3059, 401, 489, 298, 955, 582, 359, 2420, 354, 582, 298, 2227, 401, 298, 466, 582, 298, 1308, 14, 3796, 14, 1214, 293, 14, 396, 14, 1974, 14, 5127, 21, 3570, 1622, 1362, 1660, 1362, 2420, 354, 582, 298, 774, 547, 401, 298, 3251, 582, 298, 1308, 14, 3796, 14, 1214, 293, 14, 396, 14, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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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 ]
bathepawan/workload-automation
wlauto/commands/run.py
7
6157
# Copyright 2014-2015 ARM Limited # # 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 sys import shutil import wlauto from wlauto import Command, settings from wlauto.exceptions import ConfigError from wlauto.core.agenda import Agenda from wlauto.core.execution import Executor from wlauto.utils.log import add_log_file class RunCommand(Command): name = 'run' description = 'Execute automated workloads on a remote device and process the resulting output.' def initialize(self, context): self.parser.add_argument('agenda', metavar='AGENDA', help=""" Agenda for this workload automation run. This defines which workloads will be executed, how many times, with which tunables, etc. See example agendas in {} for an example of how this file should be structured. """.format(os.path.dirname(wlauto.__file__))) self.parser.add_argument('-d', '--output-directory', metavar='DIR', default=None, help=""" Specify a directory where the output will be generated. If the directory already exists, the script will abort unless -f option (see below) is used, in which case the contents of the directory will be overwritten. If this option is not specified, then {} will be used instead. """.format(settings.output_directory)) self.parser.add_argument('-f', '--force', action='store_true', help=""" Overwrite output directory if it exists. By default, the script will abort in this situation to prevent accidental data loss. """) self.parser.add_argument('-i', '--id', action='append', dest='only_run_ids', metavar='ID', help=""" Specify a workload spec ID from an agenda to run. If this is specified, only that particular spec will be run, and other workloads in the agenda will be ignored. This option may be used to specify multiple IDs. """) self.parser.add_argument('--disable', action='append', dest='instruments_to_disable', metavar='INSTRUMENT', help=""" Specify an instrument to disable from the command line. This equivalent to adding "~{metavar}" to the instrumentation list in the agenda. This can be used to temporarily disable a troublesome instrument for a particular run without introducing permanent change to the config (which one might then forget to revert). This option may be specified multiple times. """) def execute(self, args): # NOQA self.set_up_output_directory(args) add_log_file(settings.log_file) if os.path.isfile(args.agenda): agenda = Agenda(args.agenda) settings.agenda = args.agenda shutil.copy(args.agenda, settings.meta_directory) if len(agenda.workloads) == 0: raise ConfigError("No workloads specified") elif '.' in args.agenda or os.sep in args.agenda: raise ConfigError('Agenda "{}" does not exist.'.format(args.agenda)) else: self.logger.debug('{} is not a file; assuming workload name.'.format(args.agenda)) agenda = Agenda() agenda.add_workload_entry(args.agenda) if args.instruments_to_disable: if 'instrumentation' not in agenda.config: agenda.config['instrumentation'] = [] for itd in args.instruments_to_disable: self.logger.debug('Updating agenda to disable {}'.format(itd)) agenda.config['instrumentation'].append('~{}'.format(itd)) basename = 'config_' for file_number, path in enumerate(settings.get_config_paths(), 1): file_ext = os.path.splitext(path)[1] shutil.copy(path, os.path.join(settings.meta_directory, basename + str(file_number) + file_ext)) executor = Executor() executor.execute(agenda, selectors={'ids': args.only_run_ids}) def set_up_output_directory(self, args): if args.output_directory: settings.output_directory = args.output_directory self.logger.debug('Using output directory: {}'.format(settings.output_directory)) if os.path.exists(settings.output_directory): if args.force: self.logger.info('Removing existing output directory.') shutil.rmtree(settings.output_directory) else: self.logger.error('Output directory {} exists.'.format(settings.output_directory)) self.logger.error('Please specify another location, or use -f option to overwrite.\n') sys.exit(1) self.logger.info('Creating output directory.') os.makedirs(settings.output_directory) os.makedirs(settings.meta_directory)
apache-2.0
[ 3, 259, 1898, 6927, 13, 7806, 27155, 23954, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 421, 199, 646, 747, 199, 646, 984, 199, 646, 5145, 199, 199, 646, 336, 416, 1283, 199, 504, 336, 416, 1283, 492, 5817, 12, 2202, 199, 504, 336, 416, 1283, 14, 3924, 492, 4094, 547, 199, 504, 336, 416, 1283, 14, 1018, 14, 643, 29162, 492, 21582, 29162, 199, 504, 336, 416, 1283, 14, 1018, 14, 9416, 492, 9434, 4139, 199, 504, 336, 416, 1283, 14, 1208, 14, 793, 492, 1050, 63, 793, 63, 493, 421, 199, 533, 3378, 3110, 8, 3110, 304, 339, 536, 275, 283, 1065, 7, 272, 1369, 275, 283, 12049, 6384, 23513, 1736, 3640, 641, 282, 3982, 2243, 436, 2112, 314, 9183, 1072, 3530, 339, 347, 8265, 8, 277, 12, 1067, 304, 267, 291, 14, 2087, 14, 525, 63, 2094, 360, 643, 29162, 297, 8214, 534, 1254, 3902, 33, 297, 639, 1720, 11916, 639, 21582, 29162, 367, 642, 1736, 912, 25461, 1255, 14, 961, 7890, 1314, 639, 1736, 3640, 911, 506, 7934, 12, 4212, 5002, 5431, 12, 543, 1314, 639, 15486, 5921, 12, 5423, 14, 221, 1666, 2893, 1839, 500, 305, 315, 1052, 367, 376, 2893, 402, 639, 4212, 642, 570, 1077, 506, 21781, 14, 639, 30512, 908, 8, 736, 14, 515, 14, 3475, 8, 87, 416, 1283, 855, 493, 29658, 267, 291, 14, 2087, 14, 525, 63, 2094, 3654, 68, 297, 2850, 1199, 13, 3619, 297, 8214, 534, 3022, 297, 849, 29, 403, 12, 639, 1720, 11916, 639, 13327, 282, 2082, 2382, 314, 1072, 911, 506, 4046, 14, 982, 639, 314, 2082, 2575, 3495, 12, 314, 2884, 911, 12004, 7444, 446, 70, 639, 945, 334, 3239, 5084, 9, 365, 1202, 12, 315, 1314, 1930, 314, 4072, 402, 314, 639, 2082, 911, 506, 20200, 14, 982, 642, 945, 365, 440, 2013, 12, 639, 2066, 1052, 911, 506, 1202, 3140, 14, 639, 30512, 908, 8, 1751, 14, 1199, 63, 3619, 430, 267, 291, 14, 2087, 14, 525, 63, 2094, 3654, 70, 297, 2850, 3990, 297, 1595, 534, 1617, 63, 2052, 297, 639, 1720, 11916, 639, 7259, 952, 1072, 2082, 340, 652, 3495, 14, 4885, 849, 12, 314, 2884, 639, 911, 12004, 315, 642, 25781, 370, 7981, 24634, 279, 666, 5621, 14, 639, 7857, 267, 291, 14, 2087, 14, 525, 63, 2094, 3654, 73, 297, 2850, 344, 297, 1595, 534, 740, 297, 2053, 534, 2118, 63, 1065, 63, 1580, 297, 8214, 534, 998, 297, 639, 1720, 11916, 639, 13327, 282, 1736, 912, 3158, 2870, 687, 376, 1839, 29162, 370, 1255, 14, 982, 642, 365, 639, 2013, 12, 1454, 626, 6770, 3158, 911, 506, 1255, 12, 436, 1163, 639, 1736, 3640, 315, 314, 1839, 29162, 911, 506, 5525, 14, 961, 945, 1443, 506, 639, 1202, 370, 4165, 3663, 11449, 14, 639, 7857, 267, 291, 14, 2087, 14, 525, 63, 2094, 4517, 5993, 297, 1595, 534, 740, 297, 2053, 534, 13321, 83, 63, 475, 63, 5993, 297, 639, 8214, 534, 26347, 18272, 297, 1720, 11916, 639, 13327, 376, 14498, 370, 3507, 687, 314, 1414, 1004, 14, 961, 639, 7353, 370, 7791, 26810, 91, 23303, 7063, 370, 314, 14498, 425, 769, 315, 639, 314, 1839, 29162, 14, 961, 883, 506, 1202, 370, 22256, 3507, 282, 29616, 3972, 639, 14498, 367, 282, 6770, 1255, 1928, 13318, 14713, 19860, 639, 1570, 370, 314, 1101, 334, 6777, 1373, 5594, 2066, 19459, 370, 23347, 680, 639, 961, 945, 1443, 506, 2013, 3663, 5431, 14, 639, 7857, 339, 347, 5341, 8, 277, 12, 1249, 304, 221, 327, 20432, 267, 291, 14, 409, 63, 384, 63, 1199, 63, 3619, 8, 589, 9, 267, 1050, 63, 793, 63, 493, 8, 1751, 14, 793, 63, 493, 9, 398, 340, 747, 14, 515, 14, 6292, 8, 589, 14, 643, 29162, 304, 288, 1839, 29162, 275, 21582, 29162, 8, 589, 14, 643, 29162, 9, 288, 2202, 14, 643, 29162, 275, 1249, 14, 643, 29162, 288, 5145, 14, 1574, 8, 589, 14, 643, 29162, 12, 2202, 14, 2024, 63, 3619, 9, 953, 340, 822, 8, 643, 29162, 14, 800, 3640, 9, 508, 378, 26, 355, 746, 4094, 547, 480, 1944, 1736, 3640, 2013, 531, 267, 916, 7815, 315, 1249, 14, 643, 29162, 503, 747, 14, 4127, 315, 1249, 14, 643, 29162, 26, 288, 746, 4094, 547, 360, 5676, 29162, 28168, 1630, 440, 2187, 17374, 908, 8, 589, 14, 643, 29162, 430, 267, 587, 26, 288, 291, 14, 2921, 14, 1757, 17519, 365, 440, 282, 570, 27, 18002, 1736, 912, 536, 17374, 908, 8, 589, 14, 643, 29162, 430, 288, 1839, 29162, 275, 21582, 29162, 342, 288, 1839, 29162, 14, 525, 63, 800, 912, 63, 2373, 8, 589, 14, 643, 29162, 9, 398, 340, 1249, 14, 13321, 83, 63, 475, 63, 5993, 26, 288, 340, 283, 13321, 425, 7, 440, 315, 1839, 29162, 14, 888, 26, 355, 1839, 29162, 14, 888, 459, 13321, 425, 418, 275, 942, 288, 367, 652, 68, 315, 1249, 14, 13321, 83, 63, 475, 63, 5993, 26, 355, 291, 14, 2921, 14, 1757, 360, 24993, 1839, 29162, 370, 3507, 9499, 908, 8, 390, 68, 430, 355, 1839, 29162, 14, 888, 459, 13321, 425, 2278, 740, 21114, 11123, 908, 8, 390, 68, 430, 398, 9593, 275, 283, 888, 8650, 267, 367, 570, 63, 1955, 12, 931, 315, 3874, 8, 1751, 14, 362, 63, 888, 63, 3771, 1062, 413, 304, 288, 570, 63, 832, 275, 747, 14, 515, 14, 7973, 8, 515, 2788, 17, 61, 288, 5145, 14, 1574, 8, 515, 12, 747, 14 ]
[ 259, 1898, 6927, 13, 7806, 27155, 23954, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 421, 199, 646, 747, 199, 646, 984, 199, 646, 5145, 199, 199, 646, 336, 416, 1283, 199, 504, 336, 416, 1283, 492, 5817, 12, 2202, 199, 504, 336, 416, 1283, 14, 3924, 492, 4094, 547, 199, 504, 336, 416, 1283, 14, 1018, 14, 643, 29162, 492, 21582, 29162, 199, 504, 336, 416, 1283, 14, 1018, 14, 9416, 492, 9434, 4139, 199, 504, 336, 416, 1283, 14, 1208, 14, 793, 492, 1050, 63, 793, 63, 493, 421, 199, 533, 3378, 3110, 8, 3110, 304, 339, 536, 275, 283, 1065, 7, 272, 1369, 275, 283, 12049, 6384, 23513, 1736, 3640, 641, 282, 3982, 2243, 436, 2112, 314, 9183, 1072, 3530, 339, 347, 8265, 8, 277, 12, 1067, 304, 267, 291, 14, 2087, 14, 525, 63, 2094, 360, 643, 29162, 297, 8214, 534, 1254, 3902, 33, 297, 639, 1720, 11916, 639, 21582, 29162, 367, 642, 1736, 912, 25461, 1255, 14, 961, 7890, 1314, 639, 1736, 3640, 911, 506, 7934, 12, 4212, 5002, 5431, 12, 543, 1314, 639, 15486, 5921, 12, 5423, 14, 221, 1666, 2893, 1839, 500, 305, 315, 1052, 367, 376, 2893, 402, 639, 4212, 642, 570, 1077, 506, 21781, 14, 639, 30512, 908, 8, 736, 14, 515, 14, 3475, 8, 87, 416, 1283, 855, 493, 29658, 267, 291, 14, 2087, 14, 525, 63, 2094, 3654, 68, 297, 2850, 1199, 13, 3619, 297, 8214, 534, 3022, 297, 849, 29, 403, 12, 639, 1720, 11916, 639, 13327, 282, 2082, 2382, 314, 1072, 911, 506, 4046, 14, 982, 639, 314, 2082, 2575, 3495, 12, 314, 2884, 911, 12004, 7444, 446, 70, 639, 945, 334, 3239, 5084, 9, 365, 1202, 12, 315, 1314, 1930, 314, 4072, 402, 314, 639, 2082, 911, 506, 20200, 14, 982, 642, 945, 365, 440, 2013, 12, 639, 2066, 1052, 911, 506, 1202, 3140, 14, 639, 30512, 908, 8, 1751, 14, 1199, 63, 3619, 430, 267, 291, 14, 2087, 14, 525, 63, 2094, 3654, 70, 297, 2850, 3990, 297, 1595, 534, 1617, 63, 2052, 297, 639, 1720, 11916, 639, 7259, 952, 1072, 2082, 340, 652, 3495, 14, 4885, 849, 12, 314, 2884, 639, 911, 12004, 315, 642, 25781, 370, 7981, 24634, 279, 666, 5621, 14, 639, 7857, 267, 291, 14, 2087, 14, 525, 63, 2094, 3654, 73, 297, 2850, 344, 297, 1595, 534, 740, 297, 2053, 534, 2118, 63, 1065, 63, 1580, 297, 8214, 534, 998, 297, 639, 1720, 11916, 639, 13327, 282, 1736, 912, 3158, 2870, 687, 376, 1839, 29162, 370, 1255, 14, 982, 642, 365, 639, 2013, 12, 1454, 626, 6770, 3158, 911, 506, 1255, 12, 436, 1163, 639, 1736, 3640, 315, 314, 1839, 29162, 911, 506, 5525, 14, 961, 945, 1443, 506, 639, 1202, 370, 4165, 3663, 11449, 14, 639, 7857, 267, 291, 14, 2087, 14, 525, 63, 2094, 4517, 5993, 297, 1595, 534, 740, 297, 2053, 534, 13321, 83, 63, 475, 63, 5993, 297, 639, 8214, 534, 26347, 18272, 297, 1720, 11916, 639, 13327, 376, 14498, 370, 3507, 687, 314, 1414, 1004, 14, 961, 639, 7353, 370, 7791, 26810, 91, 23303, 7063, 370, 314, 14498, 425, 769, 315, 639, 314, 1839, 29162, 14, 961, 883, 506, 1202, 370, 22256, 3507, 282, 29616, 3972, 639, 14498, 367, 282, 6770, 1255, 1928, 13318, 14713, 19860, 639, 1570, 370, 314, 1101, 334, 6777, 1373, 5594, 2066, 19459, 370, 23347, 680, 639, 961, 945, 1443, 506, 2013, 3663, 5431, 14, 639, 7857, 339, 347, 5341, 8, 277, 12, 1249, 304, 221, 327, 20432, 267, 291, 14, 409, 63, 384, 63, 1199, 63, 3619, 8, 589, 9, 267, 1050, 63, 793, 63, 493, 8, 1751, 14, 793, 63, 493, 9, 398, 340, 747, 14, 515, 14, 6292, 8, 589, 14, 643, 29162, 304, 288, 1839, 29162, 275, 21582, 29162, 8, 589, 14, 643, 29162, 9, 288, 2202, 14, 643, 29162, 275, 1249, 14, 643, 29162, 288, 5145, 14, 1574, 8, 589, 14, 643, 29162, 12, 2202, 14, 2024, 63, 3619, 9, 953, 340, 822, 8, 643, 29162, 14, 800, 3640, 9, 508, 378, 26, 355, 746, 4094, 547, 480, 1944, 1736, 3640, 2013, 531, 267, 916, 7815, 315, 1249, 14, 643, 29162, 503, 747, 14, 4127, 315, 1249, 14, 643, 29162, 26, 288, 746, 4094, 547, 360, 5676, 29162, 28168, 1630, 440, 2187, 17374, 908, 8, 589, 14, 643, 29162, 430, 267, 587, 26, 288, 291, 14, 2921, 14, 1757, 17519, 365, 440, 282, 570, 27, 18002, 1736, 912, 536, 17374, 908, 8, 589, 14, 643, 29162, 430, 288, 1839, 29162, 275, 21582, 29162, 342, 288, 1839, 29162, 14, 525, 63, 800, 912, 63, 2373, 8, 589, 14, 643, 29162, 9, 398, 340, 1249, 14, 13321, 83, 63, 475, 63, 5993, 26, 288, 340, 283, 13321, 425, 7, 440, 315, 1839, 29162, 14, 888, 26, 355, 1839, 29162, 14, 888, 459, 13321, 425, 418, 275, 942, 288, 367, 652, 68, 315, 1249, 14, 13321, 83, 63, 475, 63, 5993, 26, 355, 291, 14, 2921, 14, 1757, 360, 24993, 1839, 29162, 370, 3507, 9499, 908, 8, 390, 68, 430, 355, 1839, 29162, 14, 888, 459, 13321, 425, 2278, 740, 21114, 11123, 908, 8, 390, 68, 430, 398, 9593, 275, 283, 888, 8650, 267, 367, 570, 63, 1955, 12, 931, 315, 3874, 8, 1751, 14, 362, 63, 888, 63, 3771, 1062, 413, 304, 288, 570, 63, 832, 275, 747, 14, 515, 14, 7973, 8, 515, 2788, 17, 61, 288, 5145, 14, 1574, 8, 515, 12, 747, 14, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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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 ]
MiltosD/CEFELRC
lib/python2.7/site-packages/analytical/templatetags/reinvigorate.py
3
2592
""" Reinvigorate template tags and filters. """ from __future__ import absolute_import import re from django.template import Library, Node, TemplateSyntaxError from django.utils import simplejson from analytical.utils import get_identity, is_internal_ip, disable_html, \ get_required_setting TRACKING_ID_RE = re.compile(r'^[\w\d]+-[\w\d]+$') TRACKING_CODE = """ <script type="text/javascript"> document.write(unescape("%%3Cscript src='" + (("https:" == document.location.protocol) ? "https://ssl-" : "http://") + "include.reinvigorate.net/re_.js' type='text/javascript'%%3E%%3C/script%%3E")); </script> <script type="text/javascript"> try { %(tags)s reinvigorate.track("%(tracking_id)s"); } catch(err) {} </script> """ register = Library() @register.tag def reinvigorate(parser, token): """ Reinvigorate tracking template tag. Renders Javascript code to track page visits. You must supply your Reinvigorate tracking ID (as a string) in the ``REINVIGORATE_TRACKING_ID`` setting. """ bits = token.split_contents() if len(bits) > 1: raise TemplateSyntaxError("'%s' takes no arguments" % bits[0]) return ReinvigorateNode() class ReinvigorateNode(Node): def __init__(self): self.tracking_id = get_required_setting('REINVIGORATE_TRACKING_ID', TRACKING_ID_RE, "must be a string looking like XXXXX-XXXXXXXXXX") def render(self, context): re_vars = {} for dict_ in context: for var, val in dict_.items(): if var.startswith('reinvigorate_'): re_vars[var[13:]] = val if 'name' not in re_vars: identity = get_identity(context, 'reinvigorate', lambda u: u.get_full_name()) if identity is not None: re_vars['name'] = identity if 'context' not in re_vars: email = get_identity(context, 'reinvigorate', lambda u: u.email) if email is not None: re_vars['context'] = email tags = " ".join("var re_%s_tag = %s;" % (tag, simplejson.dumps(value)) for tag, value in re_vars.items()) html = TRACKING_CODE % {'tracking_id': self.tracking_id, 'tags': tags} if is_internal_ip(context, 'REINVIGORATE'): html = disable_html(html, 'Reinvigorate') return html def contribute_to_analytical(add_node): ReinvigorateNode() # ensure properly configured add_node('body_bottom', ReinvigorateNode)
bsd-3-clause
[ 624, 199, 497, 262, 433, 2904, 323, 1978, 3762, 436, 4766, 14, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 199, 646, 295, 199, 199, 504, 1639, 14, 1160, 492, 11243, 12, 5013, 12, 17762, 199, 504, 1639, 14, 1208, 492, 13804, 199, 199, 504, 5909, 3294, 14, 1208, 492, 664, 63, 5582, 12, 365, 63, 4672, 63, 711, 12, 3507, 63, 1360, 12, 971, 267, 664, 63, 2427, 63, 6031, 421, 199, 19755, 1206, 63, 998, 63, 907, 275, 295, 14, 2014, 8, 82, 4289, 7023, 87, 60, 68, 2807, 13, 7023, 87, 60, 68, 2807, 9988, 199, 19755, 1206, 63, 6012, 275, 408, 272, 665, 1579, 730, 628, 505, 15, 9554, 1743, 489, 2213, 14, 952, 8, 22726, 3647, 5, 19, 35, 1579, 2928, 534, 2, 435, 19110, 2859, 5424, 508, 2213, 14, 1985, 14, 3922, 9, 5805, 298, 2859, 921, 4266, 23245, 520, 298, 1014, 921, 531, 435, 298, 2613, 14, 264, 262, 433, 2904, 323, 14, 846, 15, 264, 3754, 3596, 7, 730, 534, 505, 15, 9554, 5956, 5, 19, 37, 8530, 19, 35, 15, 1579, 8530, 19, 37, 2237, 27, 272, 3068, 1579, 30, 272, 665, 1579, 730, 628, 505, 15, 9554, 1743, 489, 862, 469, 267, 2818, 2969, 9, 83, 267, 295, 262, 433, 2904, 323, 14, 3885, 480, 2840, 14428, 63, 344, 9, 83, 3547, 489, 789, 8579, 8, 1508, 9, 1052, 272, 3068, 1579, 30, 199, 624, 421, 199, 2683, 275, 11243, 342, 421, 199, 32, 2683, 14, 1450, 199, 318, 295, 262, 433, 2904, 323, 8, 2087, 12, 1526, 304, 272, 408, 272, 799, 262, 433, 2904, 323, 15161, 1978, 1947, 14, 339, 10055, 7735, 31861, 1233, 370, 4426, 2034, 1321, 30066, 14, 221, 2047, 1471, 17169, 272, 2195, 799, 262, 433, 2904, 323, 15161, 2870, 334, 305, 282, 1059, 9, 315, 314, 272, 1124, 907, 568, 54, 1277, 726, 1951, 63, 19755, 1206, 63, 998, 1040, 4260, 14, 272, 408, 272, 5821, 275, 1526, 14, 1294, 63, 4407, 342, 272, 340, 822, 8, 5609, 9, 690, 413, 26, 267, 746, 17762, 21065, 83, 7, 6181, 949, 2368, 2, 450, 5821, 59, 16, 566, 272, 372, 799, 262, 433, 2904, 323, 1716, 342, 199, 199, 533, 799, 262, 433, 2904, 323, 1716, 8, 1716, 304, 272, 347, 636, 826, 721, 277, 304, 267, 291, 14, 14428, 63, 344, 275, 664, 63, 2427, 63, 6031, 360, 907, 568, 54, 1277, 726, 1951, 63, 19755, 1206, 63, 998, 297, 355, 9074, 3099, 1206, 63, 998, 63, 907, 12, 355, 298, 7790, 506, 282, 1059, 10023, 2839, 5787, 2483, 13, 13312, 2483, 531, 339, 347, 3795, 8, 277, 12, 1067, 304, 267, 295, 63, 2936, 275, 1052, 267, 367, 1211, 63, 315, 1067, 26, 288, 367, 2729, 12, 1139, 315, 1211, 3754, 1744, 837, 355, 340, 2729, 14, 2460, 360, 264, 262, 433, 2904, 323, 25865, 490, 295, 63, 2936, 59, 1391, 59, 969, 21316, 275, 1139, 267, 340, 283, 354, 7, 440, 315, 295, 63, 2936, 26, 288, 8503, 275, 664, 63, 5582, 8, 1100, 12, 283, 264, 262, 433, 2904, 323, 297, 490, 2400, 399, 26, 399, 14, 362, 63, 2861, 63, 354, 1012, 288, 340, 8503, 365, 440, 488, 26, 355, 295, 63, 2936, 459, 354, 418, 275, 8503, 267, 340, 283, 1100, 7, 440, 315, 295, 63, 2936, 26, 288, 3031, 275, 664, 63, 5582, 8, 1100, 12, 283, 264, 262, 433, 2904, 323, 297, 2400, 399, 26, 399, 14, 2123, 9, 288, 340, 3031, 365, 440, 488, 26, 355, 295, 63, 2936, 459, 1100, 418, 275, 3031, 267, 3762, 275, 298, 3680, 904, 480, 1391, 295, 4970, 83, 63, 1450, 275, 450, 83, 9426, 450, 334, 1450, 12, 13804, 14, 4180, 8, 585, 430, 355, 367, 1947, 12, 574, 315, 295, 63, 2936, 14, 1744, 1012, 398, 3517, 275, 9074, 3099, 1206, 63, 6012, 450, 791, 14428, 63, 344, 356, 291, 14, 14428, 63, 344, 12, 355, 283, 2969, 356, 3762, 93, 267, 340, 365, 63, 4672, 63, 711, 8, 1100, 12, 283, 907, 568, 54, 1277, 726, 1951, 735, 288, 3517, 275, 3507, 63, 1360, 8, 1360, 12, 283, 497, 262, 433, 2904, 323, 358, 267, 372, 3517, 421, 199, 318, 28567, 63, 475, 63, 4797, 3294, 8, 525, 63, 932, 304, 272, 799, 262, 433, 2904, 323, 1716, 342, 221, 327, 4868, 7684, 7526, 272, 1050, 63, 932, 360, 2030, 63, 8305, 297, 799, 262, 433, 2904, 323, 1716, 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 ]
[ 199, 497, 262, 433, 2904, 323, 1978, 3762, 436, 4766, 14, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 199, 646, 295, 199, 199, 504, 1639, 14, 1160, 492, 11243, 12, 5013, 12, 17762, 199, 504, 1639, 14, 1208, 492, 13804, 199, 199, 504, 5909, 3294, 14, 1208, 492, 664, 63, 5582, 12, 365, 63, 4672, 63, 711, 12, 3507, 63, 1360, 12, 971, 267, 664, 63, 2427, 63, 6031, 421, 199, 19755, 1206, 63, 998, 63, 907, 275, 295, 14, 2014, 8, 82, 4289, 7023, 87, 60, 68, 2807, 13, 7023, 87, 60, 68, 2807, 9988, 199, 19755, 1206, 63, 6012, 275, 408, 272, 665, 1579, 730, 628, 505, 15, 9554, 1743, 489, 2213, 14, 952, 8, 22726, 3647, 5, 19, 35, 1579, 2928, 534, 2, 435, 19110, 2859, 5424, 508, 2213, 14, 1985, 14, 3922, 9, 5805, 298, 2859, 921, 4266, 23245, 520, 298, 1014, 921, 531, 435, 298, 2613, 14, 264, 262, 433, 2904, 323, 14, 846, 15, 264, 3754, 3596, 7, 730, 534, 505, 15, 9554, 5956, 5, 19, 37, 8530, 19, 35, 15, 1579, 8530, 19, 37, 2237, 27, 272, 3068, 1579, 30, 272, 665, 1579, 730, 628, 505, 15, 9554, 1743, 489, 862, 469, 267, 2818, 2969, 9, 83, 267, 295, 262, 433, 2904, 323, 14, 3885, 480, 2840, 14428, 63, 344, 9, 83, 3547, 489, 789, 8579, 8, 1508, 9, 1052, 272, 3068, 1579, 30, 199, 624, 421, 199, 2683, 275, 11243, 342, 421, 199, 32, 2683, 14, 1450, 199, 318, 295, 262, 433, 2904, 323, 8, 2087, 12, 1526, 304, 272, 408, 272, 799, 262, 433, 2904, 323, 15161, 1978, 1947, 14, 339, 10055, 7735, 31861, 1233, 370, 4426, 2034, 1321, 30066, 14, 221, 2047, 1471, 17169, 272, 2195, 799, 262, 433, 2904, 323, 15161, 2870, 334, 305, 282, 1059, 9, 315, 314, 272, 1124, 907, 568, 54, 1277, 726, 1951, 63, 19755, 1206, 63, 998, 1040, 4260, 14, 272, 408, 272, 5821, 275, 1526, 14, 1294, 63, 4407, 342, 272, 340, 822, 8, 5609, 9, 690, 413, 26, 267, 746, 17762, 21065, 83, 7, 6181, 949, 2368, 2, 450, 5821, 59, 16, 566, 272, 372, 799, 262, 433, 2904, 323, 1716, 342, 199, 199, 533, 799, 262, 433, 2904, 323, 1716, 8, 1716, 304, 272, 347, 636, 826, 721, 277, 304, 267, 291, 14, 14428, 63, 344, 275, 664, 63, 2427, 63, 6031, 360, 907, 568, 54, 1277, 726, 1951, 63, 19755, 1206, 63, 998, 297, 355, 9074, 3099, 1206, 63, 998, 63, 907, 12, 355, 298, 7790, 506, 282, 1059, 10023, 2839, 5787, 2483, 13, 13312, 2483, 531, 339, 347, 3795, 8, 277, 12, 1067, 304, 267, 295, 63, 2936, 275, 1052, 267, 367, 1211, 63, 315, 1067, 26, 288, 367, 2729, 12, 1139, 315, 1211, 3754, 1744, 837, 355, 340, 2729, 14, 2460, 360, 264, 262, 433, 2904, 323, 25865, 490, 295, 63, 2936, 59, 1391, 59, 969, 21316, 275, 1139, 267, 340, 283, 354, 7, 440, 315, 295, 63, 2936, 26, 288, 8503, 275, 664, 63, 5582, 8, 1100, 12, 283, 264, 262, 433, 2904, 323, 297, 490, 2400, 399, 26, 399, 14, 362, 63, 2861, 63, 354, 1012, 288, 340, 8503, 365, 440, 488, 26, 355, 295, 63, 2936, 459, 354, 418, 275, 8503, 267, 340, 283, 1100, 7, 440, 315, 295, 63, 2936, 26, 288, 3031, 275, 664, 63, 5582, 8, 1100, 12, 283, 264, 262, 433, 2904, 323, 297, 2400, 399, 26, 399, 14, 2123, 9, 288, 340, 3031, 365, 440, 488, 26, 355, 295, 63, 2936, 459, 1100, 418, 275, 3031, 267, 3762, 275, 298, 3680, 904, 480, 1391, 295, 4970, 83, 63, 1450, 275, 450, 83, 9426, 450, 334, 1450, 12, 13804, 14, 4180, 8, 585, 430, 355, 367, 1947, 12, 574, 315, 295, 63, 2936, 14, 1744, 1012, 398, 3517, 275, 9074, 3099, 1206, 63, 6012, 450, 791, 14428, 63, 344, 356, 291, 14, 14428, 63, 344, 12, 355, 283, 2969, 356, 3762, 93, 267, 340, 365, 63, 4672, 63, 711, 8, 1100, 12, 283, 907, 568, 54, 1277, 726, 1951, 735, 288, 3517, 275, 3507, 63, 1360, 8, 1360, 12, 283, 497, 262, 433, 2904, 323, 358, 267, 372, 3517, 421, 199, 318, 28567, 63, 475, 63, 4797, 3294, 8, 525, 63, 932, 304, 272, 799, 262, 433, 2904, 323, 1716, 342, 221, 327, 4868, 7684, 7526, 272, 1050, 63, 932, 360, 2030, 63, 8305, 297, 799, 262, 433, 2904, 323, 1716, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
nubark/odoo
addons/website_sale/controllers/main.py
3
47925
# -*- coding: utf-8 -*- import logging import werkzeug from openerp import SUPERUSER_ID from openerp import http from openerp import tools from openerp.http import request from openerp.tools.translate import _ from openerp.addons.website.models.website import slug PPG = 20 # Products Per Page PPR = 4 # Products Per Row _logger = logging.getLogger(__name__) class table_compute(object): def __init__(self): self.table = {} def _check_place(self, posx, posy, sizex, sizey): res = True for y in range(sizey): for x in range(sizex): if posx+x>=PPR: res = False break row = self.table.setdefault(posy+y, {}) if row.setdefault(posx+x) is not None: res = False break for x in range(PPR): self.table[posy+y].setdefault(x, None) return res def process(self, products, ppg=PPG): # Compute products positions on the grid minpos = 0 index = 0 maxy = 0 for p in products: x = min(max(p.website_size_x, 1), PPR) y = min(max(p.website_size_y, 1), PPR) if index>=ppg: x = y = 1 pos = minpos while not self._check_place(pos%PPR, pos/PPR, x, y): pos += 1 # if 21st products (index 20) and the last line is full (PPR products in it), break # (pos + 1.0) / PPR is the line where the product would be inserted # maxy is the number of existing lines # + 1.0 is because pos begins at 0, thus pos 20 is actually the 21st block # and to force python to not round the division operation if index >= ppg and ((pos + 1.0) / PPR) > maxy: break if x==1 and y==1: # simple heuristic for CPU optimization minpos = pos/PPR for y2 in range(y): for x2 in range(x): self.table[(pos/PPR)+y2][(pos%PPR)+x2] = False self.table[pos/PPR][pos%PPR] = { 'product': p, 'x':x, 'y': y, 'class': " ".join(map(lambda x: x.html_class or '', p.website_style_ids)) } if index<=ppg: maxy=max(maxy,y+(pos/PPR)) index += 1 # Format table according to HTML needs rows = self.table.items() rows.sort() rows = map(lambda x: x[1], rows) for col in range(len(rows)): cols = rows[col].items() cols.sort() x += len(cols) rows[col] = [c for c in map(lambda x: x[1], cols) if c != False] return rows # TODO keep with input type hidden class QueryURL(object): def __init__(self, path='', **args): self.path = path self.args = args def __call__(self, path=None, **kw): if not path: path = self.path for k,v in self.args.items(): kw.setdefault(k,v) l = [] for k,v in kw.items(): if v: if isinstance(v, list) or isinstance(v, set): l.append(werkzeug.url_encode([(k,i) for i in v])) else: l.append(werkzeug.url_encode([(k,v)])) if l: path += '?' + '&'.join(l) return path def get_pricelist(): return request.website.get_current_pricelist() if not pricelist: _logger.error('Fail to find pricelist for partner "%s" (id %s)', partner.name, partner.id) class website_sale(http.Controller): def get_pricelist(self): return get_pricelist() def get_attribute_value_ids(self, product): cr, uid, context, pool = request.cr, request.uid, request.context, request.registry currency_obj = pool['res.currency'] attribute_value_ids = [] visible_attrs = set(l.attribute_id.id for l in product.attribute_line_ids if len(l.value_ids) > 1) if request.website.currency_id != product.currency_id: for p in product.product_variant_ids: price = currency_obj.compute(cr, uid, product.currency_id.id, request.website.currency_id.id, p.lst_price) attribute_value_ids.append([p.id, [v.id for v in p.attribute_value_ids if v.attribute_id.id in visible_attrs], p.price, price]) else: attribute_value_ids = [[p.id, [v.id for v in p.attribute_value_ids if v.attribute_id.id in visible_attrs], p.price, p.lst_price] for p in product.product_variant_ids] return attribute_value_ids def _get_search_order(self, post): # OrderBy will be parsed in orm and so no direct sql injection # id is added to be sure that order is a unique sort key return 'website_published desc,%s , id desc' % post.get('order', 'website_sequence desc') @http.route(['/shop/change_pricelist/<model("product.pricelist"):pl_id>'], type='http', auth="public", website=True) def pricelist_change(self, pl_id, **post): if request.website.is_pricelist_available(pl_id.id, context=request.context): request.session['website_sale_current_pl'] = pl_id.id request.website.sale_get_order(force_pricelist=pl_id.id, context=request.context) return request.redirect(request.httprequest.referrer or '/shop') def _get_search_domain(self, search, category, attrib_values): domain = request.website.sale_product_domain() if search: for srch in search.split(" "): domain += [ '|', '|', '|', ('name', 'ilike', srch), ('description', 'ilike', srch), ('description_sale', 'ilike', srch), ('product_variant_ids.default_code', 'ilike', srch)] if category: domain += [('public_categ_ids', 'child_of', int(category))] if attrib_values: attrib = None ids = [] for value in attrib_values: if not attrib: attrib = value[0] ids.append(value[1]) elif value[0] == attrib: ids.append(value[1]) else: domain += [('attribute_line_ids.value_ids', 'in', ids)] attrib = value[0] ids = [value[1]] if attrib: domain += [('attribute_line_ids.value_ids', 'in', ids)] return domain @http.route([ '/shop', '/shop/page/<int:page>', '/shop/category/<model("product.public.category"):category>', '/shop/category/<model("product.public.category"):category>/page/<int:page>' ], type='http', auth="public", website=True) def shop(self, page=0, category=None, search='', ppg=False, **post): cr, uid, context, pool = request.cr, request.uid, request.context, request.registry if ppg: try: ppg = int(ppg) except ValueError: ppg = PPG post["ppg"] = ppg else: ppg = PPG attrib_list = request.httprequest.args.getlist('attrib') attrib_values = [map(int, v.split("-")) for v in attrib_list if v] attributes_ids = set([v[0] for v in attrib_values]) attrib_set = set([v[1] for v in attrib_values]) domain = self._get_search_domain(search, category, attrib_values) keep = QueryURL('/shop', category=category and int(category), search=search, attrib=attrib_list) if not context.get('pricelist'): pricelist = self.get_pricelist() context['pricelist'] = int(pricelist) else: pricelist = pool.get('product.pricelist').browse(cr, uid, context['pricelist'], context) url = "/shop" if search: post["search"] = search if category: category = pool['product.public.category'].browse(cr, uid, int(category), context=context) url = "/shop/category/%s" % slug(category) if attrib_list: post['attrib'] = attrib_list style_obj = pool['product.style'] style_ids = style_obj.search(cr, uid, [], context=context) styles = style_obj.browse(cr, uid, style_ids, context=context) category_obj = pool['product.public.category'] category_ids = category_obj.search(cr, uid, [('parent_id', '=', False)], context=context) categs = category_obj.browse(cr, uid, category_ids, context=context) product_obj = pool.get('product.template') parent_category_ids = [] if category: parent_category_ids = [category.id] current_category = category while current_category.parent_id: parent_category_ids.append(current_category.parent_id.id) current_category = current_category.parent_id product_count = product_obj.search_count(cr, uid, domain, context=context) pager = request.website.pager(url=url, total=product_count, page=page, step=ppg, scope=7, url_args=post) product_ids = product_obj.search(cr, uid, domain, limit=ppg, offset=pager['offset'], order=self._get_search_order(post), context=context) products = product_obj.browse(cr, uid, product_ids, context=context) attributes_obj = request.registry['product.attribute'] if product_ids: attributes_ids = attributes_obj.search(cr, uid, [('attribute_line_ids.product_tmpl_id', 'in', product_ids)], context=context) attributes = attributes_obj.browse(cr, uid, attributes_ids, context=context) from_currency = pool['res.users'].browse(cr, uid, uid, context=context).company_id.currency_id to_currency = pricelist.currency_id compute_currency = lambda price: pool['res.currency']._compute(cr, uid, from_currency, to_currency, price, context=context) values = { 'search': search, 'category': category, 'attrib_values': attrib_values, 'attrib_set': attrib_set, 'pager': pager, 'pricelist': pricelist, 'products': products, 'bins': table_compute().process(products, ppg), 'rows': PPR, 'styles': styles, 'categories': categs, 'attributes': attributes, 'compute_currency': compute_currency, 'keep': keep, 'parent_category_ids': parent_category_ids, 'style_in_product': lambda style, product: style.id in [s.id for s in product.website_style_ids], 'attrib_encode': lambda attribs: werkzeug.url_encode([('attrib',i) for i in attribs]), } if category: values['main_object'] = category return request.website.render("website_sale.products", values) @http.route(['/shop/product/<model("product.template"):product>'], type='http', auth="public", website=True) def product(self, product, category='', search='', **kwargs): cr, uid, context, pool = request.cr, request.uid, request.context, request.registry category_obj = pool['product.public.category'] template_obj = pool['product.template'] context.update(active_id=product.id) if category: category = category_obj.browse(cr, uid, int(category), context=context) category = category if category.exists() else False attrib_list = request.httprequest.args.getlist('attrib') attrib_values = [map(int,v.split("-")) for v in attrib_list if v] attrib_set = set([v[1] for v in attrib_values]) keep = QueryURL('/shop', category=category and category.id, search=search, attrib=attrib_list) category_ids = category_obj.search(cr, uid, [('parent_id', '=', False)], context=context) categs = category_obj.browse(cr, uid, category_ids, context=context) pricelist = self.get_pricelist() from_currency = pool['res.users'].browse(cr, uid, uid, context=context).company_id.currency_id to_currency = pricelist.currency_id compute_currency = lambda price: pool['res.currency']._compute(cr, uid, from_currency, to_currency, price, context=context) # get the rating attached to a mail.message, and the rating stats of the product Rating = pool['rating.rating'] rating_ids = Rating.search(cr, uid, [('message_id', 'in', product.website_message_ids.ids)], context=context) ratings = Rating.browse(cr, uid, rating_ids, context=context) rating_message_values = dict([(record.message_id.id, record.rating) for record in ratings]) rating_product = product.rating_get_stats([('website_published', '=', True)]) if not context.get('pricelist'): context['pricelist'] = int(self.get_pricelist()) product = template_obj.browse(cr, uid, int(product), context=context) values = { 'search': search, 'category': category, 'pricelist': pricelist, 'attrib_values': attrib_values, 'compute_currency': compute_currency, 'attrib_set': attrib_set, 'keep': keep, 'categories': categs, 'main_object': product, 'product': product, 'get_attribute_value_ids': self.get_attribute_value_ids, 'rating_message_values' : rating_message_values, 'rating_product' : rating_product } return request.website.render("website_sale.product", values) @http.route(['/shop/pricelist'], type='http', auth="public", website=True) def pricelist(self, promo, **post): cr, uid, pool, context = request.cr, request.uid, request.registry, request.context pl = pool['product.pricelist'].search(cr, SUPERUSER_ID, [('code', '=', promo)], context=context) if pl: if not request.website.is_pricelist_available(pl[0], context=context): return request.redirect("/shop/cart?code_not_available=1") request.website.sale_get_order(code=promo, context=context) return request.redirect("/shop/cart") @http.route(['/shop/cart'], type='http', auth="public", website=True) def cart(self, **post): cr, uid, context, pool = request.cr, request.uid, request.context, request.registry order = request.website.sale_get_order() if order: from_currency = order.company_id.currency_id to_currency = order.pricelist_id.currency_id compute_currency = lambda price: pool['res.currency']._compute(cr, uid, from_currency, to_currency, price, context=context) else: compute_currency = lambda price: price values = { 'website_sale_order': order, 'compute_currency': compute_currency, 'suggested_products': [], } if order: _order = order if not context.get('pricelist'): _order = order.with_context(pricelist=order.pricelist_id.id) values['suggested_products'] = _order._cart_accessories() if post.get('type') == 'popover': return request.website.render("website_sale.cart_popover", values) if post.get('code_not_available'): values['code_not_available'] = post.get('code_not_available') return request.website.render("website_sale.cart", values) @http.route(['/shop/cart/update'], type='http', auth="public", methods=['POST'], website=True) def cart_update(self, product_id, add_qty=1, set_qty=0, **kw): request.website.sale_get_order(force_create=1)._cart_update(product_id=int(product_id), add_qty=float(add_qty), set_qty=float(set_qty)) return request.redirect("/shop/cart") @http.route(['/shop/cart/update_json'], type='json', auth="public", methods=['POST'], website=True) def cart_update_json(self, product_id, line_id=None, add_qty=None, set_qty=None, display=True): order = request.website.sale_get_order(force_create=1) if order.state != 'draft': request.website.sale_reset() return {} value = order._cart_update(product_id=product_id, line_id=line_id, add_qty=add_qty, set_qty=set_qty) if not order.cart_quantity: request.website.sale_reset() return {} if not display: return None order = request.website.sale_get_order() value['cart_quantity'] = order.cart_quantity value['website_sale.cart_lines'] = request.website._render("website_sale.cart_lines", { 'website_sale_order': order, 'compute_currency': lambda price: request.registry['res.currency']._compute(request.cr, request.uid, order.company_id.currency_id, order.pricelist_id.currency_id, price, context=request.context), 'suggested_products': order.with_context(pricelist=order.pricelist_id.id)._cart_accessories() }) return value #------------------------------------------------------ # Checkout #------------------------------------------------------ def checkout_redirection(self, order): cr, uid, context, registry = request.cr, request.uid, request.context, request.registry # must have a draft sale order with lines at this point, otherwise reset if not order or order.state != 'draft': request.session['sale_order_id'] = None request.session['sale_transaction_id'] = None return request.redirect('/shop') # if transaction pending / done: redirect to confirmation tx = context.get('website_sale_transaction') if tx and tx.state != 'draft': return request.redirect('/shop/payment/confirmation/%s' % order.id) def checkout_values(self, data=None): cr, uid, context, registry = request.cr, request.uid, request.context, request.registry orm_partner = registry.get('res.partner') orm_user = registry.get('res.users') orm_country = registry.get('res.country') state_orm = registry.get('res.country.state') country_ids = orm_country.search(cr, SUPERUSER_ID, [], context=context) countries = orm_country.browse(cr, SUPERUSER_ID, country_ids, context) states_ids = state_orm.search(cr, SUPERUSER_ID, [], context=context) states = state_orm.browse(cr, SUPERUSER_ID, states_ids, context) partner = orm_user.browse(cr, SUPERUSER_ID, request.uid, context).partner_id order = None shipping_id = data and data.get('shipping_id') or None shipping_ids = [] checkout = {} if not data: if request.uid != request.website.user_id.id: checkout.update( self.checkout_parse("billing", partner) ) shipping_ids = orm_partner.search(cr, SUPERUSER_ID, [("parent_id", "=", partner.id), ('type', "=", 'delivery')], context=context) else: order = request.website.sale_get_order(force_create=1, context=context) if order.partner_id: domain = [("partner_id", "=", order.partner_id.id)] user_ids = request.registry['res.users'].search(cr, SUPERUSER_ID, domain, context=dict(context or {}, active_test=False)) if not user_ids or request.website.user_id.id not in user_ids: checkout.update( self.checkout_parse("billing", order.partner_id) ) else: checkout = self.checkout_parse('billing', data) try: shipping_id = int(shipping_id) except (ValueError, TypeError): pass if shipping_id == -1: checkout.update(self.checkout_parse('shipping', data)) if shipping_id is None: if not order: order = request.website.sale_get_order(context=context) if order and order.partner_shipping_id: shipping_id = order.partner_shipping_id.id shipping_ids = list(set(shipping_ids) - set([partner.id])) if shipping_id == partner.id: shipping_id = 0 elif shipping_id > 0 and shipping_id not in shipping_ids: shipping_ids.append(shipping_id) elif shipping_id is None and shipping_ids: shipping_id = shipping_ids[0] ctx = dict(context, show_address=1) shippings = [] if shipping_ids: shippings = shipping_ids and orm_partner.browse(cr, SUPERUSER_ID, list(shipping_ids), ctx) or [] if shipping_id > 0: shipping = orm_partner.browse(cr, SUPERUSER_ID, shipping_id, ctx) checkout.update( self.checkout_parse("shipping", shipping) ) checkout['shipping_id'] = shipping_id # Default search by user country if not checkout.get('country_id'): country_code = request.session['geoip'].get('country_code') if country_code: country_ids = request.registry.get('res.country').search(cr, uid, [('code', '=', country_code)], context=context) if country_ids: checkout['country_id'] = country_ids[0] values = { 'countries': countries, 'states': states, 'checkout': checkout, 'shipping_id': partner.id != shipping_id and shipping_id or 0, 'shippings': shippings, 'error': {}, 'has_check_vat': hasattr(registry['res.partner'], 'check_vat'), 'only_services': order and order.only_services or False } return values mandatory_billing_fields = ["name", "phone", "email", "street2", "city", "country_id"] optional_billing_fields = ["street", "state_id", "vat", "zip"] mandatory_shipping_fields = ["name", "phone", "street", "city", "country_id"] optional_shipping_fields = ["state_id", "zip"] def _get_mandatory_billing_fields(self): return self.mandatory_billing_fields def _get_optional_billing_fields(self): return self.optional_billing_fields def _get_mandatory_shipping_fields(self): return self.mandatory_shipping_fields def _get_optional_shipping_fields(self): return self.optional_shipping_fields def _post_prepare_query(self, query, data, address_type): return query def checkout_parse(self, address_type, data, remove_prefix=False): """ data is a dict OR a partner browse record """ # set mandatory and optional fields assert address_type in ('billing', 'shipping') if address_type == 'billing': all_fields = self._get_mandatory_billing_fields() + self._get_optional_billing_fields() prefix = '' else: all_fields = self._get_mandatory_shipping_fields() + self._get_optional_shipping_fields() prefix = 'shipping_' # set data if isinstance(data, dict): query = dict((prefix + field_name, data[prefix + field_name]) for field_name in all_fields if prefix + field_name in data) else: query = dict((prefix + field_name, getattr(data, field_name)) for field_name in all_fields if getattr(data, field_name)) if address_type == 'billing' and data.parent_id: query[prefix + 'street'] = data.parent_id.name if query.get(prefix + 'state_id'): query[prefix + 'state_id'] = int(query[prefix + 'state_id']) if query.get(prefix + 'country_id'): query[prefix + 'country_id'] = int(query[prefix + 'country_id']) query = self._post_prepare_query(query, data, address_type) if not remove_prefix: return query return dict((field_name, data[prefix + field_name]) for field_name in all_fields if prefix + field_name in data) def checkout_form_validate(self, data): cr, uid, context, registry = request.cr, request.uid, request.context, request.registry error = dict() error_message = [] # Validation for field_name in self._get_mandatory_billing_fields(): if not data.get(field_name): error[field_name] = 'missing' # email validation if data.get('email') and not tools.single_email_re.match(data.get('email')): error["email"] = 'error' error_message.append(_('Invalid Email! Please enter a valid email address.')) # vat validation if data.get("vat") and hasattr(registry["res.partner"], "check_vat"): if request.website.company_id.vat_check_vies: # force full VIES online check check_func = registry["res.partner"].vies_vat_check else: # quick and partial off-line checksum validation check_func = registry["res.partner"].simple_vat_check vat_country, vat_number = registry["res.partner"]._split_vat(data.get("vat")) if not check_func(cr, uid, vat_country, vat_number, context=None): # simple_vat_check error["vat"] = 'error' if data.get("shipping_id") == -1: for field_name in self._get_mandatory_shipping_fields(): field_name = 'shipping_' + field_name if not data.get(field_name): error[field_name] = 'missing' # error message for empty required fields if [err for err in error.values() if err == 'missing']: error_message.append(_('Some required fields are empty.')) return error, error_message def _get_shipping_info(self, checkout): shipping_info = {} shipping_info.update(self.checkout_parse('shipping', checkout, True)) shipping_info['type'] = 'delivery' return shipping_info def checkout_form_save(self, checkout): cr, uid, context, registry = request.cr, request.uid, request.context, request.registry order = request.website.sale_get_order(force_create=1, context=context) orm_partner = registry.get('res.partner') orm_user = registry.get('res.users') order_obj = request.registry.get('sale.order') partner_lang = request.lang if request.lang in [lang.code for lang in request.website.language_ids] else None billing_info = {'customer': True} if partner_lang: billing_info['lang'] = partner_lang billing_info.update(self.checkout_parse('billing', checkout, True)) # set partner_id partner_id = None if request.uid != request.website.user_id.id: partner_id = orm_user.browse(cr, SUPERUSER_ID, uid, context=context).partner_id.id elif order.partner_id: user_ids = request.registry['res.users'].search(cr, SUPERUSER_ID, [("partner_id", "=", order.partner_id.id)], context=dict(context or {}, active_test=False)) if not user_ids or request.website.user_id.id not in user_ids: partner_id = order.partner_id.id # save partner informations if partner_id and request.website.partner_id.id != partner_id: orm_partner.write(cr, SUPERUSER_ID, [partner_id], billing_info, context=context) else: # create partner billing_info['team_id'] = request.website.salesteam_id.id partner_id = orm_partner.create(cr, SUPERUSER_ID, billing_info, context=context) order.write({'partner_id': partner_id}) order_obj.onchange_partner_id(cr, SUPERUSER_ID, [order.id], context=context) # create a new shipping partner if checkout.get('shipping_id') == -1: shipping_info = self._get_shipping_info(checkout) if partner_lang: shipping_info['lang'] = partner_lang shipping_info['parent_id'] = partner_id checkout['shipping_id'] = orm_partner.create(cr, SUPERUSER_ID, shipping_info, context) order_info = { 'message_partner_ids': [(4, partner_id), (3, request.website.partner_id.id)], 'partner_shipping_id': checkout.get('shipping_id') or partner_id, } order_obj.write(cr, SUPERUSER_ID, [order.id], order_info, context=context) @http.route(['/shop/checkout'], type='http', auth="public", website=True) def checkout(self, **post): cr, uid, context = request.cr, request.uid, request.context order = request.website.sale_get_order(force_create=1, context=context) redirection = self.checkout_redirection(order) if redirection: return redirection values = self.checkout_values() return request.website.render("website_sale.checkout", values) @http.route(['/shop/confirm_order'], type='http', auth="public", website=True) def confirm_order(self, **post): cr, uid, context, registry = request.cr, request.uid, request.context, request.registry order = request.website.sale_get_order(context=context) if not order: return request.redirect("/shop") redirection = self.checkout_redirection(order) if redirection: return redirection values = self.checkout_values(post) values["error"], values["error_message"] = self.checkout_form_validate(values["checkout"]) if values["error"]: return request.website.render("website_sale.checkout", values) self.checkout_form_save(values["checkout"]) order.onchange_partner_shipping_id() order.order_line._compute_tax_id() request.session['sale_last_order_id'] = order.id request.website.sale_get_order(update_pricelist=True, context=context) extra_step = registry['ir.model.data'].xmlid_to_object(cr, uid, 'website_sale.extra_info_option', raise_if_not_found=True) if extra_step.active: return request.redirect("/shop/extra_info") return request.redirect("/shop/payment") #------------------------------------------------------ # Extra step #------------------------------------------------------ @http.route(['/shop/extra_info'], type='http', auth="public", website=True) def extra_info(self, **post): cr, uid, context, registry = request.cr, request.uid, request.context, request.registry # Check that this option is activated extra_step = registry['ir.model.data'].xmlid_to_object(cr, uid, 'website_sale.extra_info_option', raise_if_not_found=True) if not extra_step.active: return request.redirect("/shop/payment") # check that cart is valid order = request.website.sale_get_order(context=context) redirection = self.checkout_redirection(order) if redirection: return redirection # if form posted if 'post_values' in post: values = {} for field_name, field_value in post.items(): if field_name in request.registry['sale.order']._fields and field_name.startswith('x_'): values[field_name] = field_value if values: order.write(values) return request.redirect("/shop/payment") values = { 'website_sale_order': order } sale_order_obj = request.registry.get('sale.order') values.update(sale_order_obj._get_website_data(cr, uid, order, context)) return request.website.render("website_sale.extra_info", values) #------------------------------------------------------ # Payment #------------------------------------------------------ @http.route(['/shop/payment'], type='http', auth="public", website=True) def payment(self, **post): """ Payment step. This page proposes several payment means based on available payment.acquirer. State at this point : - a draft sale order with lines; otherwise, clean context / session and back to the shop - no transaction in context / session, or only a draft one, if the customer did go to a payment.acquirer website but closed the tab without paying / canceling """ cr, uid, context = request.cr, request.uid, request.context payment_obj = request.registry.get('payment.acquirer') sale_order_obj = request.registry.get('sale.order') order = request.website.sale_get_order(context=context) redirection = self.checkout_redirection(order) if redirection: return redirection shipping_partner_id = False if order: if order.partner_shipping_id.id: shipping_partner_id = order.partner_shipping_id.id else: shipping_partner_id = order.partner_invoice_id.id values = { 'website_sale_order': order } values['errors'] = sale_order_obj._get_errors(cr, uid, order, context=context) values.update(sale_order_obj._get_website_data(cr, uid, order, context)) if not values['errors']: acquirer_ids = payment_obj.search(cr, SUPERUSER_ID, [('website_published', '=', True), ('company_id', '=', order.company_id.id)], context=context) values['acquirers'] = list(payment_obj.browse(cr, uid, acquirer_ids, context=context)) render_ctx = dict(context, submit_class='btn btn-primary', submit_txt=_('Pay Now')) for acquirer in values['acquirers']: acquirer.button = payment_obj.render( cr, SUPERUSER_ID, acquirer.id, '/', order.amount_total, order.pricelist_id.currency_id.id, values={ 'return_url': '/shop/payment/validate', 'partner_id': shipping_partner_id, 'billing_partner_id': order.partner_invoice_id.id, }, context=render_ctx) return request.website.render("website_sale.payment", values) @http.route(['/shop/payment/transaction/<int:acquirer_id>'], type='json', auth="public", website=True) def payment_transaction(self, acquirer_id): """ Json method that creates a payment.transaction, used to create a transaction when the user clicks on 'pay now' button. After having created the transaction, the event continues and the user is redirected to the acquirer website. :param int acquirer_id: id of a payment.acquirer record. If not set the user is redirected to the checkout page """ cr, uid, context = request.cr, request.uid, request.context payment_obj = request.registry.get('payment.acquirer') transaction_obj = request.registry.get('payment.transaction') order = request.website.sale_get_order(context=context) if not order or not order.order_line or acquirer_id is None: return request.redirect("/shop/checkout") assert order.partner_id.id != request.website.partner_id.id # find an already existing transaction tx = request.website.sale_get_transaction() if tx: tx_id = tx.id if tx.sale_order_id.id != order.id or tx.state in ['error', 'cancel'] or tx.acquirer_id.id != acquirer_id: tx = False tx_id = False elif tx.state == 'draft': # button cliked but no more info -> rewrite on tx or create a new one ? tx.write(dict(transaction_obj.on_change_partner_id(cr, SUPERUSER_ID, None, order.partner_id.id, context=context).get('value', {}), amount=order.amount_total)) if not tx: tx_id = transaction_obj.create(cr, SUPERUSER_ID, { 'acquirer_id': acquirer_id, 'type': 'form', 'amount': order.amount_total, 'currency_id': order.pricelist_id.currency_id.id, 'partner_id': order.partner_id.id, 'partner_country_id': order.partner_id.country_id.id, 'reference': request.env['payment.transaction'].get_next_reference(order.name), 'sale_order_id': order.id, }, context=context) request.session['sale_transaction_id'] = tx_id tx = transaction_obj.browse(cr, SUPERUSER_ID, tx_id, context=context) # update quotation request.registry['sale.order'].write( cr, SUPERUSER_ID, [order.id], { 'payment_acquirer_id': acquirer_id, 'payment_tx_id': request.session['sale_transaction_id'] }, context=context) # confirm the quotation if tx.acquirer_id.auto_confirm == 'at_pay_now': request.registry['sale.order'].action_confirm(cr, SUPERUSER_ID, [order.id], context=dict(request.context, send_email=True)) return payment_obj.render( request.cr, SUPERUSER_ID, tx.acquirer_id.id, tx.reference, order.amount_total, order.pricelist_id.currency_id.id, values={ 'return_url': '/shop/payment/validate', 'partner_id': order.partner_shipping_id.id or order.partner_invoice_id.id, 'billing_partner_id': order.partner_invoice_id.id, }, context=dict(context, submit_class='btn btn-primary', submit_txt=_('Pay Now'))) @http.route('/shop/payment/get_status/<int:sale_order_id>', type='json', auth="public", website=True) def payment_get_status(self, sale_order_id, **post): cr, uid, context = request.cr, request.uid, request.context order = request.registry['sale.order'].browse(cr, SUPERUSER_ID, sale_order_id, context=context) assert order.id == request.session.get('sale_last_order_id') values = {} flag = False if not order: values.update({'not_order': True, 'state': 'error'}) else: tx_ids = request.registry['payment.transaction'].search( cr, SUPERUSER_ID, [ '|', ('sale_order_id', '=', order.id), ('reference', '=', order.name) ], context=context) if not tx_ids: if order.amount_total: values.update({'tx_ids': False, 'state': 'error'}) else: values.update({'tx_ids': False, 'state': 'done', 'validation': None}) else: tx = request.registry['payment.transaction'].browse(cr, SUPERUSER_ID, tx_ids[0], context=context) state = tx.state flag = state == 'pending' values.update({ 'tx_ids': True, 'state': state, 'acquirer_id': tx.acquirer_id, 'validation': tx.acquirer_id.auto_confirm == 'none', 'tx_post_msg': tx.acquirer_id.post_msg or None }) return {'recall': flag, 'message': request.website._render("website_sale.order_state_message", values)} @http.route('/shop/payment/validate', type='http', auth="public", website=True) def payment_validate(self, transaction_id=None, sale_order_id=None, **post): """ Method that should be called by the server when receiving an update for a transaction. State at this point : - UDPATE ME """ cr, uid, context = request.cr, request.uid, request.context email_act = None sale_order_obj = request.registry['sale.order'] if transaction_id is None: tx = request.website.sale_get_transaction() else: tx = request.registry['payment.transaction'].browse(cr, uid, transaction_id, context=context) if sale_order_id is None: order = request.website.sale_get_order(context=context) else: order = request.registry['sale.order'].browse(cr, SUPERUSER_ID, sale_order_id, context=context) assert order.id == request.session.get('sale_last_order_id') if not order or (order.amount_total and not tx): return request.redirect('/shop') if (not order.amount_total and not tx) or tx.state in ['pending', 'done']: if (not order.amount_total and not tx): # Orders are confirmed by payment transactions, but there is none for free orders, # (e.g. free events), so confirm immediately order.with_context(dict(context, send_email=True)).action_confirm() elif tx and tx.state == 'cancel': # cancel the quotation sale_order_obj.action_cancel(cr, SUPERUSER_ID, [order.id], context=request.context) # clean context and session, then redirect to the confirmation page request.website.sale_reset(context=context) if tx and tx.state == 'draft': return request.redirect('/shop') return request.redirect('/shop/confirmation') @http.route(['/shop/confirmation'], type='http', auth="public", website=True) def payment_confirmation(self, **post): """ End of checkout process controller. Confirmation is basically seing the status of a sale.order. State at this point : - should not have any context / session info: clean them - take a sale.order id, because we request a sale.order and are not session dependant anymore """ cr, uid, context = request.cr, request.uid, request.context sale_order_id = request.session.get('sale_last_order_id') if sale_order_id: order = request.registry['sale.order'].browse(cr, SUPERUSER_ID, sale_order_id, context=context) else: return request.redirect('/shop') return request.website.render("website_sale.confirmation", {'order': order}) @http.route(['/shop/print'], type='http', auth="public", website=True) def print_saleorder(self): cr, uid, context = request.cr, SUPERUSER_ID, request.context sale_order_id = request.session.get('sale_last_order_id') if sale_order_id: pdf = request.registry['report'].get_pdf(cr, uid, [sale_order_id], 'sale.report_saleorder', data=None, context=context) pdfhttpheaders = [('Content-Type', 'application/pdf'), ('Content-Length', len(pdf))] return request.make_response(pdf, headers=pdfhttpheaders) else: return request.redirect('/shop') #------------------------------------------------------ # Edit #------------------------------------------------------ @http.route(['/shop/add_product'], type='http', auth="user", methods=['POST'], website=True) def add_product(self, name=None, category=0, **post): cr, uid, context, pool = request.cr, request.uid, request.context, request.registry if not name: name = _("New Product") product_obj = request.registry.get('product.product') product_id = product_obj.create(cr, uid, { 'name': name, 'public_categ_ids': category }, context=context) product = product_obj.browse(cr, uid, product_id, context=context) return request.redirect("/shop/product/%s?enable_editor=1" % slug(product.product_tmpl_id)) @http.route(['/shop/change_styles'], type='json', auth="public") def change_styles(self, id, style_id): product_obj = request.registry.get('product.template') product = product_obj.browse(request.cr, request.uid, id, context=request.context) remove = [] active = False style_id = int(style_id) for style in product.website_style_ids: if style.id == style_id: remove.append(style.id) active = True break style = request.registry.get('product.style').browse(request.cr, request.uid, style_id, context=request.context) if remove: product.write({'website_style_ids': [(3, rid) for rid in remove]}) if not active: product.write({'website_style_ids': [(4, style.id)]}) return not active @http.route(['/shop/change_sequence'], type='json', auth="public") def change_sequence(self, id, sequence): product_obj = request.registry.get('product.template') if sequence == "top": product_obj.set_sequence_top(request.cr, request.uid, [id], context=request.context) elif sequence == "bottom": product_obj.set_sequence_bottom(request.cr, request.uid, [id], context=request.context) elif sequence == "up": product_obj.set_sequence_up(request.cr, request.uid, [id], context=request.context) elif sequence == "down": product_obj.set_sequence_down(request.cr, request.uid, [id], context=request.context) @http.route(['/shop/change_size'], type='json', auth="public") def change_size(self, id, x, y): product_obj = request.registry.get('product.template') product = product_obj.browse(request.cr, request.uid, id, context=request.context) return product.write({'website_size_x': x, 'website_size_y': y}) def order_lines_2_google_api(self, order_lines): """ Transforms a list of order lines into a dict for google analytics """ ret = [] for line in order_lines: product = line.product_id ret.append({ 'id': line.order_id and line.order_id.id, 'sku': product.barcode or product.id, 'name': product.name or '-', 'category': product.categ_id and product.categ_id.name or '-', 'price': line.price_unit, 'quantity': line.product_uom_qty, }) return ret def order_2_return_dict(self, order): """ Returns the tracking_cart dict of the order for Google analytics basically defined to be inherited """ return { 'transaction': { 'id': order.id, 'affiliation': order.company_id.name, 'revenue': order.amount_total, 'tax': order.amount_tax, 'currency': order.currency_id.name }, 'lines': self.order_lines_2_google_api(order.order_line) } @http.route(['/shop/tracking_last_order'], type='json', auth="public") def tracking_cart(self, **post): """ return data about order in JSON needed for google analytics""" cr, context = request.cr, request.context ret = {} sale_order_id = request.session.get('sale_last_order_id') if sale_order_id: order = request.registry['sale.order'].browse(cr, SUPERUSER_ID, sale_order_id, context=context) ret = self.order_2_return_dict(order) return ret @http.route(['/shop/get_unit_price'], type='json', auth="public", methods=['POST'], website=True) def get_unit_price(self, product_ids, add_qty, use_order_pricelist=False, **kw): cr, uid, context, pool = request.cr, request.uid, request.context, request.registry products = pool['product.product'].browse(cr, uid, product_ids, context=context) partner = pool['res.users'].browse(cr, uid, uid, context=context).partner_id pricelist_id = request.website.get_current_pricelist(context=context).id prices = pool['product.pricelist'].price_rule_get_multi(cr, uid, [pricelist_id], [(product, add_qty, partner) for product in products], context=context) return {product_id: prices[product_id][pricelist_id][0] for product_id in product_ids}
gpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 646, 2050, 199, 646, 10380, 199, 199, 504, 5166, 492, 12824, 63, 998, 199, 504, 5166, 492, 1455, 199, 504, 5166, 492, 7249, 199, 504, 5166, 14, 1014, 492, 1056, 199, 504, 5166, 14, 2537, 14, 5275, 492, 485, 199, 504, 5166, 14, 10788, 14, 7360, 14, 992, 14, 7360, 492, 8889, 199, 199, 7701, 39, 275, 3388, 327, 32411, 3492, 10331, 199, 48, 3311, 275, 841, 221, 327, 32411, 3492, 15231, 199, 199, 63, 2921, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 533, 1817, 63, 3357, 8, 785, 304, 272, 347, 636, 826, 721, 277, 304, 267, 291, 14, 1224, 275, 1052, 339, 347, 485, 1074, 63, 2778, 8, 277, 12, 2086, 88, 12, 2086, 89, 12, 308, 565, 476, 12, 1568, 89, 304, 267, 522, 275, 715, 267, 367, 612, 315, 1425, 8, 890, 89, 304, 288, 367, 671, 315, 1425, 8, 5946, 476, 304, 355, 340, 2086, 88, 11, 88, 8119, 48, 3311, 26, 490, 522, 275, 756, 490, 2059, 355, 1962, 275, 291, 14, 1224, 14, 5486, 8, 1712, 89, 11, 89, 12, 5009, 355, 340, 1962, 14, 5486, 8, 32405, 11, 88, 9, 365, 440, 488, 26, 490, 522, 275, 756, 490, 2059, 288, 367, 671, 315, 1425, 8, 48, 3311, 304, 355, 291, 14, 1224, 59, 1712, 89, 11, 89, 1055, 5486, 8, 88, 12, 488, 9, 267, 372, 522, 339, 347, 2112, 8, 277, 12, 7585, 12, 299, 4198, 29, 7701, 39, 304, 267, 327, 8354, 7585, 12266, 641, 314, 6068, 267, 1748, 1712, 275, 378, 267, 1478, 275, 378, 267, 1390, 89, 275, 378, 267, 367, 299, 315, 7585, 26, 288, 671, 275, 1748, 8, 988, 8, 80, 14, 7360, 63, 890, 63, 88, 12, 413, 395, 510, 3311, 9, 288, 612, 275, 1748, 8, 988, 8, 80, 14, 7360, 63, 890, 63, 89, 12, 413, 395, 510, 3311, 9, 288, 340, 1478, 8119, 802, 71, 26, 355, 671, 275, 612, 275, 413, 953, 2086, 275, 1748, 1712, 288, 1830, 440, 291, 423, 1074, 63, 2778, 8, 1712, 5, 48, 3311, 12, 2086, 15, 48, 3311, 12, 671, 12, 612, 304, 355, 2086, 847, 413, 288, 327, 340, 7829, 270, 7585, 334, 1080, 3388, 9, 436, 314, 2061, 1004, 365, 2615, 334, 48, 3311, 7585, 315, 652, 395, 2059, 288, 327, 334, 1712, 435, 413, 14, 16, 9, 1182, 510, 3311, 365, 314, 1004, 2382, 314, 3336, 3955, 506, 11788, 288, 327, 1390, 89, 365, 314, 1329, 402, 3411, 2385, 288, 327, 435, 413, 14, 16, 365, 2952, 2086, 22241, 737, 378, 12, 12850, 2086, 3388, 365, 5965, 314, 7829, 270, 1853, 288, 327, 436, 370, 3542, 2366, 370, 440, 6168, 314, 4629, 3439, 288, 340, 1478, 2356, 299, 4198, 436, 3666, 1712, 435, 413, 14, 16, 9, 1182, 510, 3311, 9, 690, 1390, 89, 26, 355, 2059, 953, 340, 671, 389, 17, 436, 612, 389, 17, 26, 257, 327, 3486, 25332, 367, 11952, 13712, 355, 1748, 1712, 275, 2086, 15, 48, 3311, 953, 367, 612, 18, 315, 1425, 8, 89, 304, 355, 367, 671, 18, 315, 1425, 8, 88, 304, 490, 291, 14, 1224, 7528, 1712, 15, 48, 3311, 6393, 89, 18, 1527, 8, 1712, 5, 48, 3311, 6393, 88, 18, 61, 275, 756, 288, 291, 14, 1224, 59, 1712, 15, 48, 3311, 1527, 1712, 5, 48, 3311, 61, 275, 469, 355, 283, 2558, 356, 299, 12, 283, 88, 356, 88, 12, 283, 89, 356, 612, 12, 355, 283, 533, 356, 298, 3680, 904, 8, 1130, 8, 2734, 671, 26, 671, 14, 1360, 63, 533, 503, 3260, 299, 14, 7360, 63, 2487, 63, 1580, 430, 288, 789, 288, 340, 1478, 12932, 802, 71, 26, 355, 1390, 89, 29, 988, 8, 988, 89, 12, 89, 15622, 1712, 15, 48, 3311, 430, 288, 1478, 847, 413, 398, 327, 9701, 1817, 7182, 370, 4163, 4839, 267, 4730, 275, 291, 14, 1224, 14, 1744, 342, 267, 4730, 14, 3191, 342, 267, 4730, 275, 2341, 8, 2734, 671, 26, 671, 59, 17, 467, 4730, 9, 267, 367, 1048, 315, 1425, 8, 552, 8, 3838, 2298, 288, 8850, 275, 4730, 59, 761, 1055, 1744, 342, 288, 8850, 14, 3191, 342, 288, 671, 847, 822, 8, 4574, 9, 288, 4730, 59, 761, 61, 275, 359, 67, 367, 286, 315, 2341, 8, 2734, 671, 26, 671, 59, 17, 467, 8850, 9, 340, 286, 1137, 756, 61, 398, 372, 4730, 398, 327, 3254, 4215, 543, 1324, 730, 8752, 421, 199, 533, 8133, 2632, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 931, 4581, 1011, 589, 304, 267, 291, 14, 515, 275, 931, 267, 291, 14, 589, 275, 1249, 339, 347, 636, 1250, 721, 277, 12, 931, 29, 403, 12, 1011, 829, 304, 267, 340, 440, 931, 26, 288, 931, 275, 291, 14, 515, 267, 367, 1022, 12, 86, 315, 291, 14, 589, 14, 1744, 837, 288, 4775, 14, 5486, 8, 75, 12, 86, 9, 267, 634, 275, 942, 267, 367, 1022, 12, 86, 315, 4775, 14, 1744, 837, 288, 340, 373, 26, 355, 340, 1228, 8, 86, 12, 769, 9, 503, 1228, 8, 86, 12, 663, 304, 490, 634, 14, 740, 8, 17719, 14, 633, 63, 2143, 7694, 75, 12, 73, 9, 367, 284, 315, 373, 2459, 355, 587, 26, 490, 634, 14, 740, 8, 17719, 14, 633, 63, 2143, 7694, 75, 12, 86, 19563, 267, 340, 634, 26, 288, 931, 847, 15539, 435, 7673, 1370, 904, 8, 76, 9, 267, 372, 931, 421, 199, 318, 664, 63, 17385, 837, 272, 372, 1056, 14, 7360, 14, 362, 63, 1818, 63, 17385, 342, 272, 340, 440, 25162, 26, 267, 485, 2921, 14, 705, 360, 4874, 370, 2342, 25162, 367, 5854, 2071, 83, 2, 334, 344, 450, 83, 3196, 5854, 14, 354, 12, 5854, 14, 344, 9, 199, 199, 533, 10691, 63, 8515, 8, 1014, 14, 7506, 304, 339, 347, 664, 63, 17385, 8, 277, 304, 267, 372, 664, 63, 17385, 342, 339, 347, 664, 63, 3215, 63, 585, 63, 1580, 8, 277, 12, 3336, 304, 267, 2467, 12, 1747, 12, 1067, 12, 4203, 275, 1056, 14, 1556, 12, 1056, 14, 1535, 12, 1056, 14, 1100, 12, 1056, 14, 5189, 267, 9952, 63 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 646, 2050, 199, 646, 10380, 199, 199, 504, 5166, 492, 12824, 63, 998, 199, 504, 5166, 492, 1455, 199, 504, 5166, 492, 7249, 199, 504, 5166, 14, 1014, 492, 1056, 199, 504, 5166, 14, 2537, 14, 5275, 492, 485, 199, 504, 5166, 14, 10788, 14, 7360, 14, 992, 14, 7360, 492, 8889, 199, 199, 7701, 39, 275, 3388, 327, 32411, 3492, 10331, 199, 48, 3311, 275, 841, 221, 327, 32411, 3492, 15231, 199, 199, 63, 2921, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 533, 1817, 63, 3357, 8, 785, 304, 272, 347, 636, 826, 721, 277, 304, 267, 291, 14, 1224, 275, 1052, 339, 347, 485, 1074, 63, 2778, 8, 277, 12, 2086, 88, 12, 2086, 89, 12, 308, 565, 476, 12, 1568, 89, 304, 267, 522, 275, 715, 267, 367, 612, 315, 1425, 8, 890, 89, 304, 288, 367, 671, 315, 1425, 8, 5946, 476, 304, 355, 340, 2086, 88, 11, 88, 8119, 48, 3311, 26, 490, 522, 275, 756, 490, 2059, 355, 1962, 275, 291, 14, 1224, 14, 5486, 8, 1712, 89, 11, 89, 12, 5009, 355, 340, 1962, 14, 5486, 8, 32405, 11, 88, 9, 365, 440, 488, 26, 490, 522, 275, 756, 490, 2059, 288, 367, 671, 315, 1425, 8, 48, 3311, 304, 355, 291, 14, 1224, 59, 1712, 89, 11, 89, 1055, 5486, 8, 88, 12, 488, 9, 267, 372, 522, 339, 347, 2112, 8, 277, 12, 7585, 12, 299, 4198, 29, 7701, 39, 304, 267, 327, 8354, 7585, 12266, 641, 314, 6068, 267, 1748, 1712, 275, 378, 267, 1478, 275, 378, 267, 1390, 89, 275, 378, 267, 367, 299, 315, 7585, 26, 288, 671, 275, 1748, 8, 988, 8, 80, 14, 7360, 63, 890, 63, 88, 12, 413, 395, 510, 3311, 9, 288, 612, 275, 1748, 8, 988, 8, 80, 14, 7360, 63, 890, 63, 89, 12, 413, 395, 510, 3311, 9, 288, 340, 1478, 8119, 802, 71, 26, 355, 671, 275, 612, 275, 413, 953, 2086, 275, 1748, 1712, 288, 1830, 440, 291, 423, 1074, 63, 2778, 8, 1712, 5, 48, 3311, 12, 2086, 15, 48, 3311, 12, 671, 12, 612, 304, 355, 2086, 847, 413, 288, 327, 340, 7829, 270, 7585, 334, 1080, 3388, 9, 436, 314, 2061, 1004, 365, 2615, 334, 48, 3311, 7585, 315, 652, 395, 2059, 288, 327, 334, 1712, 435, 413, 14, 16, 9, 1182, 510, 3311, 365, 314, 1004, 2382, 314, 3336, 3955, 506, 11788, 288, 327, 1390, 89, 365, 314, 1329, 402, 3411, 2385, 288, 327, 435, 413, 14, 16, 365, 2952, 2086, 22241, 737, 378, 12, 12850, 2086, 3388, 365, 5965, 314, 7829, 270, 1853, 288, 327, 436, 370, 3542, 2366, 370, 440, 6168, 314, 4629, 3439, 288, 340, 1478, 2356, 299, 4198, 436, 3666, 1712, 435, 413, 14, 16, 9, 1182, 510, 3311, 9, 690, 1390, 89, 26, 355, 2059, 953, 340, 671, 389, 17, 436, 612, 389, 17, 26, 257, 327, 3486, 25332, 367, 11952, 13712, 355, 1748, 1712, 275, 2086, 15, 48, 3311, 953, 367, 612, 18, 315, 1425, 8, 89, 304, 355, 367, 671, 18, 315, 1425, 8, 88, 304, 490, 291, 14, 1224, 7528, 1712, 15, 48, 3311, 6393, 89, 18, 1527, 8, 1712, 5, 48, 3311, 6393, 88, 18, 61, 275, 756, 288, 291, 14, 1224, 59, 1712, 15, 48, 3311, 1527, 1712, 5, 48, 3311, 61, 275, 469, 355, 283, 2558, 356, 299, 12, 283, 88, 356, 88, 12, 283, 89, 356, 612, 12, 355, 283, 533, 356, 298, 3680, 904, 8, 1130, 8, 2734, 671, 26, 671, 14, 1360, 63, 533, 503, 3260, 299, 14, 7360, 63, 2487, 63, 1580, 430, 288, 789, 288, 340, 1478, 12932, 802, 71, 26, 355, 1390, 89, 29, 988, 8, 988, 89, 12, 89, 15622, 1712, 15, 48, 3311, 430, 288, 1478, 847, 413, 398, 327, 9701, 1817, 7182, 370, 4163, 4839, 267, 4730, 275, 291, 14, 1224, 14, 1744, 342, 267, 4730, 14, 3191, 342, 267, 4730, 275, 2341, 8, 2734, 671, 26, 671, 59, 17, 467, 4730, 9, 267, 367, 1048, 315, 1425, 8, 552, 8, 3838, 2298, 288, 8850, 275, 4730, 59, 761, 1055, 1744, 342, 288, 8850, 14, 3191, 342, 288, 671, 847, 822, 8, 4574, 9, 288, 4730, 59, 761, 61, 275, 359, 67, 367, 286, 315, 2341, 8, 2734, 671, 26, 671, 59, 17, 467, 8850, 9, 340, 286, 1137, 756, 61, 398, 372, 4730, 398, 327, 3254, 4215, 543, 1324, 730, 8752, 421, 199, 533, 8133, 2632, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 931, 4581, 1011, 589, 304, 267, 291, 14, 515, 275, 931, 267, 291, 14, 589, 275, 1249, 339, 347, 636, 1250, 721, 277, 12, 931, 29, 403, 12, 1011, 829, 304, 267, 340, 440, 931, 26, 288, 931, 275, 291, 14, 515, 267, 367, 1022, 12, 86, 315, 291, 14, 589, 14, 1744, 837, 288, 4775, 14, 5486, 8, 75, 12, 86, 9, 267, 634, 275, 942, 267, 367, 1022, 12, 86, 315, 4775, 14, 1744, 837, 288, 340, 373, 26, 355, 340, 1228, 8, 86, 12, 769, 9, 503, 1228, 8, 86, 12, 663, 304, 490, 634, 14, 740, 8, 17719, 14, 633, 63, 2143, 7694, 75, 12, 73, 9, 367, 284, 315, 373, 2459, 355, 587, 26, 490, 634, 14, 740, 8, 17719, 14, 633, 63, 2143, 7694, 75, 12, 86, 19563, 267, 340, 634, 26, 288, 931, 847, 15539, 435, 7673, 1370, 904, 8, 76, 9, 267, 372, 931, 421, 199, 318, 664, 63, 17385, 837, 272, 372, 1056, 14, 7360, 14, 362, 63, 1818, 63, 17385, 342, 272, 340, 440, 25162, 26, 267, 485, 2921, 14, 705, 360, 4874, 370, 2342, 25162, 367, 5854, 2071, 83, 2, 334, 344, 450, 83, 3196, 5854, 14, 354, 12, 5854, 14, 344, 9, 199, 199, 533, 10691, 63, 8515, 8, 1014, 14, 7506, 304, 339, 347, 664, 63, 17385, 8, 277, 304, 267, 372, 664, 63, 17385, 342, 339, 347, 664, 63, 3215, 63, 585, 63, 1580, 8, 277, 12, 3336, 304, 267, 2467, 12, 1747, 12, 1067, 12, 4203, 275, 1056, 14, 1556, 12, 1056, 14, 1535, 12, 1056, 14, 1100, 12, 1056, 14, 5189, 267, 9952, 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, 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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 ]
pasqualguerrero/django
django/db/backends/utils.py
430
6689
from __future__ import unicode_literals import datetime import decimal import hashlib import logging from time import time from django.conf import settings from django.utils.encoding import force_bytes from django.utils.timezone import utc logger = logging.getLogger('django.db.backends') class CursorWrapper(object): def __init__(self, cursor, db): self.cursor = cursor self.db = db WRAP_ERROR_ATTRS = frozenset(['fetchone', 'fetchmany', 'fetchall', 'nextset']) def __getattr__(self, attr): cursor_attr = getattr(self.cursor, attr) if attr in CursorWrapper.WRAP_ERROR_ATTRS: return self.db.wrap_database_errors(cursor_attr) else: return cursor_attr def __iter__(self): with self.db.wrap_database_errors: for item in self.cursor: yield item def __enter__(self): return self def __exit__(self, type, value, traceback): # Ticket #17671 - Close instead of passing thru to avoid backend # specific behavior. Catch errors liberally because errors in cleanup # code aren't useful. try: self.close() except self.db.Database.Error: pass # The following methods cannot be implemented in __getattr__, because the # code must run when the method is invoked, not just when it is accessed. def callproc(self, procname, params=None): self.db.validate_no_broken_transaction() with self.db.wrap_database_errors: if params is None: return self.cursor.callproc(procname) else: return self.cursor.callproc(procname, params) def execute(self, sql, params=None): self.db.validate_no_broken_transaction() with self.db.wrap_database_errors: if params is None: return self.cursor.execute(sql) else: return self.cursor.execute(sql, params) def executemany(self, sql, param_list): self.db.validate_no_broken_transaction() with self.db.wrap_database_errors: return self.cursor.executemany(sql, param_list) class CursorDebugWrapper(CursorWrapper): # XXX callproc isn't instrumented at this time. def execute(self, sql, params=None): start = time() try: return super(CursorDebugWrapper, self).execute(sql, params) finally: stop = time() duration = stop - start sql = self.db.ops.last_executed_query(self.cursor, sql, params) self.db.queries_log.append({ 'sql': sql, 'time': "%.3f" % duration, }) logger.debug('(%.3f) %s; args=%s' % (duration, sql, params), extra={'duration': duration, 'sql': sql, 'params': params} ) def executemany(self, sql, param_list): start = time() try: return super(CursorDebugWrapper, self).executemany(sql, param_list) finally: stop = time() duration = stop - start try: times = len(param_list) except TypeError: # param_list could be an iterator times = '?' self.db.queries_log.append({ 'sql': '%s times: %s' % (times, sql), 'time': "%.3f" % duration, }) logger.debug('(%.3f) %s; args=%s' % (duration, sql, param_list), extra={'duration': duration, 'sql': sql, 'params': param_list} ) ############################################### # Converters from database (string) to Python # ############################################### def typecast_date(s): return datetime.date(*map(int, s.split('-'))) if s else None # returns None if s is null def typecast_time(s): # does NOT store time zone information if not s: return None hour, minutes, seconds = s.split(':') if '.' in seconds: # check whether seconds have a fractional part seconds, microseconds = seconds.split('.') else: microseconds = '0' return datetime.time(int(hour), int(minutes), int(seconds), int(float('.' + microseconds) * 1000000)) def typecast_timestamp(s): # does NOT store time zone information # "2005-07-29 15:48:00.590358-05" # "2005-07-29 09:56:00-05" if not s: return None if ' ' not in s: return typecast_date(s) d, t = s.split() # Extract timezone information, if it exists. Currently we just throw # it away, but in the future we may make use of it. if '-' in t: t, tz = t.split('-', 1) tz = '-' + tz elif '+' in t: t, tz = t.split('+', 1) tz = '+' + tz else: tz = '' dates = d.split('-') times = t.split(':') seconds = times[2] if '.' in seconds: # check whether seconds have a fractional part seconds, microseconds = seconds.split('.') else: microseconds = '0' tzinfo = utc if settings.USE_TZ else None return datetime.datetime(int(dates[0]), int(dates[1]), int(dates[2]), int(times[0]), int(times[1]), int(seconds), int((microseconds + '000000')[:6]), tzinfo) def typecast_decimal(s): if s is None or s == '': return None return decimal.Decimal(s) ############################################### # Converters from Python to database (string) # ############################################### def rev_typecast_decimal(d): if d is None: return None return str(d) def truncate_name(name, length=None, hash_len=4): """Shortens a string to a repeatable mangled version with the given length. """ if length is None or len(name) <= length: return name hsh = hashlib.md5(force_bytes(name)).hexdigest()[:hash_len] return '%s%s' % (name[:length - hash_len], hsh) def format_number(value, max_digits, decimal_places): """ Formats a number into a string with the requisite number of digits and decimal places. """ if value is None: return None if isinstance(value, decimal.Decimal): context = decimal.getcontext().copy() if max_digits is not None: context.prec = max_digits if decimal_places is not None: value = value.quantize(decimal.Decimal(".1") ** decimal_places, context=context) else: context.traps[decimal.Rounded] = 1 value = context.create_decimal(value) return "{:f}".format(value) if decimal_places is not None: return "%.*f" % (decimal_places, value) return "{:f}".format(value)
bsd-3-clause
[ 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 2197, 199, 646, 6107, 199, 646, 8337, 199, 646, 2050, 199, 504, 900, 492, 900, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 1208, 14, 2991, 492, 3542, 63, 2394, 199, 504, 1639, 14, 1208, 14, 7145, 492, 19314, 199, 199, 2921, 275, 2050, 14, 5572, 360, 1176, 14, 697, 14, 7765, 358, 421, 199, 533, 20385, 4590, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 3920, 12, 1592, 304, 267, 291, 14, 3937, 275, 3920, 267, 291, 14, 697, 275, 1592, 339, 16573, 1282, 63, 3170, 63, 27356, 275, 9522, 2941, 11591, 297, 283, 3535, 3479, 297, 283, 10174, 297, 283, 2184, 409, 1105, 339, 347, 636, 5675, 721, 277, 12, 1921, 304, 267, 3920, 63, 962, 275, 2519, 8, 277, 14, 3937, 12, 1921, 9, 267, 340, 1921, 315, 20385, 4590, 14, 23824, 63, 3170, 63, 27356, 26, 288, 372, 291, 14, 697, 14, 3823, 63, 4659, 63, 2550, 8, 3937, 63, 962, 9, 267, 587, 26, 288, 372, 3920, 63, 962, 339, 347, 636, 1661, 721, 277, 304, 267, 543, 291, 14, 697, 14, 3823, 63, 4659, 63, 2550, 26, 288, 367, 1242, 315, 291, 14, 3937, 26, 355, 1995, 1242, 339, 347, 636, 4200, 721, 277, 304, 267, 372, 291, 339, 347, 636, 2224, 721, 277, 12, 730, 12, 574, 12, 5190, 304, 267, 327, 21932, 327, 1196, 23772, 446, 15524, 3140, 402, 9476, 294, 6558, 370, 5126, 4865, 267, 327, 2488, 5953, 14, 32754, 2552, 1212, 605, 1183, 2952, 2552, 315, 9058, 267, 327, 1233, 10621, 1133, 2997, 14, 267, 862, 26, 288, 291, 14, 1600, 342, 267, 871, 291, 14, 697, 14, 7243, 14, 547, 26, 288, 986, 339, 327, 710, 2569, 3102, 3913, 506, 6366, 315, 636, 5675, 3108, 2952, 314, 272, 327, 1233, 1471, 1255, 1380, 314, 1083, 365, 10302, 12, 440, 2951, 1380, 652, 365, 13810, 14, 339, 347, 1240, 4687, 8, 277, 12, 6499, 354, 12, 1862, 29, 403, 304, 267, 291, 14, 697, 14, 3502, 63, 889, 63, 15697, 63, 5945, 342, 267, 543, 291, 14, 697, 14, 3823, 63, 4659, 63, 2550, 26, 288, 340, 1862, 365, 488, 26, 355, 372, 291, 14, 3937, 14, 1250, 4687, 8, 4687, 354, 9, 288, 587, 26, 355, 372, 291, 14, 3937, 14, 1250, 4687, 8, 4687, 354, 12, 1862, 9, 339, 347, 5341, 8, 277, 12, 3875, 12, 1862, 29, 403, 304, 267, 291, 14, 697, 14, 3502, 63, 889, 63, 15697, 63, 5945, 342, 267, 543, 291, 14, 697, 14, 3823, 63, 4659, 63, 2550, 26, 288, 340, 1862, 365, 488, 26, 355, 372, 291, 14, 3937, 14, 2526, 8, 3009, 9, 288, 587, 26, 355, 372, 291, 14, 3937, 14, 2526, 8, 3009, 12, 1862, 9, 339, 347, 2146, 25450, 8, 277, 12, 3875, 12, 1215, 63, 513, 304, 267, 291, 14, 697, 14, 3502, 63, 889, 63, 15697, 63, 5945, 342, 267, 543, 291, 14, 697, 14, 3823, 63, 4659, 63, 2550, 26, 288, 372, 291, 14, 3937, 14, 31162, 8, 3009, 12, 1215, 63, 513, 9, 421, 199, 533, 20385, 7084, 4590, 8, 8993, 4590, 304, 339, 327, 5787, 1240, 4687, 5712, 1133, 18885, 12546, 737, 642, 900, 14, 339, 347, 5341, 8, 277, 12, 3875, 12, 1862, 29, 403, 304, 267, 1343, 275, 900, 342, 267, 862, 26, 288, 372, 1613, 8, 8993, 7084, 4590, 12, 291, 680, 2526, 8, 3009, 12, 1862, 9, 267, 3753, 26, 288, 3631, 275, 900, 342, 288, 7373, 275, 3631, 446, 1343, 288, 3875, 275, 291, 14, 697, 14, 1483, 14, 2019, 63, 22564, 63, 1131, 8, 277, 14, 3937, 12, 3875, 12, 1862, 9, 288, 291, 14, 697, 14, 10590, 63, 793, 14, 740, 2561, 355, 283, 3009, 356, 3875, 12, 355, 283, 521, 356, 31681, 19, 70, 2, 450, 7373, 12, 288, 3828, 288, 2512, 14, 1757, 360, 4042, 14, 19, 70, 9, 450, 83, 27, 1249, 2458, 83, 7, 450, 334, 5553, 12, 3875, 12, 1862, 395, 355, 2402, 3713, 5553, 356, 7373, 12, 283, 3009, 356, 3875, 12, 283, 1162, 356, 1862, 93, 288, 776, 339, 347, 2146, 25450, 8, 277, 12, 3875, 12, 1215, 63, 513, 304, 267, 1343, 275, 900, 342, 267, 862, 26, 288, 372, 1613, 8, 8993, 7084, 4590, 12, 291, 680, 31162, 8, 3009, 12, 1215, 63, 513, 9, 267, 3753, 26, 288, 3631, 275, 900, 342, 288, 7373, 275, 3631, 446, 1343, 288, 862, 26, 355, 5431, 275, 822, 8, 635, 63, 513, 9, 288, 871, 3146, 26, 3698, 327, 1215, 63, 513, 4293, 506, 376, 6122, 355, 5431, 275, 15539, 288, 291, 14, 697, 14, 10590, 63, 793, 14, 740, 2561, 355, 283, 3009, 356, 1543, 83, 5431, 26, 450, 83, 7, 450, 334, 4508, 12, 3875, 395, 355, 283, 521, 356, 31681, 19, 70, 2, 450, 7373, 12, 288, 3828, 288, 2512, 14, 1757, 360, 4042, 14, 19, 70, 9, 450, 83, 27, 1249, 2458, 83, 7, 450, 334, 5553, 12, 3875, 12, 1215, 63, 513, 395, 355, 2402, 3713, 5553, 356, 7373, 12, 283, 3009, 356, 3875, 12, 283, 1162, 356, 1215, 63, 513, 93, 288, 776, 421, 199, 26634, 14776, 199, 3, 11801, 878, 687, 3050, 334, 875, 9, 370, 2018, 327, 199, 26634, 14776, 199, 199, 318, 730, 2931, 63, 602, 8, 83, 304, 272, 372, 2197, 14, 602, 2031, 1130, 8, 442, 12, 308, 14, 1294, 3654, 7058, 340, 308, 587, 488, 221, 327, 2529, 488, 340, 308, 365, 2973, 421, 199, 318, 730, 2931, 63, 521, 8, 83, 304, 221, 327, 1630, 2845, 3877, 900, 5718, 2556, 272, 340, 440, 308, 26, 267, 372, 488, 272, 6925, 12, 9395, 12, 4696, 275, 308, 14, 1294, 11633, 272, 340, 7815, 315, 4696, 26, 221, 327, 1104, 3775, 4696, 1172, 282, 27487, 1777, 267, 4696, 12, 21574, 275, 4696, 14, 1294, 7563, 272, 587, 26, 267, 21574, 275, 283, 16, 7, 272, 372, 2197, 14, 521, 8, 442, 8, 5180, 395, 1109, 8, 10430, 395, 1109, 8, 4515, 395, 1109, 8, 1609, 360, 3530, 435, 21574, 9, 627, 19492, 430, 421, 199, 318, 730, 2931, 63, 3954, 8, 83, 304, 221 ]
[ 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 2197, 199, 646, 6107, 199, 646, 8337, 199, 646, 2050, 199, 504, 900, 492, 900, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 1208, 14, 2991, 492, 3542, 63, 2394, 199, 504, 1639, 14, 1208, 14, 7145, 492, 19314, 199, 199, 2921, 275, 2050, 14, 5572, 360, 1176, 14, 697, 14, 7765, 358, 421, 199, 533, 20385, 4590, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 3920, 12, 1592, 304, 267, 291, 14, 3937, 275, 3920, 267, 291, 14, 697, 275, 1592, 339, 16573, 1282, 63, 3170, 63, 27356, 275, 9522, 2941, 11591, 297, 283, 3535, 3479, 297, 283, 10174, 297, 283, 2184, 409, 1105, 339, 347, 636, 5675, 721, 277, 12, 1921, 304, 267, 3920, 63, 962, 275, 2519, 8, 277, 14, 3937, 12, 1921, 9, 267, 340, 1921, 315, 20385, 4590, 14, 23824, 63, 3170, 63, 27356, 26, 288, 372, 291, 14, 697, 14, 3823, 63, 4659, 63, 2550, 8, 3937, 63, 962, 9, 267, 587, 26, 288, 372, 3920, 63, 962, 339, 347, 636, 1661, 721, 277, 304, 267, 543, 291, 14, 697, 14, 3823, 63, 4659, 63, 2550, 26, 288, 367, 1242, 315, 291, 14, 3937, 26, 355, 1995, 1242, 339, 347, 636, 4200, 721, 277, 304, 267, 372, 291, 339, 347, 636, 2224, 721, 277, 12, 730, 12, 574, 12, 5190, 304, 267, 327, 21932, 327, 1196, 23772, 446, 15524, 3140, 402, 9476, 294, 6558, 370, 5126, 4865, 267, 327, 2488, 5953, 14, 32754, 2552, 1212, 605, 1183, 2952, 2552, 315, 9058, 267, 327, 1233, 10621, 1133, 2997, 14, 267, 862, 26, 288, 291, 14, 1600, 342, 267, 871, 291, 14, 697, 14, 7243, 14, 547, 26, 288, 986, 339, 327, 710, 2569, 3102, 3913, 506, 6366, 315, 636, 5675, 3108, 2952, 314, 272, 327, 1233, 1471, 1255, 1380, 314, 1083, 365, 10302, 12, 440, 2951, 1380, 652, 365, 13810, 14, 339, 347, 1240, 4687, 8, 277, 12, 6499, 354, 12, 1862, 29, 403, 304, 267, 291, 14, 697, 14, 3502, 63, 889, 63, 15697, 63, 5945, 342, 267, 543, 291, 14, 697, 14, 3823, 63, 4659, 63, 2550, 26, 288, 340, 1862, 365, 488, 26, 355, 372, 291, 14, 3937, 14, 1250, 4687, 8, 4687, 354, 9, 288, 587, 26, 355, 372, 291, 14, 3937, 14, 1250, 4687, 8, 4687, 354, 12, 1862, 9, 339, 347, 5341, 8, 277, 12, 3875, 12, 1862, 29, 403, 304, 267, 291, 14, 697, 14, 3502, 63, 889, 63, 15697, 63, 5945, 342, 267, 543, 291, 14, 697, 14, 3823, 63, 4659, 63, 2550, 26, 288, 340, 1862, 365, 488, 26, 355, 372, 291, 14, 3937, 14, 2526, 8, 3009, 9, 288, 587, 26, 355, 372, 291, 14, 3937, 14, 2526, 8, 3009, 12, 1862, 9, 339, 347, 2146, 25450, 8, 277, 12, 3875, 12, 1215, 63, 513, 304, 267, 291, 14, 697, 14, 3502, 63, 889, 63, 15697, 63, 5945, 342, 267, 543, 291, 14, 697, 14, 3823, 63, 4659, 63, 2550, 26, 288, 372, 291, 14, 3937, 14, 31162, 8, 3009, 12, 1215, 63, 513, 9, 421, 199, 533, 20385, 7084, 4590, 8, 8993, 4590, 304, 339, 327, 5787, 1240, 4687, 5712, 1133, 18885, 12546, 737, 642, 900, 14, 339, 347, 5341, 8, 277, 12, 3875, 12, 1862, 29, 403, 304, 267, 1343, 275, 900, 342, 267, 862, 26, 288, 372, 1613, 8, 8993, 7084, 4590, 12, 291, 680, 2526, 8, 3009, 12, 1862, 9, 267, 3753, 26, 288, 3631, 275, 900, 342, 288, 7373, 275, 3631, 446, 1343, 288, 3875, 275, 291, 14, 697, 14, 1483, 14, 2019, 63, 22564, 63, 1131, 8, 277, 14, 3937, 12, 3875, 12, 1862, 9, 288, 291, 14, 697, 14, 10590, 63, 793, 14, 740, 2561, 355, 283, 3009, 356, 3875, 12, 355, 283, 521, 356, 31681, 19, 70, 2, 450, 7373, 12, 288, 3828, 288, 2512, 14, 1757, 360, 4042, 14, 19, 70, 9, 450, 83, 27, 1249, 2458, 83, 7, 450, 334, 5553, 12, 3875, 12, 1862, 395, 355, 2402, 3713, 5553, 356, 7373, 12, 283, 3009, 356, 3875, 12, 283, 1162, 356, 1862, 93, 288, 776, 339, 347, 2146, 25450, 8, 277, 12, 3875, 12, 1215, 63, 513, 304, 267, 1343, 275, 900, 342, 267, 862, 26, 288, 372, 1613, 8, 8993, 7084, 4590, 12, 291, 680, 31162, 8, 3009, 12, 1215, 63, 513, 9, 267, 3753, 26, 288, 3631, 275, 900, 342, 288, 7373, 275, 3631, 446, 1343, 288, 862, 26, 355, 5431, 275, 822, 8, 635, 63, 513, 9, 288, 871, 3146, 26, 3698, 327, 1215, 63, 513, 4293, 506, 376, 6122, 355, 5431, 275, 15539, 288, 291, 14, 697, 14, 10590, 63, 793, 14, 740, 2561, 355, 283, 3009, 356, 1543, 83, 5431, 26, 450, 83, 7, 450, 334, 4508, 12, 3875, 395, 355, 283, 521, 356, 31681, 19, 70, 2, 450, 7373, 12, 288, 3828, 288, 2512, 14, 1757, 360, 4042, 14, 19, 70, 9, 450, 83, 27, 1249, 2458, 83, 7, 450, 334, 5553, 12, 3875, 12, 1215, 63, 513, 395, 355, 2402, 3713, 5553, 356, 7373, 12, 283, 3009, 356, 3875, 12, 283, 1162, 356, 1215, 63, 513, 93, 288, 776, 421, 199, 26634, 14776, 199, 3, 11801, 878, 687, 3050, 334, 875, 9, 370, 2018, 327, 199, 26634, 14776, 199, 199, 318, 730, 2931, 63, 602, 8, 83, 304, 272, 372, 2197, 14, 602, 2031, 1130, 8, 442, 12, 308, 14, 1294, 3654, 7058, 340, 308, 587, 488, 221, 327, 2529, 488, 340, 308, 365, 2973, 421, 199, 318, 730, 2931, 63, 521, 8, 83, 304, 221, 327, 1630, 2845, 3877, 900, 5718, 2556, 272, 340, 440, 308, 26, 267, 372, 488, 272, 6925, 12, 9395, 12, 4696, 275, 308, 14, 1294, 11633, 272, 340, 7815, 315, 4696, 26, 221, 327, 1104, 3775, 4696, 1172, 282, 27487, 1777, 267, 4696, 12, 21574, 275, 4696, 14, 1294, 7563, 272, 587, 26, 267, 21574, 275, 283, 16, 7, 272, 372, 2197, 14, 521, 8, 442, 8, 5180, 395, 1109, 8, 10430, 395, 1109, 8, 4515, 395, 1109, 8, 1609, 360, 3530, 435, 21574, 9, 627, 19492, 430, 421, 199, 318, 730, 2931, 63, 3954, 8, 83, 304, 221, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Boyang--Li/mavlink
pymavlink/generator/mavgen_c.py
20
21028
#!/usr/bin/env python ''' parse a MAVLink protocol XML file and generate a C implementation Copyright Andrew Tridgell 2011 Released under GNU GPL version 3 or later ''' import sys, textwrap, os, time from . import mavparse, mavtemplate t = mavtemplate.MAVTemplate() def generate_version_h(directory, xml): '''generate version.h''' f = open(os.path.join(directory, "version.h"), mode='w') t.write(f,''' /** @file * @brief MAVLink comm protocol built from ${basename}.xml * @see http://mavlink.org */ #ifndef MAVLINK_VERSION_H #define MAVLINK_VERSION_H #define MAVLINK_BUILD_DATE "${parse_time}" #define MAVLINK_WIRE_PROTOCOL_VERSION "${wire_protocol_version}" #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE ${largest_payload} #endif // MAVLINK_VERSION_H ''', xml) f.close() def generate_mavlink_h(directory, xml): '''generate mavlink.h''' f = open(os.path.join(directory, "mavlink.h"), mode='w') t.write(f,''' /** @file * @brief MAVLink comm protocol built from ${basename}.xml * @see http://mavlink.org */ #ifndef MAVLINK_H #define MAVLINK_H #ifndef MAVLINK_STX #define MAVLINK_STX ${protocol_marker} #endif #ifndef MAVLINK_ENDIAN #define MAVLINK_ENDIAN ${mavlink_endian} #endif #ifndef MAVLINK_ALIGNED_FIELDS #define MAVLINK_ALIGNED_FIELDS ${aligned_fields_define} #endif #ifndef MAVLINK_CRC_EXTRA #define MAVLINK_CRC_EXTRA ${crc_extra_define} #endif #include "version.h" #include "${basename}.h" #endif // MAVLINK_H ''', xml) f.close() def generate_main_h(directory, xml): '''generate main header per XML file''' f = open(os.path.join(directory, xml.basename + ".h"), mode='w') t.write(f, ''' /** @file * @brief MAVLink comm protocol generated from ${basename}.xml * @see http://mavlink.org */ #ifndef MAVLINK_${basename_upper}_H #define MAVLINK_${basename_upper}_H #ifndef MAVLINK_H #error Wrong include order: MAVLINK_${basename_upper}.H MUST NOT BE DIRECTLY USED. Include mavlink.h from the same directory instead or set ALL AND EVERY defines from MAVLINK.H manually accordingly, including the #define MAVLINK_H call. #endif #ifdef __cplusplus extern "C" { #endif // MESSAGE LENGTHS AND CRCS #ifndef MAVLINK_MESSAGE_LENGTHS #define MAVLINK_MESSAGE_LENGTHS {${message_lengths_array}} #endif #ifndef MAVLINK_MESSAGE_CRCS #define MAVLINK_MESSAGE_CRCS {${message_crcs_array}} #endif #ifndef MAVLINK_MESSAGE_INFO #define MAVLINK_MESSAGE_INFO {${message_info_array}} #endif #include "../protocol.h" #define MAVLINK_ENABLED_${basename_upper} // ENUM DEFINITIONS ${{enum: /** @brief ${description} */ #ifndef HAVE_ENUM_${name} #define HAVE_ENUM_${name} typedef enum ${name} { ${{entry: ${name}=${value}, /* ${description} |${{param:${description}| }} */ }} } ${name}; #endif }} ${{include_list:#include "../${base}/${base}.h" }} // MAVLINK VERSION #ifndef MAVLINK_VERSION #define MAVLINK_VERSION ${version} #endif #if (MAVLINK_VERSION == 0) #undef MAVLINK_VERSION #define MAVLINK_VERSION ${version} #endif // MESSAGE DEFINITIONS ${{message:#include "./mavlink_msg_${name_lower}.h" }} #ifdef __cplusplus } #endif // __cplusplus #endif // MAVLINK_${basename_upper}_H ''', xml) f.close() def generate_message_h(directory, m): '''generate per-message header for a XML file''' f = open(os.path.join(directory, 'mavlink_msg_%s.h' % m.name_lower), mode='w') t.write(f, ''' // MESSAGE ${name} PACKING #define MAVLINK_MSG_ID_${name} ${id} typedef struct __mavlink_${name_lower}_t { ${{ordered_fields: ${type} ${name}${array_suffix}; ///< ${description} }} } mavlink_${name_lower}_t; #define MAVLINK_MSG_ID_${name}_LEN ${wire_length} #define MAVLINK_MSG_ID_${id}_LEN ${wire_length} #define MAVLINK_MSG_ID_${name}_CRC ${crc_extra} #define MAVLINK_MSG_ID_${id}_CRC ${crc_extra} ${{array_fields:#define MAVLINK_MSG_${msg_name}_FIELD_${name_upper}_LEN ${array_length} }} #define MAVLINK_MESSAGE_INFO_${name} { \\ "${name}", \\ ${num_fields}, \\ { ${{ordered_fields: { "${name}", ${c_print_format}, MAVLINK_TYPE_${type_upper}, ${array_length}, ${wire_offset}, offsetof(mavlink_${name_lower}_t, ${name}) }, \\ }} } \\ } /** * @brief Pack a ${name_lower} message * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param msg The MAVLink message to compress the data into * ${{arg_fields: * @param ${name} ${description} }} * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_${name_lower}_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, ${{arg_fields: ${array_const}${type} ${array_prefix}${name},}}) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_${name}_LEN]; ${{scalar_fields: _mav_put_${type}(buf, ${wire_offset}, ${putname}); }} ${{array_fields: _mav_put_${type}_array(buf, ${wire_offset}, ${name}, ${array_length}); }} memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_${name}_LEN); #else mavlink_${name_lower}_t packet; ${{scalar_fields: packet.${name} = ${putname}; }} ${{array_fields: mav_array_memcpy(packet.${name}, ${name}, sizeof(${type})*${array_length}); }} memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_${name}_LEN); #endif msg->msgid = MAVLINK_MSG_ID_${name}; #if MAVLINK_CRC_EXTRA return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_${name}_LEN, MAVLINK_MSG_ID_${name}_CRC); #else return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_${name}_LEN); #endif } /** * @brief Pack a ${name_lower} message on a channel * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param chan The MAVLink channel this message will be sent over * @param msg The MAVLink message to compress the data into ${{arg_fields: * @param ${name} ${description} }} * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_${name_lower}_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, ${{arg_fields:${array_const}${type} ${array_prefix}${name},}}) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_${name}_LEN]; ${{scalar_fields: _mav_put_${type}(buf, ${wire_offset}, ${putname}); }} ${{array_fields: _mav_put_${type}_array(buf, ${wire_offset}, ${name}, ${array_length}); }} memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_${name}_LEN); #else mavlink_${name_lower}_t packet; ${{scalar_fields: packet.${name} = ${putname}; }} ${{array_fields: mav_array_memcpy(packet.${name}, ${name}, sizeof(${type})*${array_length}); }} memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_${name}_LEN); #endif msg->msgid = MAVLINK_MSG_ID_${name}; #if MAVLINK_CRC_EXTRA return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_${name}_LEN, MAVLINK_MSG_ID_${name}_CRC); #else return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_${name}_LEN); #endif } /** * @brief Encode a ${name_lower} struct * * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param msg The MAVLink message to compress the data into * @param ${name_lower} C-struct to read the message contents from */ static inline uint16_t mavlink_msg_${name_lower}_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_${name_lower}_t* ${name_lower}) { return mavlink_msg_${name_lower}_pack(system_id, component_id, msg,${{arg_fields: ${name_lower}->${name},}}); } /** * @brief Encode a ${name_lower} struct on a channel * * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param chan The MAVLink channel this message will be sent over * @param msg The MAVLink message to compress the data into * @param ${name_lower} C-struct to read the message contents from */ static inline uint16_t mavlink_msg_${name_lower}_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_${name_lower}_t* ${name_lower}) { return mavlink_msg_${name_lower}_pack_chan(system_id, component_id, chan, msg,${{arg_fields: ${name_lower}->${name},}}); } /** * @brief Send a ${name_lower} message * @param chan MAVLink channel to send the message * ${{arg_fields: * @param ${name} ${description} }} */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS static inline void mavlink_msg_${name_lower}_send(mavlink_channel_t chan,${{arg_fields: ${array_const}${type} ${array_prefix}${name},}}) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_${name}_LEN]; ${{scalar_fields: _mav_put_${type}(buf, ${wire_offset}, ${putname}); }} ${{array_fields: _mav_put_${type}_array(buf, ${wire_offset}, ${name}, ${array_length}); }} #if MAVLINK_CRC_EXTRA _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_${name}, buf, MAVLINK_MSG_ID_${name}_LEN, MAVLINK_MSG_ID_${name}_CRC); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_${name}, buf, MAVLINK_MSG_ID_${name}_LEN); #endif #else mavlink_${name_lower}_t packet; ${{scalar_fields: packet.${name} = ${putname}; }} ${{array_fields: mav_array_memcpy(packet.${name}, ${name}, sizeof(${type})*${array_length}); }} #if MAVLINK_CRC_EXTRA _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_${name}, (const char *)&packet, MAVLINK_MSG_ID_${name}_LEN, MAVLINK_MSG_ID_${name}_CRC); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_${name}, (const char *)&packet, MAVLINK_MSG_ID_${name}_LEN); #endif #endif } #if MAVLINK_MSG_ID_${name}_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* This varient of _send() can be used to save stack space by re-using memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ static inline void mavlink_msg_${name_lower}_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, ${{arg_fields: ${array_const}${type} ${array_prefix}${name},}}) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; ${{scalar_fields: _mav_put_${type}(buf, ${wire_offset}, ${putname}); }} ${{array_fields: _mav_put_${type}_array(buf, ${wire_offset}, ${name}, ${array_length}); }} #if MAVLINK_CRC_EXTRA _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_${name}, buf, MAVLINK_MSG_ID_${name}_LEN, MAVLINK_MSG_ID_${name}_CRC); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_${name}, buf, MAVLINK_MSG_ID_${name}_LEN); #endif #else mavlink_${name_lower}_t *packet = (mavlink_${name_lower}_t *)msgbuf; ${{scalar_fields: packet->${name} = ${putname}; }} ${{array_fields: mav_array_memcpy(packet->${name}, ${name}, sizeof(${type})*${array_length}); }} #if MAVLINK_CRC_EXTRA _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_${name}, (const char *)packet, MAVLINK_MSG_ID_${name}_LEN, MAVLINK_MSG_ID_${name}_CRC); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_${name}, (const char *)packet, MAVLINK_MSG_ID_${name}_LEN); #endif #endif } #endif #endif // MESSAGE ${name} UNPACKING ${{fields: /** * @brief Get field ${name} from ${name_lower} message * * @return ${description} */ static inline ${return_type} mavlink_msg_${name_lower}_get_${name}(const mavlink_message_t* msg${get_arg}) { return _MAV_RETURN_${type}${array_tag}(msg, ${array_return_arg} ${wire_offset}); } }} /** * @brief Decode a ${name_lower} message into a struct * * @param msg The message to decode * @param ${name_lower} C-struct to decode the message contents into */ static inline void mavlink_msg_${name_lower}_decode(const mavlink_message_t* msg, mavlink_${name_lower}_t* ${name_lower}) { #if MAVLINK_NEED_BYTE_SWAP ${{ordered_fields: ${decode_left}mavlink_msg_${name_lower}_get_${name}(msg${decode_right}); }} #else memcpy(${name_lower}, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_${name}_LEN); #endif } ''', m) f.close() def generate_testsuite_h(directory, xml): '''generate testsuite.h per XML file''' f = open(os.path.join(directory, "testsuite.h"), mode='w') t.write(f, ''' /** @file * @brief MAVLink comm protocol testsuite generated from ${basename}.xml * @see http://qgroundcontrol.org/mavlink/ */ #ifndef ${basename_upper}_TESTSUITE_H #define ${basename_upper}_TESTSUITE_H #ifdef __cplusplus extern "C" { #endif #ifndef MAVLINK_TEST_ALL #define MAVLINK_TEST_ALL ${{include_list:static void mavlink_test_${base}(uint8_t, uint8_t, mavlink_message_t *last_msg); }} static void mavlink_test_${basename}(uint8_t, uint8_t, mavlink_message_t *last_msg); static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) { ${{include_list: mavlink_test_${base}(system_id, component_id, last_msg); }} mavlink_test_${basename}(system_id, component_id, last_msg); } #endif ${{include_list:#include "../${base}/testsuite.h" }} ${{message: static void mavlink_test_${name_lower}(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) { mavlink_message_t msg; uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; mavlink_${name_lower}_t packet_in = { ${{ordered_fields:${c_test_value},}} }; mavlink_${name_lower}_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); ${{scalar_fields: packet1.${name} = packet_in.${name}; }} ${{array_fields: mav_array_memcpy(packet1.${name}, packet_in.${name}, sizeof(${type})*${array_length}); }} memset(&packet2, 0, sizeof(packet2)); mavlink_msg_${name_lower}_encode(system_id, component_id, &msg, &packet1); mavlink_msg_${name_lower}_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); mavlink_msg_${name_lower}_pack(system_id, component_id, &msg ${{arg_fields:, packet1.${name} }}); mavlink_msg_${name_lower}_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); mavlink_msg_${name_lower}_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg ${{arg_fields:, packet1.${name} }}); mavlink_msg_${name_lower}_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); mavlink_msg_to_send_buffer(buffer, &msg); for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { comm_send_ch(MAVLINK_COMM_0, buffer[i]); } mavlink_msg_${name_lower}_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); mavlink_msg_${name_lower}_send(MAVLINK_COMM_1 ${{arg_fields:, packet1.${name} }}); mavlink_msg_${name_lower}_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); } }} static void mavlink_test_${basename}(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) { ${{message: mavlink_test_${name_lower}(system_id, component_id, last_msg); }} } #ifdef __cplusplus } #endif // __cplusplus #endif // ${basename_upper}_TESTSUITE_H ''', xml) f.close() def copy_fixed_headers(directory, xml): '''copy the fixed protocol headers to the target directory''' import shutil hlist = [ 'protocol.h', 'mavlink_helpers.h', 'mavlink_types.h', 'checksum.h', 'mavlink_conversions.h' ] basepath = os.path.dirname(os.path.realpath(__file__)) srcpath = os.path.join(basepath, 'C/include_v%s' % xml.wire_protocol_version) print("Copying fixed headers") for h in hlist: if (not ((h == 'mavlink_conversions.h') and xml.wire_protocol_version == '0.9')): src = os.path.realpath(os.path.join(srcpath, h)) dest = os.path.realpath(os.path.join(directory, h)) if src == dest: continue shutil.copy(src, dest) class mav_include(object): def __init__(self, base): self.base = base def generate_one(basename, xml): '''generate headers for one XML file''' directory = os.path.join(basename, xml.basename) print("Generating C implementation in directory %s" % directory) mavparse.mkdir_p(directory) if xml.little_endian: xml.mavlink_endian = "MAVLINK_LITTLE_ENDIAN" else: xml.mavlink_endian = "MAVLINK_BIG_ENDIAN" if xml.crc_extra: xml.crc_extra_define = "1" else: xml.crc_extra_define = "0" if xml.sort_fields: xml.aligned_fields_define = "1" else: xml.aligned_fields_define = "0" # work out the included headers xml.include_list = [] for i in xml.include: base = i[:-4] xml.include_list.append(mav_include(base)) # form message lengths array xml.message_lengths_array = '' for mlen in xml.message_lengths: xml.message_lengths_array += '%u, ' % mlen xml.message_lengths_array = xml.message_lengths_array[:-2] # and message CRCs array xml.message_crcs_array = '' for crc in xml.message_crcs: xml.message_crcs_array += '%u, ' % crc xml.message_crcs_array = xml.message_crcs_array[:-2] # form message info array xml.message_info_array = '' for name in xml.message_names: if name is not None: xml.message_info_array += 'MAVLINK_MESSAGE_INFO_%s, ' % name else: # Several C compilers don't accept {NULL} for # multi-dimensional arrays and structs # feed the compiler a "filled" empty message xml.message_info_array += '{"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, ' xml.message_info_array = xml.message_info_array[:-2] # add some extra field attributes for convenience with arrays for m in xml.message: m.msg_name = m.name if xml.crc_extra: m.crc_extra_arg = ", %s" % m.crc_extra else: m.crc_extra_arg = "" for f in m.fields: if f.print_format is None: f.c_print_format = 'NULL' else: f.c_print_format = '"%s"' % f.print_format if f.array_length != 0: f.array_suffix = '[%u]' % f.array_length f.array_prefix = '*' f.array_tag = '_array' f.array_arg = ', %u' % f.array_length f.array_return_arg = '%s, %u, ' % (f.name, f.array_length) f.array_const = 'const ' f.decode_left = '' f.decode_right = ', %s->%s' % (m.name_lower, f.name) f.return_type = 'uint16_t' f.get_arg = ', %s *%s' % (f.type, f.name) if f.type == 'char': f.c_test_value = '"%s"' % f.test_value else: test_strings = [] for v in f.test_value: test_strings.append(str(v)) f.c_test_value = '{ %s }' % ', '.join(test_strings) else: f.array_suffix = '' f.array_prefix = '' f.array_tag = '' f.array_arg = '' f.array_return_arg = '' f.array_const = '' f.decode_left = "%s->%s = " % (m.name_lower, f.name) f.decode_right = '' f.get_arg = '' f.return_type = f.type if f.type == 'char': f.c_test_value = "'%s'" % f.test_value elif f.type == 'uint64_t': f.c_test_value = "%sULL" % f.test_value elif f.type == 'int64_t': f.c_test_value = "%sLL" % f.test_value else: f.c_test_value = f.test_value # cope with uint8_t_mavlink_version for m in xml.message: m.arg_fields = [] m.array_fields = [] m.scalar_fields = [] for f in m.ordered_fields: if f.array_length != 0: m.array_fields.append(f) else: m.scalar_fields.append(f) for f in m.fields: if not f.omit_arg: m.arg_fields.append(f) f.putname = f.name else: f.putname = f.const_value generate_mavlink_h(directory, xml) generate_version_h(directory, xml) generate_main_h(directory, xml) for m in xml.message: generate_message_h(directory, m) generate_testsuite_h(directory, xml) def generate(basename, xml_list): '''generate complete MAVLink C implemenation''' for xml in xml_list: generate_one(basename, xml) copy_fixed_headers(basename, xml_list[0])
lgpl-3.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 2344, 199, 1122, 282, 30811, 4113, 4692, 570, 436, 3550, 282, 445, 4514, 199, 199, 7384, 6061, 5257, 377, 5562, 914, 7760, 199, 9625, 68, 1334, 1664, 14629, 1015, 650, 503, 2945, 199, 2344, 199, 199, 646, 984, 12, 13390, 12, 747, 12, 900, 199, 504, 1275, 492, 11456, 1122, 12, 11456, 1160, 199, 199, 84, 275, 11456, 1160, 14, 19273, 4231, 342, 199, 199, 318, 3550, 63, 1023, 63, 72, 8, 3619, 12, 2748, 304, 272, 1449, 4208, 1015, 14, 72, 2344, 272, 289, 275, 1551, 8, 736, 14, 515, 14, 904, 8, 3619, 12, 298, 1023, 14, 72, 1288, 818, 534, 87, 358, 272, 307, 14, 952, 8, 70, 12, 2344, 199, 15, 538, 768, 493, 199, 627, 198, 32, 19127, 30811, 1923, 4113, 6137, 687, 10839, 4846, 5565, 1652, 199, 627, 198, 32, 3239, 1455, 921, 24610, 14, 1308, 199, 11589, 199, 3, 27708, 20553, 7916, 63, 4612, 63, 40, 199, 3, 4640, 20553, 7916, 63, 4612, 63, 40, 199, 199, 3, 4640, 20553, 7916, 63, 8248, 63, 5390, 29696, 1122, 63, 521, 7063, 199, 3, 4640, 20553, 7916, 63, 18759, 907, 63, 9583, 63, 4612, 29696, 11239, 63, 3922, 63, 1023, 7063, 199, 3, 4640, 20553, 7916, 63, 4283, 63, 1914, 748, 3582, 63, 24647, 63, 4305, 10839, 9828, 3199, 63, 4749, 93, 523, 199, 3, 13739, 5001, 20553, 7916, 63, 4612, 63, 40, 199, 18108, 2748, 9, 272, 289, 14, 1600, 342, 199, 199, 318, 3550, 63, 24610, 63, 72, 8, 3619, 12, 2748, 304, 272, 1449, 4208, 11456, 1073, 14, 72, 2344, 272, 289, 275, 1551, 8, 736, 14, 515, 14, 904, 8, 3619, 12, 298, 24610, 14, 72, 1288, 818, 534, 87, 358, 272, 307, 14, 952, 8, 70, 12, 2344, 199, 15, 538, 768, 493, 199, 627, 198, 32, 19127, 30811, 1923, 4113, 6137, 687, 10839, 4846, 5565, 1652, 199, 627, 198, 32, 3239, 1455, 921, 24610, 14, 1308, 199, 11589, 199, 3, 27708, 20553, 7916, 63, 40, 199, 3, 4640, 20553, 7916, 63, 40, 199, 199, 3, 27708, 20553, 7916, 63, 840, 56, 199, 3, 4640, 20553, 7916, 63, 840, 56, 10839, 3922, 63, 4211, 93, 199, 3, 13739, 199, 199, 3, 27708, 20553, 7916, 63, 21046, 199, 3, 4640, 20553, 7916, 63, 21046, 10839, 24610, 63, 15009, 93, 199, 3, 13739, 199, 199, 3, 27708, 20553, 7916, 63, 15255, 1149, 63, 12767, 199, 3, 4640, 20553, 7916, 63, 15255, 1149, 63, 12767, 10839, 19175, 63, 955, 63, 4640, 93, 199, 3, 13739, 199, 199, 3, 27708, 20553, 7916, 63, 29243, 63, 18555, 199, 3, 4640, 20553, 7916, 63, 29243, 63, 18555, 10839, 13258, 63, 2911, 63, 4640, 93, 199, 3, 13739, 199, 199, 3, 2613, 298, 1023, 14, 72, 2, 199, 3, 2613, 29696, 4846, 5565, 72, 2, 199, 199, 3, 13739, 5001, 20553, 7916, 63, 40, 199, 18108, 2748, 9, 272, 289, 14, 1600, 342, 199, 199, 318, 3550, 63, 973, 63, 72, 8, 3619, 12, 2748, 304, 272, 1449, 4208, 2446, 1406, 1126, 4692, 570, 2344, 272, 289, 275, 1551, 8, 736, 14, 515, 14, 904, 8, 3619, 12, 2748, 14, 4846, 435, 3680, 72, 1288, 818, 534, 87, 358, 272, 307, 14, 952, 8, 70, 12, 1449, 199, 15, 538, 768, 493, 199, 627, 198, 32, 19127, 30811, 1923, 4113, 4046, 687, 10839, 4846, 5565, 1652, 199, 627, 198, 32, 3239, 1455, 921, 24610, 14, 1308, 199, 11589, 199, 3, 27708, 20553, 7916, 63, 10545, 4846, 63, 4142, 12585, 40, 199, 3, 4640, 20553, 7916, 63, 10545, 4846, 63, 4142, 12585, 40, 199, 199, 3, 27708, 20553, 7916, 63, 40, 272, 327, 705, 30801, 2387, 1865, 26, 20553, 7916, 63, 10545, 4846, 63, 4142, 5565, 40, 18095, 2845, 6262, 8703, 6084, 4815, 36, 14, 15783, 11456, 1073, 14, 72, 687, 314, 2011, 2082, 3140, 503, 663, 11727, 2401, 662, 2111, 57, 7890, 687, 20553, 7916, 14, 40, 10250, 24137, 12, 5893, 314, 327, 4640, 20553, 7916, 63, 40, 1240, 14, 199, 3, 13739, 199, 199, 3, 27737, 636, 67, 6666, 6666, 199, 18587, 298, 35, 2, 469, 199, 3, 13739, 199, 199, 501, 603, 1608, 2962, 491, 32106, 51, 2401, 17101, 3298, 199, 199, 3, 27708, 20553, 7916, 63, 8272, 63, 9127, 51, 199, 3, 4640, 20553, 7916, 63, 8272, 63, 9127, 51, 469, 10545, 1188, 63, 14563, 63, 1144, 4863, 199, 3, 13739, 199, 199, 3, 27708, 20553, 7916, 63, 8272, 63, 2944, 3298, 199, 3, 4640, 20553, 7916, 63, 8272, 63, 2944, 3298, 469, 10545, 1188, 63, 13258, 83, 63, 1144, 4863, 199, 3, 13739, 199, 199, 3, 27708, 20553, 7916, 63, 8272, 63, 4531, 199, 3, 4640, 20553, 7916, 63, 8272, 63, 4531, 469, 10545, 1188, 63, 815, 63, 1144, 4863, 199, 3, 13739, 199, 199, 3, 2613, 29024, 3922, 14, 72, 2, 199, 199, 3, 4640, 20553, 7916, 63, 15704, 63, 10545, 4846, 63, 4142, 93, 199, 199, 501, 662, 7125, 23566, 8727, 2823, 199, 199, 4, 3638, 4869, 26, 199, 15, 538, 768, 19127, 10839, 1802, 93, 11589, 199, 3, 27708, 25227, 63, 17563, 63, 10545, 354, 93, 199, 3, 4640, 25227, 63, 17563, 63, 10545, 354, 93, 199, 9594, 4952, 10839, 354, 93, 199, 91, 199, 4, 3638, 2373, 26, 198, 10545, 354, 93, 29, 10545, 585, 1386, 13505, 10839, 1802, 93, 1204, 4, 3638, 635, 26, 10545, 1802, 22441, 3586, 11589, 199, 4863, 199, 93, 10839, 354, 12084, 199, 3, 13739, 199, 4863, 199, 199, 4, 3638, 2613, 63, 513, 15596, 2613, 29024, 10545, 1095, 5995, 10545, 1095, 5565, 72, 2, 199, 4863, 199, 199, 501, 20553, 7916, 15945, 199, 199, 3, 27708, 20553, 7916, 63, 4612, 199, 3, 4640, 20553, 7916, 63, 4612, 10839, 1023, 93, 199, 3, 13739, 199, 199, 3, 692, 334, 19273, 7916, 63, 4612, 508, 378, 9, 199, 3, 25878, 20553, 7916, 63, 4612, 199, 3, 4640, 20553, 7916, 63, 4612, 10839, 1023, 93, 199, 3, 13739, 199, 199, 501, 603, 1608, 2962, 23566, 8727, 2823, 199, 4, 3638, 1188, 15596, 2613, 26069, 24610, 63, 1328, 63, 10545, 354, 63, 2325, 5565, 72, 2, 199, 4863, 199, 199, 3, 27737, 636, 67, 6666, 6666, 199, 93, 199, 3, 13739, 5001, 636 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 2344, 199, 1122, 282, 30811, 4113, 4692, 570, 436, 3550, 282, 445, 4514, 199, 199, 7384, 6061, 5257, 377, 5562, 914, 7760, 199, 9625, 68, 1334, 1664, 14629, 1015, 650, 503, 2945, 199, 2344, 199, 199, 646, 984, 12, 13390, 12, 747, 12, 900, 199, 504, 1275, 492, 11456, 1122, 12, 11456, 1160, 199, 199, 84, 275, 11456, 1160, 14, 19273, 4231, 342, 199, 199, 318, 3550, 63, 1023, 63, 72, 8, 3619, 12, 2748, 304, 272, 1449, 4208, 1015, 14, 72, 2344, 272, 289, 275, 1551, 8, 736, 14, 515, 14, 904, 8, 3619, 12, 298, 1023, 14, 72, 1288, 818, 534, 87, 358, 272, 307, 14, 952, 8, 70, 12, 2344, 199, 15, 538, 768, 493, 199, 627, 198, 32, 19127, 30811, 1923, 4113, 6137, 687, 10839, 4846, 5565, 1652, 199, 627, 198, 32, 3239, 1455, 921, 24610, 14, 1308, 199, 11589, 199, 3, 27708, 20553, 7916, 63, 4612, 63, 40, 199, 3, 4640, 20553, 7916, 63, 4612, 63, 40, 199, 199, 3, 4640, 20553, 7916, 63, 8248, 63, 5390, 29696, 1122, 63, 521, 7063, 199, 3, 4640, 20553, 7916, 63, 18759, 907, 63, 9583, 63, 4612, 29696, 11239, 63, 3922, 63, 1023, 7063, 199, 3, 4640, 20553, 7916, 63, 4283, 63, 1914, 748, 3582, 63, 24647, 63, 4305, 10839, 9828, 3199, 63, 4749, 93, 523, 199, 3, 13739, 5001, 20553, 7916, 63, 4612, 63, 40, 199, 18108, 2748, 9, 272, 289, 14, 1600, 342, 199, 199, 318, 3550, 63, 24610, 63, 72, 8, 3619, 12, 2748, 304, 272, 1449, 4208, 11456, 1073, 14, 72, 2344, 272, 289, 275, 1551, 8, 736, 14, 515, 14, 904, 8, 3619, 12, 298, 24610, 14, 72, 1288, 818, 534, 87, 358, 272, 307, 14, 952, 8, 70, 12, 2344, 199, 15, 538, 768, 493, 199, 627, 198, 32, 19127, 30811, 1923, 4113, 6137, 687, 10839, 4846, 5565, 1652, 199, 627, 198, 32, 3239, 1455, 921, 24610, 14, 1308, 199, 11589, 199, 3, 27708, 20553, 7916, 63, 40, 199, 3, 4640, 20553, 7916, 63, 40, 199, 199, 3, 27708, 20553, 7916, 63, 840, 56, 199, 3, 4640, 20553, 7916, 63, 840, 56, 10839, 3922, 63, 4211, 93, 199, 3, 13739, 199, 199, 3, 27708, 20553, 7916, 63, 21046, 199, 3, 4640, 20553, 7916, 63, 21046, 10839, 24610, 63, 15009, 93, 199, 3, 13739, 199, 199, 3, 27708, 20553, 7916, 63, 15255, 1149, 63, 12767, 199, 3, 4640, 20553, 7916, 63, 15255, 1149, 63, 12767, 10839, 19175, 63, 955, 63, 4640, 93, 199, 3, 13739, 199, 199, 3, 27708, 20553, 7916, 63, 29243, 63, 18555, 199, 3, 4640, 20553, 7916, 63, 29243, 63, 18555, 10839, 13258, 63, 2911, 63, 4640, 93, 199, 3, 13739, 199, 199, 3, 2613, 298, 1023, 14, 72, 2, 199, 3, 2613, 29696, 4846, 5565, 72, 2, 199, 199, 3, 13739, 5001, 20553, 7916, 63, 40, 199, 18108, 2748, 9, 272, 289, 14, 1600, 342, 199, 199, 318, 3550, 63, 973, 63, 72, 8, 3619, 12, 2748, 304, 272, 1449, 4208, 2446, 1406, 1126, 4692, 570, 2344, 272, 289, 275, 1551, 8, 736, 14, 515, 14, 904, 8, 3619, 12, 2748, 14, 4846, 435, 3680, 72, 1288, 818, 534, 87, 358, 272, 307, 14, 952, 8, 70, 12, 1449, 199, 15, 538, 768, 493, 199, 627, 198, 32, 19127, 30811, 1923, 4113, 4046, 687, 10839, 4846, 5565, 1652, 199, 627, 198, 32, 3239, 1455, 921, 24610, 14, 1308, 199, 11589, 199, 3, 27708, 20553, 7916, 63, 10545, 4846, 63, 4142, 12585, 40, 199, 3, 4640, 20553, 7916, 63, 10545, 4846, 63, 4142, 12585, 40, 199, 199, 3, 27708, 20553, 7916, 63, 40, 272, 327, 705, 30801, 2387, 1865, 26, 20553, 7916, 63, 10545, 4846, 63, 4142, 5565, 40, 18095, 2845, 6262, 8703, 6084, 4815, 36, 14, 15783, 11456, 1073, 14, 72, 687, 314, 2011, 2082, 3140, 503, 663, 11727, 2401, 662, 2111, 57, 7890, 687, 20553, 7916, 14, 40, 10250, 24137, 12, 5893, 314, 327, 4640, 20553, 7916, 63, 40, 1240, 14, 199, 3, 13739, 199, 199, 3, 27737, 636, 67, 6666, 6666, 199, 18587, 298, 35, 2, 469, 199, 3, 13739, 199, 199, 501, 603, 1608, 2962, 491, 32106, 51, 2401, 17101, 3298, 199, 199, 3, 27708, 20553, 7916, 63, 8272, 63, 9127, 51, 199, 3, 4640, 20553, 7916, 63, 8272, 63, 9127, 51, 469, 10545, 1188, 63, 14563, 63, 1144, 4863, 199, 3, 13739, 199, 199, 3, 27708, 20553, 7916, 63, 8272, 63, 2944, 3298, 199, 3, 4640, 20553, 7916, 63, 8272, 63, 2944, 3298, 469, 10545, 1188, 63, 13258, 83, 63, 1144, 4863, 199, 3, 13739, 199, 199, 3, 27708, 20553, 7916, 63, 8272, 63, 4531, 199, 3, 4640, 20553, 7916, 63, 8272, 63, 4531, 469, 10545, 1188, 63, 815, 63, 1144, 4863, 199, 3, 13739, 199, 199, 3, 2613, 29024, 3922, 14, 72, 2, 199, 199, 3, 4640, 20553, 7916, 63, 15704, 63, 10545, 4846, 63, 4142, 93, 199, 199, 501, 662, 7125, 23566, 8727, 2823, 199, 199, 4, 3638, 4869, 26, 199, 15, 538, 768, 19127, 10839, 1802, 93, 11589, 199, 3, 27708, 25227, 63, 17563, 63, 10545, 354, 93, 199, 3, 4640, 25227, 63, 17563, 63, 10545, 354, 93, 199, 9594, 4952, 10839, 354, 93, 199, 91, 199, 4, 3638, 2373, 26, 198, 10545, 354, 93, 29, 10545, 585, 1386, 13505, 10839, 1802, 93, 1204, 4, 3638, 635, 26, 10545, 1802, 22441, 3586, 11589, 199, 4863, 199, 93, 10839, 354, 12084, 199, 3, 13739, 199, 4863, 199, 199, 4, 3638, 2613, 63, 513, 15596, 2613, 29024, 10545, 1095, 5995, 10545, 1095, 5565, 72, 2, 199, 4863, 199, 199, 501, 20553, 7916, 15945, 199, 199, 3, 27708, 20553, 7916, 63, 4612, 199, 3, 4640, 20553, 7916, 63, 4612, 10839, 1023, 93, 199, 3, 13739, 199, 199, 3, 692, 334, 19273, 7916, 63, 4612, 508, 378, 9, 199, 3, 25878, 20553, 7916, 63, 4612, 199, 3, 4640, 20553, 7916, 63, 4612, 10839, 1023, 93, 199, 3, 13739, 199, 199, 501, 603, 1608, 2962, 23566, 8727, 2823, 199, 4, 3638, 1188, 15596, 2613, 26069, 24610, 63, 1328, 63, 10545, 354, 63, 2325, 5565, 72, 2, 199, 4863, 199, 199, 3, 27737, 636, 67, 6666, 6666, 199, 93, 199, 3, 13739, 5001, 636, 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 ]
shaufi10/odoo
openerp/addons/base/res/res_currency.py
96
16006
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 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 re import time import math from openerp import api, fields as fields2 from openerp import tools from openerp.osv import fields, osv from openerp.tools import float_round, float_is_zero, float_compare from openerp.tools.translate import _ import simplejson as json CURRENCY_DISPLAY_PATTERN = re.compile(r'(\w+)\s*(?:\((.*)\))?') class res_currency(osv.osv): def _current_rate(self, cr, uid, ids, name, arg, context=None): return self._get_current_rate(cr, uid, ids, context=context) def _current_rate_silent(self, cr, uid, ids, name, arg, context=None): return self._get_current_rate(cr, uid, ids, raise_on_no_rate=False, context=context) def _get_current_rate(self, cr, uid, ids, raise_on_no_rate=True, context=None): if context is None: context = {} res = {} date = context.get('date') or time.strftime('%Y-%m-%d') for id in ids: cr.execute('SELECT rate FROM res_currency_rate ' 'WHERE currency_id = %s ' 'AND name <= %s ' 'ORDER BY name desc LIMIT 1', (id, date)) if cr.rowcount: res[id] = cr.fetchone()[0] elif not raise_on_no_rate: res[id] = 0 else: currency = self.browse(cr, uid, id, context=context) raise osv.except_osv(_('Error!'),_("No currency rate associated for currency '%s' for the given period" % (currency.name))) return res _name = "res.currency" _description = "Currency" _columns = { # Note: 'code' column was removed as of v6.0, the 'name' should now hold the ISO code. 'name': fields.char('Currency', size=3, required=True, help="Currency Code (ISO 4217)"), 'symbol': fields.char('Symbol', size=4, help="Currency sign, to be used when printing amounts."), 'rate': fields.function(_current_rate, string='Current Rate', digits=(12,6), help='The rate of the currency to the currency of rate 1.'), # Do not use for computation ! Same as rate field with silent failing 'rate_silent': fields.function(_current_rate_silent, string='Current Rate', digits=(12,6), help='The rate of the currency to the currency of rate 1 (0 if no rate defined).'), 'rate_ids': fields.one2many('res.currency.rate', 'currency_id', 'Rates'), 'accuracy': fields.integer('Computational Accuracy'), 'rounding': fields.float('Rounding Factor', digits=(12,6)), 'active': fields.boolean('Active'), 'company_id':fields.many2one('res.company', 'Company'), 'base': fields.boolean('Base'), 'position': fields.selection([('after','After Amount'),('before','Before Amount')], 'Symbol Position', help="Determines where the currency symbol should be placed after or before the amount.") } _defaults = { 'active': 1, 'position' : 'after', 'rounding': 0.01, 'accuracy': 4, 'company_id': False, } _sql_constraints = [ # this constraint does not cover all cases due to SQL NULL handling for company_id, # so it is complemented with a unique index (see below). The constraint and index # share the same prefix so that IntegrityError triggered by the index will be caught # and reported to the user with the constraint's error message. ('unique_name_company_id', 'unique (name, company_id)', 'The currency code must be unique per company!'), ] _order = "name" def init(self, cr): # CONSTRAINT/UNIQUE INDEX on (name,company_id) # /!\ The unique constraint 'unique_name_company_id' is not sufficient, because SQL92 # only support field names in constraint definitions, and we need a function here: # we need to special-case company_id to treat all NULL company_id as equal, otherwise # we would allow duplicate "global" currencies (all having company_id == NULL) cr.execute("""SELECT indexname FROM pg_indexes WHERE indexname = 'res_currency_unique_name_company_id_idx'""") if not cr.fetchone(): cr.execute("""CREATE UNIQUE INDEX res_currency_unique_name_company_id_idx ON res_currency (name, (COALESCE(company_id,-1)))""") date = fields2.Date(compute='compute_date') @api.one @api.depends('rate_ids.name') def compute_date(self): self.date = self.rate_ids[:1].name def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100): if not args: args = [] results = super(res_currency,self)\ .name_search(cr, user, name, args, operator=operator, context=context, limit=limit) if not results: name_match = CURRENCY_DISPLAY_PATTERN.match(name) if name_match: results = super(res_currency,self)\ .name_search(cr, user, name_match.group(1), args, operator=operator, context=context, limit=limit) return results def name_get(self, cr, uid, ids, context=None): if not ids: return [] if isinstance(ids, (int, long)): ids = [ids] reads = self.read(cr, uid, ids, ['name','symbol'], context=context, load='_classic_write') return [(x['id'], tools.ustr(x['name'])) for x in reads] def copy(self, cr, uid, id, default=None, context=None): if context is None: context = {} if not default: default = {} default.update(name=_("%s (copy)") % (self.browse(cr, uid, id, context=context).name)) return super(res_currency, self).copy( cr, uid, id, default=default, context=context) @api.v8 def round(self, amount): """ Return `amount` rounded according to currency `self`. """ return float_round(amount, precision_rounding=self.rounding) @api.v7 def round(self, cr, uid, currency, amount): """Return ``amount`` rounded according to ``currency``'s rounding rules. :param Record currency: currency for which we are rounding :param float amount: the amount to round :return: rounded float """ return float_round(amount, precision_rounding=currency.rounding) @api.v8 def compare_amounts(self, amount1, amount2): """ Compare `amount1` and `amount2` after rounding them according to `self`'s precision. An amount is considered lower/greater than another amount if their rounded value is different. This is not the same as having a non-zero difference! For example 1.432 and 1.431 are equal at 2 digits precision, so this method would return 0. However 0.006 and 0.002 are considered different (returns 1) because they respectively round to 0.01 and 0.0, even though 0.006-0.002 = 0.004 which would be considered zero at 2 digits precision. """ return float_compare(amount1, amount2, precision_rounding=self.rounding) @api.v7 def compare_amounts(self, cr, uid, currency, amount1, amount2): """Compare ``amount1`` and ``amount2`` after rounding them according to the given currency's precision.. An amount is considered lower/greater than another amount if their rounded value is different. This is not the same as having a non-zero difference! For example 1.432 and 1.431 are equal at 2 digits precision, so this method would return 0. However 0.006 and 0.002 are considered different (returns 1) because they respectively round to 0.01 and 0.0, even though 0.006-0.002 = 0.004 which would be considered zero at 2 digits precision. :param Record currency: currency for which we are rounding :param float amount1: first amount to compare :param float amount2: second amount to compare :return: (resp.) -1, 0 or 1, if ``amount1`` is (resp.) lower than, equal to, or greater than ``amount2``, according to ``currency``'s rounding. """ return float_compare(amount1, amount2, precision_rounding=currency.rounding) @api.v8 def is_zero(self, amount): """ Return true if `amount` is small enough to be treated as zero according to currency `self`'s rounding rules. Warning: ``is_zero(amount1-amount2)`` is not always equivalent to ``compare_amounts(amount1,amount2) == 0``, as the former will round after computing the difference, while the latter will round before, giving different results, e.g., 0.006 and 0.002 at 2 digits precision. """ return float_is_zero(amount, precision_rounding=self.rounding) @api.v7 def is_zero(self, cr, uid, currency, amount): """Returns true if ``amount`` is small enough to be treated as zero according to ``currency``'s rounding rules. Warning: ``is_zero(amount1-amount2)`` is not always equivalent to ``compare_amounts(amount1,amount2) == 0``, as the former will round after computing the difference, while the latter will round before, giving different results for e.g. 0.006 and 0.002 at 2 digits precision. :param Record currency: currency for which we are rounding :param float amount: amount to compare with currency's zero """ return float_is_zero(amount, precision_rounding=currency.rounding) def _get_conversion_rate(self, cr, uid, from_currency, to_currency, context=None): if context is None: context = {} ctx = context.copy() from_currency = self.browse(cr, uid, from_currency.id, context=ctx) to_currency = self.browse(cr, uid, to_currency.id, context=ctx) if from_currency.rate == 0 or to_currency.rate == 0: date = context.get('date', time.strftime('%Y-%m-%d')) if from_currency.rate == 0: currency_symbol = from_currency.symbol else: currency_symbol = to_currency.symbol raise osv.except_osv(_('Error'), _('No rate found \n' \ 'for the currency: %s \n' \ 'at the date: %s') % (currency_symbol, date)) return to_currency.rate/from_currency.rate def _compute(self, cr, uid, from_currency, to_currency, from_amount, round=True, context=None): if (to_currency.id == from_currency.id): if round: return self.round(cr, uid, to_currency, from_amount) else: return from_amount else: rate = self._get_conversion_rate(cr, uid, from_currency, to_currency, context=context) if round: return self.round(cr, uid, to_currency, from_amount * rate) else: return from_amount * rate @api.v7 def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context=None): context = context or {} if not from_currency_id: from_currency_id = to_currency_id if not to_currency_id: to_currency_id = from_currency_id xc = self.browse(cr, uid, [from_currency_id,to_currency_id], context=context) from_currency = (xc[0].id == from_currency_id and xc[0]) or xc[1] to_currency = (xc[0].id == to_currency_id and xc[0]) or xc[1] return self._compute(cr, uid, from_currency, to_currency, from_amount, round, context) @api.v8 def compute(self, from_amount, to_currency, round=True): """ Convert `from_amount` from currency `self` to `to_currency`. """ assert self, "compute from unknown currency" assert to_currency, "compute to unknown currency" # apply conversion rate if self == to_currency: to_amount = from_amount else: to_amount = from_amount * self._get_conversion_rate(self, to_currency) # apply rounding return to_currency.round(to_amount) if round else to_amount def get_format_currencies_js_function(self, cr, uid, context=None): """ Returns a string that can be used to instanciate a javascript function that formats numbers as currencies. That function expects the number as first parameter and the currency id as second parameter. In case of failure it returns undefined.""" function = "" for row in self.search_read(cr, uid, domain=[], fields=['id', 'name', 'symbol', 'rounding', 'position'], context=context): digits = int(math.ceil(math.log10(1 / row['rounding']))) symbol = row['symbol'] or row['name'] format_number_str = "openerp.web.format_value(arguments[0], {type: 'float', digits: [69," + str(digits) + "]}, 0.00)" if row['position'] == 'after': return_str = "return " + format_number_str + " + '\\xA0' + " + json.dumps(symbol) + ";" else: return_str = "return " + json.dumps(symbol) + " + '\\xA0' + " + format_number_str + ";" function += "if (arguments[1] === " + str(row['id']) + ") { " + return_str + " }" return function class res_currency_rate(osv.osv): _name = "res.currency.rate" _description = "Currency Rate" _columns = { 'name': fields.datetime('Date', required=True, select=True), 'rate': fields.float('Rate', digits=(12, 6), help='The rate of the currency to the currency of rate 1'), 'currency_id': fields.many2one('res.currency', 'Currency', readonly=True), } _defaults = { 'name': lambda *a: time.strftime('%Y-%m-%d 00:00:00'), } _order = "name desc" def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80): if operator in ['=', '!=']: try: date_format = '%Y-%m-%d' if context.get('lang'): lang_obj = self.pool['res.lang'] lang_ids = lang_obj.search(cr, user, [('code', '=', context['lang'])], context=context) if lang_ids: date_format = lang_obj.browse(cr, user, lang_ids[0], context=context).date_format name = time.strftime('%Y-%m-%d', time.strptime(name, date_format)) except ValueError: try: args.append(('rate', operator, float(name))) except ValueError: return [] name = '' operator = 'ilike' return super(res_currency_rate, self).name_search(cr, user, name, args=args, operator=operator, context=context, limit=limit) # 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, 8664, 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, 295, 199, 646, 900, 199, 646, 3473, 199, 199, 504, 5166, 492, 2986, 12, 1504, 465, 1504, 18, 199, 504, 5166, 492, 7249, 199, 504, 5166, 14, 4795, 492, 1504, 12, 9506, 199, 504, 5166, 14, 2537, 492, 2069, 63, 2363, 12, 2069, 63, 374, 63, 4262, 12, 2069, 63, 5785, 199, 504, 5166, 14, 2537, 14, 5275, 492, 485, 199, 646, 13804, 465, 2022, 199, 199, 7013, 24861, 63, 20993, 63, 10764, 275, 295, 14, 2014, 8, 82, 13445, 87, 13439, 83, 10, 15840, 1332, 2795, 2862, 430, 18478, 199, 199, 533, 522, 63, 4968, 8, 4795, 14, 4795, 304, 272, 347, 485, 1818, 63, 1866, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 536, 12, 1680, 12, 1067, 29, 403, 304, 267, 372, 291, 423, 362, 63, 1818, 63, 1866, 8, 1556, 12, 1747, 12, 2762, 12, 1067, 29, 1100, 9, 339, 347, 485, 1818, 63, 1866, 63, 14434, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 536, 12, 1680, 12, 1067, 29, 403, 304, 267, 372, 291, 423, 362, 63, 1818, 63, 1866, 8, 1556, 12, 1747, 12, 2762, 12, 746, 63, 265, 63, 889, 63, 1866, 29, 797, 12, 1067, 29, 1100, 9, 339, 347, 485, 362, 63, 1818, 63, 1866, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 746, 63, 265, 63, 889, 63, 1866, 29, 549, 12, 1067, 29, 403, 304, 267, 340, 1067, 365, 488, 26, 288, 1067, 275, 1052, 267, 522, 275, 1052, 398, 1434, 275, 1067, 14, 362, 360, 602, 358, 503, 900, 14, 6205, 3508, 57, 3295, 77, 3295, 68, 358, 267, 367, 1305, 315, 2762, 26, 288, 2467, 14, 2526, 360, 4859, 6634, 4442, 522, 63, 4968, 63, 1866, 283, 2432, 283, 17688, 9952, 63, 344, 275, 450, 83, 283, 586, 283, 3649, 536, 2695, 450, 83, 283, 2432, 283, 12125, 6515, 536, 4328, 5138, 413, 297, 2432, 334, 344, 12, 1434, 430, 288, 340, 2467, 14, 24007, 26, 355, 522, 59, 344, 61, 275, 2467, 14, 11591, 3430, 16, 61, 288, 916, 440, 746, 63, 265, 63, 889, 63, 1866, 26, 355, 522, 59, 344, 61, 275, 378, 288, 587, 26, 355, 9952, 275, 291, 14, 4570, 8, 1556, 12, 1747, 12, 1305, 12, 1067, 29, 1100, 9, 355, 746, 9506, 14, 2590, 63, 4795, 6723, 547, 15659, 14332, 1944, 9952, 6634, 4568, 367, 9952, 1543, 83, 7, 367, 314, 1627, 6247, 2, 450, 334, 4968, 14, 354, 1724, 267, 372, 522, 339, 485, 354, 275, 298, 470, 14, 4968, 2, 272, 485, 1802, 275, 298, 19567, 2, 272, 485, 3406, 275, 469, 267, 327, 3390, 26, 283, 600, 7, 2763, 1990, 4829, 465, 402, 373, 22, 14, 16, 12, 314, 283, 354, 7, 1077, 3063, 10266, 314, 9055, 1233, 14, 267, 283, 354, 356, 1504, 14, 1560, 360, 19567, 297, 1568, 29, 19, 12, 1415, 29, 549, 12, 1720, 628, 19567, 5495, 334, 7336, 5685, 1196, 13185, 267, 283, 5155, 356, 1504, 14, 1560, 360, 8169, 297, 1568, 29, 20, 12, 1720, 628, 19567, 2070, 12, 370, 506, 1202, 1380, 16116, 32247, 7651, 267, 283, 1866, 356, 1504, 14, 1593, 1547, 1818, 63, 1866, 12, 1059, 534, 5639, 26311, 297, 7576, 2687, 713, 12, 22, 395, 288, 1720, 534, 1918, 6634, 402, 314, 9952, 370, 314, 9952, 402, 6634, 413, 8038, 398, 327, 4226, 440, 675, 367, 14009, 8546, 14766, 465, 6634, 901, 543, 10866, 18648, 267, 283, 1866, 63, 14434, 356, 1504, 14, 1593, 1547, 1818, 63, 1866, 63, 14434, 12, 1059, 534, 5639, 26311, 297, 7576, 2687, 713, 12, 22, 395, 288, 1720, 534, 1918, 6634, 402, 314, 9952, 370, 314, 9952, 402, 6634, 413, 334, 16, 340, 949, 6634, 3247, 680, 659, 267, 283, 1866, 63, 1580, 356, 1504, 14, 368, 18, 3479, 360, 470, 14, 4968, 14, 1866, 297, 283, 4968, 63, 344, 297, 283, 23308, 659, 267, 283, 13374, 356, 1504, 14, 4115, 360, 2404, 337, 6279, 4473, 7933, 659, 267, 283, 15326, 356, 1504, 14, 1609, 360, 18579, 316, 27348, 297, 7576, 2687, 713, 12, 22, 1826, 267, 283, 2682, 356, 1504, 14, 4871, 360, 7472, 659, 267, 283, 4627, 63, 344, 356, 955, 14, 3479, 18, 368, 360, 470, 14, 4627, 297, 283, 16063, 659, 267, 283, 1095, 356, 1504, 14, 4871, 360, 1563, 659, 267, 283, 3124, 356, 1504, 14, 5592, 8318, 4399, 1673, 10881, 26701, 8157, 5182, 1673, 13569, 26701, 2665, 283, 8169, 15483, 297, 1720, 628, 872, 18454, 2382, 314, 9952, 5272, 1077, 506, 15090, 2410, 503, 2544, 314, 5982, 2685, 272, 789, 272, 485, 4322, 275, 469, 267, 283, 2682, 356, 413, 12, 267, 283, 3124, 7, 520, 283, 4399, 297, 267, 283, 15326, 356, 378, 14, 614, 12, 267, 283, 13374, 356, 841, 12, 267, 283, 4627, 63, 344, 356, 756, 12, 272, 789, 272, 485, 3009, 63, 9882, 275, 359, 267, 327, 642, 5828, 1630, 440, 8486, 1006, 5560, 7037, 370, 5385, 5962, 7252 ]
[ 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, 8664, 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, 295, 199, 646, 900, 199, 646, 3473, 199, 199, 504, 5166, 492, 2986, 12, 1504, 465, 1504, 18, 199, 504, 5166, 492, 7249, 199, 504, 5166, 14, 4795, 492, 1504, 12, 9506, 199, 504, 5166, 14, 2537, 492, 2069, 63, 2363, 12, 2069, 63, 374, 63, 4262, 12, 2069, 63, 5785, 199, 504, 5166, 14, 2537, 14, 5275, 492, 485, 199, 646, 13804, 465, 2022, 199, 199, 7013, 24861, 63, 20993, 63, 10764, 275, 295, 14, 2014, 8, 82, 13445, 87, 13439, 83, 10, 15840, 1332, 2795, 2862, 430, 18478, 199, 199, 533, 522, 63, 4968, 8, 4795, 14, 4795, 304, 272, 347, 485, 1818, 63, 1866, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 536, 12, 1680, 12, 1067, 29, 403, 304, 267, 372, 291, 423, 362, 63, 1818, 63, 1866, 8, 1556, 12, 1747, 12, 2762, 12, 1067, 29, 1100, 9, 339, 347, 485, 1818, 63, 1866, 63, 14434, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 536, 12, 1680, 12, 1067, 29, 403, 304, 267, 372, 291, 423, 362, 63, 1818, 63, 1866, 8, 1556, 12, 1747, 12, 2762, 12, 746, 63, 265, 63, 889, 63, 1866, 29, 797, 12, 1067, 29, 1100, 9, 339, 347, 485, 362, 63, 1818, 63, 1866, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 746, 63, 265, 63, 889, 63, 1866, 29, 549, 12, 1067, 29, 403, 304, 267, 340, 1067, 365, 488, 26, 288, 1067, 275, 1052, 267, 522, 275, 1052, 398, 1434, 275, 1067, 14, 362, 360, 602, 358, 503, 900, 14, 6205, 3508, 57, 3295, 77, 3295, 68, 358, 267, 367, 1305, 315, 2762, 26, 288, 2467, 14, 2526, 360, 4859, 6634, 4442, 522, 63, 4968, 63, 1866, 283, 2432, 283, 17688, 9952, 63, 344, 275, 450, 83, 283, 586, 283, 3649, 536, 2695, 450, 83, 283, 2432, 283, 12125, 6515, 536, 4328, 5138, 413, 297, 2432, 334, 344, 12, 1434, 430, 288, 340, 2467, 14, 24007, 26, 355, 522, 59, 344, 61, 275, 2467, 14, 11591, 3430, 16, 61, 288, 916, 440, 746, 63, 265, 63, 889, 63, 1866, 26, 355, 522, 59, 344, 61, 275, 378, 288, 587, 26, 355, 9952, 275, 291, 14, 4570, 8, 1556, 12, 1747, 12, 1305, 12, 1067, 29, 1100, 9, 355, 746, 9506, 14, 2590, 63, 4795, 6723, 547, 15659, 14332, 1944, 9952, 6634, 4568, 367, 9952, 1543, 83, 7, 367, 314, 1627, 6247, 2, 450, 334, 4968, 14, 354, 1724, 267, 372, 522, 339, 485, 354, 275, 298, 470, 14, 4968, 2, 272, 485, 1802, 275, 298, 19567, 2, 272, 485, 3406, 275, 469, 267, 327, 3390, 26, 283, 600, 7, 2763, 1990, 4829, 465, 402, 373, 22, 14, 16, 12, 314, 283, 354, 7, 1077, 3063, 10266, 314, 9055, 1233, 14, 267, 283, 354, 356, 1504, 14, 1560, 360, 19567, 297, 1568, 29, 19, 12, 1415, 29, 549, 12, 1720, 628, 19567, 5495, 334, 7336, 5685, 1196, 13185, 267, 283, 5155, 356, 1504, 14, 1560, 360, 8169, 297, 1568, 29, 20, 12, 1720, 628, 19567, 2070, 12, 370, 506, 1202, 1380, 16116, 32247, 7651, 267, 283, 1866, 356, 1504, 14, 1593, 1547, 1818, 63, 1866, 12, 1059, 534, 5639, 26311, 297, 7576, 2687, 713, 12, 22, 395, 288, 1720, 534, 1918, 6634, 402, 314, 9952, 370, 314, 9952, 402, 6634, 413, 8038, 398, 327, 4226, 440, 675, 367, 14009, 8546, 14766, 465, 6634, 901, 543, 10866, 18648, 267, 283, 1866, 63, 14434, 356, 1504, 14, 1593, 1547, 1818, 63, 1866, 63, 14434, 12, 1059, 534, 5639, 26311, 297, 7576, 2687, 713, 12, 22, 395, 288, 1720, 534, 1918, 6634, 402, 314, 9952, 370, 314, 9952, 402, 6634, 413, 334, 16, 340, 949, 6634, 3247, 680, 659, 267, 283, 1866, 63, 1580, 356, 1504, 14, 368, 18, 3479, 360, 470, 14, 4968, 14, 1866, 297, 283, 4968, 63, 344, 297, 283, 23308, 659, 267, 283, 13374, 356, 1504, 14, 4115, 360, 2404, 337, 6279, 4473, 7933, 659, 267, 283, 15326, 356, 1504, 14, 1609, 360, 18579, 316, 27348, 297, 7576, 2687, 713, 12, 22, 1826, 267, 283, 2682, 356, 1504, 14, 4871, 360, 7472, 659, 267, 283, 4627, 63, 344, 356, 955, 14, 3479, 18, 368, 360, 470, 14, 4627, 297, 283, 16063, 659, 267, 283, 1095, 356, 1504, 14, 4871, 360, 1563, 659, 267, 283, 3124, 356, 1504, 14, 5592, 8318, 4399, 1673, 10881, 26701, 8157, 5182, 1673, 13569, 26701, 2665, 283, 8169, 15483, 297, 1720, 628, 872, 18454, 2382, 314, 9952, 5272, 1077, 506, 15090, 2410, 503, 2544, 314, 5982, 2685, 272, 789, 272, 485, 4322, 275, 469, 267, 283, 2682, 356, 413, 12, 267, 283, 3124, 7, 520, 283, 4399, 297, 267, 283, 15326, 356, 378, 14, 614, 12, 267, 283, 13374, 356, 841, 12, 267, 283, 4627, 63, 344, 356, 756, 12, 272, 789, 272, 485, 3009, 63, 9882, 275, 359, 267, 327, 642, 5828, 1630, 440, 8486, 1006, 5560, 7037, 370, 5385, 5962, 7252, 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, 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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 ]
pombredanne/discodb
python/discodb/query.py
3
8881
""" :mod:`discodb.query` -- Supporting objects for the DiscoDB query interface ========================================================================== >>> from discodb import Q >>> Q.parse('~(B | C)') == Q.parse('~B & ~C') True >>> Q.parse('(A & B) | C') == Q.parse('(A | C) & (B | C)') True >>> Q.parse('A & (B | (D & E))') == Q.parse('A & (B | D) & (B | E)') True >>> Q.parse(str(Q.parse('a | b | c & d | e'))) == Q.parse('a | b | c & d | e') True >>> Q.urlscan(Q.parse('(a | b) & ~c').urlformat()) == Q.parse('~c & (a | b)') True >>> from discodb import DiscoDB >>> d = DiscoDB({'A': ['B', 'C'], 'B': 'D', 'C': 'E', 'D': 'F', 'E': 'G'}) >>> sorted(d.query(Q.parse('A'))) ['B', 'C'] >>> sorted(d.query(Q.parse('*A'))) ['D', 'E'] >>> sorted(d.query(Q.parse('A | B'))) ['B', 'C', 'D'] >>> sorted(d.query(Q.parse('*A | B'))) ['D', 'E'] >>> sorted(d.query(Q.parse('**A | *B'))) ['F', 'G'] >>> sorted((str(k), sorted(vs)) for k, vs in d.metaquery(Q.parse('A'))) [('A', ['B', 'C'])] >>> sorted((str(k), sorted(vs)) for k, vs in d.metaquery(Q.parse('*A'))) [('B', ['D']), ('C', ['E'])] >>> sorted((str(k), sorted(vs)) for k, vs in d.metaquery(Q.parse('A | B'))) [('A | B', ['B', 'C', 'D'])] >>> sorted((str(k), sorted(vs)) for k, vs in d.metaquery(Q.parse('*A | B'))) [('B', ['D']), ('C | B', ['D', 'E'])] >>> sorted((str(k), sorted(vs)) for k, vs in d.metaquery(Q.parse('**A | *B'))) [('D', ['F']), ('E | D', ['F', 'G'])] """ from operator import __and__, __or__ class Q(object): """ Contains a conjunction of clauses. """ def __init__(self, clauses): self.clauses = frozenset(clauses) def __and__(self, other): """ Conjunction of Qs is always a Q. """ return Q(self.clauses | other.clauses) def __or__(self, other): """ Disjunction of Qs is always a Q. """ return Q(c | d for c in self.clauses for d in other.clauses) def __invert__(self): """ Inversion of a Q is always a Q. ~(c & ...) -> (~c) | ... -> ~(C) -> Q """ if not self.clauses: return self return Q.wrap(reduce(__or__, (~c for c in self.clauses))) def __pos__(self): return Q((Clause((MetaLiteral(self), )), )) def __cmp__(self, other): return cmp(str(self), str(other)) def __eq__(self, other): return self.clauses == other.clauses def __hash__(self): return hash(self.clauses) def __str__(self): format = '(%s)' if len(self.clauses) > 1 else '%s' return ' & '.join(format % c for c in self.clauses) def expand(self, discodb): from itertools import product for combo in product(*(c.expand(discodb) for c in self.clauses)): yield reduce(__and__, combo) def metaquery(self, discodb): for q in self.expand(discodb): yield q, discodb.query(q) def resolve(self, discodb): return reduce(__and__, (c.resolve(discodb) for c in self.clauses), Q([])) def urlformat(self, safe=':()/,~'): from urllib import quote return quote(str(self) .replace('&', '/') .replace('|', ',') .replace(' ' ,''), safe) @classmethod def urlscan(cls, string): from urllib import unquote return cls.parse(unquote(string)\ .strip().strip('/')\ .replace('/', '&')\ .replace(',', '|')) @classmethod def parse(cls, string): """ Parse a string into a Q object. The parsed string is subject to the following conditions: - `*` characters will be replaced with `+` - literal terms cannot contain the characters `&|~+()` - leading and trailing spaces will be stripped from terms - the characters `&|~` signify the corresponding logical operations - parentheses make operator precedence explicit - `+` characters introduce a dereferencing operation The string will be parsed into a logical combination of the terms, which will be stored internally in conjunctive normal form. Dereferencing is performed when the :class:`Q` object is actually used to query a :class:`discodb.DiscoDB`. In queries (:meth:`discodb.DiscoDB.query`), the dereferencing operation replaces an expression with the union of the values which result from querying with the expression. Thus in the case of:: discodb = DiscoDB({'A': ['B', 'C'], 'B': 'D'}) The following queries would be equivalent:: discodb.query(Q.parse('+A')) discodb.query(Q.parse('*A')) discodb.query(Q.parse('B | C')) and would result in an iterator containing only the value ``'D'``. In metaqueries (:meth:`discodb.DiscoDB.metaquery`), the dereferencing operation replaces an expression with each value which results from querying with the expression, and yields a (query, values) pair for each item in the expansion. Thus, for the discodb above:: discodb.metaquery('A') would return an iterator roughly equivalent to `[(Q.parse('A'), ['B', 'C'])]`, while:: discodb.metaquery('*A') would return an iterator roughly equivalent to `[(Q.parse('B'), ['D']), (Q.parse('C'), [])]`. """ import re return eval(re.sub(r'([^&|~+()\s][^&|~+()]*)', r'Q.wrap("""\1""".strip())', string.replace('*', '+')) or 'Q([])') @classmethod def wrap(cls, proposition): """ Consider any object as a proposition and return a well-behaved Q. """ if isinstance(proposition, Q): return proposition if isinstance(proposition, Clause): return Q((proposition, )) if isinstance(proposition, Literal): return Q((Clause((proposition, )), )) return Q((Clause((Literal(proposition), )), )) class Clause(object): """ Contains a disjunction of literals. """ def __init__(self, literals): self.literals = frozenset(literals) def __and__(self, other): """ Conjunction of Clauses is always a Q. """ return Q((self, other)) def __or__(self, other): """ Disjunction of Clauses is always a Clause. """ return Clause(self.literals | other.literals) def __invert__(self): """ Inversion of a Clause is always a Q. ~(l | ...) -> (~l) & ... -> Q """ return Q.wrap(reduce(__and__, (~l for l in self.literals))) def __eq__(self, other): return self.literals == other.literals def __hash__(self): return hash(self.literals) def __str__(self): return ' | '.join('%s' % l for l in self.literals) def expand(self, discodb): from itertools import product for combo in product(*(l.expand(discodb) for l in self.literals)): yield reduce(__or__, combo) def resolve(self, discodb): return reduce(__or__, (l.resolve(discodb) for l in self.literals)) class Literal(object): """ A potential key in a discodb (or its negation). """ def __init__(self, term, negated=False): self.term = term self.negated = negated def __and__(self, other): """ Conjunction of Literals is always a Q. """ return Clause((self, )) & Clause((other, )) def __or__(self, other): """ Disjunction of Literals is always a Clause. """ return Clause((self, other)) def __invert__(self): """ Inversion of a Literal is always a Literal. """ return type(self)(self.term, negated=not self.negated) def __eq__(self, other): return self.term == other.term and self.negated == other.negated def __hash__(self): return hash(self.term) ^ hash(self.negated) def __str__(self): return '%s%s' % ('~' if self.negated else '', self.term) def expand(self, discodb): yield Q.wrap(self) def resolve(self, discodb): return Q.wrap(self) class MetaLiteral(Literal): def __str__(self): return '%s+(%s)' % ('~' if self.negated else '', self.term) def expand(self, discodb): for q in self.term.expand(discodb): for v in discodb.query(q): yield ~Q.wrap(v) if self.negated else Q.wrap(v) def resolve(self, discodb): q = self.term.resolve(discodb) clause = Clause(Literal(v) for v in discodb.query(q)) return Q.wrap(~clause if self.negated else clause)
bsd-3-clause
[ 624, 199, 26, 1494, 1705, 2297, 331, 697, 14, 1131, 64, 1553, 12502, 316, 2251, 367, 314, 5289, 331, 2846, 1827, 3217, 199, 5695, 17575, 199, 6071, 687, 2153, 331, 697, 492, 1413, 199, 6071, 1413, 14, 1122, 21114, 8, 34, 1204, 445, 5942, 508, 1413, 14, 1122, 21114, 34, 1253, 6146, 35, 358, 199, 549, 199, 6071, 1413, 14, 1122, 14097, 33, 1253, 699, 9, 1204, 445, 358, 508, 1413, 14, 1122, 14097, 33, 1204, 445, 9, 1253, 334, 34, 1204, 445, 5942, 199, 549, 199, 6071, 1413, 14, 1122, 360, 33, 1253, 334, 34, 1204, 334, 36, 1253, 662, 28435, 508, 1413, 14, 1122, 360, 33, 1253, 334, 34, 1204, 577, 9, 1253, 334, 34, 1204, 662, 5942, 199, 549, 199, 6071, 1413, 14, 1122, 8, 495, 8, 49, 14, 1122, 360, 65, 1204, 330, 1204, 286, 1253, 366, 1204, 325, 7058, 508, 1413, 14, 1122, 360, 65, 1204, 330, 1204, 286, 1253, 366, 1204, 325, 358, 199, 549, 199, 6071, 1413, 14, 3603, 2425, 8, 49, 14, 1122, 14097, 65, 1204, 330, 9, 1253, 6146, 67, 1959, 300, 276, 269, 569, 1012, 508, 1413, 14, 1122, 21114, 67, 1253, 334, 65, 1204, 330, 5942, 199, 549, 199, 199, 6071, 687, 2153, 331, 697, 492, 5289, 331, 2846, 199, 6071, 366, 275, 5289, 331, 2846, 3252, 33, 356, 788, 34, 297, 283, 35, 995, 283, 34, 356, 283, 36, 297, 283, 35, 356, 283, 37, 297, 283, 36, 356, 283, 38, 297, 283, 37, 356, 283, 39, 3071, 199, 6071, 3355, 8, 68, 14, 1131, 8, 49, 14, 1122, 360, 33, 7058, 199, 459, 34, 297, 283, 35, 418, 199, 6071, 3355, 8, 68, 14, 1131, 8, 49, 14, 1122, 18225, 33, 7058, 199, 459, 36, 297, 283, 37, 418, 199, 6071, 3355, 8, 68, 14, 1131, 8, 49, 14, 1122, 360, 33, 1204, 699, 7058, 199, 459, 34, 297, 283, 35, 297, 283, 36, 418, 199, 6071, 3355, 8, 68, 14, 1131, 8, 49, 14, 1122, 18225, 33, 1204, 699, 7058, 199, 459, 36, 297, 283, 37, 418, 199, 6071, 3355, 8, 68, 14, 1131, 8, 49, 14, 1122, 31260, 33, 1204, 627, 34, 7058, 199, 459, 38, 297, 283, 39, 418, 199, 199, 6071, 3355, 1332, 495, 8, 75, 395, 3355, 8, 3122, 430, 367, 1022, 12, 8118, 315, 366, 14, 2024, 1131, 8, 49, 14, 1122, 360, 33, 7058, 199, 19412, 33, 297, 788, 34, 297, 283, 35, 24437, 199, 6071, 3355, 1332, 495, 8, 75, 395, 3355, 8, 3122, 430, 367, 1022, 12, 8118, 315, 366, 14, 2024, 1131, 8, 49, 14, 1122, 18225, 33, 7058, 199, 19412, 34, 297, 788, 36, 3815, 661, 35, 297, 788, 37, 24437, 199, 6071, 3355, 1332, 495, 8, 75, 395, 3355, 8, 3122, 430, 367, 1022, 12, 8118, 315, 366, 14, 2024, 1131, 8, 49, 14, 1122, 360, 33, 1204, 699, 7058, 199, 19412, 33, 1204, 699, 297, 788, 34, 297, 283, 35, 297, 283, 36, 24437, 199, 6071, 3355, 1332, 495, 8, 75, 395, 3355, 8, 3122, 430, 367, 1022, 12, 8118, 315, 366, 14, 2024, 1131, 8, 49, 14, 1122, 18225, 33, 1204, 699, 7058, 199, 19412, 34, 297, 788, 36, 3815, 661, 35, 1204, 699, 297, 788, 36, 297, 283, 37, 24437, 199, 6071, 3355, 1332, 495, 8, 75, 395, 3355, 8, 3122, 430, 367, 1022, 12, 8118, 315, 366, 14, 2024, 1131, 8, 49, 14, 1122, 31260, 33, 1204, 627, 34, 7058, 199, 19412, 36, 297, 788, 38, 3815, 661, 37, 1204, 577, 297, 788, 38, 297, 283, 39, 24437, 199, 624, 199, 504, 4182, 492, 636, 460, 3108, 636, 269, 363, 199, 199, 533, 1413, 8, 785, 304, 272, 408, 272, 22493, 282, 22888, 402, 25089, 14, 272, 408, 272, 347, 636, 826, 721, 277, 12, 25089, 304, 267, 291, 14, 26089, 275, 9522, 8, 26089, 9, 339, 347, 636, 460, 721, 277, 12, 1163, 304, 267, 408, 267, 1448, 32367, 402, 1413, 83, 365, 3544, 282, 1413, 14, 267, 408, 267, 372, 1413, 8, 277, 14, 26089, 1204, 1163, 14, 26089, 9, 339, 347, 636, 269, 721, 277, 12, 1163, 304, 267, 408, 267, 5289, 32367, 402, 1413, 83, 365, 3544, 282, 1413, 14, 267, 408, 267, 372, 1413, 8, 67, 1204, 366, 367, 286, 315, 291, 14, 26089, 326, 367, 366, 315, 1163, 14, 26089, 9, 339, 347, 636, 18957, 721, 277, 304, 267, 408, 267, 1010, 1023, 402, 282, 1413, 365, 3544, 282, 1413, 14, 398, 6146, 8, 67, 1253, 19172, 1035, 31742, 67, 9, 1204, 2263, 1035, 6146, 8, 35, 9, 1035, 1413, 267, 408, 267, 340, 440, 291, 14, 26089, 26, 288, 372, 291, 267, 372, 1413, 14, 3823, 8, 5270, 3460, 269, 3108, 31742, 67, 367, 286, 315, 291, 14, 26089, 1724, 339, 347, 636, 1712, 721, 277, 304, 267, 372, 1413, 1332, 16009, 1332, 3396, 7621, 8, 277, 395, 22583, 5082, 339, 347, 636, 5730, 721, 277, 12, 1163, 304, 267, 372, 10467, 8, 495, 8, 277, 395, 620, 8, 1848, 430, 339, 347, 636, 4077, 721, 277, 12, 1163, 304, 267, 372, 291, 14, 26089, 508, 1163, 14, 26089, 339, 347, 636, 2227, 721, 277, 304, 267, 372, 2631, 8, 277, 14, 26089, 9, 339, 347, 636, 495, 721, 277, 304, 267, 1475, 275, 25676, 83, 3171, 340, 822, 8, 277, 14, 26089, 9, 690, 413, 587, 1543, 83, 7, 267, 372, 283, 1253, 1987, 904, 8, 908, 450, 286, 367, 286, 315, 291, 14, 26089, 9, 339, 347, 6544, 8, 277, 12, 2153, 331, 697, 304, 267, 687, 7975, 492, 3336, 267, 367, 20972, 315, 3336, 29316, 67, 14, 4441, 8, 2297, 331, 697, 9, 367, 286, 315, 291, 14, 26089, 2298, 288, 1995, 7114, 3460, 460, 3108, 20972, 9, 339, 347, 3404, 1131, 8, 277, 12, 2153, 331, 697, 304, 267, 367, 1894, 315, 291, 14, 4441, 8, 2297, 331, 697, 304, 288, 1995, 1894, 12, 2153, 331, 697, 14, 1131, 8, 81, 9, 339, 347, 7512, 8, 277, 12, 2153, 331, 697, 304, 267, 372, 7114, 3460, 460, 3108, 334, 67, 14, 6983, 8, 2297, 331, 697, 9, 367, 286, 315, 291, 14, 26089, 395, 1413, 26064, 339, 347, 7629, 276, 269, 569, 8, 277 ]
[ 199, 26, 1494, 1705, 2297, 331, 697, 14, 1131, 64, 1553, 12502, 316, 2251, 367, 314, 5289, 331, 2846, 1827, 3217, 199, 5695, 17575, 199, 6071, 687, 2153, 331, 697, 492, 1413, 199, 6071, 1413, 14, 1122, 21114, 8, 34, 1204, 445, 5942, 508, 1413, 14, 1122, 21114, 34, 1253, 6146, 35, 358, 199, 549, 199, 6071, 1413, 14, 1122, 14097, 33, 1253, 699, 9, 1204, 445, 358, 508, 1413, 14, 1122, 14097, 33, 1204, 445, 9, 1253, 334, 34, 1204, 445, 5942, 199, 549, 199, 6071, 1413, 14, 1122, 360, 33, 1253, 334, 34, 1204, 334, 36, 1253, 662, 28435, 508, 1413, 14, 1122, 360, 33, 1253, 334, 34, 1204, 577, 9, 1253, 334, 34, 1204, 662, 5942, 199, 549, 199, 6071, 1413, 14, 1122, 8, 495, 8, 49, 14, 1122, 360, 65, 1204, 330, 1204, 286, 1253, 366, 1204, 325, 7058, 508, 1413, 14, 1122, 360, 65, 1204, 330, 1204, 286, 1253, 366, 1204, 325, 358, 199, 549, 199, 6071, 1413, 14, 3603, 2425, 8, 49, 14, 1122, 14097, 65, 1204, 330, 9, 1253, 6146, 67, 1959, 300, 276, 269, 569, 1012, 508, 1413, 14, 1122, 21114, 67, 1253, 334, 65, 1204, 330, 5942, 199, 549, 199, 199, 6071, 687, 2153, 331, 697, 492, 5289, 331, 2846, 199, 6071, 366, 275, 5289, 331, 2846, 3252, 33, 356, 788, 34, 297, 283, 35, 995, 283, 34, 356, 283, 36, 297, 283, 35, 356, 283, 37, 297, 283, 36, 356, 283, 38, 297, 283, 37, 356, 283, 39, 3071, 199, 6071, 3355, 8, 68, 14, 1131, 8, 49, 14, 1122, 360, 33, 7058, 199, 459, 34, 297, 283, 35, 418, 199, 6071, 3355, 8, 68, 14, 1131, 8, 49, 14, 1122, 18225, 33, 7058, 199, 459, 36, 297, 283, 37, 418, 199, 6071, 3355, 8, 68, 14, 1131, 8, 49, 14, 1122, 360, 33, 1204, 699, 7058, 199, 459, 34, 297, 283, 35, 297, 283, 36, 418, 199, 6071, 3355, 8, 68, 14, 1131, 8, 49, 14, 1122, 18225, 33, 1204, 699, 7058, 199, 459, 36, 297, 283, 37, 418, 199, 6071, 3355, 8, 68, 14, 1131, 8, 49, 14, 1122, 31260, 33, 1204, 627, 34, 7058, 199, 459, 38, 297, 283, 39, 418, 199, 199, 6071, 3355, 1332, 495, 8, 75, 395, 3355, 8, 3122, 430, 367, 1022, 12, 8118, 315, 366, 14, 2024, 1131, 8, 49, 14, 1122, 360, 33, 7058, 199, 19412, 33, 297, 788, 34, 297, 283, 35, 24437, 199, 6071, 3355, 1332, 495, 8, 75, 395, 3355, 8, 3122, 430, 367, 1022, 12, 8118, 315, 366, 14, 2024, 1131, 8, 49, 14, 1122, 18225, 33, 7058, 199, 19412, 34, 297, 788, 36, 3815, 661, 35, 297, 788, 37, 24437, 199, 6071, 3355, 1332, 495, 8, 75, 395, 3355, 8, 3122, 430, 367, 1022, 12, 8118, 315, 366, 14, 2024, 1131, 8, 49, 14, 1122, 360, 33, 1204, 699, 7058, 199, 19412, 33, 1204, 699, 297, 788, 34, 297, 283, 35, 297, 283, 36, 24437, 199, 6071, 3355, 1332, 495, 8, 75, 395, 3355, 8, 3122, 430, 367, 1022, 12, 8118, 315, 366, 14, 2024, 1131, 8, 49, 14, 1122, 18225, 33, 1204, 699, 7058, 199, 19412, 34, 297, 788, 36, 3815, 661, 35, 1204, 699, 297, 788, 36, 297, 283, 37, 24437, 199, 6071, 3355, 1332, 495, 8, 75, 395, 3355, 8, 3122, 430, 367, 1022, 12, 8118, 315, 366, 14, 2024, 1131, 8, 49, 14, 1122, 31260, 33, 1204, 627, 34, 7058, 199, 19412, 36, 297, 788, 38, 3815, 661, 37, 1204, 577, 297, 788, 38, 297, 283, 39, 24437, 199, 624, 199, 504, 4182, 492, 636, 460, 3108, 636, 269, 363, 199, 199, 533, 1413, 8, 785, 304, 272, 408, 272, 22493, 282, 22888, 402, 25089, 14, 272, 408, 272, 347, 636, 826, 721, 277, 12, 25089, 304, 267, 291, 14, 26089, 275, 9522, 8, 26089, 9, 339, 347, 636, 460, 721, 277, 12, 1163, 304, 267, 408, 267, 1448, 32367, 402, 1413, 83, 365, 3544, 282, 1413, 14, 267, 408, 267, 372, 1413, 8, 277, 14, 26089, 1204, 1163, 14, 26089, 9, 339, 347, 636, 269, 721, 277, 12, 1163, 304, 267, 408, 267, 5289, 32367, 402, 1413, 83, 365, 3544, 282, 1413, 14, 267, 408, 267, 372, 1413, 8, 67, 1204, 366, 367, 286, 315, 291, 14, 26089, 326, 367, 366, 315, 1163, 14, 26089, 9, 339, 347, 636, 18957, 721, 277, 304, 267, 408, 267, 1010, 1023, 402, 282, 1413, 365, 3544, 282, 1413, 14, 398, 6146, 8, 67, 1253, 19172, 1035, 31742, 67, 9, 1204, 2263, 1035, 6146, 8, 35, 9, 1035, 1413, 267, 408, 267, 340, 440, 291, 14, 26089, 26, 288, 372, 291, 267, 372, 1413, 14, 3823, 8, 5270, 3460, 269, 3108, 31742, 67, 367, 286, 315, 291, 14, 26089, 1724, 339, 347, 636, 1712, 721, 277, 304, 267, 372, 1413, 1332, 16009, 1332, 3396, 7621, 8, 277, 395, 22583, 5082, 339, 347, 636, 5730, 721, 277, 12, 1163, 304, 267, 372, 10467, 8, 495, 8, 277, 395, 620, 8, 1848, 430, 339, 347, 636, 4077, 721, 277, 12, 1163, 304, 267, 372, 291, 14, 26089, 508, 1163, 14, 26089, 339, 347, 636, 2227, 721, 277, 304, 267, 372, 2631, 8, 277, 14, 26089, 9, 339, 347, 636, 495, 721, 277, 304, 267, 1475, 275, 25676, 83, 3171, 340, 822, 8, 277, 14, 26089, 9, 690, 413, 587, 1543, 83, 7, 267, 372, 283, 1253, 1987, 904, 8, 908, 450, 286, 367, 286, 315, 291, 14, 26089, 9, 339, 347, 6544, 8, 277, 12, 2153, 331, 697, 304, 267, 687, 7975, 492, 3336, 267, 367, 20972, 315, 3336, 29316, 67, 14, 4441, 8, 2297, 331, 697, 9, 367, 286, 315, 291, 14, 26089, 2298, 288, 1995, 7114, 3460, 460, 3108, 20972, 9, 339, 347, 3404, 1131, 8, 277, 12, 2153, 331, 697, 304, 267, 367, 1894, 315, 291, 14, 4441, 8, 2297, 331, 697, 304, 288, 1995, 1894, 12, 2153, 331, 697, 14, 1131,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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 ]
thanatos/lets-encrypt-preview
letsencrypt-nginx/setup.py
1
2062
import sys from setuptools import setup from setuptools import find_packages version = '0.5.0.dev0' # Please update tox.ini when modifying dependency version requirements install_requires = [ 'acme=={0}'.format(version), 'letsencrypt=={0}'.format(version), 'PyOpenSSL', 'pyparsing>=1.5.5', # Python3 support; perhaps unnecessary? # For pkg_resources. >=1.0 so pip resolves it to a version cryptography # will tolerate; see #2599: 'setuptools>=1.0', 'zope.interface', ] if sys.version_info < (2, 7): install_requires.append('mock<1.1.0') else: install_requires.append('mock') docs_extras = [ 'Sphinx>=1.0', # autodoc_member_order = 'bysource', autodoc_default_flags 'sphinx_rtd_theme', ] setup( name='letsencrypt-nginx', version=version, description="Nginx plugin for Let's Encrypt client", url='https://github.com/letsencrypt/letsencrypt', author="Let's Encrypt Project", author_email='client-dev@letsencrypt.org', license='Apache License 2.0', classifiers=[ 'Development Status :: 3 - Alpha', 'Environment :: Plugins', 'Intended Audience :: System Administrators', 'License :: OSI Approved :: Apache Software License', 'Operating System :: POSIX :: Linux', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Security', 'Topic :: System :: Installation/Setup', 'Topic :: System :: Networking', 'Topic :: System :: Systems Administration', 'Topic :: Utilities', ], packages=find_packages(), include_package_data=True, install_requires=install_requires, extras_require={ 'docs': docs_extras, }, entry_points={ 'letsencrypt.plugins': [ 'nginx = letsencrypt_nginx.configurator:NginxConfigurator', ], }, test_suite='letsencrypt_nginx', )
apache-2.0
[ 646, 984, 199, 199, 504, 9116, 492, 3272, 199, 504, 9116, 492, 2342, 63, 5154, 421, 199, 1023, 275, 283, 16, 14, 21, 14, 16, 14, 2374, 16, 7, 199, 199, 3, 7754, 1678, 370, 88, 14, 2730, 1380, 24662, 5936, 1015, 9760, 199, 3174, 63, 6537, 275, 359, 272, 283, 18107, 389, 91, 16, 5285, 908, 8, 1023, 395, 272, 283, 2723, 31561, 389, 91, 16, 5285, 908, 8, 1023, 395, 272, 283, 2713, 22791, 297, 272, 283, 647, 11059, 8119, 17, 14, 21, 14, 21, 297, 221, 327, 2018, 19, 2291, 27, 25358, 23361, 31, 272, 327, 2104, 5496, 63, 4435, 14, 2356, 17, 14, 16, 880, 7305, 32253, 652, 370, 282, 1015, 27617, 272, 327, 911, 370, 1435, 323, 27, 1937, 327, 821, 1020, 26, 272, 283, 13623, 8119, 17, 14, 16, 297, 272, 283, 90, 13458, 14, 3266, 297, 199, 61, 199, 199, 692, 984, 14, 1023, 63, 815, 665, 334, 18, 12, 1520, 304, 272, 3907, 63, 6537, 14, 740, 360, 1805, 28, 17, 14, 17, 14, 16, 358, 199, 2836, 26, 272, 3907, 63, 6537, 14, 740, 360, 1805, 358, 199, 199, 4757, 63, 9975, 275, 359, 272, 283, 51, 7807, 8119, 17, 14, 16, 297, 221, 327, 29973, 63, 1114, 63, 1648, 275, 283, 66, 588, 616, 297, 29973, 63, 885, 63, 2469, 272, 283, 8008, 63, 29048, 63, 7915, 297, 199, 61, 199, 199, 2758, 8, 272, 536, 534, 2723, 31561, 13, 25826, 297, 272, 1015, 29, 1023, 12, 272, 1369, 628, 46, 19101, 3589, 367, 12230, 1159, 3447, 4997, 1890, 401, 272, 1166, 534, 2859, 921, 5031, 14, 957, 15, 2723, 31561, 15, 2723, 31561, 297, 272, 4132, 628, 15314, 1159, 3447, 4997, 7290, 401, 272, 4132, 63, 2123, 534, 1258, 13, 2374, 32, 2723, 31561, 14, 1308, 297, 272, 4190, 534, 28993, 844, 499, 14, 16, 297, 272, 19137, 1524, 267, 283, 23753, 9795, 3800, 650, 446, 32657, 297, 267, 283, 8263, 3800, 30317, 297, 267, 283, 23910, 23975, 3800, 6187, 9516, 3075, 2750, 297, 267, 283, 3761, 3800, 25718, 26330, 3800, 3668, 2290, 844, 297, 267, 283, 23699, 6187, 3800, 18169, 3800, 10130, 297, 267, 283, 11411, 8466, 3800, 2018, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 499, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 499, 14, 22, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 499, 14, 23, 297, 267, 283, 12157, 3800, 22026, 3800, 644, 11178, 15, 2856, 297, 267, 283, 12157, 3800, 13863, 297, 267, 283, 12157, 3800, 6187, 3800, 26866, 15, 8555, 297, 267, 283, 12157, 3800, 6187, 3800, 7220, 316, 297, 267, 283, 12157, 3800, 6187, 3800, 15285, 9516, 4633, 297, 267, 283, 12157, 3800, 738, 17933, 297, 272, 2156, 339, 6117, 29, 1623, 63, 5154, 1062, 272, 2387, 63, 2491, 63, 576, 29, 549, 12, 272, 3907, 63, 6537, 29, 3174, 63, 6537, 12, 272, 13751, 63, 4365, 3126, 267, 283, 4757, 356, 9149, 63, 9975, 12, 272, 1660, 272, 2397, 63, 3438, 3126, 267, 283, 2723, 31561, 14, 5265, 356, 359, 288, 283, 25826, 275, 4691, 31561, 63, 25826, 14, 888, 17320, 26, 46, 19101, 28051, 297, 267, 2156, 272, 1660, 272, 511, 63, 5768, 534, 2723, 31561, 63, 25826, 297, 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 ]
[ 984, 199, 199, 504, 9116, 492, 3272, 199, 504, 9116, 492, 2342, 63, 5154, 421, 199, 1023, 275, 283, 16, 14, 21, 14, 16, 14, 2374, 16, 7, 199, 199, 3, 7754, 1678, 370, 88, 14, 2730, 1380, 24662, 5936, 1015, 9760, 199, 3174, 63, 6537, 275, 359, 272, 283, 18107, 389, 91, 16, 5285, 908, 8, 1023, 395, 272, 283, 2723, 31561, 389, 91, 16, 5285, 908, 8, 1023, 395, 272, 283, 2713, 22791, 297, 272, 283, 647, 11059, 8119, 17, 14, 21, 14, 21, 297, 221, 327, 2018, 19, 2291, 27, 25358, 23361, 31, 272, 327, 2104, 5496, 63, 4435, 14, 2356, 17, 14, 16, 880, 7305, 32253, 652, 370, 282, 1015, 27617, 272, 327, 911, 370, 1435, 323, 27, 1937, 327, 821, 1020, 26, 272, 283, 13623, 8119, 17, 14, 16, 297, 272, 283, 90, 13458, 14, 3266, 297, 199, 61, 199, 199, 692, 984, 14, 1023, 63, 815, 665, 334, 18, 12, 1520, 304, 272, 3907, 63, 6537, 14, 740, 360, 1805, 28, 17, 14, 17, 14, 16, 358, 199, 2836, 26, 272, 3907, 63, 6537, 14, 740, 360, 1805, 358, 199, 199, 4757, 63, 9975, 275, 359, 272, 283, 51, 7807, 8119, 17, 14, 16, 297, 221, 327, 29973, 63, 1114, 63, 1648, 275, 283, 66, 588, 616, 297, 29973, 63, 885, 63, 2469, 272, 283, 8008, 63, 29048, 63, 7915, 297, 199, 61, 199, 199, 2758, 8, 272, 536, 534, 2723, 31561, 13, 25826, 297, 272, 1015, 29, 1023, 12, 272, 1369, 628, 46, 19101, 3589, 367, 12230, 1159, 3447, 4997, 1890, 401, 272, 1166, 534, 2859, 921, 5031, 14, 957, 15, 2723, 31561, 15, 2723, 31561, 297, 272, 4132, 628, 15314, 1159, 3447, 4997, 7290, 401, 272, 4132, 63, 2123, 534, 1258, 13, 2374, 32, 2723, 31561, 14, 1308, 297, 272, 4190, 534, 28993, 844, 499, 14, 16, 297, 272, 19137, 1524, 267, 283, 23753, 9795, 3800, 650, 446, 32657, 297, 267, 283, 8263, 3800, 30317, 297, 267, 283, 23910, 23975, 3800, 6187, 9516, 3075, 2750, 297, 267, 283, 3761, 3800, 25718, 26330, 3800, 3668, 2290, 844, 297, 267, 283, 23699, 6187, 3800, 18169, 3800, 10130, 297, 267, 283, 11411, 8466, 3800, 2018, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 499, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 499, 14, 22, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 499, 14, 23, 297, 267, 283, 12157, 3800, 22026, 3800, 644, 11178, 15, 2856, 297, 267, 283, 12157, 3800, 13863, 297, 267, 283, 12157, 3800, 6187, 3800, 26866, 15, 8555, 297, 267, 283, 12157, 3800, 6187, 3800, 7220, 316, 297, 267, 283, 12157, 3800, 6187, 3800, 15285, 9516, 4633, 297, 267, 283, 12157, 3800, 738, 17933, 297, 272, 2156, 339, 6117, 29, 1623, 63, 5154, 1062, 272, 2387, 63, 2491, 63, 576, 29, 549, 12, 272, 3907, 63, 6537, 29, 3174, 63, 6537, 12, 272, 13751, 63, 4365, 3126, 267, 283, 4757, 356, 9149, 63, 9975, 12, 272, 1660, 272, 2397, 63, 3438, 3126, 267, 283, 2723, 31561, 14, 5265, 356, 359, 288, 283, 25826, 275, 4691, 31561, 63, 25826, 14, 888, 17320, 26, 46, 19101, 28051, 297, 267, 2156, 272, 1660, 272, 511, 63, 5768, 534, 2723, 31561, 63, 25826, 297, 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, 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, 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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 ]
orwa1902/code-exemples
TicTacToe.py
1
4091
board = [] for i in range(3): board.append(["*"] * 3) #a function that creats the board def print_board(board): for row in board: print (" ".join(row)) print("Let\'s play Tic Tac Toe! the rules are simple. you, the players, is given two choices: the row and column of your symbol. note that the numbers are between 0 and 2 and not 1 and 3. have fun!") print(print_board(board)) #tg=he game itself for turn in range(1,10): print("turn number: " + str(turn)) #for every odd turn there will be x turn and for every even there will be o turn. thats because the X player alwayes start if turn == 1 or turn % 2 == 1: print ("X turn") X_col = int(input("choose row: ")) X_row = int(input("choose column: ")) # if given a number bigger than 2 or smaller than 0, you will lose a turn if (X_col > 2 or X_col < 0 or X_row > 2 or X_row < 0): print("oops, that not even on the board") print(print_board(board)) turn = turn + 1 # same goes for picking the same spot or someone else's same spot again elif board[X_row][X_col] == "X" or board[X_row][X_col] == "O": print("you have already played that spot or someone else did. try again") print(print_board(board)) else: board[X_row][X_col] = "X" print(print_board(board)) turn = turn + 1 else: print("O turn") O_col = int(input("choose row: ")) O_row = int(input("choose column: ")) if (O_col > 2 or O_col < 0 or O_row > 2 or O_row < 0): print("oops, that not even on the board") print(print_board(board)) turn = turn + 1 elif board[O_row][O_col] == "X" or board[O_row][O_col] == "O": print("you have already played that spot or someone else did. try again") print(print_board(board)) else: board[O_row][O_col] = "O" print(print_board(board)) turn = turn + 1 #win conditions #left row winner if board[0][0] == "X" and board[0][1] == "X" and board[0][2] == "X": x = "winner" print("the winner is X") break; #middle row winner elif board[1][0] == "X" and board[1][1] == "X" and board[1][2] == "X": x = "winner" print("the winner is X") break; #right row winner elif board[2][0] == "X" and board[2][1] == "X" and board[2][2]=="X": x = "winner" print("the winner is X") break; #top column winner elif board[0][0] == "X" and board[1][0] == "X" and board[2][0] == "X": x = "winner" print("the winner is X") break; #middle column winner elif board[0][1] == "X" and board[1][1] == "X" and board[2][1] == "X": x = "winner" print("the winner is X") break; #bottom line winner elif board[0][2] == "X" and board[1][2] == "X" and board[2][2] == "X": x = "winner" print("the winner is X") break; #left crossover winner elif board[0][0] == "X" and board[1][1] == "X" and board[2][2] == "X": x = "winner" print("the winner is X") break; elif board[2][0] == "X" and board[1][1] == "X" and board[0][2] == "X": x = "winner" print("the winner is X") break; #middle row winner if board[1][0] == "O" and board[1][1] == "O" and board[1][2] == "O": o = "winner" print("the winner is O") break; #right row winner elif board[2][0] == "O" and board[2][1] == "O" and board[2][2]=="O": o = "winner" print("the winner is O") break; #top column winner elif board[0][0] == "O" and board[1][0] == "O" and board[2][0] == "O": o = "winner" print("the winner is O") break; #middle column winner elif board[0][1] == "O" and board[1][1] == "O" and board[2][1] == "O": o = "winner" print("the winner is O") break; #bottom column winner elif board[0][2] == "O" and board[1][2] == "O" and board[2][2] == "O": o = "winner" print("the winner is O") break; #left crossover winner elif board[0][0] == "O" and board[1][1] == "O" and board[2][2] == "O": o = "winner" print("the winner is O") break; #right crossover winner elif board[2][0] == "O" and board[1][1] == "O" and board[0][2] == "O": o = "winner" print("the winner is O") break; #the most logical condition - a tie if turn == 9: print("It\'s a Tie!") break;
apache-2.0
[ 3576, 275, 942, 199, 509, 284, 315, 1425, 8, 19, 304, 199, 198, 3576, 14, 740, 5234, 10, 937, 627, 650, 9, 199, 3, 65, 805, 626, 2837, 1956, 314, 13811, 199, 318, 870, 63, 3576, 8, 3576, 304, 199, 198, 509, 1962, 315, 13811, 26, 507, 198, 1361, 1689, 3680, 904, 8, 1143, 430, 199, 1361, 480, 15314, 3985, 83, 5232, 377, 530, 377, 645, 4005, 69, 1, 314, 4713, 787, 3486, 14, 1265, 12, 314, 30130, 12, 365, 1627, 2877, 3415, 26, 314, 1962, 436, 2763, 402, 2195, 5272, 14, 5317, 626, 314, 5579, 787, 3382, 378, 436, 499, 436, 440, 413, 436, 650, 14, 1172, 9627, 9124, 199, 1361, 8, 1361, 63, 3576, 8, 3576, 430, 199, 199, 3, 17699, 29, 426, 9219, 6337, 199, 509, 7485, 315, 1425, 8, 17, 12, 709, 304, 199, 198, 1361, 480, 353, 1329, 26, 298, 435, 620, 8, 353, 430, 199, 198, 3, 509, 4036, 16699, 7485, 2337, 911, 506, 671, 7485, 436, 367, 4036, 2755, 2337, 911, 506, 312, 7485, 14, 626, 83, 2952, 314, 1323, 7748, 741, 3316, 397, 1343, 199, 198, 692, 7485, 508, 413, 503, 7485, 450, 499, 508, 413, 26, 507, 198, 1361, 1689, 56, 7485, 531, 507, 198, 56, 63, 761, 275, 1109, 8, 1210, 480, 16143, 1962, 26, 26725, 507, 198, 56, 63, 1143, 275, 1109, 8, 1210, 480, 16143, 2763, 26, 26725, 507, 198, 3, 340, 1627, 282, 1329, 29416, 2419, 499, 503, 12700, 2419, 378, 12, 1265, 911, 27332, 282, 7485, 507, 198, 692, 334, 56, 63, 761, 690, 499, 503, 1323, 63, 761, 665, 378, 503, 1323, 63, 1143, 690, 499, 503, 1323, 63, 1143, 665, 378, 304, 686, 198, 1361, 480, 79, 1483, 12, 626, 440, 2755, 641, 314, 13811, 531, 686, 198, 1361, 8, 1361, 63, 3576, 8, 3576, 430, 686, 198, 353, 275, 7485, 435, 413, 507, 198, 3, 2011, 13538, 367, 12433, 314, 2011, 23226, 503, 17122, 587, 1159, 2011, 23226, 4020, 9068, 198, 4164, 13811, 59, 56, 63, 1143, 1527, 56, 63, 761, 61, 508, 298, 56, 2, 503, 13811, 59, 56, 63, 1143, 1527, 56, 63, 761, 61, 508, 298, 47, 582, 686, 198, 1361, 480, 13297, 1172, 2575, 5232, 379, 626, 23226, 503, 17122, 587, 8103, 14, 862, 4020, 531, 686, 198, 1361, 8, 1361, 63, 3576, 8, 3576, 430, 507, 198, 2836, 26, 686, 198, 3576, 59, 56, 63, 1143, 1527, 56, 63, 761, 61, 275, 298, 56, 2, 26140, 198, 1361, 8, 1361, 63, 3576, 8, 3576, 430, 507, 198, 353, 275, 7485, 435, 413, 199, 198, 2836, 26, 507, 198, 1361, 480, 47, 7485, 531, 507, 198, 47, 63, 761, 275, 1109, 8, 1210, 480, 16143, 1962, 26, 26725, 507, 198, 47, 63, 1143, 275, 1109, 8, 1210, 480, 16143, 2763, 26, 26725, 507, 198, 692, 334, 47, 63, 761, 690, 499, 503, 593, 63, 761, 665, 378, 503, 593, 63, 1143, 690, 499, 503, 593, 63, 1143, 665, 378, 304, 686, 198, 1361, 480, 79, 1483, 12, 626, 440, 2755, 641, 314, 13811, 531, 686, 198, 1361, 8, 1361, 63, 3576, 8, 3576, 430, 686, 198, 353, 275, 7485, 435, 413, 507, 198, 4164, 13811, 59, 47, 63, 1143, 1527, 47, 63, 761, 61, 508, 298, 56, 2, 503, 13811, 59, 47, 63, 1143, 1527, 47, 63, 761, 61, 508, 298, 47, 582, 686, 198, 1361, 480, 13297, 1172, 2575, 5232, 379, 626, 23226, 503, 17122, 587, 8103, 14, 862, 4020, 531, 686, 198, 1361, 8, 1361, 63, 3576, 8, 3576, 430, 507, 198, 2836, 26, 686, 198, 3576, 59, 47, 63, 1143, 1527, 47, 63, 761, 61, 275, 298, 47, 2, 686, 198, 1361, 8, 1361, 63, 3576, 8, 3576, 430, 507, 198, 353, 275, 7485, 435, 413, 507, 198, 3, 2676, 3704, 507, 198, 3, 3039, 1962, 4747, 1372, 199, 198, 692, 13811, 59, 16, 1527, 16, 61, 508, 298, 56, 2, 436, 13811, 59, 16, 1527, 17, 61, 508, 298, 56, 2, 436, 13811, 59, 16, 1527, 18, 61, 508, 298, 56, 582, 686, 198, 88, 275, 298, 2676, 1372, 2, 686, 198, 1361, 480, 1589, 4747, 1372, 365, 1323, 531, 686, 198, 4785, 27, 507, 198, 3, 14885, 1962, 4747, 1372, 199, 198, 4164, 13811, 59, 17, 1527, 16, 61, 508, 298, 56, 2, 436, 13811, 59, 17, 1527, 17, 61, 508, 298, 56, 2, 436, 13811, 59, 17, 1527, 18, 61, 508, 298, 56, 582, 686, 198, 88, 275, 298, 2676, 1372, 2, 686, 198, 1361, 480, 1589, 4747, 1372, 365, 1323, 531, 686, 198, 4785, 27, 507, 198, 3, 1019, 1962, 4747, 1372, 199, 198, 4164, 13811, 59, 18, 1527, 16, 61, 508, 298, 56, 2, 436, 13811, 59, 18, 1527, 17, 61, 508, 298, 56, 2, 436, 13811, 59, 18, 1527, 18, 61, 11800, 56, 582, 686, 198, 88, 275, 298, 2676, 1372, 2, 686, 198, 1361, 480, 1589, 4747, 1372, 365, 1323, 531, 686, 198, 4785, 27, 507, 198, 3, 2119, 2763, 4747, 1372, 199, 198, 4164, 13811, 59, 16, 1527, 16, 61, 508, 298, 56, 2, 436, 13811, 59, 17, 1527, 16, 61, 508, 298, 56, 2, 436, 13811, 59, 18, 1527, 16, 61, 508, 298, 56, 582, 686, 198, 88, 275, 298, 2676, 1372, 2, 686, 198, 1361, 480, 1589, 4747, 1372, 365, 1323, 531, 686, 198, 4785, 27, 507, 198, 3, 14885, 2763, 4747, 1372, 199, 198, 4164, 13811, 59, 16, 1527, 17, 61, 508, 298, 56, 2, 436, 13811, 59, 17, 1527, 17, 61, 508, 298, 56, 2, 436, 13811, 59, 18, 1527, 17, 61, 508, 298, 56, 582, 686, 198, 88, 275, 298, 2676, 1372, 2, 686, 198, 1361, 480, 1589, 4747, 1372, 365, 1323, 531, 686, 198, 4785, 27, 507, 198, 3, 8305, 1004, 4747, 1372, 199, 198, 4164, 13811, 59, 16, 1527, 18, 61, 508, 298, 56, 2, 436, 13811, 59, 17, 1527, 18, 61, 508, 298, 56, 2, 436, 13811, 59, 18, 1527, 18, 61, 508, 298, 56, 582, 686, 198, 88, 275, 298, 2676, 1372, 2, 686, 198, 1361, 480, 1589, 4747, 1372, 365, 1323, 531, 686, 198, 4785, 27, 507, 198, 3, 3039, 8059, 1883, 4747, 1372, 199, 198, 4164, 13811, 59, 16, 1527, 16 ]
[ 275, 942, 199, 509, 284, 315, 1425, 8, 19, 304, 199, 198, 3576, 14, 740, 5234, 10, 937, 627, 650, 9, 199, 3, 65, 805, 626, 2837, 1956, 314, 13811, 199, 318, 870, 63, 3576, 8, 3576, 304, 199, 198, 509, 1962, 315, 13811, 26, 507, 198, 1361, 1689, 3680, 904, 8, 1143, 430, 199, 1361, 480, 15314, 3985, 83, 5232, 377, 530, 377, 645, 4005, 69, 1, 314, 4713, 787, 3486, 14, 1265, 12, 314, 30130, 12, 365, 1627, 2877, 3415, 26, 314, 1962, 436, 2763, 402, 2195, 5272, 14, 5317, 626, 314, 5579, 787, 3382, 378, 436, 499, 436, 440, 413, 436, 650, 14, 1172, 9627, 9124, 199, 1361, 8, 1361, 63, 3576, 8, 3576, 430, 199, 199, 3, 17699, 29, 426, 9219, 6337, 199, 509, 7485, 315, 1425, 8, 17, 12, 709, 304, 199, 198, 1361, 480, 353, 1329, 26, 298, 435, 620, 8, 353, 430, 199, 198, 3, 509, 4036, 16699, 7485, 2337, 911, 506, 671, 7485, 436, 367, 4036, 2755, 2337, 911, 506, 312, 7485, 14, 626, 83, 2952, 314, 1323, 7748, 741, 3316, 397, 1343, 199, 198, 692, 7485, 508, 413, 503, 7485, 450, 499, 508, 413, 26, 507, 198, 1361, 1689, 56, 7485, 531, 507, 198, 56, 63, 761, 275, 1109, 8, 1210, 480, 16143, 1962, 26, 26725, 507, 198, 56, 63, 1143, 275, 1109, 8, 1210, 480, 16143, 2763, 26, 26725, 507, 198, 3, 340, 1627, 282, 1329, 29416, 2419, 499, 503, 12700, 2419, 378, 12, 1265, 911, 27332, 282, 7485, 507, 198, 692, 334, 56, 63, 761, 690, 499, 503, 1323, 63, 761, 665, 378, 503, 1323, 63, 1143, 690, 499, 503, 1323, 63, 1143, 665, 378, 304, 686, 198, 1361, 480, 79, 1483, 12, 626, 440, 2755, 641, 314, 13811, 531, 686, 198, 1361, 8, 1361, 63, 3576, 8, 3576, 430, 686, 198, 353, 275, 7485, 435, 413, 507, 198, 3, 2011, 13538, 367, 12433, 314, 2011, 23226, 503, 17122, 587, 1159, 2011, 23226, 4020, 9068, 198, 4164, 13811, 59, 56, 63, 1143, 1527, 56, 63, 761, 61, 508, 298, 56, 2, 503, 13811, 59, 56, 63, 1143, 1527, 56, 63, 761, 61, 508, 298, 47, 582, 686, 198, 1361, 480, 13297, 1172, 2575, 5232, 379, 626, 23226, 503, 17122, 587, 8103, 14, 862, 4020, 531, 686, 198, 1361, 8, 1361, 63, 3576, 8, 3576, 430, 507, 198, 2836, 26, 686, 198, 3576, 59, 56, 63, 1143, 1527, 56, 63, 761, 61, 275, 298, 56, 2, 26140, 198, 1361, 8, 1361, 63, 3576, 8, 3576, 430, 507, 198, 353, 275, 7485, 435, 413, 199, 198, 2836, 26, 507, 198, 1361, 480, 47, 7485, 531, 507, 198, 47, 63, 761, 275, 1109, 8, 1210, 480, 16143, 1962, 26, 26725, 507, 198, 47, 63, 1143, 275, 1109, 8, 1210, 480, 16143, 2763, 26, 26725, 507, 198, 692, 334, 47, 63, 761, 690, 499, 503, 593, 63, 761, 665, 378, 503, 593, 63, 1143, 690, 499, 503, 593, 63, 1143, 665, 378, 304, 686, 198, 1361, 480, 79, 1483, 12, 626, 440, 2755, 641, 314, 13811, 531, 686, 198, 1361, 8, 1361, 63, 3576, 8, 3576, 430, 686, 198, 353, 275, 7485, 435, 413, 507, 198, 4164, 13811, 59, 47, 63, 1143, 1527, 47, 63, 761, 61, 508, 298, 56, 2, 503, 13811, 59, 47, 63, 1143, 1527, 47, 63, 761, 61, 508, 298, 47, 582, 686, 198, 1361, 480, 13297, 1172, 2575, 5232, 379, 626, 23226, 503, 17122, 587, 8103, 14, 862, 4020, 531, 686, 198, 1361, 8, 1361, 63, 3576, 8, 3576, 430, 507, 198, 2836, 26, 686, 198, 3576, 59, 47, 63, 1143, 1527, 47, 63, 761, 61, 275, 298, 47, 2, 686, 198, 1361, 8, 1361, 63, 3576, 8, 3576, 430, 507, 198, 353, 275, 7485, 435, 413, 507, 198, 3, 2676, 3704, 507, 198, 3, 3039, 1962, 4747, 1372, 199, 198, 692, 13811, 59, 16, 1527, 16, 61, 508, 298, 56, 2, 436, 13811, 59, 16, 1527, 17, 61, 508, 298, 56, 2, 436, 13811, 59, 16, 1527, 18, 61, 508, 298, 56, 582, 686, 198, 88, 275, 298, 2676, 1372, 2, 686, 198, 1361, 480, 1589, 4747, 1372, 365, 1323, 531, 686, 198, 4785, 27, 507, 198, 3, 14885, 1962, 4747, 1372, 199, 198, 4164, 13811, 59, 17, 1527, 16, 61, 508, 298, 56, 2, 436, 13811, 59, 17, 1527, 17, 61, 508, 298, 56, 2, 436, 13811, 59, 17, 1527, 18, 61, 508, 298, 56, 582, 686, 198, 88, 275, 298, 2676, 1372, 2, 686, 198, 1361, 480, 1589, 4747, 1372, 365, 1323, 531, 686, 198, 4785, 27, 507, 198, 3, 1019, 1962, 4747, 1372, 199, 198, 4164, 13811, 59, 18, 1527, 16, 61, 508, 298, 56, 2, 436, 13811, 59, 18, 1527, 17, 61, 508, 298, 56, 2, 436, 13811, 59, 18, 1527, 18, 61, 11800, 56, 582, 686, 198, 88, 275, 298, 2676, 1372, 2, 686, 198, 1361, 480, 1589, 4747, 1372, 365, 1323, 531, 686, 198, 4785, 27, 507, 198, 3, 2119, 2763, 4747, 1372, 199, 198, 4164, 13811, 59, 16, 1527, 16, 61, 508, 298, 56, 2, 436, 13811, 59, 17, 1527, 16, 61, 508, 298, 56, 2, 436, 13811, 59, 18, 1527, 16, 61, 508, 298, 56, 582, 686, 198, 88, 275, 298, 2676, 1372, 2, 686, 198, 1361, 480, 1589, 4747, 1372, 365, 1323, 531, 686, 198, 4785, 27, 507, 198, 3, 14885, 2763, 4747, 1372, 199, 198, 4164, 13811, 59, 16, 1527, 17, 61, 508, 298, 56, 2, 436, 13811, 59, 17, 1527, 17, 61, 508, 298, 56, 2, 436, 13811, 59, 18, 1527, 17, 61, 508, 298, 56, 582, 686, 198, 88, 275, 298, 2676, 1372, 2, 686, 198, 1361, 480, 1589, 4747, 1372, 365, 1323, 531, 686, 198, 4785, 27, 507, 198, 3, 8305, 1004, 4747, 1372, 199, 198, 4164, 13811, 59, 16, 1527, 18, 61, 508, 298, 56, 2, 436, 13811, 59, 17, 1527, 18, 61, 508, 298, 56, 2, 436, 13811, 59, 18, 1527, 18, 61, 508, 298, 56, 582, 686, 198, 88, 275, 298, 2676, 1372, 2, 686, 198, 1361, 480, 1589, 4747, 1372, 365, 1323, 531, 686, 198, 4785, 27, 507, 198, 3, 3039, 8059, 1883, 4747, 1372, 199, 198, 4164, 13811, 59, 16, 1527, 16, 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,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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 ]
kai5263499/networkx
examples/graph/unix_email.py
62
2683
#!/usr/bin/env python """ Create a directed graph, allowing multiple edges and self loops, from a unix mailbox. The nodes are email addresses with links that point from the sender to the recievers. The edge data is a Python email.Message object which contains all of the email message data. This example shows the power of XDiGraph to hold edge data of arbitrary Python objects (in this case a list of email messages). By default, load the sample unix email mailbox called "unix_email.mbox". You can load your own mailbox by naming it on the command line, eg python unixemail.py /var/spool/mail/username """ __author__ = """Aric Hagberg (hagberg@lanl.gov)""" # Copyright (C) 2005 by # Aric Hagberg <hagberg@lanl.gov> # Dan Schult <dschult@colgate.edu> # Pieter Swart <swart@lanl.gov> # All rights reserved. # BSD license. import email from email.utils import getaddresses,parseaddr import mailbox import sys # unix mailbox recipe # see http://www.python.org/doc/current/lib/module-mailbox.html def msgfactory(fp): try: return email.message_from_file(fp) except email.Errors.MessageParseError: # Don't return None since that will stop the mailbox iterator return '' if __name__ == '__main__': import networkx as nx try: import matplotlib.pyplot as plt except: pass if len(sys.argv)==1: filePath = "unix_email.mbox" else: filePath = sys.argv[1] mbox = mailbox.mbox(filePath, msgfactory) # parse unix mailbox G=nx.MultiDiGraph() # create empty graph # parse each messages and build graph for msg in mbox: # msg is python email.Message.Message object (source_name,source_addr) = parseaddr(msg['From']) # sender # get all recipients # see http://www.python.org/doc/current/lib/module-email.Utils.html tos = msg.get_all('to', []) ccs = msg.get_all('cc', []) resent_tos = msg.get_all('resent-to', []) resent_ccs = msg.get_all('resent-cc', []) all_recipients = getaddresses(tos + ccs + resent_tos + resent_ccs) # now add the edges for this mail message for (target_name,target_addr) in all_recipients: G.add_edge(source_addr,target_addr,message=msg) # print edges with message subject for (u,v,d) in G.edges_iter(data=True): print("From: %s To: %s Subject: %s"%(u,v,d['message']["Subject"])) try: # draw pos=nx.spring_layout(G,iterations=10) nx.draw(G,pos,node_size=0,alpha=0.4,edge_color='r',font_size=16) plt.savefig("unix_email.png") plt.show() except: # matplotlib not available pass
bsd-3-clause
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 624, 199, 2499, 282, 23667, 3343, 12, 17266, 3663, 8207, 436, 291, 17222, 12, 687, 199, 65, 16572, 17470, 14, 221, 710, 3380, 787, 3031, 7149, 543, 6220, 199, 9099, 2376, 687, 314, 8904, 370, 314, 295, 559, 5907, 83, 14, 221, 710, 6275, 666, 199, 374, 282, 2018, 3031, 14, 2209, 909, 1314, 3509, 1006, 402, 199, 1589, 3031, 1245, 666, 14, 9948, 199, 2765, 2893, 13703, 314, 7074, 402, 1323, 23208, 370, 10266, 6275, 666, 199, 1618, 9697, 2018, 2251, 334, 262, 642, 1930, 282, 769, 402, 3031, 3788, 680, 199, 199, 2175, 849, 12, 2248, 314, 2690, 16572, 3031, 17470, 2797, 298, 11864, 63, 2123, 14, 27201, 1674, 199, 5556, 883, 2248, 2195, 5705, 17470, 701, 19720, 652, 641, 314, 1414, 1004, 12, 11837, 199, 199, 1548, 16572, 2123, 14, 647, 1182, 1391, 15, 83, 2293, 15, 1198, 15, 2473, 199, 199, 624, 199, 363, 2502, 363, 275, 408, 33, 1567, 869, 643, 14630, 334, 72, 643, 14630, 32, 1502, 76, 14, 16294, 9471, 199, 3, 259, 1898, 334, 35, 9, 11811, 701, 221, 199, 3, 259, 437, 1567, 869, 643, 14630, 665, 72, 643, 14630, 32, 1502, 76, 14, 16294, 30, 199, 3, 259, 24747, 22985, 427, 665, 795, 335, 427, 32, 761, 3237, 14, 8654, 30, 199, 3, 259, 510, 1873, 351, 16666, 580, 665, 3519, 580, 32, 1502, 76, 14, 16294, 30, 199, 3, 259, 2900, 4481, 4644, 14, 199, 3, 259, 6289, 4190, 14, 199, 199, 646, 3031, 199, 504, 3031, 14, 1208, 492, 664, 7423, 12, 1122, 2697, 199, 646, 17470, 199, 646, 984, 199, 199, 3, 16572, 17470, 17121, 199, 3, 1937, 1455, 921, 1544, 14, 1548, 14, 1308, 15, 1301, 15, 1818, 15, 773, 15, 578, 13, 21869, 14, 1360, 199, 318, 1499, 3702, 8, 3997, 304, 272, 862, 26, 267, 372, 3031, 14, 1188, 63, 504, 63, 493, 8, 3997, 9, 272, 871, 3031, 14, 9298, 14, 2209, 9123, 26, 267, 327, 7529, 1133, 372, 488, 3967, 626, 911, 3631, 314, 17470, 6122, 267, 372, 2125, 4388, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 339, 492, 24313, 465, 8484, 272, 862, 26, 4960, 492, 8027, 14, 13563, 465, 4488, 272, 871, 26, 267, 986, 339, 340, 822, 8, 1274, 14, 3020, 12694, 17, 26, 267, 570, 2042, 275, 298, 11864, 63, 2123, 14, 27201, 2, 272, 587, 26, 267, 570, 2042, 275, 984, 14, 3020, 59, 17, 61, 339, 333, 1977, 275, 17470, 14, 27201, 8, 27501, 12, 1499, 3702, 9, 327, 2198, 16572, 17470, 339, 598, 29, 7343, 14, 3947, 23208, 342, 327, 1218, 2701, 3343, 339, 327, 2198, 1924, 3788, 436, 1900, 3343, 5591, 367, 1499, 315, 333, 1977, 26, 327, 1499, 365, 2366, 3031, 14, 2209, 14, 2209, 909, 267, 334, 1365, 63, 354, 12, 1365, 63, 2697, 9, 275, 2198, 2697, 8, 1328, 459, 2532, 1105, 327, 8904, 267, 327, 664, 1006, 19255, 267, 327, 1937, 1455, 921, 1544, 14, 1548, 14, 1308, 15, 1301, 15, 1818, 15, 773, 15, 578, 13, 2123, 14, 7535, 14, 1360, 267, 370, 83, 275, 1499, 14, 362, 63, 452, 360, 475, 297, 3073, 267, 286, 1259, 275, 1499, 14, 362, 63, 452, 360, 2055, 297, 3073, 267, 295, 1150, 63, 14543, 275, 1499, 14, 362, 63, 452, 360, 264, 1150, 13, 475, 297, 3073, 267, 295, 1150, 63, 67, 1259, 275, 1499, 14, 362, 63, 452, 360, 264, 1150, 13, 2055, 297, 3073, 267, 1006, 63, 18323, 275, 664, 7423, 8, 14543, 435, 286, 1259, 435, 295, 1150, 63, 14543, 435, 295, 1150, 63, 67, 1259, 9, 267, 327, 3063, 1050, 314, 8207, 367, 642, 6016, 1245, 267, 367, 334, 1375, 63, 354, 12, 1375, 63, 2697, 9, 315, 1006, 63, 18323, 26, 288, 598, 14, 525, 63, 5173, 8, 1365, 63, 2697, 12, 1375, 63, 2697, 12, 1188, 29, 1328, 9, 257, 339, 327, 870, 8207, 543, 1245, 5420, 272, 367, 334, 85, 12, 86, 12, 68, 9, 315, 598, 14, 6929, 63, 1661, 8, 576, 29, 549, 304, 267, 870, 480, 2532, 26, 450, 83, 4005, 26, 450, 83, 26793, 26, 450, 83, 14007, 85, 12, 86, 12, 68, 459, 1188, 418, 905, 13528, 13045, 1362, 339, 862, 26, 327, 5954, 267, 2086, 29, 7343, 14, 26008, 63, 4209, 8, 39, 12, 13570, 29, 709, 9, 267, 8484, 14, 5485, 8, 39, 12, 1712, 12, 932, 63, 890, 29, 16, 12, 4468, 29, 16, 14, 20, 12, 5173, 63, 2326, 534, 82, 297, 4246, 63, 890, 29, 975, 9, 267, 4488, 14, 19556, 480, 11864, 63, 2123, 14, 4524, 531, 267, 4488, 14, 2384, 342, 272, 871, 26, 327, 8027, 440, 2808, 267, 986, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 624, 199, 2499, 282, 23667, 3343, 12, 17266, 3663, 8207, 436, 291, 17222, 12, 687, 199, 65, 16572, 17470, 14, 221, 710, 3380, 787, 3031, 7149, 543, 6220, 199, 9099, 2376, 687, 314, 8904, 370, 314, 295, 559, 5907, 83, 14, 221, 710, 6275, 666, 199, 374, 282, 2018, 3031, 14, 2209, 909, 1314, 3509, 1006, 402, 199, 1589, 3031, 1245, 666, 14, 9948, 199, 2765, 2893, 13703, 314, 7074, 402, 1323, 23208, 370, 10266, 6275, 666, 199, 1618, 9697, 2018, 2251, 334, 262, 642, 1930, 282, 769, 402, 3031, 3788, 680, 199, 199, 2175, 849, 12, 2248, 314, 2690, 16572, 3031, 17470, 2797, 298, 11864, 63, 2123, 14, 27201, 1674, 199, 5556, 883, 2248, 2195, 5705, 17470, 701, 19720, 652, 641, 314, 1414, 1004, 12, 11837, 199, 199, 1548, 16572, 2123, 14, 647, 1182, 1391, 15, 83, 2293, 15, 1198, 15, 2473, 199, 199, 624, 199, 363, 2502, 363, 275, 408, 33, 1567, 869, 643, 14630, 334, 72, 643, 14630, 32, 1502, 76, 14, 16294, 9471, 199, 3, 259, 1898, 334, 35, 9, 11811, 701, 221, 199, 3, 259, 437, 1567, 869, 643, 14630, 665, 72, 643, 14630, 32, 1502, 76, 14, 16294, 30, 199, 3, 259, 24747, 22985, 427, 665, 795, 335, 427, 32, 761, 3237, 14, 8654, 30, 199, 3, 259, 510, 1873, 351, 16666, 580, 665, 3519, 580, 32, 1502, 76, 14, 16294, 30, 199, 3, 259, 2900, 4481, 4644, 14, 199, 3, 259, 6289, 4190, 14, 199, 199, 646, 3031, 199, 504, 3031, 14, 1208, 492, 664, 7423, 12, 1122, 2697, 199, 646, 17470, 199, 646, 984, 199, 199, 3, 16572, 17470, 17121, 199, 3, 1937, 1455, 921, 1544, 14, 1548, 14, 1308, 15, 1301, 15, 1818, 15, 773, 15, 578, 13, 21869, 14, 1360, 199, 318, 1499, 3702, 8, 3997, 304, 272, 862, 26, 267, 372, 3031, 14, 1188, 63, 504, 63, 493, 8, 3997, 9, 272, 871, 3031, 14, 9298, 14, 2209, 9123, 26, 267, 327, 7529, 1133, 372, 488, 3967, 626, 911, 3631, 314, 17470, 6122, 267, 372, 2125, 4388, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 339, 492, 24313, 465, 8484, 272, 862, 26, 4960, 492, 8027, 14, 13563, 465, 4488, 272, 871, 26, 267, 986, 339, 340, 822, 8, 1274, 14, 3020, 12694, 17, 26, 267, 570, 2042, 275, 298, 11864, 63, 2123, 14, 27201, 2, 272, 587, 26, 267, 570, 2042, 275, 984, 14, 3020, 59, 17, 61, 339, 333, 1977, 275, 17470, 14, 27201, 8, 27501, 12, 1499, 3702, 9, 327, 2198, 16572, 17470, 339, 598, 29, 7343, 14, 3947, 23208, 342, 327, 1218, 2701, 3343, 339, 327, 2198, 1924, 3788, 436, 1900, 3343, 5591, 367, 1499, 315, 333, 1977, 26, 327, 1499, 365, 2366, 3031, 14, 2209, 14, 2209, 909, 267, 334, 1365, 63, 354, 12, 1365, 63, 2697, 9, 275, 2198, 2697, 8, 1328, 459, 2532, 1105, 327, 8904, 267, 327, 664, 1006, 19255, 267, 327, 1937, 1455, 921, 1544, 14, 1548, 14, 1308, 15, 1301, 15, 1818, 15, 773, 15, 578, 13, 2123, 14, 7535, 14, 1360, 267, 370, 83, 275, 1499, 14, 362, 63, 452, 360, 475, 297, 3073, 267, 286, 1259, 275, 1499, 14, 362, 63, 452, 360, 2055, 297, 3073, 267, 295, 1150, 63, 14543, 275, 1499, 14, 362, 63, 452, 360, 264, 1150, 13, 475, 297, 3073, 267, 295, 1150, 63, 67, 1259, 275, 1499, 14, 362, 63, 452, 360, 264, 1150, 13, 2055, 297, 3073, 267, 1006, 63, 18323, 275, 664, 7423, 8, 14543, 435, 286, 1259, 435, 295, 1150, 63, 14543, 435, 295, 1150, 63, 67, 1259, 9, 267, 327, 3063, 1050, 314, 8207, 367, 642, 6016, 1245, 267, 367, 334, 1375, 63, 354, 12, 1375, 63, 2697, 9, 315, 1006, 63, 18323, 26, 288, 598, 14, 525, 63, 5173, 8, 1365, 63, 2697, 12, 1375, 63, 2697, 12, 1188, 29, 1328, 9, 257, 339, 327, 870, 8207, 543, 1245, 5420, 272, 367, 334, 85, 12, 86, 12, 68, 9, 315, 598, 14, 6929, 63, 1661, 8, 576, 29, 549, 304, 267, 870, 480, 2532, 26, 450, 83, 4005, 26, 450, 83, 26793, 26, 450, 83, 14007, 85, 12, 86, 12, 68, 459, 1188, 418, 905, 13528, 13045, 1362, 339, 862, 26, 327, 5954, 267, 2086, 29, 7343, 14, 26008, 63, 4209, 8, 39, 12, 13570, 29, 709, 9, 267, 8484, 14, 5485, 8, 39, 12, 1712, 12, 932, 63, 890, 29, 16, 12, 4468, 29, 16, 14, 20, 12, 5173, 63, 2326, 534, 82, 297, 4246, 63, 890, 29, 975, 9, 267, 4488, 14, 19556, 480, 11864, 63, 2123, 14, 4524, 531, 267, 4488, 14, 2384, 342, 272, 871, 26, 327, 8027, 440, 2808, 267, 986, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
40223139/39g7test
static/Brython3.1.0-20150301-090019/Lib/platform.py
620
51006
#!/usr/bin/env python3 """ This module tries to retrieve as much platform-identifying data as possible. It makes this information available via function APIs. If called from the command line, it prints the platform information concatenated as single string to stdout. The output format is useable as part of a filename. """ # This module is maintained by Marc-Andre Lemburg <mal@egenix.com>. # If you find problems, please submit bug reports/patches via the # Python bug tracker (http://bugs.python.org) and assign them to "lemburg". # # Still needed: # * more support for WinCE # * support for MS-DOS (PythonDX ?) # * support for Amiga and other still unsupported platforms running Python # * support for additional Linux distributions # # Many thanks to all those who helped adding platform-specific # checks (in no particular order): # # Charles G Waldman, David Arnold, Gordon McMillan, Ben Darnell, # Jeff Bauer, Cliff Crawford, Ivan Van Laningham, Josef # Betancourt, Randall Hopper, Karl Putland, John Farrell, Greg # Andruk, Just van Rossum, Thomas Heller, Mark R. Levinson, Mark # Hammond, Bill Tutt, Hans Nowak, Uwe Zessin (OpenVMS support), # Colin Kong, Trent Mick, Guido van Rossum, Anthony Baxter # # History: # # <see CVS and SVN checkin messages for history> # # 1.0.7 - added DEV_NULL # 1.0.6 - added linux_distribution() # 1.0.5 - fixed Java support to allow running the module on Jython # 1.0.4 - added IronPython support # 1.0.3 - added normalization of Windows system name # 1.0.2 - added more Windows support # 1.0.1 - reformatted to make doc.py happy # 1.0.0 - reformatted a bit and checked into Python CVS # 0.8.0 - added sys.version parser and various new access # APIs (python_version(), python_compiler(), etc.) # 0.7.2 - fixed architecture() to use sizeof(pointer) where available # 0.7.1 - added support for Caldera OpenLinux # 0.7.0 - some fixes for WinCE; untabified the source file # 0.6.2 - support for OpenVMS - requires version 1.5.2-V006 or higher and # vms_lib.getsyi() configured # 0.6.1 - added code to prevent 'uname -p' on platforms which are # known not to support it # 0.6.0 - fixed win32_ver() to hopefully work on Win95,98,NT and Win2k; # did some cleanup of the interfaces - some APIs have changed # 0.5.5 - fixed another type in the MacOS code... should have # used more coffee today ;-) # 0.5.4 - fixed a few typos in the MacOS code # 0.5.3 - added experimental MacOS support; added better popen() # workarounds in _syscmd_ver() -- still not 100% elegant # though # 0.5.2 - fixed uname() to return '' instead of 'unknown' in all # return values (the system uname command tends to return # 'unknown' instead of just leaving the field emtpy) # 0.5.1 - included code for slackware dist; added exception handlers # to cover up situations where platforms don't have os.popen # (e.g. Mac) or fail on socket.gethostname(); fixed libc # detection RE # 0.5.0 - changed the API names referring to system commands to *syscmd*; # added java_ver(); made syscmd_ver() a private # API (was system_ver() in previous versions) -- use uname() # instead; extended the win32_ver() to also return processor # type information # 0.4.0 - added win32_ver() and modified the platform() output for WinXX # 0.3.4 - fixed a bug in _follow_symlinks() # 0.3.3 - fixed popen() and "file" command invokation bugs # 0.3.2 - added architecture() API and support for it in platform() # 0.3.1 - fixed syscmd_ver() RE to support Windows NT # 0.3.0 - added system alias support # 0.2.3 - removed 'wince' again... oh well. # 0.2.2 - added 'wince' to syscmd_ver() supported platforms # 0.2.1 - added cache logic and changed the platform string format # 0.2.0 - changed the API to use functions instead of module globals # since some action take too long to be run on module import # 0.1.0 - first release # # You can always get the latest version of this module at: # # http://www.egenix.com/files/python/platform.py # # If that URL should fail, try contacting the author. __copyright__ = """ Copyright (c) 1999-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com Copyright (c) 2000-2010, eGenix.com Software GmbH; mailto:info@egenix.com Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee or royalty is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation or portions thereof, including modifications, that you make. EGENIX.COM SOFTWARE GMBH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE ! """ __version__ = '1.0.7' import collections import sys, os, re, subprocess ### Globals & Constants # Determine the platform's /dev/null device try: DEV_NULL = os.devnull except AttributeError: # os.devnull was added in Python 2.4, so emulate it for earlier # Python versions if sys.platform in ('dos','win32','win16','os2'): # Use the old CP/M NUL as device name DEV_NULL = 'NUL' else: # Standard Unix uses /dev/null DEV_NULL = '/dev/null' ### Platform specific APIs _libc_search = re.compile(b'(__libc_init)' b'|' b'(GLIBC_([0-9.]+))' b'|' br'(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)', re.ASCII) def libc_ver(executable=sys.executable,lib='',version='', chunksize=16384): """ Tries to determine the libc version that the file executable (which defaults to the Python interpreter) is linked against. Returns a tuple of strings (lib,version) which default to the given parameters in case the lookup fails. Note that the function has intimate knowledge of how different libc versions add symbols to the executable and thus is probably only useable for executables compiled using gcc. The file is read and scanned in chunks of chunksize bytes. """ if hasattr(os.path, 'realpath'): # Python 2.2 introduced os.path.realpath(); it is used # here to work around problems with Cygwin not being # able to open symlinks for reading executable = os.path.realpath(executable) f = open(executable,'rb') binary = f.read(chunksize) pos = 0 while 1: if b'libc' in binary or b'GLIBC' in binary: m = _libc_search.search(binary,pos) else: m = None if not m: binary = f.read(chunksize) if not binary: break pos = 0 continue libcinit,glibc,glibcversion,so,threads,soversion = [ s.decode('latin1') if s is not None else s for s in m.groups()] if libcinit and not lib: lib = 'libc' elif glibc: if lib != 'glibc': lib = 'glibc' version = glibcversion elif glibcversion > version: version = glibcversion elif so: if lib != 'glibc': lib = 'libc' if soversion and soversion > version: version = soversion if threads and version[-len(threads):] != threads: version = version + threads pos = m.end() f.close() return lib,version def _dist_try_harder(distname,version,id): """ Tries some special tricks to get the distribution information in case the default method fails. Currently supports older SuSE Linux, Caldera OpenLinux and Slackware Linux distributions. """ if os.path.exists('/var/adm/inst-log/info'): # SuSE Linux stores distribution information in that file distname = 'SuSE' for line in open('/var/adm/inst-log/info'): tv = line.split() if len(tv) == 2: tag,value = tv else: continue if tag == 'MIN_DIST_VERSION': version = value.strip() elif tag == 'DIST_IDENT': values = value.split('-') id = values[2] return distname,version,id if os.path.exists('/etc/.installed'): # Caldera OpenLinux has some infos in that file (thanks to Colin Kong) for line in open('/etc/.installed'): pkg = line.split('-') if len(pkg) >= 2 and pkg[0] == 'OpenLinux': # XXX does Caldera support non Intel platforms ? If yes, # where can we find the needed id ? return 'OpenLinux',pkg[1],id if os.path.isdir('/usr/lib/setup'): # Check for slackware version tag file (thanks to Greg Andruk) verfiles = os.listdir('/usr/lib/setup') for n in range(len(verfiles)-1, -1, -1): if verfiles[n][:14] != 'slack-version-': del verfiles[n] if verfiles: verfiles.sort() distname = 'slackware' version = verfiles[-1][14:] return distname,version,id return distname,version,id _release_filename = re.compile(r'(\w+)[-_](release|version)', re.ASCII) _lsb_release_version = re.compile(r'(.+)' ' release ' '([\d.]+)' '[^(]*(?:\((.+)\))?', re.ASCII) _release_version = re.compile(r'([^0-9]+)' '(?: release )?' '([\d.]+)' '[^(]*(?:\((.+)\))?', re.ASCII) # See also http://www.novell.com/coolsolutions/feature/11251.html # and http://linuxmafia.com/faq/Admin/release-files.html # and http://data.linux-ntfs.org/rpm/whichrpm # and http://www.die.net/doc/linux/man/man1/lsb_release.1.html _supported_dists = ( 'SuSE', 'debian', 'fedora', 'redhat', 'centos', 'mandrake', 'mandriva', 'rocks', 'slackware', 'yellowdog', 'gentoo', 'UnitedLinux', 'turbolinux', 'arch', 'mageia') def _parse_release_file(firstline): # Default to empty 'version' and 'id' strings. Both defaults are used # when 'firstline' is empty. 'id' defaults to empty when an id can not # be deduced. version = '' id = '' # Parse the first line m = _lsb_release_version.match(firstline) if m is not None: # LSB format: "distro release x.x (codename)" return tuple(m.groups()) # Pre-LSB format: "distro x.x (codename)" m = _release_version.match(firstline) if m is not None: return tuple(m.groups()) # Unknown format... take the first two words l = firstline.strip().split() if l: version = l[0] if len(l) > 1: id = l[1] return '', version, id def linux_distribution(distname='', version='', id='', supported_dists=_supported_dists, full_distribution_name=1): """ Tries to determine the name of the Linux OS distribution name. The function first looks for a distribution release file in /etc and then reverts to _dist_try_harder() in case no suitable files are found. supported_dists may be given to define the set of Linux distributions to look for. It defaults to a list of currently supported Linux distributions identified by their release file name. If full_distribution_name is true (default), the full distribution read from the OS is returned. Otherwise the short name taken from supported_dists is used. Returns a tuple (distname,version,id) which default to the args given as parameters. """ try: etc = os.listdir('/etc') except os.error: # Probably not a Unix system return distname,version,id etc.sort() for file in etc: m = _release_filename.match(file) if m is not None: _distname,dummy = m.groups() if _distname in supported_dists: distname = _distname break else: return _dist_try_harder(distname,version,id) # Read the first line with open('/etc/'+file, 'r') as f: firstline = f.readline() _distname, _version, _id = _parse_release_file(firstline) if _distname and full_distribution_name: distname = _distname if _version: version = _version if _id: id = _id return distname, version, id # To maintain backwards compatibility: def dist(distname='',version='',id='', supported_dists=_supported_dists): """ Tries to determine the name of the Linux OS distribution name. The function first looks for a distribution release file in /etc and then reverts to _dist_try_harder() in case no suitable files are found. Returns a tuple (distname,version,id) which default to the args given as parameters. """ return linux_distribution(distname, version, id, supported_dists=supported_dists, full_distribution_name=0) def popen(cmd, mode='r', bufsize=-1): """ Portable popen() interface. """ import warnings warnings.warn('use os.popen instead', DeprecationWarning, stacklevel=2) return os.popen(cmd, mode, bufsize) def _norm_version(version, build=''): """ Normalize the version and build strings and return a single version string using the format major.minor.build (or patchlevel). """ l = version.split('.') if build: l.append(build) try: ints = map(int,l) except ValueError: strings = l else: strings = list(map(str,ints)) version = '.'.join(strings[:3]) return version _ver_output = re.compile(r'(?:([\w ]+) ([\w.]+) ' '.*' '\[.* ([\d.]+)\])') # Examples of VER command output: # # Windows 2000: Microsoft Windows 2000 [Version 5.00.2195] # Windows XP: Microsoft Windows XP [Version 5.1.2600] # Windows Vista: Microsoft Windows [Version 6.0.6002] # # Note that the "Version" string gets localized on different # Windows versions. def _syscmd_ver(system='', release='', version='', supported_platforms=('win32','win16','dos','os2')): """ Tries to figure out the OS version used and returns a tuple (system,release,version). It uses the "ver" shell command for this which is known to exists on Windows, DOS and OS/2. XXX Others too ? In case this fails, the given parameters are used as defaults. """ if sys.platform not in supported_platforms: return system,release,version # Try some common cmd strings for cmd in ('ver','command /c ver','cmd /c ver'): try: pipe = popen(cmd) info = pipe.read() if pipe.close(): raise os.error('command failed') # XXX How can I suppress shell errors from being written # to stderr ? except os.error as why: #print 'Command %s failed: %s' % (cmd,why) continue except IOError as why: #print 'Command %s failed: %s' % (cmd,why) continue else: break else: return system,release,version # Parse the output info = info.strip() m = _ver_output.match(info) if m is not None: system,release,version = m.groups() # Strip trailing dots from version and release if release[-1] == '.': release = release[:-1] if version[-1] == '.': version = version[:-1] # Normalize the version and build strings (eliminating additional # zeros) version = _norm_version(version) return system,release,version def _win32_getvalue(key,name,default=''): """ Read a value for name from the registry key. In case this fails, default is returned. """ try: # Use win32api if available from win32api import RegQueryValueEx except ImportError: # On Python 2.0 and later, emulate using winreg import winreg RegQueryValueEx = winreg.QueryValueEx try: return RegQueryValueEx(key,name) except: return default def win32_ver(release='',version='',csd='',ptype=''): """ Get additional version information from the Windows Registry and return a tuple (version,csd,ptype) referring to version number, CSD level (service pack), and OS type (multi/single processor). As a hint: ptype returns 'Uniprocessor Free' on single processor NT machines and 'Multiprocessor Free' on multi processor machines. The 'Free' refers to the OS version being free of debugging code. It could also state 'Checked' which means the OS version uses debugging code, i.e. code that checks arguments, ranges, etc. (Thomas Heller). Note: this function works best with Mark Hammond's win32 package installed, but also on Python 2.3 and later. It obviously only runs on Win32 compatible platforms. """ # XXX Is there any way to find out the processor type on WinXX ? # XXX Is win32 available on Windows CE ? # # Adapted from code posted by Karl Putland to comp.lang.python. # # The mappings between reg. values and release names can be found # here: http://msdn.microsoft.com/library/en-us/sysinfo/base/osversioninfo_str.asp # Import the needed APIs try: import win32api from win32api import RegQueryValueEx, RegOpenKeyEx, \ RegCloseKey, GetVersionEx from win32con import HKEY_LOCAL_MACHINE, VER_PLATFORM_WIN32_NT, \ VER_PLATFORM_WIN32_WINDOWS, VER_NT_WORKSTATION except ImportError: # Emulate the win32api module using Python APIs try: sys.getwindowsversion except AttributeError: # No emulation possible, so return the defaults... return release,version,csd,ptype else: # Emulation using winreg (added in Python 2.0) and # sys.getwindowsversion() (added in Python 2.3) import winreg GetVersionEx = sys.getwindowsversion RegQueryValueEx = winreg.QueryValueEx RegOpenKeyEx = winreg.OpenKeyEx RegCloseKey = winreg.CloseKey HKEY_LOCAL_MACHINE = winreg.HKEY_LOCAL_MACHINE VER_PLATFORM_WIN32_WINDOWS = 1 VER_PLATFORM_WIN32_NT = 2 VER_NT_WORKSTATION = 1 VER_NT_SERVER = 3 REG_SZ = 1 # Find out the registry key and some general version infos winver = GetVersionEx() maj,min,buildno,plat,csd = winver version = '%i.%i.%i' % (maj,min,buildno & 0xFFFF) if hasattr(winver, "service_pack"): if winver.service_pack != "": csd = 'SP%s' % winver.service_pack_major else: if csd[:13] == 'Service Pack ': csd = 'SP' + csd[13:] if plat == VER_PLATFORM_WIN32_WINDOWS: regkey = 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion' # Try to guess the release name if maj == 4: if min == 0: release = '95' elif min == 10: release = '98' elif min == 90: release = 'Me' else: release = 'postMe' elif maj == 5: release = '2000' elif plat == VER_PLATFORM_WIN32_NT: regkey = 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion' if maj <= 4: release = 'NT' elif maj == 5: if min == 0: release = '2000' elif min == 1: release = 'XP' elif min == 2: release = '2003Server' else: release = 'post2003' elif maj == 6: if hasattr(winver, "product_type"): product_type = winver.product_type else: product_type = VER_NT_WORKSTATION # Without an OSVERSIONINFOEX capable sys.getwindowsversion(), # or help from the registry, we cannot properly identify # non-workstation versions. try: key = RegOpenKeyEx(HKEY_LOCAL_MACHINE, regkey) name, type = RegQueryValueEx(key, "ProductName") # Discard any type that isn't REG_SZ if type == REG_SZ and name.find("Server") != -1: product_type = VER_NT_SERVER except WindowsError: # Use default of VER_NT_WORKSTATION pass if min == 0: if product_type == VER_NT_WORKSTATION: release = 'Vista' else: release = '2008Server' elif min == 1: if product_type == VER_NT_WORKSTATION: release = '7' else: release = '2008ServerR2' elif min == 2: if product_type == VER_NT_WORKSTATION: release = '8' else: release = '2012Server' else: release = 'post2012Server' else: if not release: # E.g. Win3.1 with win32s release = '%i.%i' % (maj,min) return release,version,csd,ptype # Open the registry key try: keyCurVer = RegOpenKeyEx(HKEY_LOCAL_MACHINE, regkey) # Get a value to make sure the key exists... RegQueryValueEx(keyCurVer, 'SystemRoot') except: return release,version,csd,ptype # Parse values #subversion = _win32_getvalue(keyCurVer, # 'SubVersionNumber', # ('',1))[0] #if subversion: # release = release + subversion # 95a, 95b, etc. build = _win32_getvalue(keyCurVer, 'CurrentBuildNumber', ('',1))[0] ptype = _win32_getvalue(keyCurVer, 'CurrentType', (ptype,1))[0] # Normalize version version = _norm_version(version,build) # Close key RegCloseKey(keyCurVer) return release,version,csd,ptype def _mac_ver_lookup(selectors,default=None): from _gestalt import gestalt l = [] append = l.append for selector in selectors: try: append(gestalt(selector)) except (RuntimeError, OSError): append(default) return l def _bcd2str(bcd): return hex(bcd)[2:] def _mac_ver_gestalt(): """ Thanks to Mark R. Levinson for mailing documentation links and code examples for this function. Documentation for the gestalt() API is available online at: http://www.rgaros.nl/gestalt/ """ # Check whether the version info module is available try: import _gestalt except ImportError: return None # Get the infos sysv, sysa = _mac_ver_lookup(('sysv','sysa')) # Decode the infos if sysv: major = (sysv & 0xFF00) >> 8 minor = (sysv & 0x00F0) >> 4 patch = (sysv & 0x000F) if (major, minor) >= (10, 4): # the 'sysv' gestald cannot return patchlevels # higher than 9. Apple introduced 3 new # gestalt codes in 10.4 to deal with this # issue (needed because patch levels can # run higher than 9, such as 10.4.11) major,minor,patch = _mac_ver_lookup(('sys1','sys2','sys3')) release = '%i.%i.%i' %(major, minor, patch) else: release = '%s.%i.%i' % (_bcd2str(major),minor,patch) if sysa: machine = {0x1: '68k', 0x2: 'PowerPC', 0xa: 'i386'}.get(sysa,'') versioninfo=('', '', '') return release,versioninfo,machine def _mac_ver_xml(): fn = '/System/Library/CoreServices/SystemVersion.plist' if not os.path.exists(fn): return None try: import plistlib except ImportError: return None pl = plistlib.readPlist(fn) release = pl['ProductVersion'] versioninfo=('', '', '') machine = os.uname().machine if machine in ('ppc', 'Power Macintosh'): # for compatibility with the gestalt based code machine = 'PowerPC' return release,versioninfo,machine def mac_ver(release='',versioninfo=('','',''),machine=''): """ Get MacOS version information and return it as tuple (release, versioninfo, machine) with versioninfo being a tuple (version, dev_stage, non_release_version). Entries which cannot be determined are set to the parameter values which default to ''. All tuple entries are strings. """ # First try reading the information from an XML file which should # always be present info = _mac_ver_xml() if info is not None: return info # If that doesn't work for some reason fall back to reading the # information using gestalt calls. info = _mac_ver_gestalt() if info is not None: return info # If that also doesn't work return the default values return release,versioninfo,machine def _java_getprop(name,default): from java.lang import System try: value = System.getProperty(name) if value is None: return default return value except AttributeError: return default def java_ver(release='',vendor='',vminfo=('','',''),osinfo=('','','')): """ Version interface for Jython. Returns a tuple (release,vendor,vminfo,osinfo) with vminfo being a tuple (vm_name,vm_release,vm_vendor) and osinfo being a tuple (os_name,os_version,os_arch). Values which cannot be determined are set to the defaults given as parameters (which all default to ''). """ # Import the needed APIs try: import java.lang except ImportError: return release,vendor,vminfo,osinfo vendor = _java_getprop('java.vendor', vendor) release = _java_getprop('java.version', release) vm_name, vm_release, vm_vendor = vminfo vm_name = _java_getprop('java.vm.name', vm_name) vm_vendor = _java_getprop('java.vm.vendor', vm_vendor) vm_release = _java_getprop('java.vm.version', vm_release) vminfo = vm_name, vm_release, vm_vendor os_name, os_version, os_arch = osinfo os_arch = _java_getprop('java.os.arch', os_arch) os_name = _java_getprop('java.os.name', os_name) os_version = _java_getprop('java.os.version', os_version) osinfo = os_name, os_version, os_arch return release, vendor, vminfo, osinfo ### System name aliasing def system_alias(system,release,version): """ Returns (system,release,version) aliased to common marketing names used for some systems. It also does some reordering of the information in some cases where it would otherwise cause confusion. """ if system == 'Rhapsody': # Apple's BSD derivative # XXX How can we determine the marketing release number ? return 'MacOS X Server',system+release,version elif system == 'SunOS': # Sun's OS if release < '5': # These releases use the old name SunOS return system,release,version # Modify release (marketing release = SunOS release - 3) l = release.split('.') if l: try: major = int(l[0]) except ValueError: pass else: major = major - 3 l[0] = str(major) release = '.'.join(l) if release < '6': system = 'Solaris' else: # XXX Whatever the new SunOS marketing name is... system = 'Solaris' elif system == 'IRIX64': # IRIX reports IRIX64 on platforms with 64-bit support; yet it # is really a version and not a different platform, since 32-bit # apps are also supported.. system = 'IRIX' if version: version = version + ' (64bit)' else: version = '64bit' elif system in ('win32','win16'): # In case one of the other tricks system = 'Windows' return system,release,version ### Various internal helpers def _platform(*args): """ Helper to format the platform string in a filename compatible format e.g. "system-version-machine". """ # Format the platform string platform = '-'.join(x.strip() for x in filter(len, args)) # Cleanup some possible filename obstacles... platform = platform.replace(' ','_') platform = platform.replace('/','-') platform = platform.replace('\\','-') platform = platform.replace(':','-') platform = platform.replace(';','-') platform = platform.replace('"','-') platform = platform.replace('(','-') platform = platform.replace(')','-') # No need to report 'unknown' information... platform = platform.replace('unknown','') # Fold '--'s and remove trailing '-' while 1: cleaned = platform.replace('--','-') if cleaned == platform: break platform = cleaned while platform[-1] == '-': platform = platform[:-1] return platform def _node(default=''): """ Helper to determine the node name of this machine. """ try: import socket except ImportError: # No sockets... return default try: return socket.gethostname() except socket.error: # Still not working... return default def _follow_symlinks(filepath): """ In case filepath is a symlink, follow it until a real file is reached. """ filepath = os.path.abspath(filepath) while os.path.islink(filepath): filepath = os.path.normpath( os.path.join(os.path.dirname(filepath),os.readlink(filepath))) return filepath def _syscmd_uname(option,default=''): """ Interface to the system's uname command. """ if sys.platform in ('dos','win32','win16','os2'): # XXX Others too ? return default try: f = os.popen('uname %s 2> %s' % (option, DEV_NULL)) except (AttributeError,os.error): return default output = f.read().strip() rc = f.close() if not output or rc: return default else: return output def _syscmd_file(target,default=''): """ Interface to the system's file command. The function uses the -b option of the file command to have it omit the filename in its output. Follow the symlinks. It returns default in case the command should fail. """ if sys.platform in ('dos','win32','win16','os2'): # XXX Others too ? return default target = _follow_symlinks(target) try: proc = subprocess.Popen(['file', target], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) except (AttributeError,os.error): return default output = proc.communicate()[0].decode('latin-1') rc = proc.wait() if not output or rc: return default else: return output ### Information about the used architecture # Default values for architecture; non-empty strings override the # defaults given as parameters _default_architecture = { 'win32': ('','WindowsPE'), 'win16': ('','Windows'), 'dos': ('','MSDOS'), } def architecture(executable=sys.executable,bits='',linkage=''): """ Queries the given executable (defaults to the Python interpreter binary) for various architecture information. Returns a tuple (bits,linkage) which contains information about the bit architecture and the linkage format used for the executable. Both values are returned as strings. Values that cannot be determined are returned as given by the parameter presets. If bits is given as '', the sizeof(pointer) (or sizeof(long) on Python version < 1.5.2) is used as indicator for the supported pointer size. The function relies on the system's "file" command to do the actual work. This is available on most if not all Unix platforms. On some non-Unix platforms where the "file" command does not exist and the executable is set to the Python interpreter binary defaults from _default_architecture are used. """ # Use the sizeof(pointer) as default number of bits if nothing # else is given as default. if not bits: import struct try: size = struct.calcsize('P') except struct.error: # Older installations can only query longs size = struct.calcsize('l') bits = str(size*8) + 'bit' # Get data from the 'file' system command if executable: fileout = _syscmd_file(executable, '') else: fileout = '' if not fileout and \ executable == sys.executable: # "file" command did not return anything; we'll try to provide # some sensible defaults then... if sys.platform in _default_architecture: b,l = _default_architecture[sys.platform] if b: bits = b if l: linkage = l return bits,linkage if 'executable' not in fileout: # Format not supported return bits,linkage # Bits if '32-bit' in fileout: bits = '32bit' elif 'N32' in fileout: # On Irix only bits = 'n32bit' elif '64-bit' in fileout: bits = '64bit' # Linkage if 'ELF' in fileout: linkage = 'ELF' elif 'PE' in fileout: # E.g. Windows uses this format if 'Windows' in fileout: linkage = 'WindowsPE' else: linkage = 'PE' elif 'COFF' in fileout: linkage = 'COFF' elif 'MS-DOS' in fileout: linkage = 'MSDOS' else: # XXX the A.OUT format also falls under this class... pass return bits,linkage ### Portable uname() interface uname_result = collections.namedtuple("uname_result", "system node release version machine processor") _uname_cache = None def uname(): """ Fairly portable uname interface. Returns a tuple of strings (system,node,release,version,machine,processor) identifying the underlying platform. Note that unlike the os.uname function this also returns possible processor information as an additional tuple entry. Entries which cannot be determined are set to ''. """ global _uname_cache no_os_uname = 0 if _uname_cache is not None: return _uname_cache processor = '' # Get some infos from the builtin os.uname API... try: system,node,release,version,machine = os.uname() except AttributeError: no_os_uname = 1 if no_os_uname or not list(filter(None, (system, node, release, version, machine))): # Hmm, no there is either no uname or uname has returned #'unknowns'... we'll have to poke around the system then. if no_os_uname: system = sys.platform release = '' version = '' node = _node() machine = '' use_syscmd_ver = 1 # Try win32_ver() on win32 platforms if system == 'win32': release,version,csd,ptype = win32_ver() if release and version: use_syscmd_ver = 0 # Try to use the PROCESSOR_* environment variables # available on Win XP and later; see # http://support.microsoft.com/kb/888731 and # http://www.geocities.com/rick_lively/MANUALS/ENV/MSWIN/PROCESSI.HTM if not machine: # WOW64 processes mask the native architecture if "PROCESSOR_ARCHITEW6432" in os.environ: machine = os.environ.get("PROCESSOR_ARCHITEW6432", '') else: machine = os.environ.get('PROCESSOR_ARCHITECTURE', '') if not processor: processor = os.environ.get('PROCESSOR_IDENTIFIER', machine) # Try the 'ver' system command available on some # platforms if use_syscmd_ver: system,release,version = _syscmd_ver(system) # Normalize system to what win32_ver() normally returns # (_syscmd_ver() tends to return the vendor name as well) if system == 'Microsoft Windows': system = 'Windows' elif system == 'Microsoft' and release == 'Windows': # Under Windows Vista and Windows Server 2008, # Microsoft changed the output of the ver command. The # release is no longer printed. This causes the # system and release to be misidentified. system = 'Windows' if '6.0' == version[:3]: release = 'Vista' else: release = '' # In case we still don't know anything useful, we'll try to # help ourselves if system in ('win32','win16'): if not version: if system == 'win32': version = '32bit' else: version = '16bit' system = 'Windows' elif system[:4] == 'java': release,vendor,vminfo,osinfo = java_ver() system = 'Java' version = ', '.join(vminfo) if not version: version = vendor # System specific extensions if system == 'OpenVMS': # OpenVMS seems to have release and version mixed up if not release or release == '0': release = version version = '' # Get processor information try: import vms_lib except ImportError: pass else: csid, cpu_number = vms_lib.getsyi('SYI$_CPU',0) if (cpu_number >= 128): processor = 'Alpha' else: processor = 'VAX' if not processor: # Get processor information from the uname system command processor = _syscmd_uname('-p','') #If any unknowns still exist, replace them with ''s, which are more portable if system == 'unknown': system = '' if node == 'unknown': node = '' if release == 'unknown': release = '' if version == 'unknown': version = '' if machine == 'unknown': machine = '' if processor == 'unknown': processor = '' # normalize name if system == 'Microsoft' and release == 'Windows': system = 'Windows' release = 'Vista' _uname_cache = uname_result(system,node,release,version,machine,processor) return _uname_cache ### Direct interfaces to some of the uname() return values def system(): """ Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'. An empty string is returned if the value cannot be determined. """ return uname().system def node(): """ Returns the computer's network name (which may not be fully qualified) An empty string is returned if the value cannot be determined. """ return uname().node def release(): """ Returns the system's release, e.g. '2.2.0' or 'NT' An empty string is returned if the value cannot be determined. """ return uname().release def version(): """ Returns the system's release version, e.g. '#3 on degas' An empty string is returned if the value cannot be determined. """ return uname().version def machine(): """ Returns the machine type, e.g. 'i386' An empty string is returned if the value cannot be determined. """ return uname().machine def processor(): """ Returns the (true) processor name, e.g. 'amdk6' An empty string is returned if the value cannot be determined. Note that many platforms do not provide this information or simply return the same value as for machine(), e.g. NetBSD does this. """ return uname().processor ### Various APIs for extracting information from sys.version _sys_version_parser = re.compile( r'([\w.+]+)\s*' '\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*' '\[([^\]]+)\]?', re.ASCII) _ironpython_sys_version_parser = re.compile( r'IronPython\s*' '([\d\.]+)' '(?: \(([\d\.]+)\))?' ' on (.NET [\d\.]+)', re.ASCII) # IronPython covering 2.6 and 2.7 _ironpython26_sys_version_parser = re.compile( r'([\d.]+)\s*' '\(IronPython\s*' '[\d.]+\s*' '\(([\d.]+)\) on ([\w.]+ [\d.]+(?: \(\d+-bit\))?)\)' ) _pypy_sys_version_parser = re.compile( r'([\w.+]+)\s*' '\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*' '\[PyPy [^\]]+\]?') _sys_version_cache = {} def _sys_version(sys_version=None): """ Returns a parsed version of Python's sys.version as tuple (name, version, branch, revision, buildno, builddate, compiler) referring to the Python implementation name, version, branch, revision, build number, build date/time as string and the compiler identification string. Note that unlike the Python sys.version, the returned value for the Python version will always include the patchlevel (it defaults to '.0'). The function returns empty strings for tuple entries that cannot be determined. sys_version may be given to parse an alternative version string, e.g. if the version was read from a different Python interpreter. """ # Get the Python version if sys_version is None: sys_version = sys.version # Try the cache first result = _sys_version_cache.get(sys_version, None) if result is not None: return result # Parse it if 'Brython' in sys_version: # IronPython name = 'Brython' _parser=re.compile("^(\d+\.\d+\.\d+)[^[]+\[(.*)\]") match=_parser.match(sys_version) if match is None: raise ValueError( 'failed to parse Brython sys.version: %s' % repr(sys_version)) #version, alt_version, compiler = match.groups() version, compiler = match.groups() alt_version = '' buildno = '' builddate = '' elif 'IronPython' in sys_version: # IronPython name = 'IronPython' if sys_version.startswith('IronPython'): match = _ironpython_sys_version_parser.match(sys_version) else: match = _ironpython26_sys_version_parser.match(sys_version) if match is None: raise ValueError( 'failed to parse IronPython sys.version: %s' % repr(sys_version)) version, alt_version, compiler = match.groups() buildno = '' builddate = '' elif sys.platform.startswith('java'): # Jython name = 'Jython' match = _sys_version_parser.match(sys_version) if match is None: raise ValueError( 'failed to parse Jython sys.version: %s' % repr(sys_version)) version, buildno, builddate, buildtime, _ = match.groups() compiler = sys.platform elif "PyPy" in sys_version: # PyPy name = "PyPy" match = _pypy_sys_version_parser.match(sys_version) if match is None: raise ValueError("failed to parse PyPy sys.version: %s" % repr(sys_version)) version, buildno, builddate, buildtime = match.groups() compiler = "" else: # CPython match = _sys_version_parser.match(sys_version) if match is None: raise ValueError( 'failed to parse CPython sys.version: %s' % repr(sys_version)) version, buildno, builddate, buildtime, compiler = \ match.groups() name = 'CPython' builddate = builddate + ' ' + buildtime if hasattr(sys, '_mercurial'): _, branch, revision = sys._mercurial elif hasattr(sys, 'subversion'): # sys.subversion was added in Python 2.5 _, branch, revision = sys.subversion else: branch = '' revision = '' # Add the patchlevel version if missing l = version.split('.') if len(l) == 2: l.append('0') version = '.'.join(l) # Build and cache the result result = (name, version, branch, revision, buildno, builddate, compiler) _sys_version_cache[sys_version] = result return result def python_implementation(): """ Returns a string identifying the Python implementation. Currently, the following implementations are identified: 'CPython' (C implementation of Python), 'IronPython' (.NET implementation of Python), 'Jython' (Java implementation of Python), 'PyPy' (Python implementation of Python). """ return _sys_version()[0] def python_version(): """ Returns the Python version as string 'major.minor.patchlevel' Note that unlike the Python sys.version, the returned value will always include the patchlevel (it defaults to 0). """ return _sys_version()[1] def python_version_tuple(): """ Returns the Python version as tuple (major, minor, patchlevel) of strings. Note that unlike the Python sys.version, the returned value will always include the patchlevel (it defaults to 0). """ return tuple(_sys_version()[1].split('.')) def python_branch(): """ Returns a string identifying the Python implementation branch. For CPython this is the Subversion branch from which the Python binary was built. If not available, an empty string is returned. """ return _sys_version()[2] def python_revision(): """ Returns a string identifying the Python implementation revision. For CPython this is the Subversion revision from which the Python binary was built. If not available, an empty string is returned. """ return _sys_version()[3] def python_build(): """ Returns a tuple (buildno, builddate) stating the Python build number and date as strings. """ return _sys_version()[4:6] def python_compiler(): """ Returns a string identifying the compiler used for compiling Python. """ return _sys_version()[6] ### The Opus Magnum of platform strings :-) _platform_cache = {} def platform(aliased=0, terse=0): """ Returns a single string identifying the underlying platform with as much useful information as possible (but no more :). The output is intended to be human readable rather than machine parseable. It may look different on different platforms and this is intended. If "aliased" is true, the function will use aliases for various platforms that report system names which differ from their common names, e.g. SunOS will be reported as Solaris. The system_alias() function is used to implement this. Setting terse to true causes the function to return only the absolute minimum information needed to identify the platform. """ result = _platform_cache.get((aliased, terse), None) if result is not None: return result # Get uname information and then apply platform specific cosmetics # to it... system,node,release,version,machine,processor = uname() if machine == processor: processor = '' if aliased: system,release,version = system_alias(system,release,version) if system == 'Windows': # MS platforms rel,vers,csd,ptype = win32_ver(version) if terse: platform = _platform(system,release) else: platform = _platform(system,release,version,csd) elif system in ('Linux',): # Linux based systems distname,distversion,distid = dist('') if distname and not terse: platform = _platform(system,release,machine,processor, 'with', distname,distversion,distid) else: # If the distribution name is unknown check for libc vs. glibc libcname,libcversion = libc_ver(sys.executable) platform = _platform(system,release,machine,processor, 'with', libcname+libcversion) elif system == 'Java': # Java platforms r,v,vminfo,(os_name,os_version,os_arch) = java_ver() if terse or not os_name: platform = _platform(system,release,version) else: platform = _platform(system,release,version, 'on', os_name,os_version,os_arch) elif system == 'MacOS': # MacOS platforms if terse: platform = _platform(system,release) else: platform = _platform(system,release,machine) else: # Generic handler if terse: platform = _platform(system,release) else: bits,linkage = architecture(sys.executable) platform = _platform(system,release,machine,processor,bits,linkage) _platform_cache[(aliased, terse)] = platform return platform ### Command line interface if __name__ == '__main__': # Default is to print the aliased verbose platform string terse = ('terse' in sys.argv or '--terse' in sys.argv) aliased = (not 'nonaliased' in sys.argv and not '--nonaliased' in sys.argv) print(platform(aliased,terse)) sys.exit(0)
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 19, 199, 199, 624, 961, 859, 11275, 370, 8044, 465, 8298, 4298, 13, 22232, 316, 666, 465, 272, 3962, 14, 2779, 7704, 642, 2556, 2808, 4799, 805, 15913, 14, 339, 982, 2797, 687, 314, 1414, 1004, 12, 652, 14767, 314, 4298, 272, 2556, 26271, 465, 2849, 1059, 370, 3839, 14, 710, 1072, 272, 1475, 365, 675, 461, 465, 1777, 402, 282, 1788, 14, 199, 199, 624, 199, 3, 259, 961, 859, 365, 26391, 701, 603, 9912, 13, 3325, 264, 7005, 32649, 665, 2174, 32, 69, 2268, 1148, 14, 957, 10827, 199, 3, 259, 982, 1265, 2342, 8826, 12, 8749, 11482, 6519, 13924, 15, 11350, 4799, 314, 199, 3, 259, 2018, 6519, 15271, 334, 1014, 921, 13017, 14, 1548, 14, 1308, 9, 436, 5090, 3062, 370, 298, 274, 32649, 1674, 199, 3, 199, 3, 259, 428, 12587, 4346, 26, 199, 3, 259, 627, 1655, 2291, 367, 13036, 2089, 199, 3, 259, 627, 2291, 367, 14282, 13, 32735, 334, 4718, 19596, 5805, 9, 199, 3, 259, 627, 2291, 367, 437, 4071, 65, 436, 1163, 5139, 16313, 10677, 3879, 2018, 199, 3, 259, 627, 2291, 367, 4722, 10130, 10208, 199, 3, 199, 3, 259, 15517, 2419, 6080, 370, 1006, 5204, 3963, 20181, 1915, 7791, 4298, 13, 6100, 199, 3, 259, 5920, 334, 262, 949, 6770, 1865, 304, 199, 3, 199, 3, 420, 6659, 2978, 598, 644, 27075, 1237, 12, 20232, 1952, 78, 1753, 12, 598, 2181, 265, 22895, 45, 778, 290, 12, 26844, 577, 1060, 1697, 12, 199, 3, 420, 1603, 3609, 699, 3844, 281, 12, 445, 317, 556, 445, 1773, 18090, 12, 473, 20662, 812, 290, 491, 290, 316, 10670, 12, 1603, 3362, 70, 199, 3, 420, 31535, 290, 331, 20471, 12, 820, 460, 452, 869, 411, 529, 12, 1804, 285, 76, 16280, 9688, 12, 17815, 481, 285, 264, 914, 12, 29096, 199, 3, 420, 6061, 82, 3210, 12, 13870, 20744, 6848, 385, 453, 12, 27864, 869, 352, 1435, 12, 7173, 820, 14, 491, 6857, 262, 834, 12, 7173, 199, 3, 420, 869, 455, 2106, 68, 12, 699, 778, 377, 337, 84, 12, 869, 796, 7356, 1151, 12, 738, 1129, 3107, 16709, 262, 334, 4299, 54, 3053, 2291, 395, 199, 3, 420, 3626, 262, 1804, 951, 12, 377, 640, 603, 2000, 12, 598, 1535, 79, 20744, 6848, 385, 453, 12, 1626, 898, 89, 699, 1219, 351, 199, 3, 199, 3, 259, 27829, 26, 199, 3, 199, 3, 259, 665, 3239, 445, 7428, 436, 24639, 1104, 262, 3788, 367, 7994, 30, 199, 3, 199, 3, 259, 413, 14, 16, 14, 23, 446, 3483, 3265, 54, 63, 8084, 199, 3, 259, 413, 14, 16, 14, 22, 446, 3483, 18369, 63, 4972, 342, 199, 3, 259, 413, 14, 16, 14, 21, 446, 6317, 9586, 2291, 370, 2040, 3879, 314, 859, 641, 25333, 199, 3, 259, 413, 14, 16, 14, 20, 446, 3483, 473, 2641, 4718, 2291, 199, 3, 259, 413, 14, 16, 14, 19, 446, 3483, 16973, 402, 5417, 2656, 536, 199, 3, 259, 413, 14, 16, 14, 18, 446, 3483, 1655, 5417, 2291, 199, 3, 259, 413, 14, 16, 14, 17, 446, 295, 15317, 370, 1852, 1382, 14, 647, 394, 18869, 199, 3, 259, 413, 14, 16, 14, 16, 446, 295, 15317, 282, 4546, 436, 7923, 1901, 2018, 445, 7428, 199, 3, 259, 378, 14, 24, 14, 16, 446, 3483, 984, 14, 1023, 1798, 436, 7750, 892, 2879, 199, 3, 3322, 15913, 334, 1548, 63, 1023, 1062, 2366, 63, 5772, 1062, 5423, 4959, 199, 3, 259, 378, 14, 23, 14, 18, 446, 6317, 15931, 342, 370, 675, 13855, 8, 3929, 9, 2382, 2808, 199, 3, 259, 378, 14, 23, 14, 17, 446, 3483, 2291, 367, 8256, 271, 345, 3232, 14091, 199, 3, 259, 378, 14, 23, 14, 16, 446, 2005, 25079, 367, 13036, 2089, 27, 625, 2902, 4541, 314, 1350, 570, 199, 3, 259, 378, 14, 22, 14, 18, 446, 2291, 367, 3232, 54, 3053, 446, 5074, 1015, 413, 14, 21, 14, 18, 13, 54, 8010, 503, 10948, 436, 199, 3, 3322, 22505, 63, 773, 14, 362, 1786, 73, 342, 7526, 199, 3, 259, 378, 14, 22, 14, 17, 446, 3483, 1233, 370, 7981, 283, 16040, 446, 80, 7, 641, 10677, 1314, 787, 199, 3, 3322, 6040, 440, 370, 2291, 652, 199, 3, 259, 378, 14, 22, 14, 16, 446, 6317, 4747, 708, 63, 422, 342, 370, 3661, 5836, 1736, 641, 13036, 2720, 12, 2905, 12, 12460, 436, 13036, 18, 75, 27, 199, 3, 3322, 8103, 2005, 9058, 402, 314, 8386, 446, 2005, 15913, 1172, 2896, 199, 3, 259, 378, 14, 21, 14, 21, 446, 6317, 4573, 730, 315, 314, 10444, 3100, 1233, 1396, 1077, 1172, 199, 3, 3322, 1202, 1655, 512, 24715, 11168, 8700, 13, 9, 199, 3, 259, 378, 14, 21, 14, 20, 446, 6317, 282, 9284, 10284, 1712, 315, 314, 10444, 3100, 1233, 199, 3, 259, 378, 14, 21, 14, 19, 446, 3483, 22820, 10444, 3100, 2291, 27, 3483, 8034, 17758, 342, 199, 3, 3322, 18092, 83, 315, 485, 1786, 551, 1064, 63, 422, 342, 1553, 5139, 440, 2948, 5, 325, 4170, 867, 199, 3, 3322, 10617, 199, 3, 259, 378, 14, 21, 14, 18, 446, 6317, 28179, 342, 370, 372, 2125, 3140, 402, 283, 5187, 7, 315, 1006, 199, 3, 3322, 372, 1338, 334, 1589, 2656, 28179, 1414, 16685, 795, 370, 372, 199, 3, 3322, 283, 5187, 7, 3140, 402, 2951, 23188, 314, 901, 325, 2037, 647, 9, 199, 3, 259, 378, 14, 21, 14, 17, 446, 5120, 1233, 367, 29877, 1068, 2917, 27, 3483, 1919, 8297, 199, 3, 3322, 370, 8486, 1536, 24325, 2382, 10677, 2793, 1133, 1172, 747, 14, 12207, 199, 3, 3322, 334, 69, 14, 71, 14, 10444, 9, 503, 2449, 641, 2838, 14, 29789, 7303, 6317, 1973, 67, 199, 3, 3322, 15212, 5363, 199, 3, 259, 378, 14, 21, 14, 16, 446, 2896, 314, 3261, 1561, 21864, 370, 2656, 3718, 370, 627, 1786, 551, 1064, 10, 27, 199, 3, 3322, 3483, 12120, 63, 422, 7303, 6326, 1847, 551, 1064, 63, 422, 342, 282, 5726, 199, 3, 3322, 3261, 334, 10274, 2656, 63, 422, 342, 315, 4136, 5459, 9, 1553, 675, 28179, 342, 199, 3, 3322, 3140, 27, 9243, 314, 4747, 708, 63, 422 ]
[ 2647, 15, 1393, 15, 1813, 2366, 19, 199, 199, 624, 961, 859, 11275, 370, 8044, 465, 8298, 4298, 13, 22232, 316, 666, 465, 272, 3962, 14, 2779, 7704, 642, 2556, 2808, 4799, 805, 15913, 14, 339, 982, 2797, 687, 314, 1414, 1004, 12, 652, 14767, 314, 4298, 272, 2556, 26271, 465, 2849, 1059, 370, 3839, 14, 710, 1072, 272, 1475, 365, 675, 461, 465, 1777, 402, 282, 1788, 14, 199, 199, 624, 199, 3, 259, 961, 859, 365, 26391, 701, 603, 9912, 13, 3325, 264, 7005, 32649, 665, 2174, 32, 69, 2268, 1148, 14, 957, 10827, 199, 3, 259, 982, 1265, 2342, 8826, 12, 8749, 11482, 6519, 13924, 15, 11350, 4799, 314, 199, 3, 259, 2018, 6519, 15271, 334, 1014, 921, 13017, 14, 1548, 14, 1308, 9, 436, 5090, 3062, 370, 298, 274, 32649, 1674, 199, 3, 199, 3, 259, 428, 12587, 4346, 26, 199, 3, 259, 627, 1655, 2291, 367, 13036, 2089, 199, 3, 259, 627, 2291, 367, 14282, 13, 32735, 334, 4718, 19596, 5805, 9, 199, 3, 259, 627, 2291, 367, 437, 4071, 65, 436, 1163, 5139, 16313, 10677, 3879, 2018, 199, 3, 259, 627, 2291, 367, 4722, 10130, 10208, 199, 3, 199, 3, 259, 15517, 2419, 6080, 370, 1006, 5204, 3963, 20181, 1915, 7791, 4298, 13, 6100, 199, 3, 259, 5920, 334, 262, 949, 6770, 1865, 304, 199, 3, 199, 3, 420, 6659, 2978, 598, 644, 27075, 1237, 12, 20232, 1952, 78, 1753, 12, 598, 2181, 265, 22895, 45, 778, 290, 12, 26844, 577, 1060, 1697, 12, 199, 3, 420, 1603, 3609, 699, 3844, 281, 12, 445, 317, 556, 445, 1773, 18090, 12, 473, 20662, 812, 290, 491, 290, 316, 10670, 12, 1603, 3362, 70, 199, 3, 420, 31535, 290, 331, 20471, 12, 820, 460, 452, 869, 411, 529, 12, 1804, 285, 76, 16280, 9688, 12, 17815, 481, 285, 264, 914, 12, 29096, 199, 3, 420, 6061, 82, 3210, 12, 13870, 20744, 6848, 385, 453, 12, 27864, 869, 352, 1435, 12, 7173, 820, 14, 491, 6857, 262, 834, 12, 7173, 199, 3, 420, 869, 455, 2106, 68, 12, 699, 778, 377, 337, 84, 12, 869, 796, 7356, 1151, 12, 738, 1129, 3107, 16709, 262, 334, 4299, 54, 3053, 2291, 395, 199, 3, 420, 3626, 262, 1804, 951, 12, 377, 640, 603, 2000, 12, 598, 1535, 79, 20744, 6848, 385, 453, 12, 1626, 898, 89, 699, 1219, 351, 199, 3, 199, 3, 259, 27829, 26, 199, 3, 199, 3, 259, 665, 3239, 445, 7428, 436, 24639, 1104, 262, 3788, 367, 7994, 30, 199, 3, 199, 3, 259, 413, 14, 16, 14, 23, 446, 3483, 3265, 54, 63, 8084, 199, 3, 259, 413, 14, 16, 14, 22, 446, 3483, 18369, 63, 4972, 342, 199, 3, 259, 413, 14, 16, 14, 21, 446, 6317, 9586, 2291, 370, 2040, 3879, 314, 859, 641, 25333, 199, 3, 259, 413, 14, 16, 14, 20, 446, 3483, 473, 2641, 4718, 2291, 199, 3, 259, 413, 14, 16, 14, 19, 446, 3483, 16973, 402, 5417, 2656, 536, 199, 3, 259, 413, 14, 16, 14, 18, 446, 3483, 1655, 5417, 2291, 199, 3, 259, 413, 14, 16, 14, 17, 446, 295, 15317, 370, 1852, 1382, 14, 647, 394, 18869, 199, 3, 259, 413, 14, 16, 14, 16, 446, 295, 15317, 282, 4546, 436, 7923, 1901, 2018, 445, 7428, 199, 3, 259, 378, 14, 24, 14, 16, 446, 3483, 984, 14, 1023, 1798, 436, 7750, 892, 2879, 199, 3, 3322, 15913, 334, 1548, 63, 1023, 1062, 2366, 63, 5772, 1062, 5423, 4959, 199, 3, 259, 378, 14, 23, 14, 18, 446, 6317, 15931, 342, 370, 675, 13855, 8, 3929, 9, 2382, 2808, 199, 3, 259, 378, 14, 23, 14, 17, 446, 3483, 2291, 367, 8256, 271, 345, 3232, 14091, 199, 3, 259, 378, 14, 23, 14, 16, 446, 2005, 25079, 367, 13036, 2089, 27, 625, 2902, 4541, 314, 1350, 570, 199, 3, 259, 378, 14, 22, 14, 18, 446, 2291, 367, 3232, 54, 3053, 446, 5074, 1015, 413, 14, 21, 14, 18, 13, 54, 8010, 503, 10948, 436, 199, 3, 3322, 22505, 63, 773, 14, 362, 1786, 73, 342, 7526, 199, 3, 259, 378, 14, 22, 14, 17, 446, 3483, 1233, 370, 7981, 283, 16040, 446, 80, 7, 641, 10677, 1314, 787, 199, 3, 3322, 6040, 440, 370, 2291, 652, 199, 3, 259, 378, 14, 22, 14, 16, 446, 6317, 4747, 708, 63, 422, 342, 370, 3661, 5836, 1736, 641, 13036, 2720, 12, 2905, 12, 12460, 436, 13036, 18, 75, 27, 199, 3, 3322, 8103, 2005, 9058, 402, 314, 8386, 446, 2005, 15913, 1172, 2896, 199, 3, 259, 378, 14, 21, 14, 21, 446, 6317, 4573, 730, 315, 314, 10444, 3100, 1233, 1396, 1077, 1172, 199, 3, 3322, 1202, 1655, 512, 24715, 11168, 8700, 13, 9, 199, 3, 259, 378, 14, 21, 14, 20, 446, 6317, 282, 9284, 10284, 1712, 315, 314, 10444, 3100, 1233, 199, 3, 259, 378, 14, 21, 14, 19, 446, 3483, 22820, 10444, 3100, 2291, 27, 3483, 8034, 17758, 342, 199, 3, 3322, 18092, 83, 315, 485, 1786, 551, 1064, 63, 422, 342, 1553, 5139, 440, 2948, 5, 325, 4170, 867, 199, 3, 3322, 10617, 199, 3, 259, 378, 14, 21, 14, 18, 446, 6317, 28179, 342, 370, 372, 2125, 3140, 402, 283, 5187, 7, 315, 1006, 199, 3, 3322, 372, 1338, 334, 1589, 2656, 28179, 1414, 16685, 795, 370, 372, 199, 3, 3322, 283, 5187, 7, 3140, 402, 2951, 23188, 314, 901, 325, 2037, 647, 9, 199, 3, 259, 378, 14, 21, 14, 17, 446, 5120, 1233, 367, 29877, 1068, 2917, 27, 3483, 1919, 8297, 199, 3, 3322, 370, 8486, 1536, 24325, 2382, 10677, 2793, 1133, 1172, 747, 14, 12207, 199, 3, 3322, 334, 69, 14, 71, 14, 10444, 9, 503, 2449, 641, 2838, 14, 29789, 7303, 6317, 1973, 67, 199, 3, 3322, 15212, 5363, 199, 3, 259, 378, 14, 21, 14, 16, 446, 2896, 314, 3261, 1561, 21864, 370, 2656, 3718, 370, 627, 1786, 551, 1064, 10, 27, 199, 3, 3322, 3483, 12120, 63, 422, 7303, 6326, 1847, 551, 1064, 63, 422, 342, 282, 5726, 199, 3, 3322, 3261, 334, 10274, 2656, 63, 422, 342, 315, 4136, 5459, 9, 1553, 675, 28179, 342, 199, 3, 3322, 3140, 27, 9243, 314, 4747, 708, 63, 422, 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,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@us.ibm.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; under version 2 of the License. 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ import sys import commands import re import time from Xm import * from arch import * from Test import * from config import * from Console import * from XenDevice import * from DomainTracking import * from acm import * DOM0_UUID = "00000000-0000-0000-0000-000000000000" def getDefaultKernel(): return arch.getDefaultKernel() def getRdPath(): return arch.getRdPath() def getUniqueName(): """Get a uniqueish name for use in a domain""" unixtime = int(time.time()) test_name = sys.argv[0] test_name = re.sub("\.test", "", test_name) test_name = re.sub("[\/\.]", "", test_name) name = "%s-%i" % (test_name, unixtime) return name class XenConfig: """An object to help create a xen-compliant config file""" def __init__(self): self.defaultOpts = {} # These options need to be lists self.defaultOpts["disk"] = [] self.defaultOpts["vif"] = [] self.defaultOpts["vtpm"] = [] if isACMEnabled(): #A default so every VM can start with ACM enabled self.defaultOpts["access_control"] = ['policy=xm-test,label=red'] self.opts = self.defaultOpts def toString(self): """Convert this config to a string for writing out to a file""" string = "# Xen configuration generated by xm-test\n" for k, v in self.opts.items(): if isinstance(v, int): piece = "%s = %i" % (k, v) elif isinstance(v, list) and v: piece = "%s = %s" % (k, v) elif isinstance(v, str) and v: piece = "%s = \"%s\"" % (k, v) else: piece = None if piece: string += "%s\n" % piece return string def write(self, filename): """Write this config out to filename""" output = file(filename, "w") output.write(self.toString()) output.close() ACMPrepareSystem(self.opts) def __str__(self): """When used as a string, we represent ourself by a config filename, which points to a temporary config that we write out ahead of time""" filename = "/tmp/xm-test.conf" self.write(filename) return filename def setOpt(self, name, value): """Set an option in the config""" if name in self.opts.keys() and isinstance(self.opts[name] , list) and not isinstance(value, list): self.opts[name] = [value] # "extra" is special so append to it. elif name == "extra" and name in self.opts.keys(): self.opts[name] += " %s" % (value) else: self.opts[name] = value def appOpt(self, name, value): """Append a value to a list option""" if name in self.opts.keys() and isinstance(self.opts[name], list): self.opts[name].append(value) def getOpt(self, name): """Return the value of a config option""" if name in self.opts.keys(): return self.opts[name] else: return None def setOpts(self, opts): """Batch-set options from a dictionary""" for k, v in opts.items(): self.setOpt(k, v) def clearOpts(self, name=None): """Clear one or all config options""" if name: self.opts[name] = self.defaultOpts[name] else: self.opts = self.defaultOpts class DomainError(Exception): def __init__(self, msg, extra="", errorcode=0): self.msg = msg self.extra = extra try: self.errorcode = int(errorcode) except Exception, e: self.errorcode = -1 def __str__(self): return str(self.msg) class XenDomain: def __init__(self, name=None, config=None, isManaged=False): """Create a domain object. @param config: String filename of config file """ if name: self.name = name else: self.name = getUniqueName() self.config = config self.console = None self.devices = {} self.netEnv = "bridge" if os.getenv("XM_MANAGED_DOMAINS"): isManaged = True self.isManaged = isManaged # Set domain type, either PV for ParaVirt domU or HVM for # FullVirt domain if ENABLE_HVM_SUPPORT: self.type = "HVM" else: self.type = "PV" def start(self, noConsole=False): if not self.isManaged: ret, output = traceCommand("xm create %s" % self.config) print self.config else: ret, output = traceCommand("xm new %s" % self.config) if ret != 0: _ret, output = traceCommand("xm delete " + self.config.getOpt("name")) else: ret, output = traceCommand("xm start " + self.config.getOpt("name")) addManagedDomain(self.config.getOpt("name")) if ret != 0: raise DomainError("Failed to create domain", extra=output, errorcode=ret) # HVM domains require waiting for boot if self.getDomainType() == "HVM": waitForBoot() # Go through device list and run console cmds for dev in self.devices.keys(): self.devices[dev].execAddCmds() if self.console and noConsole == True: self.closeConsole() elif self.console and noConsole == False: return self.console elif not self.console and noConsole == False: return self.getConsole() def stop(self): prog = "xm" cmd = " shutdown " self.removeAllDevices() if self.console: self.closeConsole() ret, output = traceCommand(prog + cmd + self.config.getOpt("name")) return ret def destroy(self): prog = "xm" cmd = " destroy " self.removeAllDevices() if self.console: self.closeConsole() ret, output = traceCommand(prog + cmd + self.config.getOpt("name")) if self.isManaged: ret, output = traceCommand(prog + " delete " + self.config.getOpt("name")) delManagedDomain(self.config.getOpt("name")) return ret def getName(self): return self.name def getId(self): return domid(self.getName()); def getDomainType(self): return self.type def closeConsole(self): # The domain closeConsole command must be called by tests, not the # console's close command. Once close is called, the console is # gone. You can't get history or anything else from it. if self.console: self.console._XmConsole__closeConsole() self.console = None def getConsole(self): if self.console: self.closeConsole() self.console = XmConsole(self.getName()) # Activate the console self.console.sendInput("input") return self.console def newDevice(self, Device, *args): """Device Factory: Generic factory for creating new XenDevices. All device creation should be done through the XenDomain factory. Supply a XenDevice instance and its args and the constructor will be called.""" # Make sure device with id hasn't already been added if self.devices.has_key(args[0]): raise DeviceError("Error: Domain already has device %s" % args[0]) # Call constructor for supplied Device instance dargs = (self,) dargs += args dev = apply(Device, dargs) if self.isRunning(): # Note: This needs to be done, XenDevice should have an attach # method. print "Domain is running, need to attach new device to domain." self.devices[dev.id] = dev self.config.appOpt(dev.configNode, str(dev)) return dev def removeDevice(self, id): if self.devices.has_key(id): self.devices[id].removeDevice() def removeAllDevices(self): for k in self.devices.keys(): self.removeDevice(k) def isRunning(self): return isDomainRunning(self.name) def getNetEnv(self): # We need to know the network environment: bridge, NAT, or routed. return self.netEnv def getDevice(self, id): dev = self.devices[id] if dev: return dev print "Device %s not found for domain %s" % (id, self.getName()) class XmTestDomain(XenDomain): def __init__(self, name=None, extraConfig=None, baseConfig=arch.configDefaults, isManaged=False): """Create a new xm-test domain @param name: The requested domain name @param extraConfig: Additional configuration options @param baseConfig: The initial configuration defaults to use """ config = XenConfig() config.setOpts(baseConfig) if extraConfig: config.setOpts(extraConfig) if name: config.setOpt("name", name) elif not config.getOpt("name"): config.setOpt("name", getUniqueName()) XenDomain.__init__(self, config.getOpt("name"), config=config, isManaged=isManaged) def minSafeMem(self): return arch.minSafeMem class XmTestNetDomain(XmTestDomain): def __init__(self, name=None, extraConfig=None, baseConfig=arch.configDefaults): """Create a new xm-test domain with one network device @param name: The requested domain name @param extraConfig: Additional configuration options @param baseConfig: The initial configuration defaults to use """ config = XenConfig() config.setOpts(baseConfig) if extraConfig: config.setOpts(extraConfig) if name: config.setOpt("name", name) elif not config.getOpt("name"): config.setOpt("name", getUniqueName()) XenDomain.__init__(self, config.getOpt("name"), config=config) # Add one network devices to domain self.newDevice(XenNetDevice, "eth0") if __name__ == "__main__": c = XenConfig() c.setOpt("foo", "bar") c.setOpt("foob", 1) opts = {"opt1" : 19, "opt2" : "blah"} c.setOpts(opts) c.setOpt("disk", "phy:/dev/ram0,hda1,w") c.appOpt("disk", "phy:/dev/ram1,hdb1,w") print str(c) # c.write("/tmp/foo.conf") # d = XmTestDomain(); # # d.start();
gpl-2.0
[ 3381, 2647, 15, 1393, 15, 1548, 199, 624, 199, 1898, 334, 35, 9, 28220, 23813, 30611, 3746, 22304, 2020, 11811, 199, 6529, 26, 24747, 25924, 665, 24863, 706, 32, 527, 14, 19870, 14, 957, 30, 421, 961, 2240, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 314, 2868, 2290, 2752, 27, 1334, 1015, 499, 402, 314, 844, 14, 421, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 421, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3180, 543, 642, 2240, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 199, 2752, 12, 3277, 2020, 8155, 15630, 10902, 12, 14453, 13540, 12, 8226, 12, 4828, 221, 15673, 13, 13421, 221, 8217, 199, 199, 624, 199, 199, 646, 984, 199, 646, 3718, 199, 646, 295, 199, 646, 900, 199, 199, 504, 1323, 77, 492, 627, 199, 504, 3819, 492, 627, 199, 504, 1379, 492, 627, 199, 504, 1101, 492, 627, 199, 504, 19809, 492, 627, 199, 504, 30211, 2510, 492, 627, 199, 504, 14061, 23785, 492, 627, 199, 504, 1066, 77, 492, 627, 421, 199, 10462, 16, 63, 8757, 275, 298, 3607, 13, 993, 13, 993, 13, 993, 13, 15672, 2, 421, 199, 318, 664, 2698, 14127, 837, 272, 372, 3819, 14, 362, 2698, 14127, 342, 199, 199, 318, 664, 50, 68, 2042, 837, 272, 372, 3819, 14, 362, 50, 68, 2042, 342, 199, 199, 318, 664, 11427, 985, 837, 272, 408, 1002, 282, 3747, 2453, 536, 367, 675, 315, 282, 2881, 624, 272, 16572, 521, 275, 1109, 8, 521, 14, 521, 1012, 272, 511, 63, 354, 275, 984, 14, 3020, 59, 16, 61, 272, 511, 63, 354, 275, 295, 14, 954, 480, 4537, 396, 401, 4873, 511, 63, 354, 9, 272, 511, 63, 354, 275, 295, 14, 954, 480, 7023, 15, 4537, 11472, 4873, 511, 63, 354, 9, 272, 536, 275, 2071, 83, 3295, 73, 2, 450, 334, 396, 63, 354, 12, 16572, 521, 9, 339, 372, 536, 199, 199, 533, 30211, 2028, 26, 272, 408, 2493, 909, 370, 1720, 1218, 282, 20388, 13, 863, 22676, 1101, 570, 624, 272, 347, 636, 826, 721, 277, 304, 267, 291, 14, 885, 24429, 275, 1052, 398, 327, 5723, 1511, 1929, 370, 506, 5548, 267, 291, 14, 885, 24429, 905, 4032, 937, 275, 942, 267, 291, 14, 885, 24429, 905, 14430, 937, 221, 275, 942, 267, 291, 14, 885, 24429, 905, 86, 683, 77, 937, 275, 942, 267, 340, 365, 1348, 45, 6589, 837, 288, 327, 33, 849, 880, 4036, 7525, 883, 1343, 543, 6570, 45, 5223, 288, 291, 14, 885, 24429, 905, 2732, 63, 2785, 937, 275, 788, 3185, 29, 10198, 13, 396, 12, 1302, 29, 581, 418, 398, 291, 14, 3291, 275, 291, 14, 885, 24429, 339, 347, 370, 1558, 8, 277, 304, 267, 408, 7306, 642, 1101, 370, 282, 1059, 367, 3575, 734, 267, 370, 282, 570, 624, 267, 1059, 275, 5426, 30211, 2897, 4046, 701, 17725, 13, 396, 60, 78, 2, 267, 367, 1022, 12, 373, 315, 291, 14, 3291, 14, 1744, 837, 288, 340, 1228, 8, 86, 12, 1109, 304, 355, 14854, 275, 2071, 83, 275, 450, 73, 2, 450, 334, 75, 12, 373, 9, 288, 916, 1228, 8, 86, 12, 769, 9, 436, 373, 26, 355, 14854, 275, 2071, 83, 275, 450, 83, 2, 450, 334, 75, 12, 373, 9, 288, 916, 1228, 8, 86, 12, 620, 9, 436, 373, 26, 355, 14854, 275, 2071, 83, 275, 18321, 83, 18781, 450, 334, 75, 12, 373, 9, 288, 587, 26, 355, 14854, 275, 488, 953, 340, 14854, 26, 355, 1059, 847, 2071, 83, 60, 78, 2, 450, 14854, 398, 372, 1059, 339, 347, 2218, 8, 277, 12, 1788, 304, 267, 408, 3534, 642, 1101, 734, 370, 1788, 624, 267, 1072, 275, 570, 8, 1501, 12, 298, 87, 531, 267, 1072, 14, 952, 8, 277, 14, 16695, 1012, 267, 1072, 14, 1600, 342, 267, 6570, 1658, 264, 4096, 3989, 8, 277, 14, 3291, 9, 339, 347, 636, 495, 721, 277, 304, 267, 408, 11423, 1202, 465, 282, 1059, 12, 781, 2954, 4154, 277, 701, 282, 1101, 267, 1788, 12, 1314, 4501, 370, 282, 7937, 1101, 626, 781, 2218, 267, 734, 23417, 402, 900, 624, 267, 1788, 275, 3286, 2791, 15, 10198, 13, 396, 14, 2190, 2, 267, 291, 14, 952, 8, 1501, 9, 267, 372, 1788, 339, 347, 663, 9985, 8, 277, 12, 536, 12, 574, 304, 267, 408, 1084, 376, 945, 315, 314, 1101, 624, 267, 340, 536, 315, 291, 14, 3291, 14, 1612, 342, 436, 1228, 8, 277, 14, 3291, 59, 354, 61, 2360, 3147, 769, 9, 436, 440, 1228, 8, 585, 12, 769, 304, 355, 291, 14, 3291, 59, 354, 61, 275, 359, 585, 61, 267, 327, 298, 2911, 2, 365, 4539, 880, 5666, 370, 652, 14, 267, 916, 536, 508, 298, 2911, 2, 436, 536, 315, 291, 14, 3291, 14, 1612, 837, 288, 291, 14, 3291, 59, 354, 61, 847, 298, 450, 83, 2, 450, 334, 585, 9, 267, 587, 26, 288, 291, 14, 3291, 59, 354, 61, 275, 574, 339, 347, 1145, 9985, 8, 277, 12, 536, 12, 574, 304, 267, 408, 8310, 282, 574, 370, 282, 769, 945, 624, 267, 340, 536, 315, 291, 14, 3291, 14, 1612, 342, 436, 1228, 8, 277, 14, 3291, 59, 354, 467, 769, 304, 288, 291, 14, 3291, 59, 354, 1055, 740, 8, 585, 9, 339, 347, 664, 9985, 8, 277, 12, 536, 304, 267, 408, 1767, 314, 574, 402, 282, 1101, 945, 624, 267, 340, 536, 315, 291, 14, 3291, 14, 1612, 837, 288, 372, 291, 14, 3291, 59, 354, 61, 267, 587, 26, 288, 372, 488, 339, 347, 663, 24429, 8, 277, 12, 3999, 304, 267, 408, 8842, 13, 409, 1511, 687, 282, 2600, 624, 267, 367, 1022, 12, 373, 315, 3999, 14, 1744, 837, 288, 291, 14, 409, 9985, 8, 75, 12, 373, 9, 339, 347, 5436 ]
[ 2647, 15, 1393, 15, 1548, 199, 624, 199, 1898, 334, 35, 9, 28220, 23813, 30611, 3746, 22304, 2020, 11811, 199, 6529, 26, 24747, 25924, 665, 24863, 706, 32, 527, 14, 19870, 14, 957, 30, 421, 961, 2240, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 314, 2868, 2290, 2752, 27, 1334, 1015, 499, 402, 314, 844, 14, 421, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 421, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3180, 543, 642, 2240, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 199, 2752, 12, 3277, 2020, 8155, 15630, 10902, 12, 14453, 13540, 12, 8226, 12, 4828, 221, 15673, 13, 13421, 221, 8217, 199, 199, 624, 199, 199, 646, 984, 199, 646, 3718, 199, 646, 295, 199, 646, 900, 199, 199, 504, 1323, 77, 492, 627, 199, 504, 3819, 492, 627, 199, 504, 1379, 492, 627, 199, 504, 1101, 492, 627, 199, 504, 19809, 492, 627, 199, 504, 30211, 2510, 492, 627, 199, 504, 14061, 23785, 492, 627, 199, 504, 1066, 77, 492, 627, 421, 199, 10462, 16, 63, 8757, 275, 298, 3607, 13, 993, 13, 993, 13, 993, 13, 15672, 2, 421, 199, 318, 664, 2698, 14127, 837, 272, 372, 3819, 14, 362, 2698, 14127, 342, 199, 199, 318, 664, 50, 68, 2042, 837, 272, 372, 3819, 14, 362, 50, 68, 2042, 342, 199, 199, 318, 664, 11427, 985, 837, 272, 408, 1002, 282, 3747, 2453, 536, 367, 675, 315, 282, 2881, 624, 272, 16572, 521, 275, 1109, 8, 521, 14, 521, 1012, 272, 511, 63, 354, 275, 984, 14, 3020, 59, 16, 61, 272, 511, 63, 354, 275, 295, 14, 954, 480, 4537, 396, 401, 4873, 511, 63, 354, 9, 272, 511, 63, 354, 275, 295, 14, 954, 480, 7023, 15, 4537, 11472, 4873, 511, 63, 354, 9, 272, 536, 275, 2071, 83, 3295, 73, 2, 450, 334, 396, 63, 354, 12, 16572, 521, 9, 339, 372, 536, 199, 199, 533, 30211, 2028, 26, 272, 408, 2493, 909, 370, 1720, 1218, 282, 20388, 13, 863, 22676, 1101, 570, 624, 272, 347, 636, 826, 721, 277, 304, 267, 291, 14, 885, 24429, 275, 1052, 398, 327, 5723, 1511, 1929, 370, 506, 5548, 267, 291, 14, 885, 24429, 905, 4032, 937, 275, 942, 267, 291, 14, 885, 24429, 905, 14430, 937, 221, 275, 942, 267, 291, 14, 885, 24429, 905, 86, 683, 77, 937, 275, 942, 267, 340, 365, 1348, 45, 6589, 837, 288, 327, 33, 849, 880, 4036, 7525, 883, 1343, 543, 6570, 45, 5223, 288, 291, 14, 885, 24429, 905, 2732, 63, 2785, 937, 275, 788, 3185, 29, 10198, 13, 396, 12, 1302, 29, 581, 418, 398, 291, 14, 3291, 275, 291, 14, 885, 24429, 339, 347, 370, 1558, 8, 277, 304, 267, 408, 7306, 642, 1101, 370, 282, 1059, 367, 3575, 734, 267, 370, 282, 570, 624, 267, 1059, 275, 5426, 30211, 2897, 4046, 701, 17725, 13, 396, 60, 78, 2, 267, 367, 1022, 12, 373, 315, 291, 14, 3291, 14, 1744, 837, 288, 340, 1228, 8, 86, 12, 1109, 304, 355, 14854, 275, 2071, 83, 275, 450, 73, 2, 450, 334, 75, 12, 373, 9, 288, 916, 1228, 8, 86, 12, 769, 9, 436, 373, 26, 355, 14854, 275, 2071, 83, 275, 450, 83, 2, 450, 334, 75, 12, 373, 9, 288, 916, 1228, 8, 86, 12, 620, 9, 436, 373, 26, 355, 14854, 275, 2071, 83, 275, 18321, 83, 18781, 450, 334, 75, 12, 373, 9, 288, 587, 26, 355, 14854, 275, 488, 953, 340, 14854, 26, 355, 1059, 847, 2071, 83, 60, 78, 2, 450, 14854, 398, 372, 1059, 339, 347, 2218, 8, 277, 12, 1788, 304, 267, 408, 3534, 642, 1101, 734, 370, 1788, 624, 267, 1072, 275, 570, 8, 1501, 12, 298, 87, 531, 267, 1072, 14, 952, 8, 277, 14, 16695, 1012, 267, 1072, 14, 1600, 342, 267, 6570, 1658, 264, 4096, 3989, 8, 277, 14, 3291, 9, 339, 347, 636, 495, 721, 277, 304, 267, 408, 11423, 1202, 465, 282, 1059, 12, 781, 2954, 4154, 277, 701, 282, 1101, 267, 1788, 12, 1314, 4501, 370, 282, 7937, 1101, 626, 781, 2218, 267, 734, 23417, 402, 900, 624, 267, 1788, 275, 3286, 2791, 15, 10198, 13, 396, 14, 2190, 2, 267, 291, 14, 952, 8, 1501, 9, 267, 372, 1788, 339, 347, 663, 9985, 8, 277, 12, 536, 12, 574, 304, 267, 408, 1084, 376, 945, 315, 314, 1101, 624, 267, 340, 536, 315, 291, 14, 3291, 14, 1612, 342, 436, 1228, 8, 277, 14, 3291, 59, 354, 61, 2360, 3147, 769, 9, 436, 440, 1228, 8, 585, 12, 769, 304, 355, 291, 14, 3291, 59, 354, 61, 275, 359, 585, 61, 267, 327, 298, 2911, 2, 365, 4539, 880, 5666, 370, 652, 14, 267, 916, 536, 508, 298, 2911, 2, 436, 536, 315, 291, 14, 3291, 14, 1612, 837, 288, 291, 14, 3291, 59, 354, 61, 847, 298, 450, 83, 2, 450, 334, 585, 9, 267, 587, 26, 288, 291, 14, 3291, 59, 354, 61, 275, 574, 339, 347, 1145, 9985, 8, 277, 12, 536, 12, 574, 304, 267, 408, 8310, 282, 574, 370, 282, 769, 945, 624, 267, 340, 536, 315, 291, 14, 3291, 14, 1612, 342, 436, 1228, 8, 277, 14, 3291, 59, 354, 467, 769, 304, 288, 291, 14, 3291, 59, 354, 1055, 740, 8, 585, 9, 339, 347, 664, 9985, 8, 277, 12, 536, 304, 267, 408, 1767, 314, 574, 402, 282, 1101, 945, 624, 267, 340, 536, 315, 291, 14, 3291, 14, 1612, 837, 288, 372, 291, 14, 3291, 59, 354, 61, 267, 587, 26, 288, 372, 488, 339, 347, 663, 24429, 8, 277, 12, 3999, 304, 267, 408, 8842, 13, 409, 1511, 687, 282, 2600, 624, 267, 367, 1022, 12, 373, 315, 3999, 14, 1744, 837, 288, 291, 14, 409, 9985, 8, 75, 12, 373, 9, 339, 347, 5436, 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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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 ]
malmiron/incubator-airflow
airflow/ti_deps/deps/dag_ti_slots_available_dep.py
20
1422
# -*- coding: utf-8 -*- # # 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. from airflow.ti_deps.deps.base_ti_dep import BaseTIDep from airflow.utils.db import provide_session class DagTISlotsAvailableDep(BaseTIDep): NAME = "Task Instance Slots Available" IGNOREABLE = True @provide_session def _get_dep_statuses(self, ti, session, dep_context): if ti.task.dag.concurrency_reached: yield self._failing_status( reason="The maximum number of running tasks ({0}) for this task's DAG " "'{1}' has been reached.".format(ti.task.dag.concurrency, ti.dag_id))
apache-2.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 199, 3, 503, 1655, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 199, 3, 1854, 543, 642, 1736, 367, 4722, 2556, 199, 3, 12602, 4248, 12715, 14, 221, 710, 14857, 12378, 642, 570, 199, 3, 370, 1265, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 199, 3, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 199, 3, 543, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 257, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 199, 3, 2032, 1854, 1334, 314, 844, 365, 1854, 641, 376, 199, 3, 298, 1179, 2281, 2, 4207, 12, 2428, 2990, 1549, 4217, 1634, 1821, 199, 3, 3826, 12, 1902, 4056, 503, 2478, 14, 221, 1666, 314, 844, 367, 314, 199, 3, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 1334, 314, 844, 14, 199, 199, 504, 16321, 14, 280, 63, 5846, 14, 5846, 14, 1095, 63, 280, 63, 2601, 492, 3523, 13247, 8598, 199, 504, 16321, 14, 1208, 14, 697, 492, 5647, 63, 1730, 421, 199, 533, 26110, 52, 1311, 4555, 11464, 8598, 8, 1563, 13247, 8598, 304, 272, 13637, 275, 298, 4476, 10066, 428, 4555, 23840, 2, 272, 27499, 5788, 2617, 275, 715, 339, 768, 20824, 63, 1730, 272, 347, 485, 362, 63, 2601, 63, 17084, 8, 277, 12, 3367, 12, 2351, 12, 2657, 63, 1100, 304, 267, 340, 3367, 14, 1765, 14, 7406, 14, 27518, 63, 30931, 26, 288, 1995, 291, 423, 25299, 63, 1205, 8, 355, 4499, 628, 1918, 5696, 1329, 402, 3879, 6527, 11459, 16, 1552, 367, 642, 2120, 1159, 19666, 298, 2432, 3546, 91, 17, 6834, 965, 2757, 13075, 15848, 908, 8, 280, 14, 1765, 14, 7406, 14, 27518, 12, 9144, 3367, 14, 7406, 63, 344, 430, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 199, 3, 503, 1655, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 199, 3, 1854, 543, 642, 1736, 367, 4722, 2556, 199, 3, 12602, 4248, 12715, 14, 221, 710, 14857, 12378, 642, 570, 199, 3, 370, 1265, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 199, 3, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 199, 3, 543, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 257, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 199, 3, 2032, 1854, 1334, 314, 844, 365, 1854, 641, 376, 199, 3, 298, 1179, 2281, 2, 4207, 12, 2428, 2990, 1549, 4217, 1634, 1821, 199, 3, 3826, 12, 1902, 4056, 503, 2478, 14, 221, 1666, 314, 844, 367, 314, 199, 3, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 1334, 314, 844, 14, 199, 199, 504, 16321, 14, 280, 63, 5846, 14, 5846, 14, 1095, 63, 280, 63, 2601, 492, 3523, 13247, 8598, 199, 504, 16321, 14, 1208, 14, 697, 492, 5647, 63, 1730, 421, 199, 533, 26110, 52, 1311, 4555, 11464, 8598, 8, 1563, 13247, 8598, 304, 272, 13637, 275, 298, 4476, 10066, 428, 4555, 23840, 2, 272, 27499, 5788, 2617, 275, 715, 339, 768, 20824, 63, 1730, 272, 347, 485, 362, 63, 2601, 63, 17084, 8, 277, 12, 3367, 12, 2351, 12, 2657, 63, 1100, 304, 267, 340, 3367, 14, 1765, 14, 7406, 14, 27518, 63, 30931, 26, 288, 1995, 291, 423, 25299, 63, 1205, 8, 355, 4499, 628, 1918, 5696, 1329, 402, 3879, 6527, 11459, 16, 1552, 367, 642, 2120, 1159, 19666, 298, 2432, 3546, 91, 17, 6834, 965, 2757, 13075, 15848, 908, 8, 280, 14, 1765, 14, 7406, 14, 27518, 12, 9144, 3367, 14, 7406, 63, 344, 430, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
xfournet/intellij-community
python/helpers/pydev/_pydevd_bundle/pydevd_trace_dispatch.py
10
3878
# Defines which version of the trace_dispatch we'll use. # Should give warning only here if cython is not available but supported. import os import sys from _pydevd_bundle.pydevd_constants import CYTHON_SUPPORTED, IS_PYCHARM use_cython = os.getenv('PYDEVD_USE_CYTHON', None) dirname = os.path.dirname(os.path.dirname(__file__)) # Do not show incorrect warning for .egg files for Remote debugger if not CYTHON_SUPPORTED or dirname.endswith('.egg'): # Do not try to import cython extensions if cython isn't supported use_cython = 'NO' def delete_old_compiled_extensions(): import _pydevd_bundle_ext cython_extensions_dir = os.path.dirname(os.path.dirname(_pydevd_bundle_ext.__file__)) _pydevd_bundle_ext_dir = os.path.dirname(_pydevd_bundle_ext.__file__) _pydevd_frame_eval_ext_dir = os.path.join(cython_extensions_dir, '_pydevd_frame_eval_ext') try: import shutil for file in os.listdir(_pydevd_bundle_ext_dir): if file.startswith("pydevd") and file.endswith(".so"): os.remove(os.path.join(_pydevd_bundle_ext_dir, file)) for file in os.listdir(_pydevd_frame_eval_ext_dir): if file.startswith("pydevd") and file.endswith(".so"): os.remove(os.path.join(_pydevd_frame_eval_ext_dir, file)) build_dir = os.path.join(cython_extensions_dir, "build") if os.path.exists(build_dir): shutil.rmtree(os.path.join(cython_extensions_dir, "build")) except OSError: from _pydev_bundle.pydev_monkey import log_error_once log_error_once("warning: failed to delete old cython speedups. Please delete all *.so files from the directories " "\"%s\" and \"%s\"" % (_pydevd_bundle_ext_dir, _pydevd_frame_eval_ext_dir)) show_tracing_warning = False if use_cython == 'YES': # We must import the cython version if forcing cython from _pydevd_bundle.pydevd_cython_wrapper import trace_dispatch as _trace_dispatch, global_cache_skips, global_cache_frame_skips def trace_dispatch(py_db, frame, event, arg): return _trace_dispatch(py_db, frame, event, arg) elif use_cython == 'NO': # Use the regular version if not forcing cython from _pydevd_bundle.pydevd_trace_dispatch_regular import trace_dispatch, global_cache_skips, global_cache_frame_skips # @UnusedImport elif use_cython is None: # Regular: use fallback if not found and give message to user try: from _pydevd_bundle.pydevd_cython_wrapper import trace_dispatch as _trace_dispatch, global_cache_skips, global_cache_frame_skips def trace_dispatch(py_db, frame, event, arg): return _trace_dispatch(py_db, frame, event, arg) # This version number is always available from _pydevd_bundle.pydevd_additional_thread_info_regular import version as regular_version # This version number from the already compiled cython extension from _pydevd_bundle.pydevd_cython_wrapper import version as cython_version if cython_version != regular_version: delete_old_compiled_extensions() raise ImportError() except ImportError: from _pydevd_bundle.pydevd_additional_thread_info_regular import PyDBAdditionalThreadInfo # @UnusedImport from _pydevd_bundle.pydevd_trace_dispatch_regular import trace_dispatch, global_cache_skips, global_cache_frame_skips # @UnusedImport from _pydev_bundle.pydev_monkey import log_error_once if not IS_PYCHARM: log_error_once("warning: Debugger speedups using cython not found. Run '\"%s\" \"%s\" build_ext --inplace' to build." % ( sys.executable, os.path.join(dirname, 'setup_cython.py'))) else: show_tracing_warning = True else: raise RuntimeError('Unexpected value for PYDEVD_USE_CYTHON: %s (accepted: YES, NO)' % (use_cython,))
apache-2.0
[ 3, 25022, 1314, 1015, 402, 314, 3307, 63, 6052, 781, 7171, 675, 14, 199, 3, 7719, 8120, 5721, 1454, 2348, 340, 29348, 365, 440, 2808, 1325, 3748, 14, 199, 199, 646, 747, 199, 646, 984, 199, 504, 485, 23996, 68, 63, 6469, 14, 23996, 68, 63, 5559, 492, 445, 57, 8472, 63, 15925, 12, 2281, 63, 4521, 5901, 45, 421, 199, 1180, 63, 20747, 275, 747, 14, 12959, 360, 4521, 13260, 36, 63, 4701, 63, 15068, 8472, 297, 488, 9, 199, 3475, 275, 747, 14, 515, 14, 3475, 8, 736, 14, 515, 14, 3475, 3460, 493, 8964, 199, 3, 4226, 440, 2498, 8927, 5721, 367, 1275, 5799, 1584, 367, 17283, 14958, 199, 692, 440, 445, 57, 8472, 63, 15925, 503, 9017, 14, 4130, 5175, 5799, 735, 272, 327, 4226, 440, 862, 370, 492, 29348, 5478, 340, 29348, 5712, 1133, 3748, 272, 675, 63, 20747, 275, 283, 2826, 7, 421, 199, 318, 3145, 63, 1753, 63, 8427, 63, 5359, 837, 272, 492, 485, 23996, 68, 63, 6469, 63, 832, 272, 29348, 63, 5359, 63, 694, 275, 747, 14, 515, 14, 3475, 8, 736, 14, 515, 14, 3475, 1547, 23996, 68, 63, 6469, 63, 832, 855, 493, 8964, 272, 485, 23996, 68, 63, 6469, 63, 832, 63, 694, 275, 747, 14, 515, 14, 3475, 1547, 23996, 68, 63, 6469, 63, 832, 855, 493, 3368, 272, 485, 23996, 68, 63, 1943, 63, 2579, 63, 832, 63, 694, 275, 747, 14, 515, 14, 904, 8, 20747, 63, 5359, 63, 694, 12, 2513, 23996, 68, 63, 1943, 63, 2579, 63, 832, 358, 272, 862, 26, 267, 492, 5145, 267, 367, 570, 315, 747, 14, 7374, 1547, 23996, 68, 63, 6469, 63, 832, 63, 694, 304, 288, 340, 570, 14, 2460, 480, 23996, 68, 531, 436, 570, 14, 4130, 9520, 1152, 2349, 355, 747, 14, 2168, 8, 736, 14, 515, 14, 904, 1547, 23996, 68, 63, 6469, 63, 832, 63, 694, 12, 570, 430, 267, 367, 570, 315, 747, 14, 7374, 1547, 23996, 68, 63, 1943, 63, 2579, 63, 832, 63, 694, 304, 288, 340, 570, 14, 2460, 480, 23996, 68, 531, 436, 570, 14, 4130, 9520, 1152, 2349, 355, 747, 14, 2168, 8, 736, 14, 515, 14, 904, 1547, 23996, 68, 63, 1943, 63, 2579, 63, 832, 63, 694, 12, 570, 430, 267, 1900, 63, 694, 275, 747, 14, 515, 14, 904, 8, 20747, 63, 5359, 63, 694, 12, 298, 1506, 531, 267, 340, 747, 14, 515, 14, 2444, 8, 1506, 63, 694, 304, 288, 5145, 14, 9242, 8, 736, 14, 515, 14, 904, 8, 20747, 63, 5359, 63, 694, 12, 298, 1506, 2237, 272, 871, 6440, 26, 267, 687, 485, 23996, 63, 6469, 14, 23996, 63, 20372, 492, 943, 63, 705, 63, 5089, 267, 943, 63, 705, 63, 5089, 480, 3764, 26, 3405, 370, 3145, 2269, 29348, 8112, 15203, 14, 7754, 3145, 1006, 23588, 1152, 1584, 687, 314, 6602, 298, 2432, 1867, 6808, 83, 4451, 436, 18321, 83, 18781, 450, 6110, 23996, 68, 63, 6469, 63, 832, 63, 694, 12, 485, 23996, 68, 63, 1943, 63, 2579, 63, 832, 63, 694, 430, 199, 199, 2384, 63, 21635, 63, 3764, 275, 756, 199, 199, 692, 675, 63, 20747, 508, 283, 15641, 356, 272, 327, 2136, 1471, 492, 314, 29348, 1015, 340, 31070, 29348, 272, 687, 485, 23996, 68, 63, 6469, 14, 23996, 68, 63, 20747, 63, 5029, 492, 3307, 63, 6052, 465, 485, 3446, 63, 6052, 12, 2288, 63, 1637, 63, 2759, 83, 12, 2288, 63, 1637, 63, 1943, 63, 2759, 83, 272, 347, 3307, 63, 6052, 8, 647, 63, 697, 12, 2787, 12, 1566, 12, 1680, 304, 267, 372, 485, 3446, 63, 6052, 8, 647, 63, 697, 12, 2787, 12, 1566, 12, 1680, 9, 199, 199, 4164, 675, 63, 20747, 508, 283, 2826, 356, 272, 327, 3645, 314, 5578, 1015, 340, 440, 31070, 29348, 272, 687, 485, 23996, 68, 63, 6469, 14, 23996, 68, 63, 3446, 63, 6052, 63, 7898, 492, 3307, 63, 6052, 12, 2288, 63, 1637, 63, 2759, 83, 12, 2288, 63, 1637, 63, 1943, 63, 2759, 83, 221, 327, 768, 20782, 6295, 199, 199, 4164, 675, 63, 20747, 365, 488, 26, 272, 327, 18528, 26, 675, 9567, 340, 440, 1911, 436, 8120, 1245, 370, 922, 272, 862, 26, 267, 687, 485, 23996, 68, 63, 6469, 14, 23996, 68, 63, 20747, 63, 5029, 492, 3307, 63, 6052, 465, 485, 3446, 63, 6052, 12, 2288, 63, 1637, 63, 2759, 83, 12, 2288, 63, 1637, 63, 1943, 63, 2759, 83, 267, 347, 3307, 63, 6052, 8, 647, 63, 697, 12, 2787, 12, 1566, 12, 1680, 304, 288, 372, 485, 3446, 63, 6052, 8, 647, 63, 697, 12, 2787, 12, 1566, 12, 1680, 9, 398, 327, 961, 1015, 1329, 365, 3544, 2808, 267, 687, 485, 23996, 68, 63, 6469, 14, 23996, 68, 63, 8460, 63, 2671, 63, 815, 63, 7898, 492, 1015, 465, 5578, 63, 1023, 267, 327, 961, 1015, 1329, 687, 314, 2575, 10311, 29348, 3329, 267, 687, 485, 23996, 68, 63, 6469, 14, 23996, 68, 63, 20747, 63, 5029, 492, 1015, 465, 29348, 63, 1023, 267, 340, 29348, 63, 1023, 1137, 5578, 63, 1023, 26, 288, 3145, 63, 1753, 63, 8427, 63, 5359, 342, 288, 746, 3545, 342, 339, 871, 3545, 26, 267, 687, 485, 23996, 68, 63, 6469, 14, 23996, 68, 63, 8460, 63, 2671, 63, 815, 63, 7898, 492, 1611, 2846, 8824, 4436, 2354, 221, 327, 768, 20782, 6295, 267, 687, 485, 23996, 68, 63, 6469, 14, 23996, 68, 63, 3446, 63, 6052, 63, 7898, 492, 3307, 63, 6052, 12, 2288, 63, 1637, 63, 2759, 83, 12, 2288, 63, 1637, 63, 1943, 63, 2759, 83, 221, 327, 768, 20782, 6295, 267, 687, 485, 23996, 63, 6469, 14, 23996, 63, 20372, 492, 943, 63, 705, 63, 5089, 398, 340, 440, 2281, 63, 4521, 5901, 45, 26, 288, 943, 63, 705, 63, 5089, 480, 3764, 26, 14245, 836, 8112, 15203, 1808, 29348, 440, 1911, 14, 3378, 1557, 6808, 83, 4451, 18321, 83, 4451, 1900, 63, 832, 1553, 15008, 7, 370, 1900, 2122, 450, 334, 355, 984, 14, 5904, 12, 747, 14, 515, 14, 904, 8, 3475, 12, 283, 2758, 63, 20747, 14, 647, 7058, 267, 587, 26, 288, 2498, 63, 21635, 63, 3764, 275, 715, 199, 199 ]
[ 25022, 1314, 1015, 402, 314, 3307, 63, 6052, 781, 7171, 675, 14, 199, 3, 7719, 8120, 5721, 1454, 2348, 340, 29348, 365, 440, 2808, 1325, 3748, 14, 199, 199, 646, 747, 199, 646, 984, 199, 504, 485, 23996, 68, 63, 6469, 14, 23996, 68, 63, 5559, 492, 445, 57, 8472, 63, 15925, 12, 2281, 63, 4521, 5901, 45, 421, 199, 1180, 63, 20747, 275, 747, 14, 12959, 360, 4521, 13260, 36, 63, 4701, 63, 15068, 8472, 297, 488, 9, 199, 3475, 275, 747, 14, 515, 14, 3475, 8, 736, 14, 515, 14, 3475, 3460, 493, 8964, 199, 3, 4226, 440, 2498, 8927, 5721, 367, 1275, 5799, 1584, 367, 17283, 14958, 199, 692, 440, 445, 57, 8472, 63, 15925, 503, 9017, 14, 4130, 5175, 5799, 735, 272, 327, 4226, 440, 862, 370, 492, 29348, 5478, 340, 29348, 5712, 1133, 3748, 272, 675, 63, 20747, 275, 283, 2826, 7, 421, 199, 318, 3145, 63, 1753, 63, 8427, 63, 5359, 837, 272, 492, 485, 23996, 68, 63, 6469, 63, 832, 272, 29348, 63, 5359, 63, 694, 275, 747, 14, 515, 14, 3475, 8, 736, 14, 515, 14, 3475, 1547, 23996, 68, 63, 6469, 63, 832, 855, 493, 8964, 272, 485, 23996, 68, 63, 6469, 63, 832, 63, 694, 275, 747, 14, 515, 14, 3475, 1547, 23996, 68, 63, 6469, 63, 832, 855, 493, 3368, 272, 485, 23996, 68, 63, 1943, 63, 2579, 63, 832, 63, 694, 275, 747, 14, 515, 14, 904, 8, 20747, 63, 5359, 63, 694, 12, 2513, 23996, 68, 63, 1943, 63, 2579, 63, 832, 358, 272, 862, 26, 267, 492, 5145, 267, 367, 570, 315, 747, 14, 7374, 1547, 23996, 68, 63, 6469, 63, 832, 63, 694, 304, 288, 340, 570, 14, 2460, 480, 23996, 68, 531, 436, 570, 14, 4130, 9520, 1152, 2349, 355, 747, 14, 2168, 8, 736, 14, 515, 14, 904, 1547, 23996, 68, 63, 6469, 63, 832, 63, 694, 12, 570, 430, 267, 367, 570, 315, 747, 14, 7374, 1547, 23996, 68, 63, 1943, 63, 2579, 63, 832, 63, 694, 304, 288, 340, 570, 14, 2460, 480, 23996, 68, 531, 436, 570, 14, 4130, 9520, 1152, 2349, 355, 747, 14, 2168, 8, 736, 14, 515, 14, 904, 1547, 23996, 68, 63, 1943, 63, 2579, 63, 832, 63, 694, 12, 570, 430, 267, 1900, 63, 694, 275, 747, 14, 515, 14, 904, 8, 20747, 63, 5359, 63, 694, 12, 298, 1506, 531, 267, 340, 747, 14, 515, 14, 2444, 8, 1506, 63, 694, 304, 288, 5145, 14, 9242, 8, 736, 14, 515, 14, 904, 8, 20747, 63, 5359, 63, 694, 12, 298, 1506, 2237, 272, 871, 6440, 26, 267, 687, 485, 23996, 63, 6469, 14, 23996, 63, 20372, 492, 943, 63, 705, 63, 5089, 267, 943, 63, 705, 63, 5089, 480, 3764, 26, 3405, 370, 3145, 2269, 29348, 8112, 15203, 14, 7754, 3145, 1006, 23588, 1152, 1584, 687, 314, 6602, 298, 2432, 1867, 6808, 83, 4451, 436, 18321, 83, 18781, 450, 6110, 23996, 68, 63, 6469, 63, 832, 63, 694, 12, 485, 23996, 68, 63, 1943, 63, 2579, 63, 832, 63, 694, 430, 199, 199, 2384, 63, 21635, 63, 3764, 275, 756, 199, 199, 692, 675, 63, 20747, 508, 283, 15641, 356, 272, 327, 2136, 1471, 492, 314, 29348, 1015, 340, 31070, 29348, 272, 687, 485, 23996, 68, 63, 6469, 14, 23996, 68, 63, 20747, 63, 5029, 492, 3307, 63, 6052, 465, 485, 3446, 63, 6052, 12, 2288, 63, 1637, 63, 2759, 83, 12, 2288, 63, 1637, 63, 1943, 63, 2759, 83, 272, 347, 3307, 63, 6052, 8, 647, 63, 697, 12, 2787, 12, 1566, 12, 1680, 304, 267, 372, 485, 3446, 63, 6052, 8, 647, 63, 697, 12, 2787, 12, 1566, 12, 1680, 9, 199, 199, 4164, 675, 63, 20747, 508, 283, 2826, 356, 272, 327, 3645, 314, 5578, 1015, 340, 440, 31070, 29348, 272, 687, 485, 23996, 68, 63, 6469, 14, 23996, 68, 63, 3446, 63, 6052, 63, 7898, 492, 3307, 63, 6052, 12, 2288, 63, 1637, 63, 2759, 83, 12, 2288, 63, 1637, 63, 1943, 63, 2759, 83, 221, 327, 768, 20782, 6295, 199, 199, 4164, 675, 63, 20747, 365, 488, 26, 272, 327, 18528, 26, 675, 9567, 340, 440, 1911, 436, 8120, 1245, 370, 922, 272, 862, 26, 267, 687, 485, 23996, 68, 63, 6469, 14, 23996, 68, 63, 20747, 63, 5029, 492, 3307, 63, 6052, 465, 485, 3446, 63, 6052, 12, 2288, 63, 1637, 63, 2759, 83, 12, 2288, 63, 1637, 63, 1943, 63, 2759, 83, 267, 347, 3307, 63, 6052, 8, 647, 63, 697, 12, 2787, 12, 1566, 12, 1680, 304, 288, 372, 485, 3446, 63, 6052, 8, 647, 63, 697, 12, 2787, 12, 1566, 12, 1680, 9, 398, 327, 961, 1015, 1329, 365, 3544, 2808, 267, 687, 485, 23996, 68, 63, 6469, 14, 23996, 68, 63, 8460, 63, 2671, 63, 815, 63, 7898, 492, 1015, 465, 5578, 63, 1023, 267, 327, 961, 1015, 1329, 687, 314, 2575, 10311, 29348, 3329, 267, 687, 485, 23996, 68, 63, 6469, 14, 23996, 68, 63, 20747, 63, 5029, 492, 1015, 465, 29348, 63, 1023, 267, 340, 29348, 63, 1023, 1137, 5578, 63, 1023, 26, 288, 3145, 63, 1753, 63, 8427, 63, 5359, 342, 288, 746, 3545, 342, 339, 871, 3545, 26, 267, 687, 485, 23996, 68, 63, 6469, 14, 23996, 68, 63, 8460, 63, 2671, 63, 815, 63, 7898, 492, 1611, 2846, 8824, 4436, 2354, 221, 327, 768, 20782, 6295, 267, 687, 485, 23996, 68, 63, 6469, 14, 23996, 68, 63, 3446, 63, 6052, 63, 7898, 492, 3307, 63, 6052, 12, 2288, 63, 1637, 63, 2759, 83, 12, 2288, 63, 1637, 63, 1943, 63, 2759, 83, 221, 327, 768, 20782, 6295, 267, 687, 485, 23996, 63, 6469, 14, 23996, 63, 20372, 492, 943, 63, 705, 63, 5089, 398, 340, 440, 2281, 63, 4521, 5901, 45, 26, 288, 943, 63, 705, 63, 5089, 480, 3764, 26, 14245, 836, 8112, 15203, 1808, 29348, 440, 1911, 14, 3378, 1557, 6808, 83, 4451, 18321, 83, 4451, 1900, 63, 832, 1553, 15008, 7, 370, 1900, 2122, 450, 334, 355, 984, 14, 5904, 12, 747, 14, 515, 14, 904, 8, 3475, 12, 283, 2758, 63, 20747, 14, 647, 7058, 267, 587, 26, 288, 2498, 63, 21635, 63, 3764, 275, 715, 199, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
adngdb/socorro
socorro/unittest/submitter/test_submitter_app.py
2
16936
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import mock import time import json from nose.tools import eq_, ok_, assert_raises from socorro.submitter.submitter_app import ( SubmitterApp, SubmitterFileSystemWalkerSource, ) from configman.dotdict import DotDict from socorro.external.crashstorage_base import Redactor from socorro.unittest.testbase import TestCase def sequencer(*args): list_of_args = list(args) def foo(*fargs, **fkwargs): try: return list_of_args.pop() except IndexError: return None return foo def generator_for_sequence(*args): list_of_args = list(args) def foo(*fargs, **fkwargs): try: yield list_of_args.pop() except IndexError: return return foo class TestSubmitterFileSystemWalkerSource(TestCase): def get_standard_config(self): config = DotDict() config.search_root = None config.dump_suffix = '.dump' config.dump_field = "upload_file_minidump" config.redactor_class = Redactor config.forbidden_keys = Redactor.required_config.forbidden_keys.default config.logger = mock.MagicMock() return config def test_setup(self): config = self.get_standard_config() sub_walker = SubmitterFileSystemWalkerSource(config) eq_(sub_walker.config, config) eq_(sub_walker.config.logger, config.logger) def test_get_raw_crash(self): config = self.get_standard_config() sub_walker = SubmitterFileSystemWalkerSource(config) raw = ('{"name":"Gabi", ''"submitted_timestamp":"%d"}' % time.time()) fake_raw_crash = DotDict(json.loads(raw)) mocked_get_raw_crash = mock.Mock(return_value=fake_raw_crash) sub_walker.get_raw_crash = mocked_get_raw_crash path_tuple = ['6611a662-e70f-4ba5-a397-69a3a2121129.dump', '6611a662-e70f-4ba5-a397-69a3a2121129.flash1.dump', '6611a662-e70f-4ba5-a397-69a3a2121129.flash2.dump', ] raw_crash = sub_walker.get_raw_crash(path_tuple) ok_(isinstance(raw_crash, DotDict)) eq_(raw_crash['name'], 'Gabi') def test_get_raw_dumps_as_files(self): config = self.get_standard_config() sub_walker = SubmitterFileSystemWalkerSource(config) dump_pathnames = ( '6611a662-e70f-4ba5-a397-69a3a2121129', ( 'raw_crash_file', '/some/path/6611a662-e70f-4ba5-a397-69a3a2121129.dump', '/some/path/6611a662-e70f-4ba5-a397-69a3a2121129.flash1.dump', '/some/path/6611a662-e70f-4ba5-a397-69a3a2121129.flash2.dump', ), ) raw_dumps_files = sub_walker.get_raw_dumps_as_files(dump_pathnames) dump_names = { 'upload_file_minidump': '/some/path/6611a662-e70f-4ba5-a397-69a3a2121129.dump', 'flash1': '/some/path/6611a662-e70f-4ba5-a397-69a3a2121129.flash1.dump', 'flash2': '/some/path/6611a662-e70f-4ba5-a397-69a3a2121129.flash2.dump' } ok_(isinstance(raw_dumps_files, dict)) eq_(raw_dumps_files, dump_names) def test_new_crashes(self): sequence = [ ( './', '6611a662-e70f-4ba5-a397-69a3a2121129.json', './6611a662-e70f-4ba5-a397-69a3a2121129.json', ), ( './', '6611a662-e70f-4ba5-a397-69a3a2121129.upload.dump', './6611a662-e70f-4ba5-a397-69a3a2121129.upload.dump', ), ( './', '7611a662-e70f-4ba5-a397-69a3a2121129.json', './7611a662-e70f-4ba5-a397-69a3a2121129.json', ), ( './', '7611a662-e70f-4ba5-a397-69a3a2121129.other.dump', './7611a662-e70f-4ba5-a397-69a3a2121129.other.dump', ), ( './', '7611a662-e70f-4ba5-a397-69a3a2121129.other.txt', './7611a662-e70f-4ba5-a397-69a3a2121129.other.txt', ), ( './', '8611a662-e70f-4ba5-a397-69a3a2121129.json', './8611a662-e70f-4ba5-a397-69a3a2121129.json', ) ] def findFileGenerator_mock_method(root, method): for x in sequence: if method(x): yield x def listdir_mock_method(a_path): for x in sequence: yield x[1] config = self.get_standard_config() expected = [ ( (( '6611a662-e70f-4ba5-a397-69a3a2121129', [ './6611a662-e70f-4ba5-a397-69a3a2121129.json', './6611a662-e70f-4ba5-a397-69a3a2121129.upload.dump' ], ), ), {} ), ( (( '7611a662-e70f-4ba5-a397-69a3a2121129', [ './7611a662-e70f-4ba5-a397-69a3a2121129.json', './7611a662-e70f-4ba5-a397-69a3a2121129.other.dump' ], ), ), {} ), ( (( '8611a662-e70f-4ba5-a397-69a3a2121129', [ './8611a662-e70f-4ba5-a397-69a3a2121129.json' ] ), ), {} ), ] find_patch_path = 'socorro.submitter.submitter_app.findFileGenerator' with mock.patch( find_patch_path, new_callable=lambda: findFileGenerator_mock_method ): listdir_patch_path = 'socorro.submitter.submitter_app.listdir' with mock.patch( listdir_patch_path, new_callable=lambda: listdir_mock_method ): sub_walker = SubmitterFileSystemWalkerSource(config) result = [x for x in sub_walker.new_crashes()] eq_(result, expected) class TestSubmitterApp(TestCase): def get_standard_config(self): config = DotDict() config.source = DotDict() mocked_source_crashstorage = mock.Mock() mocked_source_crashstorage.id = 'mocked_source_crashstorage' config.source.crashstorage_class = mock.Mock( return_value=mocked_source_crashstorage ) config.destination = DotDict() mocked_destination_crashstorage = mock.Mock() mocked_destination_crashstorage.id = 'mocked_destination_crashstorage' config.destination.crashstorage_class = mock.Mock( return_value=mocked_destination_crashstorage ) config.producer_consumer = DotDict() mocked_producer_consumer = mock.Mock() mocked_producer_consumer.id = 'mocked_producer_consumer' config.producer_consumer.producer_consumer_class = mock.Mock( return_value=mocked_producer_consumer ) config.producer_consumer.number_of_threads = float(1) config.new_crash_source = DotDict() config.new_crash_source.new_crash_source_class = None config.submitter = DotDict() config.submitter.delay = 0 config.submitter.dry_run = False config.number_of_submissions = "all" config.logger = mock.MagicMock() return config def get_new_crash_source_config(self): config = DotDict() config.source = DotDict() mocked_source_crashstorage = mock.Mock() mocked_source_crashstorage.id = 'mocked_source_crashstorage' config.source.crashstorage_class = mock.Mock( return_value=mocked_source_crashstorage ) config.destination = DotDict() mocked_destination_crashstorage = mock.Mock() mocked_destination_crashstorage.id = 'mocked_destination_crashstorage' config.destination.crashstorage_class = mock.Mock( return_value=mocked_destination_crashstorage ) config.producer_consumer = DotDict() mocked_producer_consumer = mock.Mock() mocked_producer_consumer.id = 'mocked_producer_consumer' config.producer_consumer.producer_consumer_class = mock.Mock( return_value=mocked_producer_consumer ) config.producer_consumer.number_of_threads = float(1) config.new_crash_source = DotDict() mocked_new_crash_source = mock.Mock() mocked_new_crash_source.id = 'mocked_new_crash_source' config.new_crash_source.new_crash_source_class = mock.Mock( return_value=mocked_new_crash_source ) config.submitter = DotDict() config.submitter.delay = 0 config.submitter.dry_run = False config.number_of_submissions = "all" config.logger = mock.MagicMock() return config def test_setup(self): config = self.get_standard_config() sub = SubmitterApp(config) eq_(sub.config, config) eq_(sub.config.logger, config.logger) def test_transform(self): config = self.get_standard_config() sub = SubmitterApp(config) sub._setup_source_and_destination() crash_id = '86b58ff2-9708-487d-bfc4-9dac32121214' fake_raw_crash = DotDict() mocked_get_raw_crash = mock.Mock(return_value=fake_raw_crash) sub.source.get_raw_crash = mocked_get_raw_crash fake_dump = {'upload_file_minidump': 'fake dump'} mocked_get_raw_dumps_as_files = mock.Mock(return_value=fake_dump) sub.source.get_raw_dumps_as_files = mocked_get_raw_dumps_as_files sub.destination.save_raw_crash = mock.Mock() sub.transform(crash_id) sub.source.get_raw_crash.assert_called_with(crash_id) sub.source.get_raw_dumps_as_files.assert_called_with(crash_id) sub.destination.save_raw_crash_with_file_dumps.assert_called_with( fake_raw_crash, fake_dump, crash_id ) def test_source_iterator(self): # Test with number of submissions equal to all # It raises StopIterations after all the elements were called config = self.get_standard_config() config.number_of_submissions = "all" sub = SubmitterApp(config) sub._setup_source_and_destination() sub._setup_task_manager() sub.source.new_crashes = lambda: iter([1, 2, 3]) itera = sub.source_iterator() eq_(itera.next(), ((1,), {})) eq_(itera.next(), ((2,), {})) eq_(itera.next(), ((3,), {})) assert_raises(StopIteration, itera.next) # Test with number of submissions equal to forever # It never raises StopIterations config = self.get_standard_config() config.number_of_submissions = "forever" sub = SubmitterApp(config) sub._setup_source_and_destination() sub._setup_task_manager() itera = sub.source_iterator() sub.source.new_crashes = lambda: iter([1, 2, 3]) eq_(itera.next(), ((1,), {})) eq_(itera.next(), ((2,), {})) eq_(itera.next(), ((3,), {})) eq_(itera.next(), ((1,), {})) eq_(itera.next(), ((2,), {})) eq_(itera.next(), ((3,), {})) # Test with number of submissions equal to an integer > number of items # It raises StopIterations after some number of elements were called config = self.get_standard_config() config.number_of_submissions = "5" sub = SubmitterApp(config) sub._setup_source_and_destination() sub._setup_task_manager() itera = sub.source_iterator() sub.source.new_crashes = lambda: iter([1, 2, 3]) eq_(itera.next(), ((1,), {})) eq_(itera.next(), ((2,), {})) eq_(itera.next(), ((3,), {})) eq_(itera.next(), ((1,), {})) eq_(itera.next(), ((2,), {})) assert_raises(StopIteration, itera.next) # Test with number of submissions equal to an integer < number of items # It raises StopIterations after some number of elements were called config = self.get_standard_config() config.number_of_submissions = "1" sub = SubmitterApp(config) sub._setup_source_and_destination() sub._setup_task_manager() itera = sub.source_iterator() sub.source.new_crashes = lambda: iter([1, 2, 3]) eq_(itera.next(), ((1,), {})) assert_raises(StopIteration, itera.next) def test_new_crash_source_iterator(self): # Test with number of submissions equal to all # It raises StopIterations after all the elements were called config = self.get_new_crash_source_config() config.number_of_submissions = "all" sub = SubmitterApp(config) sub._setup_source_and_destination() sub._setup_task_manager() config.new_crash_source.new_crash_source_class.return_value \ .new_crashes = lambda: iter([1, 2, 3]) itera = sub.source_iterator() eq_(itera.next(), ((1,), {})) eq_(itera.next(), ((2,), {})) eq_(itera.next(), ((3,), {})) assert_raises(StopIteration, itera.next) # Test with number of submissions equal to forever # It never raises StopIterations config = self.get_new_crash_source_config() config.number_of_submissions = "forever" sub = SubmitterApp(config) sub._setup_source_and_destination() sub._setup_task_manager() itera = sub.source_iterator() # setup a fake iter using two form of the data to ensure it deals # with both forms correctly. config.new_crash_source.new_crash_source_class.return_value \ .new_crashes = lambda: iter([1, ((2, ), {}), 3]) eq_(itera.next(), ((1,), {})) eq_(itera.next(), ((2,), {})) eq_(itera.next(), ((3,), {})) eq_(itera.next(), ((1,), {})) eq_(itera.next(), ((2,), {})) eq_(itera.next(), ((3,), {})) # Test with number of submissions equal to an integer > number of items # It raises StopIterations after some number of elements were called config = self.get_new_crash_source_config() config.number_of_submissions = "5" sub = SubmitterApp(config) sub._setup_source_and_destination() sub._setup_task_manager() itera = sub.source_iterator() def _iter(): return iter([((1, ), {'finished_func': (1,)}), 2, 3]) config.new_crash_source.new_crash_source_class.return_value.new_crashes = _iter eq_(itera.next(), ((1,), {'finished_func': (1,)})) eq_(itera.next(), ((2,), {})) eq_(itera.next(), ((3,), {})) eq_(itera.next(), ((1,), {'finished_func': (1,)})) eq_(itera.next(), ((2,), {})) assert_raises(StopIteration, itera.next) # Test with number of submissions equal to an integer < number of items # It raises StopIterations after some number of elements were called config = self.get_new_crash_source_config() config.number_of_submissions = "1" sub = SubmitterApp(config) sub._setup_source_and_destination() sub._setup_task_manager() itera = sub.source_iterator() config.new_crash_source.new_crash_source_class.return_value \ .new_crashes = lambda: iter([1, 2, 3]) eq_(itera.next(), ((1,), {})) assert_raises(StopIteration, itera.next) # Test with number of submissions equal to an integer < number of items # AND the new_crashes iter returning an args, kwargs form rather than # than a crash_id # It raises StopIterations after some number of elements were called config = self.get_new_crash_source_config() config.number_of_submissions = "2" sub = SubmitterApp(config) sub._setup_source_and_destination() sub._setup_task_manager() itera = sub.source_iterator() config.new_crash_source.new_crash_source_class.return_value \ .new_crashes = lambda: iter( [ (((1, ['./1.json', './1.dump', './1.other.dump']), ), {}), (((2, ['./2.json', './1.dump']), ), {}) ] ) eq_( itera.next(), (((1, ['./1.json', './1.dump', './1.other.dump']), ), {}) ) eq_( itera.next(), (((2, ['./2.json', './1.dump']), ), {}) ) assert_raises(StopIteration, itera.next)
mpl-2.0
[ 3, 961, 5800, 5495, 8204, 365, 5420, 370, 314, 2895, 402, 314, 17728, 1684, 199, 3, 844, 12, 373, 14, 499, 14, 16, 14, 982, 282, 1331, 402, 314, 28481, 1990, 440, 1854, 543, 642, 199, 3, 570, 12, 2047, 883, 3332, 1373, 737, 1455, 921, 12102, 14, 1308, 15, 3950, 15, 18, 14, 16, 8083, 199, 199, 646, 1683, 199, 646, 900, 199, 646, 2022, 199, 199, 504, 11354, 14, 2537, 492, 3850, 3131, 4112, 3131, 702, 63, 3536, 199, 199, 504, 308, 28720, 293, 14, 7275, 351, 14, 7275, 351, 63, 571, 492, 334, 272, 4804, 22541, 2640, 12, 272, 4804, 22541, 17521, 26020, 2980, 12, 199, 9, 199, 504, 1101, 1237, 14, 3287, 807, 492, 24716, 2141, 199, 504, 308, 28720, 293, 14, 5159, 14, 14807, 3494, 63, 1095, 492, 9572, 5021, 199, 504, 308, 28720, 293, 14, 2796, 14, 396, 1095, 492, 7640, 421, 199, 318, 542, 1514, 2247, 2031, 589, 304, 272, 769, 63, 1618, 63, 589, 275, 769, 8, 589, 9, 339, 347, 3925, 2031, 70, 589, 12, 1011, 70, 958, 304, 267, 862, 26, 288, 372, 769, 63, 1618, 63, 589, 14, 1935, 342, 267, 871, 7888, 26, 288, 372, 488, 272, 372, 3925, 421, 199, 318, 4306, 63, 509, 63, 4041, 2031, 589, 304, 272, 769, 63, 1618, 63, 589, 275, 769, 8, 589, 9, 339, 347, 3925, 2031, 70, 589, 12, 1011, 70, 958, 304, 267, 862, 26, 288, 1995, 769, 63, 1618, 63, 589, 14, 1935, 342, 267, 871, 7888, 26, 288, 372, 272, 372, 3925, 421, 199, 533, 1379, 17187, 351, 17521, 26020, 2980, 8, 1746, 304, 339, 347, 664, 63, 6807, 63, 888, 8, 277, 304, 267, 1101, 275, 24716, 2141, 342, 267, 1101, 14, 1733, 63, 1231, 275, 488, 267, 1101, 14, 2724, 63, 4511, 275, 1987, 2724, 7, 267, 1101, 14, 2724, 63, 698, 275, 298, 5064, 63, 493, 63, 827, 344, 1220, 2, 267, 1101, 14, 581, 5021, 63, 533, 275, 9572, 5021, 267, 1101, 14, 29293, 63, 1612, 275, 9572, 5021, 14, 2427, 63, 888, 14, 29293, 63, 1612, 14, 885, 398, 1101, 14, 2921, 275, 1683, 14, 11988, 342, 398, 372, 1101, 339, 347, 511, 63, 2758, 8, 277, 304, 267, 1101, 275, 291, 14, 362, 63, 6807, 63, 888, 342, 267, 1007, 63, 87, 14976, 275, 4804, 22541, 17521, 26020, 2980, 8, 888, 9, 267, 3850, 2531, 954, 63, 87, 14976, 14, 888, 12, 1101, 9, 267, 3850, 2531, 954, 63, 87, 14976, 14, 888, 14, 2921, 12, 1101, 14, 2921, 9, 339, 347, 511, 63, 362, 63, 1773, 63, 14807, 8, 277, 304, 267, 1101, 275, 291, 14, 362, 63, 6807, 63, 888, 342, 267, 1007, 63, 87, 14976, 275, 4804, 22541, 17521, 26020, 2980, 8, 888, 9, 398, 3066, 275, 661, 6641, 354, 5122, 39, 14677, 401, 2125, 2, 23736, 63, 3954, 5122, 5, 68, 3570, 7, 450, 900, 14, 521, 1012, 267, 4026, 63, 1773, 63, 14807, 275, 24716, 2141, 8, 1001, 14, 3640, 8, 1773, 430, 267, 16991, 63, 362, 63, 1773, 63, 14807, 275, 1683, 14, 3346, 8, 1107, 63, 585, 29, 3183, 63, 1773, 63, 14807, 9, 267, 1007, 63, 87, 14976, 14, 362, 63, 1773, 63, 14807, 275, 16991, 63, 362, 63, 1773, 63, 14807, 398, 931, 63, 2960, 275, 788, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 14, 2724, 297, 1993, 283, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 14, 11331, 17, 14, 2724, 297, 1993, 283, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 14, 11331, 18, 14, 2724, 297, 1993, 1622, 398, 3066, 63, 14807, 275, 1007, 63, 87, 14976, 14, 362, 63, 1773, 63, 14807, 8, 515, 63, 2960, 9, 267, 4112, 2531, 6074, 8, 1773, 63, 14807, 12, 24716, 2141, 430, 267, 3850, 2531, 1773, 63, 14807, 459, 354, 995, 283, 39, 14677, 358, 339, 347, 511, 63, 362, 63, 1773, 63, 4180, 63, 305, 63, 1725, 8, 277, 304, 267, 1101, 275, 291, 14, 362, 63, 6807, 63, 888, 342, 267, 1007, 63, 87, 14976, 275, 4804, 22541, 17521, 26020, 2980, 8, 888, 9, 398, 5461, 63, 515, 1247, 275, 334, 288, 283, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 297, 288, 334, 355, 283, 1773, 63, 14807, 63, 493, 297, 355, 1994, 3972, 15, 515, 15, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 14, 2724, 297, 355, 1994, 3972, 15, 515, 15, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 14, 11331, 17, 14, 2724, 297, 355, 1994, 3972, 15, 515, 15, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 14, 11331, 18, 14, 2724, 297, 288, 2318, 267, 776, 267, 3066, 63, 4180, 63, 1725, 275, 1007, 63, 87, 14976, 14, 362, 63, 1773, 63, 4180, 63, 305, 63, 1725, 8, 2724, 63, 515, 1247, 9, 398, 5461, 63, 1247, 275, 469, 288, 283, 5064, 63, 493, 63, 827, 344, 1220, 356, 1994, 3972, 15, 515, 15, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 14, 2724, 297, 288, 283, 11331, 17, 356, 1994, 3972, 15, 515, 15, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 14, 11331, 17, 14, 2724, 297, 288, 283, 11331, 18, 356, 1994, 3972, 15, 515, 15, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 14, 11331, 18, 14, 2724, 7, 267 ]
[ 961, 5800, 5495, 8204, 365, 5420, 370, 314, 2895, 402, 314, 17728, 1684, 199, 3, 844, 12, 373, 14, 499, 14, 16, 14, 982, 282, 1331, 402, 314, 28481, 1990, 440, 1854, 543, 642, 199, 3, 570, 12, 2047, 883, 3332, 1373, 737, 1455, 921, 12102, 14, 1308, 15, 3950, 15, 18, 14, 16, 8083, 199, 199, 646, 1683, 199, 646, 900, 199, 646, 2022, 199, 199, 504, 11354, 14, 2537, 492, 3850, 3131, 4112, 3131, 702, 63, 3536, 199, 199, 504, 308, 28720, 293, 14, 7275, 351, 14, 7275, 351, 63, 571, 492, 334, 272, 4804, 22541, 2640, 12, 272, 4804, 22541, 17521, 26020, 2980, 12, 199, 9, 199, 504, 1101, 1237, 14, 3287, 807, 492, 24716, 2141, 199, 504, 308, 28720, 293, 14, 5159, 14, 14807, 3494, 63, 1095, 492, 9572, 5021, 199, 504, 308, 28720, 293, 14, 2796, 14, 396, 1095, 492, 7640, 421, 199, 318, 542, 1514, 2247, 2031, 589, 304, 272, 769, 63, 1618, 63, 589, 275, 769, 8, 589, 9, 339, 347, 3925, 2031, 70, 589, 12, 1011, 70, 958, 304, 267, 862, 26, 288, 372, 769, 63, 1618, 63, 589, 14, 1935, 342, 267, 871, 7888, 26, 288, 372, 488, 272, 372, 3925, 421, 199, 318, 4306, 63, 509, 63, 4041, 2031, 589, 304, 272, 769, 63, 1618, 63, 589, 275, 769, 8, 589, 9, 339, 347, 3925, 2031, 70, 589, 12, 1011, 70, 958, 304, 267, 862, 26, 288, 1995, 769, 63, 1618, 63, 589, 14, 1935, 342, 267, 871, 7888, 26, 288, 372, 272, 372, 3925, 421, 199, 533, 1379, 17187, 351, 17521, 26020, 2980, 8, 1746, 304, 339, 347, 664, 63, 6807, 63, 888, 8, 277, 304, 267, 1101, 275, 24716, 2141, 342, 267, 1101, 14, 1733, 63, 1231, 275, 488, 267, 1101, 14, 2724, 63, 4511, 275, 1987, 2724, 7, 267, 1101, 14, 2724, 63, 698, 275, 298, 5064, 63, 493, 63, 827, 344, 1220, 2, 267, 1101, 14, 581, 5021, 63, 533, 275, 9572, 5021, 267, 1101, 14, 29293, 63, 1612, 275, 9572, 5021, 14, 2427, 63, 888, 14, 29293, 63, 1612, 14, 885, 398, 1101, 14, 2921, 275, 1683, 14, 11988, 342, 398, 372, 1101, 339, 347, 511, 63, 2758, 8, 277, 304, 267, 1101, 275, 291, 14, 362, 63, 6807, 63, 888, 342, 267, 1007, 63, 87, 14976, 275, 4804, 22541, 17521, 26020, 2980, 8, 888, 9, 267, 3850, 2531, 954, 63, 87, 14976, 14, 888, 12, 1101, 9, 267, 3850, 2531, 954, 63, 87, 14976, 14, 888, 14, 2921, 12, 1101, 14, 2921, 9, 339, 347, 511, 63, 362, 63, 1773, 63, 14807, 8, 277, 304, 267, 1101, 275, 291, 14, 362, 63, 6807, 63, 888, 342, 267, 1007, 63, 87, 14976, 275, 4804, 22541, 17521, 26020, 2980, 8, 888, 9, 398, 3066, 275, 661, 6641, 354, 5122, 39, 14677, 401, 2125, 2, 23736, 63, 3954, 5122, 5, 68, 3570, 7, 450, 900, 14, 521, 1012, 267, 4026, 63, 1773, 63, 14807, 275, 24716, 2141, 8, 1001, 14, 3640, 8, 1773, 430, 267, 16991, 63, 362, 63, 1773, 63, 14807, 275, 1683, 14, 3346, 8, 1107, 63, 585, 29, 3183, 63, 1773, 63, 14807, 9, 267, 1007, 63, 87, 14976, 14, 362, 63, 1773, 63, 14807, 275, 16991, 63, 362, 63, 1773, 63, 14807, 398, 931, 63, 2960, 275, 788, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 14, 2724, 297, 1993, 283, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 14, 11331, 17, 14, 2724, 297, 1993, 283, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 14, 11331, 18, 14, 2724, 297, 1993, 1622, 398, 3066, 63, 14807, 275, 1007, 63, 87, 14976, 14, 362, 63, 1773, 63, 14807, 8, 515, 63, 2960, 9, 267, 4112, 2531, 6074, 8, 1773, 63, 14807, 12, 24716, 2141, 430, 267, 3850, 2531, 1773, 63, 14807, 459, 354, 995, 283, 39, 14677, 358, 339, 347, 511, 63, 362, 63, 1773, 63, 4180, 63, 305, 63, 1725, 8, 277, 304, 267, 1101, 275, 291, 14, 362, 63, 6807, 63, 888, 342, 267, 1007, 63, 87, 14976, 275, 4804, 22541, 17521, 26020, 2980, 8, 888, 9, 398, 5461, 63, 515, 1247, 275, 334, 288, 283, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 297, 288, 334, 355, 283, 1773, 63, 14807, 63, 493, 297, 355, 1994, 3972, 15, 515, 15, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 14, 2724, 297, 355, 1994, 3972, 15, 515, 15, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 14, 11331, 17, 14, 2724, 297, 355, 1994, 3972, 15, 515, 15, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 14, 11331, 18, 14, 2724, 297, 288, 2318, 267, 776, 267, 3066, 63, 4180, 63, 1725, 275, 1007, 63, 87, 14976, 14, 362, 63, 1773, 63, 4180, 63, 305, 63, 1725, 8, 2724, 63, 515, 1247, 9, 398, 5461, 63, 1247, 275, 469, 288, 283, 5064, 63, 493, 63, 827, 344, 1220, 356, 1994, 3972, 15, 515, 15, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 14, 2724, 297, 288, 283, 11331, 17, 356, 1994, 3972, 15, 515, 15, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 14, 11331, 17, 14, 2724, 297, 288, 283, 11331, 18, 356, 1994, 3972, 15, 515, 15, 1272, 845, 65, 19243, 13, 69, 2760, 70, 13, 20, 2470, 21, 13, 65, 13145, 13, 1876, 65, 19, 65, 11722, 6094, 25, 14, 11331, 18, 14, 2724, 7, 267, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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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 ]
matthiasplappert/pibot
src/robot/base.py
1
4268
import logging import select import Pyro4 import Pyro4.core import Pyro4.naming import Pyro4.socketutil class Robot(object): def __init__(self): self._sensors = [] self._actuators = [] self.n_steps = 0 @property def actuators(self): return self._actuators @actuators.setter def actuators(self, val): self._actuators = val @property def sensors(self): return self._sensors @sensors.setter def sensors(self, val): self._sensors = val def open(self): for sensor in self.sensors: if sensor.is_open: continue if not sensor.open(): return False for actuator in self.actuators: if actuator.is_open: continue if not actuator.open(): return False return True def close(self): for sensor in self.sensors: if not sensor.is_open: continue if not sensor.close(): return False for actuator in self.actuators: if not actuator.is_open: continue if not actuator.close(): return False return True def perceive(self): result = [] for sensor in self.sensors: data = None if self.n_steps % sensor.step_interval == 0: data = sensor.perceive() if data is None: logging.error('could not perceive with sensor %s' % sensor) result.append(data) return result def act(self, actions): if len(actions) != len(self.actuators): raise ValueError('must specify an action for each actuator') self.n_steps += 1 for idx, actuator in enumerate(self.actuators): if not actuator.act(actions[idx]): logging.error('could not perform action on actuator %s' % actuator) def run_robot(name, host, port): Pyro4.config.SERIALIZERS_ACCEPTED.add('pickle') print('initializing robot "%s" ...' % name) robot = Robot() print('starting event loop ...') pyro_event_loop(name, robot, host=host, port=port) print('shutting down robot ...') def get_remote_robot(name, host, port): # Use pickle for serialization (because we serialize numpy arrays). Pyro4.config.SERIALIZER = 'pickle' # Connect to robot and configure it. uri = 'PYRONAME:' + name if host is not None: uri += '@' + str(host) if port is not None: uri += ':' + str(port) return Pyro4.Proxy(uri) def pyro_event_loop(name, obj, timeout=3.0, host=None, port=9090, callback=None): Pyro4.config.SERVERTYPE = 'thread' if host is None: host = Pyro4.socketutil.getIpAddress(None, workaround127=True) nameserverUri, nameserverDaemon, broadcastServer = Pyro4.naming.startNS(host=host, port=port) logging.info('name server uri: %s', nameserverUri) assert broadcastServer is not None daemon = Pyro4.core.Daemon(host=host) serverUri = daemon.register(obj) nameserverDaemon.nameserver.register(name, serverUri) # Event loop while True: # Create sets of the socket objects we will be waiting on nameserverSockets = set(nameserverDaemon.sockets) pyroSockets = set(daemon.sockets) rs = [broadcastServer] # only the broadcast server is directly usable as a select() object rs.extend(nameserverSockets) rs.extend(pyroSockets) rs, _, _ = select.select(rs, [], [], timeout) eventsForNameserver = [] eventsForDaemon = [] for s in rs: if s is broadcastServer: broadcastServer.processRequest() elif s in nameserverSockets: eventsForNameserver.append(s) elif s in pyroSockets: eventsForDaemon.append(s) if eventsForNameserver: nameserverDaemon.events(eventsForNameserver) if eventsForDaemon: daemon.events(eventsForDaemon) if callback is not None and callable(callback): callback() nameserverDaemon.close() broadcastServer.close() daemon.close()
mit
[ 646, 2050, 199, 646, 3504, 199, 199, 646, 1611, 293, 20, 199, 646, 1611, 293, 20, 14, 1018, 199, 646, 1611, 293, 20, 14, 26919, 199, 646, 1611, 293, 20, 14, 3450, 1974, 421, 199, 533, 820, 17800, 8, 785, 304, 272, 347, 636, 826, 721, 277, 304, 267, 291, 423, 22675, 275, 942, 267, 291, 423, 2442, 85, 2750, 275, 942, 267, 291, 14, 78, 63, 5895, 275, 378, 339, 768, 1829, 272, 347, 2454, 85, 2750, 8, 277, 304, 267, 372, 291, 423, 2442, 85, 2750, 339, 768, 2442, 85, 2750, 14, 8345, 272, 347, 2454, 85, 2750, 8, 277, 12, 1139, 304, 267, 291, 423, 2442, 85, 2750, 275, 1139, 339, 768, 1829, 272, 347, 19678, 8, 277, 304, 267, 372, 291, 423, 22675, 339, 768, 22675, 14, 8345, 272, 347, 19678, 8, 277, 12, 1139, 304, 267, 291, 423, 22675, 275, 1139, 339, 347, 1551, 8, 277, 304, 267, 367, 8778, 315, 291, 14, 22675, 26, 288, 340, 8778, 14, 374, 63, 1490, 26, 355, 1980, 288, 340, 440, 8778, 14, 1490, 837, 355, 372, 756, 267, 367, 2454, 16530, 315, 291, 14, 2442, 85, 2750, 26, 288, 340, 2454, 16530, 14, 374, 63, 1490, 26, 355, 1980, 288, 340, 440, 2454, 16530, 14, 1490, 837, 355, 372, 756, 267, 372, 715, 339, 347, 4002, 8, 277, 304, 267, 367, 8778, 315, 291, 14, 22675, 26, 288, 340, 440, 8778, 14, 374, 63, 1490, 26, 355, 1980, 288, 340, 440, 8778, 14, 1600, 837, 355, 372, 756, 267, 367, 2454, 16530, 315, 291, 14, 2442, 85, 2750, 26, 288, 340, 440, 2454, 16530, 14, 374, 63, 1490, 26, 355, 1980, 288, 340, 440, 2454, 16530, 14, 1600, 837, 355, 372, 756, 267, 372, 715, 339, 347, 1126, 5251, 8, 277, 304, 267, 754, 275, 942, 267, 367, 8778, 315, 291, 14, 22675, 26, 288, 666, 275, 488, 288, 340, 291, 14, 78, 63, 5895, 450, 8778, 14, 2926, 63, 4284, 508, 378, 26, 355, 666, 275, 8778, 14, 529, 5251, 342, 355, 340, 666, 365, 488, 26, 490, 2050, 14, 705, 360, 15153, 440, 1126, 5251, 543, 8778, 450, 83, 7, 450, 8778, 9, 288, 754, 14, 740, 8, 576, 9, 267, 372, 754, 339, 347, 2454, 8, 277, 12, 5445, 304, 267, 340, 822, 8, 3723, 9, 1137, 822, 8, 277, 14, 2442, 85, 2750, 304, 288, 746, 1722, 360, 7790, 4165, 376, 1595, 367, 1924, 2454, 16530, 358, 398, 291, 14, 78, 63, 5895, 847, 413, 267, 367, 4280, 12, 2454, 16530, 315, 3874, 8, 277, 14, 2442, 85, 2750, 304, 288, 340, 440, 2454, 16530, 14, 2442, 8, 3723, 59, 2996, 4682, 355, 2050, 14, 705, 360, 15153, 440, 5147, 1595, 641, 2454, 16530, 450, 83, 7, 450, 2454, 16530, 9, 421, 199, 318, 1255, 63, 9751, 8, 354, 12, 1591, 12, 1844, 304, 272, 1611, 293, 20, 14, 888, 14, 19637, 5357, 3960, 63, 13089, 1149, 14, 525, 360, 8092, 358, 339, 870, 360, 2747, 9147, 14544, 2071, 83, 2, 2263, 7, 450, 536, 9, 272, 14544, 275, 820, 17800, 342, 272, 870, 360, 15769, 1566, 4438, 2263, 358, 272, 1134, 293, 63, 1430, 63, 3813, 8, 354, 12, 14544, 12, 1591, 29, 1102, 12, 1844, 29, 719, 9, 272, 870, 360, 609, 337, 1337, 3224, 14544, 2263, 358, 421, 199, 318, 664, 63, 3846, 63, 9751, 8, 354, 12, 1591, 12, 1844, 304, 272, 327, 3645, 5927, 367, 16953, 334, 20684, 781, 8437, 2680, 6572, 680, 272, 1611, 293, 20, 14, 888, 14, 19637, 5357, 540, 275, 283, 8092, 7, 339, 327, 15175, 370, 14544, 436, 7908, 652, 14, 272, 5108, 275, 283, 48, 3763, 615, 1991, 4881, 435, 536, 272, 340, 1591, 365, 440, 488, 26, 267, 5108, 847, 22143, 435, 620, 8, 1102, 9, 267, 340, 1844, 365, 440, 488, 26, 288, 5108, 847, 10871, 435, 620, 8, 719, 9, 272, 372, 1611, 293, 20, 14, 4936, 8, 2302, 9, 421, 199, 318, 1134, 293, 63, 1430, 63, 3813, 8, 354, 12, 1559, 12, 2653, 29, 19, 14, 16, 12, 1591, 29, 403, 12, 1844, 29, 25, 18526, 12, 3233, 29, 403, 304, 272, 1611, 293, 20, 14, 888, 14, 6613, 2711, 275, 283, 2671, 7, 272, 340, 1591, 365, 488, 26, 267, 1591, 275, 1611, 293, 20, 14, 3450, 1974, 14, 362, 23211, 8, 403, 12, 18092, 4195, 29, 549, 9, 339, 536, 1000, 14014, 12, 536, 1000, 20555, 12, 11180, 3120, 275, 1611, 293, 20, 14, 26919, 14, 928, 2709, 8, 1102, 29, 1102, 12, 1844, 29, 719, 9, 272, 2050, 14, 815, 360, 354, 1654, 5108, 26, 450, 83, 297, 536, 1000, 14014, 9, 272, 702, 11180, 3120, 365, 440, 488, 272, 11128, 275, 1611, 293, 20, 14, 1018, 14, 20555, 8, 1102, 29, 1102, 9, 272, 1654, 14014, 275, 11128, 14, 2683, 8, 1113, 9, 272, 536, 1000, 20555, 14, 354, 1000, 14, 2683, 8, 354, 12, 1654, 14014, 9, 339, 327, 6763, 4438, 272, 1830, 715, 26, 267, 327, 2790, 5951, 402, 314, 2838, 2251, 781, 911, 506, 10923, 641, 267, 536, 1000, 3869, 83, 275, 663, 8, 354, 1000, 20555, 14, 20517, 9, 267, 1134, 293, 3869, 83, 275, 663, 8, 10824, 14, 20517, 9, 267, 10717, 275, 359, 10786, 3120, 61, 221, 327, 1454, 314, 11180, 1654, 365, 5370, 18025, 465, 282, 3504, 342, 909, 267, 10717, 14, 2880, 8, 354, 1000, 3869, 83, 9, 267, 10717, 14, 2880, 8, 647, 293, 3869, 83, 9, 267, 10717, 12, 5501, 485, 275, 3504, 14, 2416, 8, 2393, 12, 990, 990, 2653, 9, 267, 4474, 1858, 985, 1000, 275, 942, 267, 4474, 1858, 20555, 275, 942, 267, 367, 308, 315, 10717, 26, 288, 340, 308, 365, 11180, 3120, 26, 355, 11180, 3120, 14, 1412, 2017, 342, 288, 916, 308, 315, 536, 1000, 3869, 83, 26, 355, 4474, 1858, 985, 1000, 14, 740, 8, 83, 9, 288, 916, 308, 315, 1134, 293, 3869, 83, 26, 355, 4474, 1858, 20555, 14, 740, 8, 83, 9, 267, 340, 4474, 1858, 985, 1000, 26, 288, 536, 1000, 20555, 14, 4368, 8, 4368, 1858, 985, 1000, 9, 267, 340, 4474, 1858, 20555, 26, 288, 11128, 14, 4368, 8, 4368, 1858, 20555, 9, 398 ]
[ 2050, 199, 646, 3504, 199, 199, 646, 1611, 293, 20, 199, 646, 1611, 293, 20, 14, 1018, 199, 646, 1611, 293, 20, 14, 26919, 199, 646, 1611, 293, 20, 14, 3450, 1974, 421, 199, 533, 820, 17800, 8, 785, 304, 272, 347, 636, 826, 721, 277, 304, 267, 291, 423, 22675, 275, 942, 267, 291, 423, 2442, 85, 2750, 275, 942, 267, 291, 14, 78, 63, 5895, 275, 378, 339, 768, 1829, 272, 347, 2454, 85, 2750, 8, 277, 304, 267, 372, 291, 423, 2442, 85, 2750, 339, 768, 2442, 85, 2750, 14, 8345, 272, 347, 2454, 85, 2750, 8, 277, 12, 1139, 304, 267, 291, 423, 2442, 85, 2750, 275, 1139, 339, 768, 1829, 272, 347, 19678, 8, 277, 304, 267, 372, 291, 423, 22675, 339, 768, 22675, 14, 8345, 272, 347, 19678, 8, 277, 12, 1139, 304, 267, 291, 423, 22675, 275, 1139, 339, 347, 1551, 8, 277, 304, 267, 367, 8778, 315, 291, 14, 22675, 26, 288, 340, 8778, 14, 374, 63, 1490, 26, 355, 1980, 288, 340, 440, 8778, 14, 1490, 837, 355, 372, 756, 267, 367, 2454, 16530, 315, 291, 14, 2442, 85, 2750, 26, 288, 340, 2454, 16530, 14, 374, 63, 1490, 26, 355, 1980, 288, 340, 440, 2454, 16530, 14, 1490, 837, 355, 372, 756, 267, 372, 715, 339, 347, 4002, 8, 277, 304, 267, 367, 8778, 315, 291, 14, 22675, 26, 288, 340, 440, 8778, 14, 374, 63, 1490, 26, 355, 1980, 288, 340, 440, 8778, 14, 1600, 837, 355, 372, 756, 267, 367, 2454, 16530, 315, 291, 14, 2442, 85, 2750, 26, 288, 340, 440, 2454, 16530, 14, 374, 63, 1490, 26, 355, 1980, 288, 340, 440, 2454, 16530, 14, 1600, 837, 355, 372, 756, 267, 372, 715, 339, 347, 1126, 5251, 8, 277, 304, 267, 754, 275, 942, 267, 367, 8778, 315, 291, 14, 22675, 26, 288, 666, 275, 488, 288, 340, 291, 14, 78, 63, 5895, 450, 8778, 14, 2926, 63, 4284, 508, 378, 26, 355, 666, 275, 8778, 14, 529, 5251, 342, 355, 340, 666, 365, 488, 26, 490, 2050, 14, 705, 360, 15153, 440, 1126, 5251, 543, 8778, 450, 83, 7, 450, 8778, 9, 288, 754, 14, 740, 8, 576, 9, 267, 372, 754, 339, 347, 2454, 8, 277, 12, 5445, 304, 267, 340, 822, 8, 3723, 9, 1137, 822, 8, 277, 14, 2442, 85, 2750, 304, 288, 746, 1722, 360, 7790, 4165, 376, 1595, 367, 1924, 2454, 16530, 358, 398, 291, 14, 78, 63, 5895, 847, 413, 267, 367, 4280, 12, 2454, 16530, 315, 3874, 8, 277, 14, 2442, 85, 2750, 304, 288, 340, 440, 2454, 16530, 14, 2442, 8, 3723, 59, 2996, 4682, 355, 2050, 14, 705, 360, 15153, 440, 5147, 1595, 641, 2454, 16530, 450, 83, 7, 450, 2454, 16530, 9, 421, 199, 318, 1255, 63, 9751, 8, 354, 12, 1591, 12, 1844, 304, 272, 1611, 293, 20, 14, 888, 14, 19637, 5357, 3960, 63, 13089, 1149, 14, 525, 360, 8092, 358, 339, 870, 360, 2747, 9147, 14544, 2071, 83, 2, 2263, 7, 450, 536, 9, 272, 14544, 275, 820, 17800, 342, 272, 870, 360, 15769, 1566, 4438, 2263, 358, 272, 1134, 293, 63, 1430, 63, 3813, 8, 354, 12, 14544, 12, 1591, 29, 1102, 12, 1844, 29, 719, 9, 272, 870, 360, 609, 337, 1337, 3224, 14544, 2263, 358, 421, 199, 318, 664, 63, 3846, 63, 9751, 8, 354, 12, 1591, 12, 1844, 304, 272, 327, 3645, 5927, 367, 16953, 334, 20684, 781, 8437, 2680, 6572, 680, 272, 1611, 293, 20, 14, 888, 14, 19637, 5357, 540, 275, 283, 8092, 7, 339, 327, 15175, 370, 14544, 436, 7908, 652, 14, 272, 5108, 275, 283, 48, 3763, 615, 1991, 4881, 435, 536, 272, 340, 1591, 365, 440, 488, 26, 267, 5108, 847, 22143, 435, 620, 8, 1102, 9, 267, 340, 1844, 365, 440, 488, 26, 288, 5108, 847, 10871, 435, 620, 8, 719, 9, 272, 372, 1611, 293, 20, 14, 4936, 8, 2302, 9, 421, 199, 318, 1134, 293, 63, 1430, 63, 3813, 8, 354, 12, 1559, 12, 2653, 29, 19, 14, 16, 12, 1591, 29, 403, 12, 1844, 29, 25, 18526, 12, 3233, 29, 403, 304, 272, 1611, 293, 20, 14, 888, 14, 6613, 2711, 275, 283, 2671, 7, 272, 340, 1591, 365, 488, 26, 267, 1591, 275, 1611, 293, 20, 14, 3450, 1974, 14, 362, 23211, 8, 403, 12, 18092, 4195, 29, 549, 9, 339, 536, 1000, 14014, 12, 536, 1000, 20555, 12, 11180, 3120, 275, 1611, 293, 20, 14, 26919, 14, 928, 2709, 8, 1102, 29, 1102, 12, 1844, 29, 719, 9, 272, 2050, 14, 815, 360, 354, 1654, 5108, 26, 450, 83, 297, 536, 1000, 14014, 9, 272, 702, 11180, 3120, 365, 440, 488, 272, 11128, 275, 1611, 293, 20, 14, 1018, 14, 20555, 8, 1102, 29, 1102, 9, 272, 1654, 14014, 275, 11128, 14, 2683, 8, 1113, 9, 272, 536, 1000, 20555, 14, 354, 1000, 14, 2683, 8, 354, 12, 1654, 14014, 9, 339, 327, 6763, 4438, 272, 1830, 715, 26, 267, 327, 2790, 5951, 402, 314, 2838, 2251, 781, 911, 506, 10923, 641, 267, 536, 1000, 3869, 83, 275, 663, 8, 354, 1000, 20555, 14, 20517, 9, 267, 1134, 293, 3869, 83, 275, 663, 8, 10824, 14, 20517, 9, 267, 10717, 275, 359, 10786, 3120, 61, 221, 327, 1454, 314, 11180, 1654, 365, 5370, 18025, 465, 282, 3504, 342, 909, 267, 10717, 14, 2880, 8, 354, 1000, 3869, 83, 9, 267, 10717, 14, 2880, 8, 647, 293, 3869, 83, 9, 267, 10717, 12, 5501, 485, 275, 3504, 14, 2416, 8, 2393, 12, 990, 990, 2653, 9, 267, 4474, 1858, 985, 1000, 275, 942, 267, 4474, 1858, 20555, 275, 942, 267, 367, 308, 315, 10717, 26, 288, 340, 308, 365, 11180, 3120, 26, 355, 11180, 3120, 14, 1412, 2017, 342, 288, 916, 308, 315, 536, 1000, 3869, 83, 26, 355, 4474, 1858, 985, 1000, 14, 740, 8, 83, 9, 288, 916, 308, 315, 1134, 293, 3869, 83, 26, 355, 4474, 1858, 20555, 14, 740, 8, 83, 9, 267, 340, 4474, 1858, 985, 1000, 26, 288, 536, 1000, 20555, 14, 4368, 8, 4368, 1858, 985, 1000, 9, 267, 340, 4474, 1858, 20555, 26, 288, 11128, 14, 4368, 8, 4368, 1858, 20555, 9, 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, 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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 ]
daya-shankar/foursquared.eclair
util/gen_class.py
262
3173
#!/usr/bin/python import datetime import sys import textwrap import common from xml.dom import pulldom HEADER = """\ /** * Copyright 2009 Joe LaPenna */ package com.joelapenna.foursquare.types; %(imports)s /** * Auto-generated: %(timestamp)s * * @author Joe LaPenna (joe@joelapenna.com) */ public class %(type_name)s implements %(interfaces)s { """ GETTER = """\ public %(attribute_type)s get%(camel_name)s() { return %(field_name)s; } """ SETTER = """\ public void set%(camel_name)s(%(attribute_type)s %(attribute_name)s) { %(field_name)s = %(attribute_name)s; } """ BOOLEAN_GETTER = """\ public %(attribute_type)s %(attribute_name)s() { return %(field_name)s; } """ def main(): type_name, top_node_name, attributes = common.WalkNodesForAttributes( sys.argv[1]) GenerateClass(type_name, attributes) def GenerateClass(type_name, attributes): lines = [] for attribute_name in sorted(attributes): typ, children = attributes[attribute_name] lines.extend(Field(attribute_name, typ).split('\n')) lines.append('') lines.extend(Constructor(type_name).split('\n')) lines.append('') # getters and setters for attribute_name in sorted(attributes): attribute_type, children = attributes[attribute_name] lines.extend(Accessors(attribute_name, attribute_type).split('\n')) print Header(type_name) #print ' ' + '\n '.join(lines) for line in lines: if not line: print line else: print ' ' + line print Footer() def AccessorReplacements(attribute_name, attribute_type): # CamelCaseClassName camel_name = ''.join([word.capitalize() for word in attribute_name.split('_')]) # camelCaseLocalName attribute_name = (camel_name[0].lower() + camel_name[1:]) # mFieldName field_attribute_name = 'm' + camel_name return { 'attribute_name': attribute_name, 'camel_name': camel_name, 'field_name': field_attribute_name, 'attribute_type': attribute_type } def Header(type_name): interfaces = common.INTERFACES.get(type_name, common.DEFAULT_INTERFACES) import_names = common.CLASS_IMPORTS.get(type_name, common.DEFAULT_CLASS_IMPORTS) if import_names: imports = ';\n'.join(imports) + ';' else: imports = '' return HEADER % {'type_name': type_name, 'interfaces': ', '.join(interfaces), 'imports': imports, 'timestamp': datetime.datetime.now()} def Field(attribute_name, attribute_type): """Print the field declarations.""" replacements = AccessorReplacements(attribute_name, attribute_type) return 'private %(attribute_type)s %(field_name)s;' % replacements def Constructor(type_name): return 'public %s() {\n}' % type_name def Accessors(name, attribute_type): """Print the getter and setter definitions.""" replacements = AccessorReplacements(name, attribute_type) if attribute_type == common.BOOLEAN: return '%s\n%s' % (BOOLEAN_GETTER % replacements, SETTER % replacements) else: return '%s\n%s' % (GETTER % replacements, SETTER % replacements) def Footer(): return '}' if __name__ == '__main__': main()
apache-2.0
[ 3381, 2647, 15, 1393, 15, 1548, 199, 199, 646, 2197, 199, 646, 984, 199, 646, 13390, 199, 199, 646, 2863, 199, 199, 504, 2748, 14, 4556, 492, 10299, 4556, 199, 199, 7311, 275, 9638, 199, 15, 538, 199, 627, 1898, 8937, 7135, 69, 7964, 15597, 3540, 199, 11589, 199, 199, 2491, 2414, 14, 743, 16455, 287, 3540, 14, 13672, 9646, 14, 1313, 27, 199, 2840, 12775, 9, 83, 199, 15, 538, 199, 627, 9195, 13, 10176, 26, 2818, 3954, 9, 83, 199, 627, 199, 627, 768, 2502, 7135, 69, 7964, 15597, 3540, 334, 20241, 32, 743, 16455, 287, 3540, 14, 957, 9, 199, 11589, 199, 3455, 1021, 2818, 466, 63, 354, 9, 83, 9031, 2818, 7436, 9, 83, 469, 199, 624, 421, 199, 39, 1573, 275, 9638, 199, 3455, 2818, 3215, 63, 466, 9, 83, 664, 2840, 22997, 63, 354, 9, 83, 342, 469, 272, 372, 2818, 698, 63, 354, 9, 83, 27, 199, 93, 199, 624, 199, 199, 51, 1573, 275, 9638, 199, 3455, 2309, 663, 2840, 22997, 63, 354, 9, 83, 12473, 3215, 63, 466, 9, 83, 2818, 3215, 63, 354, 9, 83, 9, 469, 272, 2818, 698, 63, 354, 9, 83, 275, 2818, 3215, 63, 354, 9, 83, 27, 199, 93, 199, 624, 199, 199, 25312, 63, 39, 1573, 275, 9638, 199, 3455, 2818, 3215, 63, 466, 9, 83, 2818, 3215, 63, 354, 9, 83, 342, 469, 272, 372, 2818, 698, 63, 354, 9, 83, 27, 199, 93, 199, 624, 421, 199, 318, 2446, 837, 523, 730, 63, 354, 12, 2746, 63, 932, 63, 354, 12, 3004, 275, 2863, 14, 31491, 6300, 1858, 5379, 8, 489, 984, 14, 3020, 59, 17, 566, 523, 7958, 2543, 8, 466, 63, 354, 12, 3004, 9, 421, 199, 318, 7958, 2543, 8, 466, 63, 354, 12, 3004, 304, 523, 2385, 275, 942, 523, 367, 2225, 63, 354, 315, 3355, 8, 2987, 304, 272, 6211, 12, 4978, 275, 3004, 59, 3215, 63, 354, 61, 272, 2385, 14, 2880, 8, 792, 8, 3215, 63, 354, 12, 6211, 680, 1294, 2258, 78, 1333, 819, 2385, 14, 740, 8355, 523, 2385, 14, 2880, 8, 11447, 8, 466, 63, 354, 680, 1294, 2258, 78, 1333, 523, 2385, 14, 740, 8355, 819, 327, 664, 878, 436, 663, 878, 523, 367, 2225, 63, 354, 315, 3355, 8, 2987, 304, 272, 2225, 63, 466, 12, 4978, 275, 3004, 59, 3215, 63, 354, 61, 272, 2385, 14, 2880, 8, 3946, 1384, 8, 3215, 63, 354, 12, 2225, 63, 466, 680, 1294, 2258, 78, 1333, 819, 870, 10240, 8, 466, 63, 354, 9, 523, 327, 1361, 283, 259, 283, 435, 1557, 78, 259, 1987, 904, 8, 1278, 9, 523, 367, 1004, 315, 2385, 26, 272, 340, 440, 1004, 26, 489, 870, 1004, 272, 587, 26, 489, 870, 283, 259, 283, 435, 1004, 523, 870, 8024, 351, 342, 421, 199, 318, 11003, 269, 11328, 1470, 8, 3215, 63, 354, 12, 2225, 63, 466, 304, 523, 327, 445, 14868, 1538, 23200, 523, 31129, 63, 354, 275, 6522, 904, 779, 1027, 14, 18351, 342, 717, 367, 4349, 315, 2225, 63, 354, 14, 1294, 6412, 2023, 523, 327, 31129, 1538, 5339, 985, 523, 2225, 63, 354, 275, 334, 22997, 63, 354, 59, 16, 1055, 2325, 342, 435, 31129, 63, 354, 59, 17, 5728, 523, 327, 333, 792, 985, 523, 901, 63, 3215, 63, 354, 275, 283, 77, 7, 435, 31129, 63, 354, 819, 372, 469, 489, 283, 3215, 63, 354, 356, 2225, 63, 354, 12, 489, 283, 22997, 63, 354, 356, 31129, 63, 354, 12, 489, 283, 698, 63, 354, 356, 901, 63, 3215, 63, 354, 12, 489, 283, 3215, 63, 466, 356, 2225, 63, 466, 523, 789, 421, 199, 318, 10240, 8, 466, 63, 354, 304, 523, 8386, 275, 2863, 14, 3843, 38, 21287, 14, 362, 8, 466, 63, 354, 12, 2863, 14, 3472, 63, 3843, 38, 21287, 9, 523, 492, 63, 1247, 275, 2863, 14, 6885, 63, 17576, 51, 14, 362, 8, 466, 63, 354, 12, 489, 2863, 14, 3472, 63, 6885, 63, 17576, 51, 9, 523, 340, 492, 63, 1247, 26, 272, 8925, 275, 283, 3779, 78, 1370, 904, 8, 12775, 9, 435, 20054, 523, 587, 26, 272, 8925, 275, 2125, 523, 372, 13053, 540, 450, 791, 466, 63, 354, 356, 730, 63, 354, 12, 673, 283, 7436, 356, 1656, 1987, 904, 8, 7436, 395, 673, 283, 12775, 356, 8925, 12, 673, 283, 3954, 356, 2197, 14, 2083, 14, 2131, 12737, 421, 199, 318, 5024, 8, 3215, 63, 354, 12, 2225, 63, 466, 304, 523, 408, 5375, 314, 901, 18707, 1041, 523, 22372, 275, 11003, 269, 11328, 1470, 8, 3215, 63, 354, 12, 2225, 63, 466, 9, 523, 372, 283, 4239, 2818, 3215, 63, 466, 9, 83, 2818, 698, 63, 354, 9, 83, 8942, 450, 22372, 421, 199, 318, 20297, 8, 466, 63, 354, 304, 523, 372, 283, 3455, 450, 83, 342, 9459, 78, 6834, 450, 730, 63, 354, 421, 199, 318, 11003, 1384, 8, 354, 12, 2225, 63, 466, 304, 523, 408, 5375, 314, 15917, 436, 18743, 10269, 1041, 523, 22372, 275, 11003, 269, 11328, 1470, 8, 354, 12, 2225, 63, 466, 9, 523, 340, 2225, 63, 466, 508, 2863, 14, 25312, 26, 272, 372, 1543, 83, 60, 78, 5, 83, 7, 450, 334, 25312, 63, 39, 1573, 450, 22372, 12, 428, 1573, 450, 22372, 9, 523, 587, 26, 272, 372, 1543, 83, 60, 78, 5, 83, 7, 450, 334, 39, 1573, 450, 22372, 12, 428, 1573, 450, 22372, 9, 421, 199, 318, 8024, 351, 837, 523, 372, 23618, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 523, 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 ]
[ 2647, 15, 1393, 15, 1548, 199, 199, 646, 2197, 199, 646, 984, 199, 646, 13390, 199, 199, 646, 2863, 199, 199, 504, 2748, 14, 4556, 492, 10299, 4556, 199, 199, 7311, 275, 9638, 199, 15, 538, 199, 627, 1898, 8937, 7135, 69, 7964, 15597, 3540, 199, 11589, 199, 199, 2491, 2414, 14, 743, 16455, 287, 3540, 14, 13672, 9646, 14, 1313, 27, 199, 2840, 12775, 9, 83, 199, 15, 538, 199, 627, 9195, 13, 10176, 26, 2818, 3954, 9, 83, 199, 627, 199, 627, 768, 2502, 7135, 69, 7964, 15597, 3540, 334, 20241, 32, 743, 16455, 287, 3540, 14, 957, 9, 199, 11589, 199, 3455, 1021, 2818, 466, 63, 354, 9, 83, 9031, 2818, 7436, 9, 83, 469, 199, 624, 421, 199, 39, 1573, 275, 9638, 199, 3455, 2818, 3215, 63, 466, 9, 83, 664, 2840, 22997, 63, 354, 9, 83, 342, 469, 272, 372, 2818, 698, 63, 354, 9, 83, 27, 199, 93, 199, 624, 199, 199, 51, 1573, 275, 9638, 199, 3455, 2309, 663, 2840, 22997, 63, 354, 9, 83, 12473, 3215, 63, 466, 9, 83, 2818, 3215, 63, 354, 9, 83, 9, 469, 272, 2818, 698, 63, 354, 9, 83, 275, 2818, 3215, 63, 354, 9, 83, 27, 199, 93, 199, 624, 199, 199, 25312, 63, 39, 1573, 275, 9638, 199, 3455, 2818, 3215, 63, 466, 9, 83, 2818, 3215, 63, 354, 9, 83, 342, 469, 272, 372, 2818, 698, 63, 354, 9, 83, 27, 199, 93, 199, 624, 421, 199, 318, 2446, 837, 523, 730, 63, 354, 12, 2746, 63, 932, 63, 354, 12, 3004, 275, 2863, 14, 31491, 6300, 1858, 5379, 8, 489, 984, 14, 3020, 59, 17, 566, 523, 7958, 2543, 8, 466, 63, 354, 12, 3004, 9, 421, 199, 318, 7958, 2543, 8, 466, 63, 354, 12, 3004, 304, 523, 2385, 275, 942, 523, 367, 2225, 63, 354, 315, 3355, 8, 2987, 304, 272, 6211, 12, 4978, 275, 3004, 59, 3215, 63, 354, 61, 272, 2385, 14, 2880, 8, 792, 8, 3215, 63, 354, 12, 6211, 680, 1294, 2258, 78, 1333, 819, 2385, 14, 740, 8355, 523, 2385, 14, 2880, 8, 11447, 8, 466, 63, 354, 680, 1294, 2258, 78, 1333, 523, 2385, 14, 740, 8355, 819, 327, 664, 878, 436, 663, 878, 523, 367, 2225, 63, 354, 315, 3355, 8, 2987, 304, 272, 2225, 63, 466, 12, 4978, 275, 3004, 59, 3215, 63, 354, 61, 272, 2385, 14, 2880, 8, 3946, 1384, 8, 3215, 63, 354, 12, 2225, 63, 466, 680, 1294, 2258, 78, 1333, 819, 870, 10240, 8, 466, 63, 354, 9, 523, 327, 1361, 283, 259, 283, 435, 1557, 78, 259, 1987, 904, 8, 1278, 9, 523, 367, 1004, 315, 2385, 26, 272, 340, 440, 1004, 26, 489, 870, 1004, 272, 587, 26, 489, 870, 283, 259, 283, 435, 1004, 523, 870, 8024, 351, 342, 421, 199, 318, 11003, 269, 11328, 1470, 8, 3215, 63, 354, 12, 2225, 63, 466, 304, 523, 327, 445, 14868, 1538, 23200, 523, 31129, 63, 354, 275, 6522, 904, 779, 1027, 14, 18351, 342, 717, 367, 4349, 315, 2225, 63, 354, 14, 1294, 6412, 2023, 523, 327, 31129, 1538, 5339, 985, 523, 2225, 63, 354, 275, 334, 22997, 63, 354, 59, 16, 1055, 2325, 342, 435, 31129, 63, 354, 59, 17, 5728, 523, 327, 333, 792, 985, 523, 901, 63, 3215, 63, 354, 275, 283, 77, 7, 435, 31129, 63, 354, 819, 372, 469, 489, 283, 3215, 63, 354, 356, 2225, 63, 354, 12, 489, 283, 22997, 63, 354, 356, 31129, 63, 354, 12, 489, 283, 698, 63, 354, 356, 901, 63, 3215, 63, 354, 12, 489, 283, 3215, 63, 466, 356, 2225, 63, 466, 523, 789, 421, 199, 318, 10240, 8, 466, 63, 354, 304, 523, 8386, 275, 2863, 14, 3843, 38, 21287, 14, 362, 8, 466, 63, 354, 12, 2863, 14, 3472, 63, 3843, 38, 21287, 9, 523, 492, 63, 1247, 275, 2863, 14, 6885, 63, 17576, 51, 14, 362, 8, 466, 63, 354, 12, 489, 2863, 14, 3472, 63, 6885, 63, 17576, 51, 9, 523, 340, 492, 63, 1247, 26, 272, 8925, 275, 283, 3779, 78, 1370, 904, 8, 12775, 9, 435, 20054, 523, 587, 26, 272, 8925, 275, 2125, 523, 372, 13053, 540, 450, 791, 466, 63, 354, 356, 730, 63, 354, 12, 673, 283, 7436, 356, 1656, 1987, 904, 8, 7436, 395, 673, 283, 12775, 356, 8925, 12, 673, 283, 3954, 356, 2197, 14, 2083, 14, 2131, 12737, 421, 199, 318, 5024, 8, 3215, 63, 354, 12, 2225, 63, 466, 304, 523, 408, 5375, 314, 901, 18707, 1041, 523, 22372, 275, 11003, 269, 11328, 1470, 8, 3215, 63, 354, 12, 2225, 63, 466, 9, 523, 372, 283, 4239, 2818, 3215, 63, 466, 9, 83, 2818, 698, 63, 354, 9, 83, 8942, 450, 22372, 421, 199, 318, 20297, 8, 466, 63, 354, 304, 523, 372, 283, 3455, 450, 83, 342, 9459, 78, 6834, 450, 730, 63, 354, 421, 199, 318, 11003, 1384, 8, 354, 12, 2225, 63, 466, 304, 523, 408, 5375, 314, 15917, 436, 18743, 10269, 1041, 523, 22372, 275, 11003, 269, 11328, 1470, 8, 354, 12, 2225, 63, 466, 9, 523, 340, 2225, 63, 466, 508, 2863, 14, 25312, 26, 272, 372, 1543, 83, 60, 78, 5, 83, 7, 450, 334, 25312, 63, 39, 1573, 450, 22372, 12, 428, 1573, 450, 22372, 9, 523, 587, 26, 272, 372, 1543, 83, 60, 78, 5, 83, 7, 450, 334, 39, 1573, 450, 22372, 12, 428, 1573, 450, 22372, 9, 421, 199, 318, 8024, 351, 837, 523, 372, 23618, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 523, 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, 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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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
kerr-huang/SL4A
python/src/Tools/scripts/nm2def.py
94
2444
#! /usr/bin/env python """nm2def.py Helpers to extract symbols from Unix libs and auto-generate Windows definition files from them. Depends on nm(1). Tested on Linux and Solaris only (-p option to nm is for Solaris only). By Marc-Andre Lemburg, Aug 1998. Additional notes: the output of nm is supposed to look like this: acceler.o: 000001fd T PyGrammar_AddAccelerators U PyGrammar_FindDFA 00000237 T PyGrammar_RemoveAccelerators U _IO_stderr_ U exit U fprintf U free U malloc U printf grammar1.o: 00000000 T PyGrammar_FindDFA 00000034 T PyGrammar_LabelRepr U _PyParser_TokenNames U abort U printf U sprintf ... Even if this isn't the default output of your nm, there is generally an option to produce this format (since it is the original v7 Unix format). """ import os, sys PYTHONLIB = 'libpython'+sys.version[:3]+'.a' PC_PYTHONLIB = 'Python'+sys.version[0]+sys.version[2]+'.dll' NM = 'nm -p -g %s' # For Linux, use "nm -g %s" def symbols(lib=PYTHONLIB,types=('T','C','D')): lines = os.popen(NM % lib).readlines() lines = [s.strip() for s in lines] symbols = {} for line in lines: if len(line) == 0 or ':' in line: continue items = line.split() if len(items) != 3: continue address, type, name = items if type not in types: continue symbols[name] = address,type return symbols def export_list(symbols): data = [] code = [] for name,(addr,type) in symbols.items(): if type in ('C','D'): data.append('\t'+name) else: code.append('\t'+name) data.sort() data.append('') code.sort() return ' DATA\n'.join(data)+'\n'+'\n'.join(code) # Definition file template DEF_TEMPLATE = """\ EXPORTS %s """ # Special symbols that have to be included even though they don't # pass the filter SPECIALS = ( ) def filter_Python(symbols,specials=SPECIALS): for name in symbols.keys(): if name[:2] == 'Py' or name[:3] == '_Py': pass elif name not in specials: del symbols[name] def main(): s = symbols(PYTHONLIB) filter_Python(s) exports = export_list(s) f = sys.stdout # open('PC/python_nt.def','w') f.write(DEF_TEMPLATE % (exports)) f.close() if __name__ == '__main__': main()
apache-2.0
[ 3168, 1182, 2647, 15, 1393, 15, 1813, 2366, 199, 624, 10756, 18, 318, 14, 647, 199, 199, 4433, 83, 370, 5536, 6698, 687, 13074, 20314, 436, 2599, 13, 4208, 199, 8647, 5492, 1584, 687, 3062, 14, 21588, 3198, 641, 16751, 8, 17, 680, 30568, 199, 265, 10130, 436, 17991, 4663, 1454, 5868, 80, 945, 370, 16751, 365, 367, 17991, 4663, 1454, 680, 199, 199, 2175, 603, 9912, 13, 3325, 264, 7005, 32649, 12, 25298, 19960, 14, 199, 199, 8824, 12681, 26, 314, 1072, 402, 16751, 365, 20042, 370, 3648, 2839, 642, 26, 199, 199, 645, 11338, 14, 79, 26, 199, 19983, 2592, 377, 1611, 27119, 63, 1123, 1945, 11338, 2750, 268, 738, 1611, 27119, 63, 6591, 36, 2078, 199, 993, 996, 1401, 377, 1611, 27119, 63, 5587, 1945, 11338, 2750, 268, 738, 485, 2090, 63, 3083, 63, 268, 738, 4458, 268, 738, 289, 19139, 268, 738, 2867, 268, 738, 333, 9373, 268, 738, 870, 70, 199, 199, 15239, 17, 14, 79, 26, 199, 3607, 377, 1611, 27119, 63, 6591, 36, 2078, 199, 3273, 1082, 377, 1611, 27119, 63, 4314, 15713, 268, 738, 485, 2713, 2842, 63, 3264, 5866, 268, 738, 12004, 268, 738, 870, 70, 268, 738, 308, 19139, 199, 199, 1396, 199, 199, 29704, 340, 642, 5712, 1133, 314, 849, 1072, 402, 2195, 16751, 12, 2337, 365, 16711, 376, 199, 1422, 370, 7389, 642, 1475, 334, 8585, 652, 365, 314, 3379, 373, 23, 13074, 1475, 680, 199, 199, 624, 199, 646, 747, 12, 984, 199, 199, 11720, 5617, 275, 283, 773, 1548, 6828, 1274, 14, 1023, 1491, 19, 2807, 1370, 65, 7, 199, 4222, 63, 11720, 5617, 275, 283, 4718, 6828, 1274, 14, 1023, 59, 16, 2807, 1274, 14, 1023, 59, 18, 2807, 1370, 9259, 7, 199, 21942, 275, 283, 10756, 446, 80, 446, 71, 450, 83, 7, 10473, 327, 2104, 10130, 12, 675, 298, 10756, 446, 71, 450, 83, 2, 199, 199, 318, 6698, 8, 773, 29, 11720, 5617, 12, 1313, 7782, 52, 1673, 35, 1673, 36, 8109, 339, 2385, 275, 747, 14, 12207, 8, 21942, 450, 1973, 680, 9684, 342, 272, 2385, 275, 359, 83, 14, 1913, 342, 367, 308, 315, 2385, 61, 272, 6698, 275, 1052, 272, 367, 1004, 315, 2385, 26, 267, 340, 822, 8, 604, 9, 508, 378, 503, 10871, 315, 1004, 26, 288, 1980, 267, 2974, 275, 1004, 14, 1294, 342, 267, 340, 822, 8, 1744, 9, 1137, 650, 26, 288, 1980, 267, 2287, 12, 730, 12, 536, 275, 2974, 267, 340, 730, 440, 315, 2943, 26, 288, 1980, 267, 6698, 59, 354, 61, 275, 2287, 12, 466, 272, 372, 6698, 199, 199, 318, 4843, 63, 513, 8, 7450, 304, 339, 666, 275, 942, 272, 1233, 275, 942, 272, 367, 536, 12803, 2697, 12, 466, 9, 315, 6698, 14, 1744, 837, 267, 340, 730, 315, 661, 35, 1673, 36, 735, 288, 666, 14, 740, 2258, 84, 6828, 354, 9, 267, 587, 26, 288, 1233, 14, 740, 2258, 84, 6828, 354, 9, 272, 666, 14, 3191, 342, 272, 666, 14, 740, 8355, 272, 1233, 14, 3191, 342, 272, 372, 283, 7126, 60, 78, 1370, 904, 8, 576, 6393, 1154, 78, 6828, 1154, 78, 1370, 904, 8, 600, 9, 199, 199, 3, 29398, 570, 1978, 199, 5638, 63, 7433, 275, 9638, 199, 18341, 51, 199, 5, 83, 199, 624, 199, 199, 3, 12568, 6698, 626, 1172, 370, 506, 5120, 2755, 10617, 2985, 2793, 1133, 199, 3, 986, 314, 2457, 199, 25748, 51, 275, 334, 272, 776, 199, 199, 318, 2457, 63, 4718, 8, 7450, 12, 3017, 2551, 29, 25748, 51, 304, 339, 367, 536, 315, 6698, 14, 1612, 837, 267, 340, 536, 1491, 18, 61, 508, 283, 2713, 7, 503, 536, 1491, 19, 61, 508, 2513, 2713, 356, 288, 986, 267, 916, 536, 440, 315, 1106, 2551, 26, 288, 2150, 6698, 59, 354, 61, 199, 199, 318, 2446, 837, 339, 308, 275, 6698, 8, 11720, 5617, 9, 272, 2457, 63, 4718, 8, 83, 9, 272, 22609, 275, 4843, 63, 513, 8, 83, 9, 272, 289, 275, 984, 14, 2703, 327, 1551, 360, 4222, 15, 1548, 63, 343, 14, 318, 1673, 87, 358, 272, 289, 14, 952, 8, 5638, 63, 7433, 450, 334, 20775, 430, 272, 289, 14, 1600, 342, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 2446, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1182, 2647, 15, 1393, 15, 1813, 2366, 199, 624, 10756, 18, 318, 14, 647, 199, 199, 4433, 83, 370, 5536, 6698, 687, 13074, 20314, 436, 2599, 13, 4208, 199, 8647, 5492, 1584, 687, 3062, 14, 21588, 3198, 641, 16751, 8, 17, 680, 30568, 199, 265, 10130, 436, 17991, 4663, 1454, 5868, 80, 945, 370, 16751, 365, 367, 17991, 4663, 1454, 680, 199, 199, 2175, 603, 9912, 13, 3325, 264, 7005, 32649, 12, 25298, 19960, 14, 199, 199, 8824, 12681, 26, 314, 1072, 402, 16751, 365, 20042, 370, 3648, 2839, 642, 26, 199, 199, 645, 11338, 14, 79, 26, 199, 19983, 2592, 377, 1611, 27119, 63, 1123, 1945, 11338, 2750, 268, 738, 1611, 27119, 63, 6591, 36, 2078, 199, 993, 996, 1401, 377, 1611, 27119, 63, 5587, 1945, 11338, 2750, 268, 738, 485, 2090, 63, 3083, 63, 268, 738, 4458, 268, 738, 289, 19139, 268, 738, 2867, 268, 738, 333, 9373, 268, 738, 870, 70, 199, 199, 15239, 17, 14, 79, 26, 199, 3607, 377, 1611, 27119, 63, 6591, 36, 2078, 199, 3273, 1082, 377, 1611, 27119, 63, 4314, 15713, 268, 738, 485, 2713, 2842, 63, 3264, 5866, 268, 738, 12004, 268, 738, 870, 70, 268, 738, 308, 19139, 199, 199, 1396, 199, 199, 29704, 340, 642, 5712, 1133, 314, 849, 1072, 402, 2195, 16751, 12, 2337, 365, 16711, 376, 199, 1422, 370, 7389, 642, 1475, 334, 8585, 652, 365, 314, 3379, 373, 23, 13074, 1475, 680, 199, 199, 624, 199, 646, 747, 12, 984, 199, 199, 11720, 5617, 275, 283, 773, 1548, 6828, 1274, 14, 1023, 1491, 19, 2807, 1370, 65, 7, 199, 4222, 63, 11720, 5617, 275, 283, 4718, 6828, 1274, 14, 1023, 59, 16, 2807, 1274, 14, 1023, 59, 18, 2807, 1370, 9259, 7, 199, 21942, 275, 283, 10756, 446, 80, 446, 71, 450, 83, 7, 10473, 327, 2104, 10130, 12, 675, 298, 10756, 446, 71, 450, 83, 2, 199, 199, 318, 6698, 8, 773, 29, 11720, 5617, 12, 1313, 7782, 52, 1673, 35, 1673, 36, 8109, 339, 2385, 275, 747, 14, 12207, 8, 21942, 450, 1973, 680, 9684, 342, 272, 2385, 275, 359, 83, 14, 1913, 342, 367, 308, 315, 2385, 61, 272, 6698, 275, 1052, 272, 367, 1004, 315, 2385, 26, 267, 340, 822, 8, 604, 9, 508, 378, 503, 10871, 315, 1004, 26, 288, 1980, 267, 2974, 275, 1004, 14, 1294, 342, 267, 340, 822, 8, 1744, 9, 1137, 650, 26, 288, 1980, 267, 2287, 12, 730, 12, 536, 275, 2974, 267, 340, 730, 440, 315, 2943, 26, 288, 1980, 267, 6698, 59, 354, 61, 275, 2287, 12, 466, 272, 372, 6698, 199, 199, 318, 4843, 63, 513, 8, 7450, 304, 339, 666, 275, 942, 272, 1233, 275, 942, 272, 367, 536, 12803, 2697, 12, 466, 9, 315, 6698, 14, 1744, 837, 267, 340, 730, 315, 661, 35, 1673, 36, 735, 288, 666, 14, 740, 2258, 84, 6828, 354, 9, 267, 587, 26, 288, 1233, 14, 740, 2258, 84, 6828, 354, 9, 272, 666, 14, 3191, 342, 272, 666, 14, 740, 8355, 272, 1233, 14, 3191, 342, 272, 372, 283, 7126, 60, 78, 1370, 904, 8, 576, 6393, 1154, 78, 6828, 1154, 78, 1370, 904, 8, 600, 9, 199, 199, 3, 29398, 570, 1978, 199, 5638, 63, 7433, 275, 9638, 199, 18341, 51, 199, 5, 83, 199, 624, 199, 199, 3, 12568, 6698, 626, 1172, 370, 506, 5120, 2755, 10617, 2985, 2793, 1133, 199, 3, 986, 314, 2457, 199, 25748, 51, 275, 334, 272, 776, 199, 199, 318, 2457, 63, 4718, 8, 7450, 12, 3017, 2551, 29, 25748, 51, 304, 339, 367, 536, 315, 6698, 14, 1612, 837, 267, 340, 536, 1491, 18, 61, 508, 283, 2713, 7, 503, 536, 1491, 19, 61, 508, 2513, 2713, 356, 288, 986, 267, 916, 536, 440, 315, 1106, 2551, 26, 288, 2150, 6698, 59, 354, 61, 199, 199, 318, 2446, 837, 339, 308, 275, 6698, 8, 11720, 5617, 9, 272, 2457, 63, 4718, 8, 83, 9, 272, 22609, 275, 4843, 63, 513, 8, 83, 9, 272, 289, 275, 984, 14, 2703, 327, 1551, 360, 4222, 15, 1548, 63, 343, 14, 318, 1673, 87, 358, 272, 289, 14, 952, 8, 5638, 63, 7433, 450, 334, 20775, 430, 272, 289, 14, 1600, 342, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 2446, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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,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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 ]
reinarduswindy/rojak
rojak-pantau/rojak_pantau/spiders/merdekacom.py
5
3466
# -*- coding: utf-8 -*- import json from scrapy import Request from scrapy.exceptions import CloseSpider from scrapy.loader import ItemLoader from datetime import datetime from rojak_pantau.items import News from rojak_pantau.util.wib_to_utc import wib_to_utc from rojak_pantau.i18n import _ from rojak_pantau.spiders.base import BaseSpider class MerdekacomSpider(BaseSpider): name="merdeka.com" allowed_domains=["merdeka.com"] start_urls=( 'http://api.merdeka.com/mobile/gettag/pilgub-dki/0/20/L9pTAoWB269T&-E/', ) def parse(self, response): self.logger.info('parse: {}'.format(response)) is_no_update = False # Collect list of news from current page articles = json.loads(response.body)['response'] for article in articles: # Example: 2016-10-12 15:16:04 date_time_str = article['news_date_publish'] # Parse date information try: published_at_wib = datetime.strptime(date_time_str, '%Y-%m-%d %H:%M:%S') except Exception as e: raise CloseSpider('cannot_parse_date: {}'.format(e)) published_at = wib_to_utc(published_at_wib) if (self.media['last_scraped_at'] >= published_at): is_no_update = True break; for sub_article in article['news_content']: yield self.parse_news(article, sub_article) if is_no_update: self.logger.info('Media have no update') return # Collect news on next page if len(articles) > 0: # Example: 'http://api.merdeka.com/mobile/gettag/pilgub-dki/0/20/L9pTAoWB269T&-E/' next_page_url = response.url.split('/') next_page_url[-4] = str(int(next_page_url[-4]) + 20) next_page_url = '/'.join(next_page_url) yield Request(next_page_url, callback=self.parse) # Collect news item def parse_news(self, article, sub_article): self.logger.info('parse_news: %s' % article) # Initialize item loader # extract news title, published_at, author, content, url loader = ItemLoader(item=News()) # Example: https://m.merdeka.com/tag/p/pilgub-dki/politik/nachrowi-pastikan-agus-sylvi-tak-cuma-incar-suara-santri-ulama.html if not sub_article['news_url']: return loader.load_item() url = 'https://www.merdeka.com' + sub_article['news_url'] loader.add_value('url', url) if not article['news_title']: return loader.load_item() loader.add_value('title', article['news_title']) if not article['news_reporter']: loader.add_value('author_name', '') else: loader.add_value('author_name', article['news_reporter']) if not sub_article['news_description']: return loader.load_item() loader.add_value('raw_content', sub_article['news_description']) # Parse date information date_time_str = article['news_date_publish'] try: # Example: 2016-10-12 15:16:04 published_at_wib = datetime.strptime(date_time_str, '%Y-%m-%d %H:%M:%S') except Exception as e: return loader.load_item() published_at = wib_to_utc(published_at_wib) loader.add_value('published_at', published_at) # Move scraped news to pipeline return loader.load_item()
bsd-3-clause
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 646, 2022, 199, 199, 504, 18918, 492, 4784, 199, 504, 18918, 14, 3924, 492, 15524, 25157, 199, 504, 18918, 14, 3422, 492, 7020, 5455, 199, 199, 504, 2197, 492, 2197, 199, 199, 504, 882, 74, 1151, 63, 10384, 16656, 14, 1744, 492, 30951, 199, 504, 882, 74, 1151, 63, 10384, 16656, 14, 1974, 14, 87, 1892, 63, 475, 63, 5834, 492, 336, 1892, 63, 475, 63, 5834, 199, 504, 882, 74, 1151, 63, 10384, 16656, 14, 73, 1085, 78, 492, 485, 199, 504, 882, 74, 1151, 63, 10384, 16656, 14, 8721, 7735, 14, 1095, 492, 3523, 25157, 199, 199, 533, 18880, 271, 7351, 957, 25157, 8, 1563, 25157, 304, 272, 536, 628, 2626, 271, 7351, 14, 957, 2, 272, 4370, 63, 9756, 6270, 2626, 271, 7351, 14, 957, 937, 272, 1343, 63, 3603, 2687, 267, 283, 1014, 921, 1246, 14, 2626, 271, 7351, 14, 957, 15, 11375, 15, 362, 1450, 15, 80, 382, 71, 456, 13, 6341, 73, 15, 16, 15, 1165, 15, 44, 25, 80, 6166, 79, 24819, 12442, 52, 6, 13, 37, 3678, 272, 776, 339, 347, 2198, 8, 277, 12, 1177, 304, 267, 291, 14, 2921, 14, 815, 360, 1122, 26, 9499, 908, 8, 1310, 430, 267, 365, 63, 889, 63, 873, 275, 756, 398, 327, 19649, 769, 402, 19497, 687, 1453, 2034, 267, 23242, 275, 2022, 14, 3640, 8, 1310, 14, 2030, 11820, 1310, 418, 267, 367, 9772, 315, 23242, 26, 288, 327, 5679, 26, 7800, 13, 709, 13, 713, 4114, 26, 975, 26, 966, 288, 1434, 63, 521, 63, 495, 275, 9772, 459, 13224, 63, 602, 63, 4763, 418, 953, 327, 6077, 1434, 2556, 288, 862, 26, 355, 3267, 63, 292, 63, 87, 1892, 275, 2197, 14, 9866, 8, 602, 63, 521, 63, 495, 12, 1543, 57, 3295, 77, 3295, 68, 450, 40, 2689, 45, 2689, 51, 358, 288, 871, 2186, 465, 325, 26, 355, 746, 15524, 25157, 360, 11250, 63, 1122, 63, 602, 26, 9499, 908, 8, 69, 430, 288, 3267, 63, 292, 275, 336, 1892, 63, 475, 63, 5834, 8, 8987, 63, 292, 63, 87, 1892, 9, 953, 340, 334, 277, 14, 4603, 459, 2019, 63, 26478, 63, 292, 418, 2356, 3267, 63, 292, 304, 355, 365, 63, 889, 63, 873, 275, 715, 355, 2059, 27, 953, 367, 1007, 63, 6934, 315, 9772, 459, 13224, 63, 1317, 2565, 355, 1995, 291, 14, 1122, 63, 13224, 8, 6934, 12, 1007, 63, 6934, 9, 398, 340, 365, 63, 889, 63, 873, 26, 288, 291, 14, 2921, 14, 815, 360, 11398, 1172, 949, 1678, 358, 288, 372, 398, 327, 19649, 19497, 641, 2163, 2034, 267, 340, 822, 8, 19813, 9, 690, 378, 26, 288, 327, 5679, 26, 283, 1014, 921, 1246, 14, 2626, 271, 7351, 14, 957, 15, 11375, 15, 362, 1450, 15, 80, 382, 71, 456, 13, 6341, 73, 15, 16, 15, 1165, 15, 44, 25, 80, 6166, 79, 24819, 12442, 52, 6, 13, 37, 4805, 288, 2163, 63, 1606, 63, 633, 275, 1177, 14, 633, 14, 1294, 7825, 288, 2163, 63, 1606, 63, 633, 1988, 20, 61, 275, 620, 8, 442, 8, 2184, 63, 1606, 63, 633, 1988, 20, 566, 435, 3388, 9, 288, 2163, 63, 1606, 63, 633, 275, 20538, 904, 8, 2184, 63, 1606, 63, 633, 9, 288, 1995, 4784, 8, 2184, 63, 1606, 63, 633, 12, 3233, 29, 277, 14, 1122, 9, 339, 327, 19649, 19497, 1242, 272, 347, 2198, 63, 13224, 8, 277, 12, 9772, 12, 1007, 63, 6934, 304, 267, 291, 14, 2921, 14, 815, 360, 1122, 63, 13224, 26, 450, 83, 7, 450, 9772, 9, 398, 327, 11578, 1242, 5077, 267, 327, 5536, 19497, 2538, 12, 3267, 63, 292, 12, 4132, 12, 1564, 12, 1166, 267, 5077, 275, 7020, 5455, 8, 1053, 29, 24730, 1012, 398, 327, 5679, 26, 4178, 921, 77, 14, 2626, 271, 7351, 14, 957, 15, 1450, 15, 80, 15, 80, 382, 71, 456, 13, 6341, 73, 15, 555, 317, 30298, 15, 78, 1225, 1143, 73, 13, 18597, 3258, 290, 13, 643, 527, 13, 1786, 76, 433, 13, 502, 75, 13, 15140, 391, 13, 6559, 285, 13, 9648, 17956, 13, 18904, 599, 13, 7586, 391, 14, 1360, 267, 340, 440, 1007, 63, 6934, 459, 13224, 63, 633, 2565, 288, 372, 5077, 14, 912, 63, 1053, 342, 267, 1166, 275, 283, 2859, 921, 1544, 14, 2626, 271, 7351, 14, 957, 7, 435, 1007, 63, 6934, 459, 13224, 63, 633, 418, 267, 5077, 14, 525, 63, 585, 360, 633, 297, 1166, 9, 398, 340, 440, 9772, 459, 13224, 63, 1213, 2565, 288, 372, 5077, 14, 912, 63, 1053, 342, 267, 5077, 14, 525, 63, 585, 360, 1213, 297, 9772, 459, 13224, 63, 1213, 1105, 398, 340, 440, 9772, 459, 13224, 63, 12222, 2565, 288, 5077, 14, 525, 63, 585, 360, 2502, 63, 354, 297, 4074, 267, 587, 26, 288, 5077, 14, 525, 63, 585, 360, 2502, 63, 354, 297, 9772, 459, 13224, 63, 12222, 1105, 398, 340, 440, 1007, 63, 6934, 459, 13224, 63, 1802, 2565, 288, 372, 5077, 14, 912, 63, 1053, 342, 267, 5077, 14, 525, 63, 585, 360, 1773, 63, 1317, 297, 1007, 63, 6934, 459, 13224, 63, 1802, 1105, 398, 327, 6077, 1434, 2556, 267, 1434, 63, 521, 63, 495, 275, 9772, 459, 13224, 63, 602, 63, 4763, 418, 267, 862, 26, 288, 327, 5679, 26, 7800, 13, 709, 13, 713, 4114, 26, 975, 26, 966, 288, 3267, 63, 292, 63, 87, 1892, 275, 2197, 14, 9866, 8, 602, 63, 521, 63, 495, 12, 1543, 57, 3295, 77, 3295, 68, 450, 40, 2689, 45, 2689, 51, 358, 267, 871, 2186, 465, 325, 26, 288, 372, 5077, 14, 912, 63, 1053, 342, 398, 3267, 63, 292, 275, 336, 1892, 63, 475, 63, 5834, 8, 8987, 63, 292, 63, 87, 1892, 9, 267, 5077, 14, 525, 63, 585, 360, 8987, 63, 292, 297, 3267, 63, 292, 9, 398, 327, 14171, 24514, 19497, 370, 7679, 267, 372, 5077, 14, 912, 63, 1053, 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 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 646, 2022, 199, 199, 504, 18918, 492, 4784, 199, 504, 18918, 14, 3924, 492, 15524, 25157, 199, 504, 18918, 14, 3422, 492, 7020, 5455, 199, 199, 504, 2197, 492, 2197, 199, 199, 504, 882, 74, 1151, 63, 10384, 16656, 14, 1744, 492, 30951, 199, 504, 882, 74, 1151, 63, 10384, 16656, 14, 1974, 14, 87, 1892, 63, 475, 63, 5834, 492, 336, 1892, 63, 475, 63, 5834, 199, 504, 882, 74, 1151, 63, 10384, 16656, 14, 73, 1085, 78, 492, 485, 199, 504, 882, 74, 1151, 63, 10384, 16656, 14, 8721, 7735, 14, 1095, 492, 3523, 25157, 199, 199, 533, 18880, 271, 7351, 957, 25157, 8, 1563, 25157, 304, 272, 536, 628, 2626, 271, 7351, 14, 957, 2, 272, 4370, 63, 9756, 6270, 2626, 271, 7351, 14, 957, 937, 272, 1343, 63, 3603, 2687, 267, 283, 1014, 921, 1246, 14, 2626, 271, 7351, 14, 957, 15, 11375, 15, 362, 1450, 15, 80, 382, 71, 456, 13, 6341, 73, 15, 16, 15, 1165, 15, 44, 25, 80, 6166, 79, 24819, 12442, 52, 6, 13, 37, 3678, 272, 776, 339, 347, 2198, 8, 277, 12, 1177, 304, 267, 291, 14, 2921, 14, 815, 360, 1122, 26, 9499, 908, 8, 1310, 430, 267, 365, 63, 889, 63, 873, 275, 756, 398, 327, 19649, 769, 402, 19497, 687, 1453, 2034, 267, 23242, 275, 2022, 14, 3640, 8, 1310, 14, 2030, 11820, 1310, 418, 267, 367, 9772, 315, 23242, 26, 288, 327, 5679, 26, 7800, 13, 709, 13, 713, 4114, 26, 975, 26, 966, 288, 1434, 63, 521, 63, 495, 275, 9772, 459, 13224, 63, 602, 63, 4763, 418, 953, 327, 6077, 1434, 2556, 288, 862, 26, 355, 3267, 63, 292, 63, 87, 1892, 275, 2197, 14, 9866, 8, 602, 63, 521, 63, 495, 12, 1543, 57, 3295, 77, 3295, 68, 450, 40, 2689, 45, 2689, 51, 358, 288, 871, 2186, 465, 325, 26, 355, 746, 15524, 25157, 360, 11250, 63, 1122, 63, 602, 26, 9499, 908, 8, 69, 430, 288, 3267, 63, 292, 275, 336, 1892, 63, 475, 63, 5834, 8, 8987, 63, 292, 63, 87, 1892, 9, 953, 340, 334, 277, 14, 4603, 459, 2019, 63, 26478, 63, 292, 418, 2356, 3267, 63, 292, 304, 355, 365, 63, 889, 63, 873, 275, 715, 355, 2059, 27, 953, 367, 1007, 63, 6934, 315, 9772, 459, 13224, 63, 1317, 2565, 355, 1995, 291, 14, 1122, 63, 13224, 8, 6934, 12, 1007, 63, 6934, 9, 398, 340, 365, 63, 889, 63, 873, 26, 288, 291, 14, 2921, 14, 815, 360, 11398, 1172, 949, 1678, 358, 288, 372, 398, 327, 19649, 19497, 641, 2163, 2034, 267, 340, 822, 8, 19813, 9, 690, 378, 26, 288, 327, 5679, 26, 283, 1014, 921, 1246, 14, 2626, 271, 7351, 14, 957, 15, 11375, 15, 362, 1450, 15, 80, 382, 71, 456, 13, 6341, 73, 15, 16, 15, 1165, 15, 44, 25, 80, 6166, 79, 24819, 12442, 52, 6, 13, 37, 4805, 288, 2163, 63, 1606, 63, 633, 275, 1177, 14, 633, 14, 1294, 7825, 288, 2163, 63, 1606, 63, 633, 1988, 20, 61, 275, 620, 8, 442, 8, 2184, 63, 1606, 63, 633, 1988, 20, 566, 435, 3388, 9, 288, 2163, 63, 1606, 63, 633, 275, 20538, 904, 8, 2184, 63, 1606, 63, 633, 9, 288, 1995, 4784, 8, 2184, 63, 1606, 63, 633, 12, 3233, 29, 277, 14, 1122, 9, 339, 327, 19649, 19497, 1242, 272, 347, 2198, 63, 13224, 8, 277, 12, 9772, 12, 1007, 63, 6934, 304, 267, 291, 14, 2921, 14, 815, 360, 1122, 63, 13224, 26, 450, 83, 7, 450, 9772, 9, 398, 327, 11578, 1242, 5077, 267, 327, 5536, 19497, 2538, 12, 3267, 63, 292, 12, 4132, 12, 1564, 12, 1166, 267, 5077, 275, 7020, 5455, 8, 1053, 29, 24730, 1012, 398, 327, 5679, 26, 4178, 921, 77, 14, 2626, 271, 7351, 14, 957, 15, 1450, 15, 80, 15, 80, 382, 71, 456, 13, 6341, 73, 15, 555, 317, 30298, 15, 78, 1225, 1143, 73, 13, 18597, 3258, 290, 13, 643, 527, 13, 1786, 76, 433, 13, 502, 75, 13, 15140, 391, 13, 6559, 285, 13, 9648, 17956, 13, 18904, 599, 13, 7586, 391, 14, 1360, 267, 340, 440, 1007, 63, 6934, 459, 13224, 63, 633, 2565, 288, 372, 5077, 14, 912, 63, 1053, 342, 267, 1166, 275, 283, 2859, 921, 1544, 14, 2626, 271, 7351, 14, 957, 7, 435, 1007, 63, 6934, 459, 13224, 63, 633, 418, 267, 5077, 14, 525, 63, 585, 360, 633, 297, 1166, 9, 398, 340, 440, 9772, 459, 13224, 63, 1213, 2565, 288, 372, 5077, 14, 912, 63, 1053, 342, 267, 5077, 14, 525, 63, 585, 360, 1213, 297, 9772, 459, 13224, 63, 1213, 1105, 398, 340, 440, 9772, 459, 13224, 63, 12222, 2565, 288, 5077, 14, 525, 63, 585, 360, 2502, 63, 354, 297, 4074, 267, 587, 26, 288, 5077, 14, 525, 63, 585, 360, 2502, 63, 354, 297, 9772, 459, 13224, 63, 12222, 1105, 398, 340, 440, 1007, 63, 6934, 459, 13224, 63, 1802, 2565, 288, 372, 5077, 14, 912, 63, 1053, 342, 267, 5077, 14, 525, 63, 585, 360, 1773, 63, 1317, 297, 1007, 63, 6934, 459, 13224, 63, 1802, 1105, 398, 327, 6077, 1434, 2556, 267, 1434, 63, 521, 63, 495, 275, 9772, 459, 13224, 63, 602, 63, 4763, 418, 267, 862, 26, 288, 327, 5679, 26, 7800, 13, 709, 13, 713, 4114, 26, 975, 26, 966, 288, 3267, 63, 292, 63, 87, 1892, 275, 2197, 14, 9866, 8, 602, 63, 521, 63, 495, 12, 1543, 57, 3295, 77, 3295, 68, 450, 40, 2689, 45, 2689, 51, 358, 267, 871, 2186, 465, 325, 26, 288, 372, 5077, 14, 912, 63, 1053, 342, 398, 3267, 63, 292, 275, 336, 1892, 63, 475, 63, 5834, 8, 8987, 63, 292, 63, 87, 1892, 9, 267, 5077, 14, 525, 63, 585, 360, 8987, 63, 292, 297, 3267, 63, 292, 9, 398, 327, 14171, 24514, 19497, 370, 7679, 267, 372, 5077, 14, 912, 63, 1053, 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, 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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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
proxysh/Safejumper-for-Mac
buildmac/Resources/env/lib/python2.7/site-packages/twisted/protocols/pcp.py
15
7088
# -*- test-case-name: twisted.test.test_pcp -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Producer-Consumer Proxy. """ from zope.interface import implementer from twisted.internet import interfaces @implementer(interfaces.IProducer, interfaces.IConsumer) class BasicProducerConsumerProxy: """ I can act as a man in the middle between any Producer and Consumer. @ivar producer: the Producer I subscribe to. @type producer: L{IProducer<interfaces.IProducer>} @ivar consumer: the Consumer I publish to. @type consumer: L{IConsumer<interfaces.IConsumer>} @ivar paused: As a Producer, am I paused? @type paused: bool """ consumer = None producer = None producerIsStreaming = None iAmStreaming = True outstandingPull = False paused = False stopped = False def __init__(self, consumer): self._buffer = [] if consumer is not None: self.consumer = consumer consumer.registerProducer(self, self.iAmStreaming) # Producer methods: def pauseProducing(self): self.paused = True if self.producer: self.producer.pauseProducing() def resumeProducing(self): self.paused = False if self._buffer: # TODO: Check to see if consumer supports writeSeq. self.consumer.write(''.join(self._buffer)) self._buffer[:] = [] else: if not self.iAmStreaming: self.outstandingPull = True if self.producer is not None: self.producer.resumeProducing() def stopProducing(self): if self.producer is not None: self.producer.stopProducing() if self.consumer is not None: del self.consumer # Consumer methods: def write(self, data): if self.paused or (not self.iAmStreaming and not self.outstandingPull): # We could use that fifo queue here. self._buffer.append(data) elif self.consumer is not None: self.consumer.write(data) self.outstandingPull = False def finish(self): if self.consumer is not None: self.consumer.finish() self.unregisterProducer() def registerProducer(self, producer, streaming): self.producer = producer self.producerIsStreaming = streaming def unregisterProducer(self): if self.producer is not None: del self.producer del self.producerIsStreaming if self.consumer: self.consumer.unregisterProducer() def __repr__(self): return '<%s@%x around %s>' % (self.__class__, id(self), self.consumer) class ProducerConsumerProxy(BasicProducerConsumerProxy): """ProducerConsumerProxy with a finite buffer. When my buffer fills up, I have my parent Producer pause until my buffer has room in it again. """ # Copies much from abstract.FileDescriptor bufferSize = 2**2**2**2 producerPaused = False unregistered = False def pauseProducing(self): # Does *not* call up to ProducerConsumerProxy to relay the pause # message through to my parent Producer. self.paused = True def resumeProducing(self): self.paused = False if self._buffer: data = ''.join(self._buffer) bytesSent = self._writeSomeData(data) if bytesSent < len(data): unsent = data[bytesSent:] assert not self.iAmStreaming, ( "Streaming producer did not write all its data.") self._buffer[:] = [unsent] else: self._buffer[:] = [] else: bytesSent = 0 if (self.unregistered and bytesSent and not self._buffer and self.consumer is not None): self.consumer.unregisterProducer() if not self.iAmStreaming: self.outstandingPull = not bytesSent if self.producer is not None: bytesBuffered = sum([len(s) for s in self._buffer]) # TODO: You can see here the potential for high and low # watermarks, where bufferSize would be the high mark when we # ask the upstream producer to pause, and we wouldn't have # it resume again until it hit the low mark. Or if producer # is Pull, maybe we'd like to pull from it as much as necessary # to keep our buffer full to the low mark, so we're never caught # without something to send. if self.producerPaused and (bytesBuffered < self.bufferSize): # Now that our buffer is empty, self.producerPaused = False self.producer.resumeProducing() elif self.outstandingPull: # I did not have any data to write in response to a pull, # so I'd better pull some myself. self.producer.resumeProducing() def write(self, data): if self.paused or (not self.iAmStreaming and not self.outstandingPull): # We could use that fifo queue here. self._buffer.append(data) elif self.consumer is not None: assert not self._buffer, ( "Writing fresh data to consumer before my buffer is empty!") # I'm going to use _writeSomeData here so that there is only one # path to self.consumer.write. But it doesn't actually make sense, # if I am streaming, for some data to not be all data. But maybe I # am not streaming, but I am writing here anyway, because there was # an earlier request for data which was not answered. bytesSent = self._writeSomeData(data) self.outstandingPull = False if not bytesSent == len(data): assert not self.iAmStreaming, ( "Streaming producer did not write all its data.") self._buffer.append(data[bytesSent:]) if (self.producer is not None) and self.producerIsStreaming: bytesBuffered = sum([len(s) for s in self._buffer]) if bytesBuffered >= self.bufferSize: self.producer.pauseProducing() self.producerPaused = True def registerProducer(self, producer, streaming): self.unregistered = False BasicProducerConsumerProxy.registerProducer(self, producer, streaming) if not streaming: producer.resumeProducing() def unregisterProducer(self): if self.producer is not None: del self.producer del self.producerIsStreaming self.unregistered = True if self.consumer and not self._buffer: self.consumer.unregisterProducer() def _writeSomeData(self, data): """Write as much of this data as possible. @returns: The number of bytes written. """ if self.consumer is None: return 0 self.consumer.write(data) return len(data)
gpl-2.0
[ 3, 1882, 511, 13, 2546, 13, 354, 26, 7390, 14, 396, 14, 396, 63, 80, 1850, 1882, 199, 3, 1898, 334, 67, 9, 17078, 8449, 26640, 14, 199, 3, 1666, 5113, 367, 2436, 14, 199, 199, 624, 199, 15532, 13, 18186, 12373, 14, 199, 624, 199, 199, 504, 20110, 14, 3266, 492, 2456, 28826, 199, 199, 504, 7390, 14, 4901, 492, 8386, 421, 199, 32, 1729, 28826, 8, 7436, 14, 41, 15532, 12, 8386, 14, 41, 18186, 9, 199, 533, 10082, 15532, 18186, 4936, 26, 272, 408, 272, 473, 883, 2454, 465, 282, 2169, 315, 314, 12180, 3382, 1263, 2165, 7610, 436, 1448, 5391, 14, 339, 768, 7725, 17339, 26, 314, 2165, 7610, 473, 23421, 370, 14, 272, 768, 466, 17339, 26, 491, 91, 41, 15532, 28, 7436, 14, 41, 15532, 23307, 272, 768, 7725, 9790, 26, 314, 1448, 5391, 473, 2780, 370, 14, 272, 768, 466, 9790, 26, 491, 91, 41, 18186, 28, 7436, 14, 41, 18186, 23307, 272, 768, 7725, 691, 2972, 26, 3709, 282, 2165, 7610, 12, 8140, 473, 691, 2972, 31, 272, 768, 466, 691, 2972, 26, 2155, 272, 408, 272, 9790, 275, 488, 272, 17339, 275, 488, 272, 17339, 1831, 22555, 275, 488, 272, 284, 24566, 22555, 275, 715, 272, 734, 18126, 27318, 275, 756, 272, 691, 2972, 275, 756, 272, 15248, 275, 756, 339, 347, 636, 826, 721, 277, 12, 9790, 304, 267, 291, 423, 2738, 275, 942, 267, 340, 9790, 365, 440, 488, 26, 288, 291, 14, 8542, 275, 9790, 288, 9790, 14, 2683, 15532, 8, 277, 12, 291, 14, 73, 24566, 22555, 9, 339, 327, 2165, 7610, 3102, 26, 339, 347, 16834, 24982, 8, 277, 304, 267, 291, 14, 22478, 275, 715, 267, 340, 291, 14, 16376, 26, 288, 291, 14, 16376, 14, 11241, 24982, 342, 339, 347, 14604, 24982, 8, 277, 304, 267, 291, 14, 22478, 275, 756, 267, 340, 291, 423, 2738, 26, 288, 327, 3254, 26, 2670, 370, 1937, 340, 9790, 5171, 2218, 11205, 14, 288, 291, 14, 8542, 14, 952, 17840, 904, 8, 277, 423, 2738, 430, 288, 291, 423, 2738, 5873, 275, 942, 267, 587, 26, 288, 340, 440, 291, 14, 73, 24566, 22555, 26, 355, 291, 14, 548, 18126, 27318, 275, 715, 398, 340, 291, 14, 16376, 365, 440, 488, 26, 288, 291, 14, 16376, 14, 9964, 24982, 342, 339, 347, 3631, 24982, 8, 277, 304, 267, 340, 291, 14, 16376, 365, 440, 488, 26, 288, 291, 14, 16376, 14, 2379, 24982, 342, 267, 340, 291, 14, 8542, 365, 440, 488, 26, 288, 2150, 291, 14, 8542, 339, 327, 1448, 5391, 3102, 26, 339, 347, 2218, 8, 277, 12, 666, 304, 267, 340, 291, 14, 22478, 503, 334, 1397, 291, 14, 73, 24566, 22555, 436, 440, 291, 14, 548, 18126, 27318, 304, 288, 327, 2136, 4293, 675, 626, 5883, 545, 4126, 2348, 14, 288, 291, 423, 2738, 14, 740, 8, 576, 9, 398, 916, 291, 14, 8542, 365, 440, 488, 26, 288, 291, 14, 8542, 14, 952, 8, 576, 9, 288, 291, 14, 548, 18126, 27318, 275, 756, 339, 347, 9578, 8, 277, 304, 267, 340, 291, 14, 8542, 365, 440, 488, 26, 288, 291, 14, 8542, 14, 8192, 342, 267, 291, 14, 18408, 15532, 342, 339, 347, 2274, 15532, 8, 277, 12, 17339, 12, 18490, 304, 267, 291, 14, 16376, 275, 17339, 267, 291, 14, 16376, 1831, 22555, 275, 18490, 339, 347, 24369, 15532, 8, 277, 304, 267, 340, 291, 14, 16376, 365, 440, 488, 26, 288, 2150, 291, 14, 16376, 288, 2150, 291, 14, 16376, 1831, 22555, 267, 340, 291, 14, 8542, 26, 288, 291, 14, 8542, 14, 18408, 15532, 342, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 18342, 83, 19437, 88, 6818, 450, 83, 3524, 450, 334, 277, 855, 533, 3108, 1305, 8, 277, 395, 291, 14, 8542, 9, 421, 199, 533, 2165, 7610, 18186, 4936, 8, 6845, 15532, 18186, 4936, 304, 272, 408, 15532, 18186, 4936, 543, 282, 21837, 3335, 14, 339, 3979, 3002, 3335, 1794, 478, 1536, 12, 473, 1172, 3002, 1676, 2165, 7610, 16834, 5133, 3002, 3335, 272, 965, 14726, 315, 652, 4020, 14, 272, 408, 272, 327, 29622, 1500, 8298, 687, 9006, 14, 23859, 272, 3335, 2320, 275, 499, 538, 18, 538, 18, 538, 18, 339, 17339, 4232, 2972, 275, 756, 272, 625, 11616, 275, 756, 339, 347, 16834, 24982, 8, 277, 304, 267, 327, 12078, 627, 1397, 10, 1240, 1536, 370, 2165, 7610, 18186, 4936, 370, 25931, 314, 16834, 267, 327, 1245, 4012, 370, 3002, 1676, 2165, 7610, 14, 267, 291, 14, 22478, 275, 715, 339, 347, 14604, 24982, 8, 277, 304, 267, 291, 14, 22478, 275, 756, 267, 340, 291, 423, 2738, 26, 288, 666, 275, 6522, 904, 8, 277, 423, 2738, 9, 288, 2783, 17367, 275, 291, 423, 952, 7700, 1451, 8, 576, 9, 288, 340, 2783, 17367, 665, 822, 8, 576, 304, 355, 625, 1150, 275, 666, 59, 2394, 17367, 2938, 355, 702, 440, 291, 14, 73, 24566, 22555, 12, 334, 490, 298, 22555, 17339, 8103, 440, 2218, 1006, 2399, 666, 2685, 355, 291, 423, 2738, 5873, 275, 359, 324, 1150, 61, 288, 587, 26, 355, 291, 423, 2738, 5873, 275, 942, 267, 587, 26, 288, 2783, 17367, 275, 378, 398, 340, 334, 277, 14, 324, 11616, 436, 2783, 17367, 436, 440, 291, 423, 2738, 436, 288, 291, 14, 8542, 365, 440, 488, 304, 288, 291, 14, 8542, 14, 18408, 15532, 342, 398, 340, 440, 291, 14, 73, 24566, 22555, 26, 288, 291, 14, 548, 18126, 27318, 275, 440, 2783, 17367, 398, 340, 291, 14, 16376, 365, 440, 488, 26, 288, 2783, 23139, 275, 3089, 779, 552, 8, 83, 9, 367, 308, 315, 291, 423, 2738, 566, 288, 327, 3254, 26, 2047, 883, 1937, 2348, 314, 12330, 367, 4721, 436, 6465, 288, 327, 22834, 10375, 12, 2382, 3335, 2320, 3955, 506, 314, 4721, 2216, 1380, 781, 288, 327, 7198, 314, 18932, 17339, 370, 16834, 12, 436, 781, 3955, 78, 1133, 1172, 288, 327, 652, 14604, 4020, 5133, 652, 9793, 314, 6465, 2216, 14, 221, 4236, 340, 17339, 288, 327, 365, 27705, 12, 11703, 781, 5121, 2839, 370, 10299, 687, 652, 465, 8298, 465, 5784, 288, 327, 370, 4215, 4154, 3335, 2615, 370, 314, 6465, 2216, 12, 880 ]
[ 1882, 511, 13, 2546, 13, 354, 26, 7390, 14, 396, 14, 396, 63, 80, 1850, 1882, 199, 3, 1898, 334, 67, 9, 17078, 8449, 26640, 14, 199, 3, 1666, 5113, 367, 2436, 14, 199, 199, 624, 199, 15532, 13, 18186, 12373, 14, 199, 624, 199, 199, 504, 20110, 14, 3266, 492, 2456, 28826, 199, 199, 504, 7390, 14, 4901, 492, 8386, 421, 199, 32, 1729, 28826, 8, 7436, 14, 41, 15532, 12, 8386, 14, 41, 18186, 9, 199, 533, 10082, 15532, 18186, 4936, 26, 272, 408, 272, 473, 883, 2454, 465, 282, 2169, 315, 314, 12180, 3382, 1263, 2165, 7610, 436, 1448, 5391, 14, 339, 768, 7725, 17339, 26, 314, 2165, 7610, 473, 23421, 370, 14, 272, 768, 466, 17339, 26, 491, 91, 41, 15532, 28, 7436, 14, 41, 15532, 23307, 272, 768, 7725, 9790, 26, 314, 1448, 5391, 473, 2780, 370, 14, 272, 768, 466, 9790, 26, 491, 91, 41, 18186, 28, 7436, 14, 41, 18186, 23307, 272, 768, 7725, 691, 2972, 26, 3709, 282, 2165, 7610, 12, 8140, 473, 691, 2972, 31, 272, 768, 466, 691, 2972, 26, 2155, 272, 408, 272, 9790, 275, 488, 272, 17339, 275, 488, 272, 17339, 1831, 22555, 275, 488, 272, 284, 24566, 22555, 275, 715, 272, 734, 18126, 27318, 275, 756, 272, 691, 2972, 275, 756, 272, 15248, 275, 756, 339, 347, 636, 826, 721, 277, 12, 9790, 304, 267, 291, 423, 2738, 275, 942, 267, 340, 9790, 365, 440, 488, 26, 288, 291, 14, 8542, 275, 9790, 288, 9790, 14, 2683, 15532, 8, 277, 12, 291, 14, 73, 24566, 22555, 9, 339, 327, 2165, 7610, 3102, 26, 339, 347, 16834, 24982, 8, 277, 304, 267, 291, 14, 22478, 275, 715, 267, 340, 291, 14, 16376, 26, 288, 291, 14, 16376, 14, 11241, 24982, 342, 339, 347, 14604, 24982, 8, 277, 304, 267, 291, 14, 22478, 275, 756, 267, 340, 291, 423, 2738, 26, 288, 327, 3254, 26, 2670, 370, 1937, 340, 9790, 5171, 2218, 11205, 14, 288, 291, 14, 8542, 14, 952, 17840, 904, 8, 277, 423, 2738, 430, 288, 291, 423, 2738, 5873, 275, 942, 267, 587, 26, 288, 340, 440, 291, 14, 73, 24566, 22555, 26, 355, 291, 14, 548, 18126, 27318, 275, 715, 398, 340, 291, 14, 16376, 365, 440, 488, 26, 288, 291, 14, 16376, 14, 9964, 24982, 342, 339, 347, 3631, 24982, 8, 277, 304, 267, 340, 291, 14, 16376, 365, 440, 488, 26, 288, 291, 14, 16376, 14, 2379, 24982, 342, 267, 340, 291, 14, 8542, 365, 440, 488, 26, 288, 2150, 291, 14, 8542, 339, 327, 1448, 5391, 3102, 26, 339, 347, 2218, 8, 277, 12, 666, 304, 267, 340, 291, 14, 22478, 503, 334, 1397, 291, 14, 73, 24566, 22555, 436, 440, 291, 14, 548, 18126, 27318, 304, 288, 327, 2136, 4293, 675, 626, 5883, 545, 4126, 2348, 14, 288, 291, 423, 2738, 14, 740, 8, 576, 9, 398, 916, 291, 14, 8542, 365, 440, 488, 26, 288, 291, 14, 8542, 14, 952, 8, 576, 9, 288, 291, 14, 548, 18126, 27318, 275, 756, 339, 347, 9578, 8, 277, 304, 267, 340, 291, 14, 8542, 365, 440, 488, 26, 288, 291, 14, 8542, 14, 8192, 342, 267, 291, 14, 18408, 15532, 342, 339, 347, 2274, 15532, 8, 277, 12, 17339, 12, 18490, 304, 267, 291, 14, 16376, 275, 17339, 267, 291, 14, 16376, 1831, 22555, 275, 18490, 339, 347, 24369, 15532, 8, 277, 304, 267, 340, 291, 14, 16376, 365, 440, 488, 26, 288, 2150, 291, 14, 16376, 288, 2150, 291, 14, 16376, 1831, 22555, 267, 340, 291, 14, 8542, 26, 288, 291, 14, 8542, 14, 18408, 15532, 342, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 18342, 83, 19437, 88, 6818, 450, 83, 3524, 450, 334, 277, 855, 533, 3108, 1305, 8, 277, 395, 291, 14, 8542, 9, 421, 199, 533, 2165, 7610, 18186, 4936, 8, 6845, 15532, 18186, 4936, 304, 272, 408, 15532, 18186, 4936, 543, 282, 21837, 3335, 14, 339, 3979, 3002, 3335, 1794, 478, 1536, 12, 473, 1172, 3002, 1676, 2165, 7610, 16834, 5133, 3002, 3335, 272, 965, 14726, 315, 652, 4020, 14, 272, 408, 272, 327, 29622, 1500, 8298, 687, 9006, 14, 23859, 272, 3335, 2320, 275, 499, 538, 18, 538, 18, 538, 18, 339, 17339, 4232, 2972, 275, 756, 272, 625, 11616, 275, 756, 339, 347, 16834, 24982, 8, 277, 304, 267, 327, 12078, 627, 1397, 10, 1240, 1536, 370, 2165, 7610, 18186, 4936, 370, 25931, 314, 16834, 267, 327, 1245, 4012, 370, 3002, 1676, 2165, 7610, 14, 267, 291, 14, 22478, 275, 715, 339, 347, 14604, 24982, 8, 277, 304, 267, 291, 14, 22478, 275, 756, 267, 340, 291, 423, 2738, 26, 288, 666, 275, 6522, 904, 8, 277, 423, 2738, 9, 288, 2783, 17367, 275, 291, 423, 952, 7700, 1451, 8, 576, 9, 288, 340, 2783, 17367, 665, 822, 8, 576, 304, 355, 625, 1150, 275, 666, 59, 2394, 17367, 2938, 355, 702, 440, 291, 14, 73, 24566, 22555, 12, 334, 490, 298, 22555, 17339, 8103, 440, 2218, 1006, 2399, 666, 2685, 355, 291, 423, 2738, 5873, 275, 359, 324, 1150, 61, 288, 587, 26, 355, 291, 423, 2738, 5873, 275, 942, 267, 587, 26, 288, 2783, 17367, 275, 378, 398, 340, 334, 277, 14, 324, 11616, 436, 2783, 17367, 436, 440, 291, 423, 2738, 436, 288, 291, 14, 8542, 365, 440, 488, 304, 288, 291, 14, 8542, 14, 18408, 15532, 342, 398, 340, 440, 291, 14, 73, 24566, 22555, 26, 288, 291, 14, 548, 18126, 27318, 275, 440, 2783, 17367, 398, 340, 291, 14, 16376, 365, 440, 488, 26, 288, 2783, 23139, 275, 3089, 779, 552, 8, 83, 9, 367, 308, 315, 291, 423, 2738, 566, 288, 327, 3254, 26, 2047, 883, 1937, 2348, 314, 12330, 367, 4721, 436, 6465, 288, 327, 22834, 10375, 12, 2382, 3335, 2320, 3955, 506, 314, 4721, 2216, 1380, 781, 288, 327, 7198, 314, 18932, 17339, 370, 16834, 12, 436, 781, 3955, 78, 1133, 1172, 288, 327, 652, 14604, 4020, 5133, 652, 9793, 314, 6465, 2216, 14, 221, 4236, 340, 17339, 288, 327, 365, 27705, 12, 11703, 781, 5121, 2839, 370, 10299, 687, 652, 465, 8298, 465, 5784, 288, 327, 370, 4215, 4154, 3335, 2615, 370, 314, 6465, 2216, 12, 880, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
zhaodelong/django
tests/one_to_one/models.py
203
3343
""" One-to-one relationships To define a one-to-one relationship, use ``OneToOneField()``. In this example, a ``Place`` optionally can be a ``Restaurant``. """ from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible @python_2_unicode_compatible class Place(models.Model): name = models.CharField(max_length=50) address = models.CharField(max_length=80) def __str__(self): return "%s the place" % self.name @python_2_unicode_compatible class Restaurant(models.Model): place = models.OneToOneField(Place, models.CASCADE, primary_key=True) serves_hot_dogs = models.BooleanField(default=False) serves_pizza = models.BooleanField(default=False) def __str__(self): return "%s the restaurant" % self.place.name @python_2_unicode_compatible class Bar(models.Model): place = models.OneToOneField(Place, models.CASCADE) serves_cocktails = models.BooleanField(default=True) def __str__(self): return "%s the bar" % self.place.name class UndergroundBar(models.Model): place = models.OneToOneField(Place, models.SET_NULL, null=True) serves_cocktails = models.BooleanField(default=True) @python_2_unicode_compatible class Waiter(models.Model): restaurant = models.ForeignKey(Restaurant, models.CASCADE) name = models.CharField(max_length=50) def __str__(self): return "%s the waiter at %s" % (self.name, self.restaurant) @python_2_unicode_compatible class Favorites(models.Model): name = models.CharField(max_length=50) restaurants = models.ManyToManyField(Restaurant) def __str__(self): return "Favorites for %s" % self.name class ManualPrimaryKey(models.Model): primary_key = models.CharField(max_length=10, primary_key=True) name = models.CharField(max_length=50) class RelatedModel(models.Model): link = models.OneToOneField(ManualPrimaryKey, models.CASCADE) name = models.CharField(max_length=50) @python_2_unicode_compatible class MultiModel(models.Model): link1 = models.OneToOneField(Place, models.CASCADE) link2 = models.OneToOneField(ManualPrimaryKey, models.CASCADE) name = models.CharField(max_length=50) def __str__(self): return "Multimodel %s" % self.name class Target(models.Model): name = models.CharField(max_length=50) class Pointer(models.Model): other = models.OneToOneField(Target, models.CASCADE, primary_key=True) class Pointer2(models.Model): other = models.OneToOneField(Target, models.CASCADE, related_name='second_pointer') class HiddenPointer(models.Model): target = models.OneToOneField(Target, models.CASCADE, related_name='hidden+') # Test related objects visibility. class SchoolManager(models.Manager): def get_queryset(self): return super(SchoolManager, self).get_queryset().filter(is_public=True) class School(models.Model): is_public = models.BooleanField(default=False) objects = SchoolManager() class DirectorManager(models.Manager): def get_queryset(self): return super(DirectorManager, self).get_queryset().filter(is_temp=False) class Director(models.Model): is_temp = models.BooleanField(default=False) school = models.OneToOneField(School, models.CASCADE) objects = DirectorManager()
bsd-3-clause
[ 624, 199, 4395, 13, 475, 13, 368, 20045, 199, 199, 1378, 5627, 282, 1373, 13, 475, 13, 368, 8931, 12, 675, 1124, 14298, 28566, 199, 199, 607, 642, 2893, 12, 282, 1124, 11613, 1040, 14190, 883, 506, 282, 1124, 32075, 4345, 199, 624, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 1639, 14, 697, 492, 1709, 199, 504, 1639, 14, 1208, 14, 2991, 492, 2366, 63, 18, 63, 2975, 63, 6490, 421, 199, 32, 1548, 63, 18, 63, 2975, 63, 6490, 199, 533, 10902, 8, 992, 14, 1685, 304, 272, 536, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1400, 9, 272, 2287, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1257, 9, 339, 347, 636, 495, 721, 277, 304, 267, 372, 2071, 83, 314, 4192, 2, 450, 291, 14, 354, 421, 199, 32, 1548, 63, 18, 63, 2975, 63, 6490, 199, 533, 799, 14436, 8, 992, 14, 1685, 304, 272, 4192, 275, 1709, 14, 14298, 8, 11613, 12, 1709, 14, 10855, 12, 5062, 63, 498, 29, 549, 9, 272, 23739, 63, 8885, 63, 1117, 458, 275, 1709, 14, 5036, 8, 885, 29, 797, 9, 272, 23739, 63, 80, 30937, 275, 1709, 14, 5036, 8, 885, 29, 797, 9, 339, 347, 636, 495, 721, 277, 304, 267, 372, 2071, 83, 314, 295, 14436, 2, 450, 291, 14, 2778, 14, 354, 421, 199, 32, 1548, 63, 18, 63, 2975, 63, 6490, 199, 533, 12377, 8, 992, 14, 1685, 304, 272, 4192, 275, 1709, 14, 14298, 8, 11613, 12, 1709, 14, 10855, 9, 272, 23739, 63, 331, 346, 2015, 275, 1709, 14, 5036, 8, 885, 29, 549, 9, 339, 347, 636, 495, 721, 277, 304, 267, 372, 2071, 83, 314, 4681, 2, 450, 291, 14, 2778, 14, 354, 421, 199, 533, 25010, 3928, 5281, 8, 992, 14, 1685, 304, 272, 4192, 275, 1709, 14, 14298, 8, 11613, 12, 1709, 14, 3597, 63, 8084, 12, 2973, 29, 549, 9, 272, 23739, 63, 331, 346, 2015, 275, 1709, 14, 5036, 8, 885, 29, 549, 9, 421, 199, 32, 1548, 63, 18, 63, 2975, 63, 6490, 199, 533, 644, 65, 1661, 8, 992, 14, 1685, 304, 272, 295, 14436, 275, 1709, 14, 3190, 8, 32075, 12, 1709, 14, 10855, 9, 272, 536, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1400, 9, 339, 347, 636, 495, 721, 277, 304, 267, 372, 2071, 83, 314, 27730, 737, 450, 83, 2, 450, 334, 277, 14, 354, 12, 291, 14, 25646, 9, 421, 199, 32, 1548, 63, 18, 63, 2975, 63, 6490, 199, 533, 481, 12958, 4033, 8, 992, 14, 1685, 304, 272, 536, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1400, 9, 272, 295, 13973, 2285, 275, 1709, 14, 7624, 8, 32075, 9, 339, 347, 636, 495, 721, 277, 304, 267, 372, 298, 24335, 4033, 367, 450, 83, 2, 450, 291, 14, 354, 421, 199, 533, 30247, 29457, 8, 992, 14, 1685, 304, 272, 5062, 63, 498, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 709, 12, 5062, 63, 498, 29, 549, 9, 272, 536, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1400, 9, 421, 199, 533, 20116, 1685, 8, 992, 14, 1685, 304, 272, 2142, 275, 1709, 14, 14298, 8, 22382, 29457, 12, 1709, 14, 10855, 9, 272, 536, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1400, 9, 421, 199, 32, 1548, 63, 18, 63, 2975, 63, 6490, 199, 533, 6879, 1685, 8, 992, 14, 1685, 304, 272, 2142, 17, 275, 1709, 14, 14298, 8, 11613, 12, 1709, 14, 10855, 9, 272, 2142, 18, 275, 1709, 14, 14298, 8, 22382, 29457, 12, 1709, 14, 10855, 9, 272, 536, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1400, 9, 339, 347, 636, 495, 721, 277, 304, 267, 372, 298, 3947, 1238, 450, 83, 2, 450, 291, 14, 354, 421, 199, 533, 10256, 8, 992, 14, 1685, 304, 272, 536, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1400, 9, 421, 199, 533, 28833, 8, 992, 14, 1685, 304, 272, 1163, 275, 1709, 14, 14298, 8, 4277, 12, 1709, 14, 10855, 12, 5062, 63, 498, 29, 549, 9, 421, 199, 533, 28833, 18, 8, 992, 14, 1685, 304, 272, 1163, 275, 1709, 14, 14298, 8, 4277, 12, 1709, 14, 10855, 12, 4048, 63, 354, 534, 4375, 63, 3929, 358, 421, 199, 533, 26401, 12190, 8, 992, 14, 1685, 304, 272, 1347, 275, 1709, 14, 14298, 8, 4277, 12, 1709, 14, 10855, 12, 4048, 63, 354, 534, 5642, 13854, 421, 199, 3, 1379, 4048, 2251, 6887, 14, 199, 533, 428, 15089, 2988, 8, 992, 14, 2988, 304, 272, 347, 664, 63, 7924, 8, 277, 304, 267, 372, 1613, 8, 51, 15089, 2988, 12, 291, 680, 362, 63, 7924, 1252, 1541, 8, 374, 63, 3455, 29, 549, 9, 421, 199, 533, 428, 15089, 8, 992, 14, 1685, 304, 272, 365, 63, 3455, 275, 1709, 14, 5036, 8, 885, 29, 797, 9, 272, 2251, 275, 428, 15089, 2988, 342, 421, 199, 533, 25596, 630, 2988, 8, 992, 14, 2988, 304, 272, 347, 664, 63, 7924, 8, 277, 304, 267, 372, 1613, 8, 28704, 2988, 12, 291, 680, 362, 63, 7924, 1252, 1541, 8, 374, 63, 808, 29, 797, 9, 421, 199, 533, 25596, 630, 8, 992, 14, 1685, 304, 272, 365, 63, 808, 275, 1709, 14, 5036, 8, 885, 29, 797, 9, 272, 308, 15089, 275, 1709, 14, 14298, 8, 51, 15089, 12, 1709, 14, 10855, 9, 272, 2251, 275, 25596, 630, 2988, 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 ]
[ 199, 4395, 13, 475, 13, 368, 20045, 199, 199, 1378, 5627, 282, 1373, 13, 475, 13, 368, 8931, 12, 675, 1124, 14298, 28566, 199, 199, 607, 642, 2893, 12, 282, 1124, 11613, 1040, 14190, 883, 506, 282, 1124, 32075, 4345, 199, 624, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 1639, 14, 697, 492, 1709, 199, 504, 1639, 14, 1208, 14, 2991, 492, 2366, 63, 18, 63, 2975, 63, 6490, 421, 199, 32, 1548, 63, 18, 63, 2975, 63, 6490, 199, 533, 10902, 8, 992, 14, 1685, 304, 272, 536, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1400, 9, 272, 2287, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1257, 9, 339, 347, 636, 495, 721, 277, 304, 267, 372, 2071, 83, 314, 4192, 2, 450, 291, 14, 354, 421, 199, 32, 1548, 63, 18, 63, 2975, 63, 6490, 199, 533, 799, 14436, 8, 992, 14, 1685, 304, 272, 4192, 275, 1709, 14, 14298, 8, 11613, 12, 1709, 14, 10855, 12, 5062, 63, 498, 29, 549, 9, 272, 23739, 63, 8885, 63, 1117, 458, 275, 1709, 14, 5036, 8, 885, 29, 797, 9, 272, 23739, 63, 80, 30937, 275, 1709, 14, 5036, 8, 885, 29, 797, 9, 339, 347, 636, 495, 721, 277, 304, 267, 372, 2071, 83, 314, 295, 14436, 2, 450, 291, 14, 2778, 14, 354, 421, 199, 32, 1548, 63, 18, 63, 2975, 63, 6490, 199, 533, 12377, 8, 992, 14, 1685, 304, 272, 4192, 275, 1709, 14, 14298, 8, 11613, 12, 1709, 14, 10855, 9, 272, 23739, 63, 331, 346, 2015, 275, 1709, 14, 5036, 8, 885, 29, 549, 9, 339, 347, 636, 495, 721, 277, 304, 267, 372, 2071, 83, 314, 4681, 2, 450, 291, 14, 2778, 14, 354, 421, 199, 533, 25010, 3928, 5281, 8, 992, 14, 1685, 304, 272, 4192, 275, 1709, 14, 14298, 8, 11613, 12, 1709, 14, 3597, 63, 8084, 12, 2973, 29, 549, 9, 272, 23739, 63, 331, 346, 2015, 275, 1709, 14, 5036, 8, 885, 29, 549, 9, 421, 199, 32, 1548, 63, 18, 63, 2975, 63, 6490, 199, 533, 644, 65, 1661, 8, 992, 14, 1685, 304, 272, 295, 14436, 275, 1709, 14, 3190, 8, 32075, 12, 1709, 14, 10855, 9, 272, 536, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1400, 9, 339, 347, 636, 495, 721, 277, 304, 267, 372, 2071, 83, 314, 27730, 737, 450, 83, 2, 450, 334, 277, 14, 354, 12, 291, 14, 25646, 9, 421, 199, 32, 1548, 63, 18, 63, 2975, 63, 6490, 199, 533, 481, 12958, 4033, 8, 992, 14, 1685, 304, 272, 536, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1400, 9, 272, 295, 13973, 2285, 275, 1709, 14, 7624, 8, 32075, 9, 339, 347, 636, 495, 721, 277, 304, 267, 372, 298, 24335, 4033, 367, 450, 83, 2, 450, 291, 14, 354, 421, 199, 533, 30247, 29457, 8, 992, 14, 1685, 304, 272, 5062, 63, 498, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 709, 12, 5062, 63, 498, 29, 549, 9, 272, 536, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1400, 9, 421, 199, 533, 20116, 1685, 8, 992, 14, 1685, 304, 272, 2142, 275, 1709, 14, 14298, 8, 22382, 29457, 12, 1709, 14, 10855, 9, 272, 536, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1400, 9, 421, 199, 32, 1548, 63, 18, 63, 2975, 63, 6490, 199, 533, 6879, 1685, 8, 992, 14, 1685, 304, 272, 2142, 17, 275, 1709, 14, 14298, 8, 11613, 12, 1709, 14, 10855, 9, 272, 2142, 18, 275, 1709, 14, 14298, 8, 22382, 29457, 12, 1709, 14, 10855, 9, 272, 536, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1400, 9, 339, 347, 636, 495, 721, 277, 304, 267, 372, 298, 3947, 1238, 450, 83, 2, 450, 291, 14, 354, 421, 199, 533, 10256, 8, 992, 14, 1685, 304, 272, 536, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1400, 9, 421, 199, 533, 28833, 8, 992, 14, 1685, 304, 272, 1163, 275, 1709, 14, 14298, 8, 4277, 12, 1709, 14, 10855, 12, 5062, 63, 498, 29, 549, 9, 421, 199, 533, 28833, 18, 8, 992, 14, 1685, 304, 272, 1163, 275, 1709, 14, 14298, 8, 4277, 12, 1709, 14, 10855, 12, 4048, 63, 354, 534, 4375, 63, 3929, 358, 421, 199, 533, 26401, 12190, 8, 992, 14, 1685, 304, 272, 1347, 275, 1709, 14, 14298, 8, 4277, 12, 1709, 14, 10855, 12, 4048, 63, 354, 534, 5642, 13854, 421, 199, 3, 1379, 4048, 2251, 6887, 14, 199, 533, 428, 15089, 2988, 8, 992, 14, 2988, 304, 272, 347, 664, 63, 7924, 8, 277, 304, 267, 372, 1613, 8, 51, 15089, 2988, 12, 291, 680, 362, 63, 7924, 1252, 1541, 8, 374, 63, 3455, 29, 549, 9, 421, 199, 533, 428, 15089, 8, 992, 14, 1685, 304, 272, 365, 63, 3455, 275, 1709, 14, 5036, 8, 885, 29, 797, 9, 272, 2251, 275, 428, 15089, 2988, 342, 421, 199, 533, 25596, 630, 2988, 8, 992, 14, 2988, 304, 272, 347, 664, 63, 7924, 8, 277, 304, 267, 372, 1613, 8, 28704, 2988, 12, 291, 680, 362, 63, 7924, 1252, 1541, 8, 374, 63, 808, 29, 797, 9, 421, 199, 533, 25596, 630, 8, 992, 14, 1685, 304, 272, 365, 63, 808, 275, 1709, 14, 5036, 8, 885, 29, 797, 9, 272, 308, 15089, 275, 1709, 14, 14298, 8, 51, 15089, 12, 1709, 14, 10855, 9, 272, 2251, 275, 25596, 630, 2988, 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, 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,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, 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 ]
schoolie/bokeh
examples/plotting/file/markers.py
13
1606
from numpy.random import random from bokeh.plotting import figure, show, output_file def mscatter(p, x, y, marker): p.scatter(x, y, marker=marker, size=15, line_color="navy", fill_color="orange", alpha=0.5) def mtext(p, x, y, text): p.text(x, y, text=[text], text_color="firebrick", text_align="center", text_font_size="10pt") p = figure(title="Bokeh Markers", toolbar_location=None) p.grid.grid_line_color = None p.background_fill_color = "#eeeeee" p.axis.visible = False N = 10 mscatter(p, random(N)+2, random(N)+1, "circle") mscatter(p, random(N)+4, random(N)+1, "square") mscatter(p, random(N)+6, random(N)+1, "triangle") mscatter(p, random(N)+8, random(N)+1, "asterisk") mscatter(p, random(N)+2, random(N)+4, "circle_x") mscatter(p, random(N)+4, random(N)+4, "square_x") mscatter(p, random(N)+6, random(N)+4, "inverted_triangle") mscatter(p, random(N)+8, random(N)+4, "x") mscatter(p, random(N)+2, random(N)+7, "circle_cross") mscatter(p, random(N)+4, random(N)+7, "square_cross") mscatter(p, random(N)+6, random(N)+7, "diamond") mscatter(p, random(N)+8, random(N)+7, "cross") mtext(p, 2.5, 0.5, "circle / o") mtext(p, 4.5, 0.5, "square") mtext(p, 6.5, 0.5, "triangle") mtext(p, 8.5, 0.5, "asterisk / *") mtext(p, 2.5, 3.5, "circle_x / ox") mtext(p, 4.5, 3.5, "square_x") mtext(p, 6.5, 3.5, "inverted_triangle") mtext(p, 8.5, 3.5, "x") mtext(p, 2.5, 6.5, "circle_cross / o+") mtext(p, 4.5, 6.5, "square_cross") mtext(p, 6.5, 6.5, "diamond") mtext(p, 8.5, 6.5, "cross / +") output_file("markers.html", title="markers.py example") show(p) # open a browser
bsd-3-clause
[ 504, 2680, 14, 2355, 492, 2196, 199, 199, 504, 25214, 14, 2798, 1337, 492, 9658, 12, 2498, 12, 1072, 63, 493, 199, 199, 318, 333, 13512, 8, 80, 12, 671, 12, 612, 12, 3608, 304, 272, 299, 14, 13512, 8, 88, 12, 612, 12, 3608, 29, 4211, 12, 1568, 29, 1046, 12, 1598, 1004, 63, 2326, 628, 10927, 89, 401, 5554, 63, 2326, 628, 22683, 401, 5131, 29, 16, 14, 21, 9, 199, 199, 318, 333, 505, 8, 80, 12, 671, 12, 612, 12, 1318, 304, 272, 299, 14, 505, 8, 88, 12, 612, 12, 1318, 1524, 505, 467, 1779, 1318, 63, 2326, 628, 8935, 29541, 401, 1318, 63, 5743, 628, 4218, 401, 1318, 63, 4246, 63, 890, 628, 709, 541, 531, 199, 199, 80, 275, 9658, 8, 1213, 628, 2208, 16610, 7173, 1192, 401, 22483, 63, 1985, 29, 403, 9, 199, 80, 14, 3825, 14, 3825, 63, 604, 63, 2326, 275, 488, 199, 80, 14, 7451, 63, 4498, 63, 2326, 275, 5426, 21706, 1024, 2, 199, 80, 14, 3127, 14, 6604, 275, 756, 199, 199, 46, 275, 1616, 199, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 18, 12, 2196, 8, 46, 6393, 17, 12, 298, 11001, 531, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 20, 12, 2196, 8, 46, 6393, 17, 12, 298, 9646, 531, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 22, 12, 2196, 8, 46, 6393, 17, 12, 298, 21584, 531, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 24, 12, 2196, 8, 46, 6393, 17, 12, 298, 305, 6236, 1339, 531, 199, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 18, 12, 2196, 8, 46, 6393, 20, 12, 298, 11001, 63, 88, 531, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 20, 12, 2196, 8, 46, 6393, 20, 12, 298, 9646, 63, 88, 531, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 22, 12, 2196, 8, 46, 6393, 20, 12, 298, 28019, 63, 21584, 531, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 24, 12, 2196, 8, 46, 6393, 20, 12, 298, 88, 531, 199, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 18, 12, 2196, 8, 46, 6393, 23, 12, 298, 11001, 63, 7925, 531, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 20, 12, 2196, 8, 46, 6393, 23, 12, 298, 9646, 63, 7925, 531, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 22, 12, 2196, 8, 46, 6393, 23, 12, 298, 328, 24940, 531, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 24, 12, 2196, 8, 46, 6393, 23, 12, 298, 7925, 531, 199, 199, 77, 505, 8, 80, 12, 499, 14, 21, 12, 378, 14, 21, 12, 298, 11001, 1182, 312, 531, 199, 77, 505, 8, 80, 12, 841, 14, 21, 12, 378, 14, 21, 12, 298, 9646, 531, 199, 77, 505, 8, 80, 12, 1227, 14, 21, 12, 378, 14, 21, 12, 298, 21584, 531, 199, 77, 505, 8, 80, 12, 1695, 14, 21, 12, 378, 14, 21, 12, 298, 305, 6236, 1339, 1182, 627, 531, 199, 199, 77, 505, 8, 80, 12, 499, 14, 21, 12, 650, 14, 21, 12, 298, 11001, 63, 88, 1182, 312, 88, 531, 199, 77, 505, 8, 80, 12, 841, 14, 21, 12, 650, 14, 21, 12, 298, 9646, 63, 88, 531, 199, 77, 505, 8, 80, 12, 1227, 14, 21, 12, 650, 14, 21, 12, 298, 28019, 63, 21584, 531, 199, 77, 505, 8, 80, 12, 1695, 14, 21, 12, 650, 14, 21, 12, 298, 88, 531, 199, 199, 77, 505, 8, 80, 12, 499, 14, 21, 12, 1227, 14, 21, 12, 298, 11001, 63, 7925, 1182, 312, 21425, 199, 77, 505, 8, 80, 12, 841, 14, 21, 12, 1227, 14, 21, 12, 298, 9646, 63, 7925, 531, 199, 77, 505, 8, 80, 12, 1227, 14, 21, 12, 1227, 14, 21, 12, 298, 328, 24940, 531, 199, 77, 505, 8, 80, 12, 1695, 14, 21, 12, 1227, 14, 21, 12, 298, 7925, 1182, 435, 531, 199, 199, 1199, 63, 493, 480, 16835, 14, 1360, 401, 2538, 628, 16835, 14, 647, 2893, 531, 199, 199, 2384, 8, 80, 9, 221, 327, 1551, 282, 7042, 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 ]
[ 2680, 14, 2355, 492, 2196, 199, 199, 504, 25214, 14, 2798, 1337, 492, 9658, 12, 2498, 12, 1072, 63, 493, 199, 199, 318, 333, 13512, 8, 80, 12, 671, 12, 612, 12, 3608, 304, 272, 299, 14, 13512, 8, 88, 12, 612, 12, 3608, 29, 4211, 12, 1568, 29, 1046, 12, 1598, 1004, 63, 2326, 628, 10927, 89, 401, 5554, 63, 2326, 628, 22683, 401, 5131, 29, 16, 14, 21, 9, 199, 199, 318, 333, 505, 8, 80, 12, 671, 12, 612, 12, 1318, 304, 272, 299, 14, 505, 8, 88, 12, 612, 12, 1318, 1524, 505, 467, 1779, 1318, 63, 2326, 628, 8935, 29541, 401, 1318, 63, 5743, 628, 4218, 401, 1318, 63, 4246, 63, 890, 628, 709, 541, 531, 199, 199, 80, 275, 9658, 8, 1213, 628, 2208, 16610, 7173, 1192, 401, 22483, 63, 1985, 29, 403, 9, 199, 80, 14, 3825, 14, 3825, 63, 604, 63, 2326, 275, 488, 199, 80, 14, 7451, 63, 4498, 63, 2326, 275, 5426, 21706, 1024, 2, 199, 80, 14, 3127, 14, 6604, 275, 756, 199, 199, 46, 275, 1616, 199, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 18, 12, 2196, 8, 46, 6393, 17, 12, 298, 11001, 531, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 20, 12, 2196, 8, 46, 6393, 17, 12, 298, 9646, 531, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 22, 12, 2196, 8, 46, 6393, 17, 12, 298, 21584, 531, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 24, 12, 2196, 8, 46, 6393, 17, 12, 298, 305, 6236, 1339, 531, 199, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 18, 12, 2196, 8, 46, 6393, 20, 12, 298, 11001, 63, 88, 531, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 20, 12, 2196, 8, 46, 6393, 20, 12, 298, 9646, 63, 88, 531, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 22, 12, 2196, 8, 46, 6393, 20, 12, 298, 28019, 63, 21584, 531, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 24, 12, 2196, 8, 46, 6393, 20, 12, 298, 88, 531, 199, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 18, 12, 2196, 8, 46, 6393, 23, 12, 298, 11001, 63, 7925, 531, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 20, 12, 2196, 8, 46, 6393, 23, 12, 298, 9646, 63, 7925, 531, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 22, 12, 2196, 8, 46, 6393, 23, 12, 298, 328, 24940, 531, 199, 77, 13512, 8, 80, 12, 2196, 8, 46, 6393, 24, 12, 2196, 8, 46, 6393, 23, 12, 298, 7925, 531, 199, 199, 77, 505, 8, 80, 12, 499, 14, 21, 12, 378, 14, 21, 12, 298, 11001, 1182, 312, 531, 199, 77, 505, 8, 80, 12, 841, 14, 21, 12, 378, 14, 21, 12, 298, 9646, 531, 199, 77, 505, 8, 80, 12, 1227, 14, 21, 12, 378, 14, 21, 12, 298, 21584, 531, 199, 77, 505, 8, 80, 12, 1695, 14, 21, 12, 378, 14, 21, 12, 298, 305, 6236, 1339, 1182, 627, 531, 199, 199, 77, 505, 8, 80, 12, 499, 14, 21, 12, 650, 14, 21, 12, 298, 11001, 63, 88, 1182, 312, 88, 531, 199, 77, 505, 8, 80, 12, 841, 14, 21, 12, 650, 14, 21, 12, 298, 9646, 63, 88, 531, 199, 77, 505, 8, 80, 12, 1227, 14, 21, 12, 650, 14, 21, 12, 298, 28019, 63, 21584, 531, 199, 77, 505, 8, 80, 12, 1695, 14, 21, 12, 650, 14, 21, 12, 298, 88, 531, 199, 199, 77, 505, 8, 80, 12, 499, 14, 21, 12, 1227, 14, 21, 12, 298, 11001, 63, 7925, 1182, 312, 21425, 199, 77, 505, 8, 80, 12, 841, 14, 21, 12, 1227, 14, 21, 12, 298, 9646, 63, 7925, 531, 199, 77, 505, 8, 80, 12, 1227, 14, 21, 12, 1227, 14, 21, 12, 298, 328, 24940, 531, 199, 77, 505, 8, 80, 12, 1695, 14, 21, 12, 1227, 14, 21, 12, 298, 7925, 1182, 435, 531, 199, 199, 1199, 63, 493, 480, 16835, 14, 1360, 401, 2538, 628, 16835, 14, 647, 2893, 531, 199, 199, 2384, 8, 80, 9, 221, 327, 1551, 282, 7042, 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, 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,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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 ]
tlatzko/spmcluster
.tox/clean/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/pulldom.py
1729
2302
from __future__ import absolute_import, division, unicode_literals from xml.dom.pulldom import START_ELEMENT, END_ELEMENT, \ COMMENT, IGNORABLE_WHITESPACE, CHARACTERS from . import _base from ..constants import voidElements class TreeWalker(_base.TreeWalker): def __iter__(self): ignore_until = None previous = None for event in self.tree: if previous is not None and \ (ignore_until is None or previous[1] is ignore_until): if previous[1] is ignore_until: ignore_until = None for token in self.tokens(previous, event): yield token if token["type"] == "EmptyTag": ignore_until = previous[1] previous = event if ignore_until is None or previous[1] is ignore_until: for token in self.tokens(previous, None): yield token elif ignore_until is not None: raise ValueError("Illformed DOM event stream: void element without END_ELEMENT") def tokens(self, event, next): type, node = event if type == START_ELEMENT: name = node.nodeName namespace = node.namespaceURI attrs = {} for attr in list(node.attributes.keys()): attr = node.getAttributeNode(attr) attrs[(attr.namespaceURI, attr.localName)] = attr.value if name in voidElements: for token in self.emptyTag(namespace, name, attrs, not next or next[1] is not node): yield token else: yield self.startTag(namespace, name, attrs) elif type == END_ELEMENT: name = node.nodeName namespace = node.namespaceURI if name not in voidElements: yield self.endTag(namespace, name) elif type == COMMENT: yield self.comment(node.nodeValue) elif type in (IGNORABLE_WHITESPACE, CHARACTERS): for token in self.text(node.nodeValue): yield token else: yield self.unknown(type)
bsd-2-clause
[ 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 2649, 63, 5955, 199, 199, 504, 2748, 14, 4556, 14, 9302, 4556, 492, 13910, 63, 12535, 12, 7729, 63, 12535, 12, 971, 272, 25071, 12, 27499, 726, 2617, 63, 20620, 12, 8518, 3036, 3960, 199, 199, 504, 1275, 492, 485, 1095, 199, 199, 504, 2508, 5559, 492, 2309, 6255, 421, 199, 533, 12178, 26020, 1547, 1095, 14, 3987, 26020, 304, 272, 347, 636, 1661, 721, 277, 304, 267, 3686, 63, 8111, 275, 488, 267, 4136, 275, 488, 267, 367, 1566, 315, 291, 14, 2350, 26, 288, 340, 4136, 365, 440, 488, 436, 971, 490, 334, 4247, 63, 8111, 365, 488, 503, 4136, 59, 17, 61, 365, 3686, 63, 8111, 304, 355, 340, 4136, 59, 17, 61, 365, 3686, 63, 8111, 26, 490, 3686, 63, 8111, 275, 488, 355, 367, 1526, 315, 291, 14, 4504, 8, 6352, 12, 1566, 304, 490, 1995, 1526, 490, 340, 1526, 905, 466, 937, 508, 298, 4699, 1931, 582, 717, 3686, 63, 8111, 275, 4136, 59, 17, 61, 288, 4136, 275, 1566, 267, 340, 3686, 63, 8111, 365, 488, 503, 4136, 59, 17, 61, 365, 3686, 63, 8111, 26, 288, 367, 1526, 315, 291, 14, 4504, 8, 6352, 12, 488, 304, 355, 1995, 1526, 267, 916, 3686, 63, 8111, 365, 440, 488, 26, 288, 746, 1722, 480, 27965, 17733, 14316, 1566, 2547, 26, 2309, 1819, 1928, 7729, 63, 12535, 531, 339, 347, 4645, 8, 277, 12, 1566, 12, 2163, 304, 267, 730, 12, 1031, 275, 1566, 267, 340, 730, 508, 13910, 63, 12535, 26, 288, 536, 275, 1031, 14, 13777, 288, 3231, 275, 1031, 14, 27855, 288, 3290, 275, 1052, 288, 367, 1921, 315, 769, 8, 932, 14, 2987, 14, 1612, 5109, 355, 1921, 275, 1031, 14, 12956, 1716, 8, 962, 9, 355, 3290, 7528, 962, 14, 27855, 12, 1921, 14, 31317, 1874, 275, 1921, 14, 585, 288, 340, 536, 315, 2309, 6255, 26, 355, 367, 1526, 315, 291, 14, 1667, 1931, 8, 3251, 12, 5644, 536, 12, 5644, 3290, 12, 5644, 440, 2163, 503, 2163, 59, 17, 61, 365, 440, 1031, 304, 490, 1995, 1526, 288, 587, 26, 355, 1995, 291, 14, 16252, 8, 3251, 12, 536, 12, 3290, 9, 398, 916, 730, 508, 7729, 63, 12535, 26, 288, 536, 275, 1031, 14, 13777, 288, 3231, 275, 1031, 14, 27855, 288, 340, 536, 440, 315, 2309, 6255, 26, 355, 1995, 291, 14, 18755, 8, 3251, 12, 536, 9, 398, 916, 730, 508, 25071, 26, 288, 1995, 291, 14, 3349, 8, 932, 14, 17240, 9, 398, 916, 730, 315, 334, 3203, 726, 2617, 63, 20620, 12, 8518, 3036, 3960, 304, 288, 367, 1526, 315, 291, 14, 505, 8, 932, 14, 17240, 304, 355, 1995, 1526, 398, 587, 26, 288, 1995, 291, 14, 5187, 8, 466, 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 ]
[ 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 2649, 63, 5955, 199, 199, 504, 2748, 14, 4556, 14, 9302, 4556, 492, 13910, 63, 12535, 12, 7729, 63, 12535, 12, 971, 272, 25071, 12, 27499, 726, 2617, 63, 20620, 12, 8518, 3036, 3960, 199, 199, 504, 1275, 492, 485, 1095, 199, 199, 504, 2508, 5559, 492, 2309, 6255, 421, 199, 533, 12178, 26020, 1547, 1095, 14, 3987, 26020, 304, 272, 347, 636, 1661, 721, 277, 304, 267, 3686, 63, 8111, 275, 488, 267, 4136, 275, 488, 267, 367, 1566, 315, 291, 14, 2350, 26, 288, 340, 4136, 365, 440, 488, 436, 971, 490, 334, 4247, 63, 8111, 365, 488, 503, 4136, 59, 17, 61, 365, 3686, 63, 8111, 304, 355, 340, 4136, 59, 17, 61, 365, 3686, 63, 8111, 26, 490, 3686, 63, 8111, 275, 488, 355, 367, 1526, 315, 291, 14, 4504, 8, 6352, 12, 1566, 304, 490, 1995, 1526, 490, 340, 1526, 905, 466, 937, 508, 298, 4699, 1931, 582, 717, 3686, 63, 8111, 275, 4136, 59, 17, 61, 288, 4136, 275, 1566, 267, 340, 3686, 63, 8111, 365, 488, 503, 4136, 59, 17, 61, 365, 3686, 63, 8111, 26, 288, 367, 1526, 315, 291, 14, 4504, 8, 6352, 12, 488, 304, 355, 1995, 1526, 267, 916, 3686, 63, 8111, 365, 440, 488, 26, 288, 746, 1722, 480, 27965, 17733, 14316, 1566, 2547, 26, 2309, 1819, 1928, 7729, 63, 12535, 531, 339, 347, 4645, 8, 277, 12, 1566, 12, 2163, 304, 267, 730, 12, 1031, 275, 1566, 267, 340, 730, 508, 13910, 63, 12535, 26, 288, 536, 275, 1031, 14, 13777, 288, 3231, 275, 1031, 14, 27855, 288, 3290, 275, 1052, 288, 367, 1921, 315, 769, 8, 932, 14, 2987, 14, 1612, 5109, 355, 1921, 275, 1031, 14, 12956, 1716, 8, 962, 9, 355, 3290, 7528, 962, 14, 27855, 12, 1921, 14, 31317, 1874, 275, 1921, 14, 585, 288, 340, 536, 315, 2309, 6255, 26, 355, 367, 1526, 315, 291, 14, 1667, 1931, 8, 3251, 12, 5644, 536, 12, 5644, 3290, 12, 5644, 440, 2163, 503, 2163, 59, 17, 61, 365, 440, 1031, 304, 490, 1995, 1526, 288, 587, 26, 355, 1995, 291, 14, 16252, 8, 3251, 12, 536, 12, 3290, 9, 398, 916, 730, 508, 7729, 63, 12535, 26, 288, 536, 275, 1031, 14, 13777, 288, 3231, 275, 1031, 14, 27855, 288, 340, 536, 440, 315, 2309, 6255, 26, 355, 1995, 291, 14, 18755, 8, 3251, 12, 536, 9, 398, 916, 730, 508, 25071, 26, 288, 1995, 291, 14, 3349, 8, 932, 14, 17240, 9, 398, 916, 730, 315, 334, 3203, 726, 2617, 63, 20620, 12, 8518, 3036, 3960, 304, 288, 367, 1526, 315, 291, 14, 505, 8, 932, 14, 17240, 304, 355, 1995, 1526, 398, 587, 26, 288, 1995, 291, 14, 5187, 8, 466, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
boompieman/iim_project
project_python2/lib/python2.7/site-packages/nltk/corpus/reader/nombank.py
3
16738
# Natural Language Toolkit: NomBank Corpus Reader # # Copyright (C) 2001-2015 NLTK Project # Authors: Paul Bedaride <paul.bedaride@gmail.com> # Edward Loper <edloper@gmail.com> # URL: <http://nltk.org/> # For license information, see LICENSE.TXT from __future__ import unicode_literals from nltk.tree import Tree from xml.etree import ElementTree from nltk.internals import raise_unorderable_types from nltk.compat import total_ordering, python_2_unicode_compatible, string_types from nltk.corpus.reader.util import * from nltk.corpus.reader.api import * class NombankCorpusReader(CorpusReader): """ Corpus reader for the nombank corpus, which augments the Penn Treebank with information about the predicate argument structure of every noun instance. The corpus consists of two parts: the predicate-argument annotations themselves, and a set of "frameset files" which define the argument labels used by the annotations, on a per-noun basis. Each "frameset file" contains one or more predicates, such as ``'turn'`` or ``'turn_on'``, each of which is divided into coarse-grained word senses called "rolesets". For each "roleset", the frameset file provides descriptions of the argument roles, along with examples. """ def __init__(self, root, nomfile, framefiles='', nounsfile=None, parse_fileid_xform=None, parse_corpus=None, encoding='utf8'): """ :param root: The root directory for this corpus. :param nomfile: The name of the file containing the predicate- argument annotations (relative to ``root``). :param framefiles: A list or regexp specifying the frameset fileids for this corpus. :param parse_fileid_xform: A transform that should be applied to the fileids in this corpus. This should be a function of one argument (a fileid) that returns a string (the new fileid). :param parse_corpus: The corpus containing the parse trees corresponding to this corpus. These parse trees are necessary to resolve the tree pointers used by nombank. """ # If framefiles is specified as a regexp, expand it. if isinstance(framefiles, string_types): framefiles = find_corpus_fileids(root, framefiles) framefiles = list(framefiles) # Initialze the corpus reader. CorpusReader.__init__(self, root, [nomfile, nounsfile] + framefiles, encoding) # Record our frame fileids & nom file. self._nomfile = nomfile self._framefiles = framefiles self._nounsfile = nounsfile self._parse_fileid_xform = parse_fileid_xform self._parse_corpus = parse_corpus def raw(self, fileids=None): """ :return: the text contents of the given fileids, as a single string. """ if fileids is None: fileids = self._fileids elif isinstance(fileids, compat.string_types): fileids = [fileids] return concat([self.open(f).read() for f in fileids]) def instances(self, baseform=None): """ :return: a corpus view that acts as a list of ``NombankInstance`` objects, one for each noun in the corpus. """ kwargs = {} if baseform is not None: kwargs['instance_filter'] = lambda inst: inst.baseform==baseform return StreamBackedCorpusView(self.abspath(self._nomfile), lambda stream: self._read_instance_block(stream, **kwargs), encoding=self.encoding(self._nomfile)) def lines(self): """ :return: a corpus view that acts as a list of strings, one for each line in the predicate-argument annotation file. """ return StreamBackedCorpusView(self.abspath(self._nomfile), read_line_block, encoding=self.encoding(self._nomfile)) def roleset(self, roleset_id): """ :return: the xml description for the given roleset. """ baseform = roleset_id.split('.')[0] baseform = baseform.replace('perc-sign','%') baseform = baseform.replace('oneslashonezero', '1/10').replace('1/10','1-slash-10') framefile = 'frames/%s.xml' % baseform if framefile not in self._framefiles: raise ValueError('Frameset file for %s not found' % roleset_id) # n.b.: The encoding for XML fileids is specified by the file # itself; so we ignore self._encoding here. etree = ElementTree.parse(self.abspath(framefile).open()).getroot() for roleset in etree.findall('predicate/roleset'): if roleset.attrib['id'] == roleset_id: return roleset else: raise ValueError('Roleset %s not found in %s' % (roleset_id, framefile)) def rolesets(self, baseform=None): """ :return: list of xml descriptions for rolesets. """ if baseform is not None: framefile = 'frames/%s.xml' % baseform if framefile not in self._framefiles: raise ValueError('Frameset file for %s not found' % baseform) framefiles = [framefile] else: framefiles = self._framefiles rsets = [] for framefile in framefiles: # n.b.: The encoding for XML fileids is specified by the file # itself; so we ignore self._encoding here. etree = ElementTree.parse(self.abspath(framefile).open()).getroot() rsets.append(etree.findall('predicate/roleset')) return LazyConcatenation(rsets) def nouns(self): """ :return: a corpus view that acts as a list of all noun lemmas in this corpus (from the nombank.1.0.words file). """ return StreamBackedCorpusView(self.abspath(self._nounsfile), read_line_block, encoding=self.encoding(self._nounsfile)) def _read_instance_block(self, stream, instance_filter=lambda inst: True): block = [] # Read 100 at a time. for i in range(100): line = stream.readline().strip() if line: inst = NombankInstance.parse( line, self._parse_fileid_xform, self._parse_corpus) if instance_filter(inst): block.append(inst) return block ###################################################################### #{ Nombank Instance & related datatypes ###################################################################### @python_2_unicode_compatible class NombankInstance(object): def __init__(self, fileid, sentnum, wordnum, baseform, sensenumber, predicate, predid, arguments, parse_corpus=None): self.fileid = fileid """The name of the file containing the parse tree for this instance's sentence.""" self.sentnum = sentnum """The sentence number of this sentence within ``fileid``. Indexing starts from zero.""" self.wordnum = wordnum """The word number of this instance's predicate within its containing sentence. Word numbers are indexed starting from zero, and include traces and other empty parse elements.""" self.baseform = baseform """The baseform of the predicate.""" self.sensenumber = sensenumber """The sense number of the predicate.""" self.predicate = predicate """A ``NombankTreePointer`` indicating the position of this instance's predicate within its containing sentence.""" self.predid = predid """Identifier of the predicate.""" self.arguments = tuple(arguments) """A list of tuples (argloc, argid), specifying the location and identifier for each of the predicate's argument in the containing sentence. Argument identifiers are strings such as ``'ARG0'`` or ``'ARGM-TMP'``. This list does *not* contain the predicate.""" self.parse_corpus = parse_corpus """A corpus reader for the parse trees corresponding to the instances in this nombank corpus.""" @property def roleset(self): """The name of the roleset used by this instance's predicate. Use ``nombank.roleset() <NombankCorpusReader.roleset>`` to look up information about the roleset.""" r = self.baseform.replace('%', 'perc-sign') r = r.replace('1/10', '1-slash-10').replace('1-slash-10', 'oneslashonezero') return '%s.%s'%(r, self.sensenumber) def __repr__(self): return ('<NombankInstance: %s, sent %s, word %s>' % (self.fileid, self.sentnum, self.wordnum)) def __str__(self): s = '%s %s %s %s %s' % (self.fileid, self.sentnum, self.wordnum, self.baseform, self.sensenumber) items = self.arguments + ((self.predicate, 'rel'),) for (argloc, argid) in sorted(items): s += ' %s-%s' % (argloc, argid) return s def _get_tree(self): if self.parse_corpus is None: return None if self.fileid not in self.parse_corpus.fileids(): return None return self.parse_corpus.parsed_sents(self.fileid)[self.sentnum] tree = property(_get_tree, doc=""" The parse tree corresponding to this instance, or None if the corresponding tree is not available.""") @staticmethod def parse(s, parse_fileid_xform=None, parse_corpus=None): pieces = s.split() if len(pieces) < 6: raise ValueError('Badly formatted nombank line: %r' % s) # Divide the line into its basic pieces. (fileid, sentnum, wordnum, baseform, sensenumber) = pieces[:5] args = pieces[5:] rel = [args.pop(i) for i,p in enumerate(args) if '-rel' in p] if len(rel) != 1: raise ValueError('Badly formatted nombank line: %r' % s) # Apply the fileid selector, if any. if parse_fileid_xform is not None: fileid = parse_fileid_xform(fileid) # Convert sentence & word numbers to ints. sentnum = int(sentnum) wordnum = int(wordnum) # Parse the predicate location. predloc, predid = rel[0].split('-', 1) predicate = NombankTreePointer.parse(predloc) # Parse the arguments. arguments = [] for arg in args: argloc, argid = arg.split('-', 1) arguments.append( (NombankTreePointer.parse(argloc), argid) ) # Put it all together. return NombankInstance(fileid, sentnum, wordnum, baseform, sensenumber, predicate, predid, arguments, parse_corpus) class NombankPointer(object): """ A pointer used by nombank to identify one or more constituents in a parse tree. ``NombankPointer`` is an abstract base class with three concrete subclasses: - ``NombankTreePointer`` is used to point to single constituents. - ``NombankSplitTreePointer`` is used to point to 'split' constituents, which consist of a sequence of two or more ``NombankTreePointer`` pointers. - ``NombankChainTreePointer`` is used to point to entire trace chains in a tree. It consists of a sequence of pieces, which can be ``NombankTreePointer`` or ``NombankSplitTreePointer`` pointers. """ def __init__(self): if self.__class__ == NombankPointer: raise NotImplementedError() @python_2_unicode_compatible class NombankChainTreePointer(NombankPointer): def __init__(self, pieces): self.pieces = pieces """A list of the pieces that make up this chain. Elements may be either ``NombankSplitTreePointer`` or ``NombankTreePointer`` pointers.""" def __str__(self): return '*'.join('%s' % p for p in self.pieces) def __repr__(self): return '<NombankChainTreePointer: %s>' % self def select(self, tree): if tree is None: raise ValueError('Parse tree not avaialable') return Tree('*CHAIN*', [p.select(tree) for p in self.pieces]) @python_2_unicode_compatible class NombankSplitTreePointer(NombankPointer): def __init__(self, pieces): self.pieces = pieces """A list of the pieces that make up this chain. Elements are all ``NombankTreePointer`` pointers.""" def __str__(self): return ','.join('%s' % p for p in self.pieces) def __repr__(self): return '<NombankSplitTreePointer: %s>' % self def select(self, tree): if tree is None: raise ValueError('Parse tree not avaialable') return Tree('*SPLIT*', [p.select(tree) for p in self.pieces]) @total_ordering @python_2_unicode_compatible class NombankTreePointer(NombankPointer): """ wordnum:height*wordnum:height*... wordnum:height, """ def __init__(self, wordnum, height): self.wordnum = wordnum self.height = height @staticmethod def parse(s): # Deal with chains (xx*yy*zz) pieces = s.split('*') if len(pieces) > 1: return NombankChainTreePointer([NombankTreePointer.parse(elt) for elt in pieces]) # Deal with split args (xx,yy,zz) pieces = s.split(',') if len(pieces) > 1: return NombankSplitTreePointer([NombankTreePointer.parse(elt) for elt in pieces]) # Deal with normal pointers. pieces = s.split(':') if len(pieces) != 2: raise ValueError('bad nombank pointer %r' % s) return NombankTreePointer(int(pieces[0]), int(pieces[1])) def __str__(self): return '%s:%s' % (self.wordnum, self.height) def __repr__(self): return 'NombankTreePointer(%d, %d)' % (self.wordnum, self.height) def __eq__(self, other): while isinstance(other, (NombankChainTreePointer, NombankSplitTreePointer)): other = other.pieces[0] if not isinstance(other, NombankTreePointer): return self is other return (self.wordnum == other.wordnum and self.height == other.height) def __ne__(self, other): return not self == other def __lt__(self, other): while isinstance(other, (NombankChainTreePointer, NombankSplitTreePointer)): other = other.pieces[0] if not isinstance(other, NombankTreePointer): return id(self) < id(other) return (self.wordnum, -self.height) < (other.wordnum, -other.height) def select(self, tree): if tree is None: raise ValueError('Parse tree not avaialable') return tree[self.treepos(tree)] def treepos(self, tree): """ Convert this pointer to a standard 'tree position' pointer, given that it points to the given tree. """ if tree is None: raise ValueError('Parse tree not avaialable') stack = [tree] treepos = [] wordnum = 0 while True: #print treepos #print stack[-1] # tree node: if isinstance(stack[-1], Tree): # Select the next child. if len(treepos) < len(stack): treepos.append(0) else: treepos[-1] += 1 # Update the stack. if treepos[-1] < len(stack[-1]): stack.append(stack[-1][treepos[-1]]) else: # End of node's child list: pop up a level. stack.pop() treepos.pop() # word node: else: if wordnum == self.wordnum: return tuple(treepos[:len(treepos)-self.height-1]) else: wordnum += 1 stack.pop()
gpl-3.0
[ 3, 653, 292, 4889, 8466, 15650, 6065, 26, 653, 676, 14814, 7499, 8843, 23099, 202, 199, 3, 202, 199, 3, 1898, 334, 35, 9, 12521, 13, 7806, 24719, 15263, 7290, 202, 199, 3, 6642, 26, 28574, 699, 379, 759, 271, 665, 387, 348, 14, 6123, 759, 271, 32, 6799, 14, 957, 30, 202, 199, 3, 3515, 17379, 3079, 491, 2262, 665, 379, 320, 529, 32, 6799, 14, 957, 30, 202, 199, 3, 2851, 26, 665, 1014, 921, 7530, 2663, 14, 1308, 3133, 202, 199, 3, 2104, 4190, 2556, 12, 1937, 5113, 14, 17715, 2999, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 2999, 199, 504, 24706, 14, 2350, 492, 12178, 202, 199, 504, 2748, 14, 9464, 492, 13139, 202, 199, 504, 24706, 14, 4404, 2551, 492, 746, 63, 324, 27788, 6842, 63, 1313, 202, 199, 504, 24706, 14, 5819, 492, 3141, 63, 7128, 12, 2366, 63, 18, 63, 2975, 63, 6490, 12, 1059, 63, 1313, 2999, 199, 504, 24706, 14, 16780, 14, 5503, 14, 1974, 492, 627, 202, 199, 504, 24706, 14, 16780, 14, 5503, 14, 1246, 492, 627, 2999, 199, 533, 653, 676, 9860, 26424, 5929, 8, 26424, 5929, 304, 1128, 408, 1128, 7499, 8843, 7002, 367, 314, 17468, 9860, 16831, 12, 1314, 18336, 1470, 314, 510, 287, 78, 1128, 12178, 9860, 543, 2556, 3595, 314, 11944, 1423, 5523, 1128, 402, 4036, 949, 324, 1256, 14, 221, 710, 16831, 18581, 402, 2877, 4184, 26, 314, 1128, 11944, 13, 2094, 15538, 17279, 12, 436, 282, 663, 402, 298, 27462, 1128, 1584, 2, 1314, 5627, 314, 1423, 3628, 1202, 701, 314, 15538, 12, 1128, 641, 282, 1126, 13, 889, 324, 5597, 14, 221, 7048, 298, 27462, 570, 2, 3509, 1373, 503, 1655, 1128, 11944, 83, 12, 4066, 465, 12692, 353, 14700, 503, 12692, 353, 63, 265, 31638, 1924, 402, 1314, 365, 1128, 29378, 1901, 512, 30672, 13, 926, 1942, 4349, 4334, 874, 2797, 298, 3756, 2193, 1674, 221, 2104, 1128, 1924, 298, 3756, 409, 401, 314, 2787, 409, 570, 6571, 18714, 402, 314, 1128, 1423, 11689, 12, 3180, 543, 7251, 14, 1128, 408, 1128, 347, 636, 826, 721, 277, 12, 1738, 12, 17468, 493, 12, 2787, 1725, 4581, 20085, 949, 324, 83, 493, 29, 403, 12, 2198, 63, 493, 344, 63, 24226, 29, 403, 12, 20085, 2198, 63, 16780, 29, 403, 12, 2644, 534, 1624, 24, 735, 1039, 408, 1039, 520, 635, 1738, 26, 710, 1738, 2082, 367, 642, 16831, 14, 1039, 520, 635, 17468, 493, 26, 710, 536, 402, 314, 570, 3035, 314, 11944, 13, 1675, 1423, 15538, 334, 6188, 370, 1124, 1231, 20008, 1039, 520, 635, 2787, 1725, 26, 437, 769, 503, 13156, 9176, 314, 2787, 409, 1675, 570, 1580, 367, 642, 16831, 14, 1039, 520, 635, 2198, 63, 493, 344, 63, 24226, 26, 437, 5793, 626, 1077, 506, 6781, 1675, 370, 314, 570, 1580, 315, 642, 16831, 14, 221, 961, 1077, 506, 282, 805, 1675, 402, 1373, 1423, 334, 65, 570, 344, 9, 626, 2529, 282, 1059, 334, 1589, 892, 1675, 570, 344, 680, 1039, 520, 635, 2198, 63, 16780, 26, 710, 16831, 3035, 314, 2198, 14416, 1675, 5226, 370, 642, 16831, 14, 221, 5723, 2198, 14416, 787, 1675, 5784, 370, 7512, 314, 3123, 21116, 1202, 701, 17468, 9860, 14, 1039, 408, 1039, 327, 982, 2787, 1725, 365, 2013, 465, 282, 13156, 12, 6544, 652, 14, 1039, 340, 1228, 8, 1943, 1725, 12, 1059, 63, 1313, 304, 1675, 2787, 1725, 275, 2342, 63, 16780, 63, 493, 1580, 8, 1231, 12, 2787, 1725, 9, 1039, 2787, 1725, 275, 769, 8, 1943, 1725, 9, 1039, 327, 6026, 806, 314, 16831, 7002, 14, 1039, 7499, 8843, 5929, 855, 826, 721, 277, 12, 1738, 12, 359, 15998, 493, 12, 949, 324, 83, 493, 61, 435, 2787, 1725, 12, 202, 2892, 2644, 9, 4341, 327, 12651, 4154, 2787, 570, 1580, 1253, 17468, 570, 14, 1039, 291, 423, 15998, 493, 275, 17468, 493, 1039, 291, 423, 1943, 1725, 275, 2787, 1725, 1039, 291, 423, 889, 324, 83, 493, 275, 949, 324, 83, 493, 1039, 291, 423, 1122, 63, 493, 344, 63, 24226, 275, 2198, 63, 493, 344, 63, 24226, 1039, 291, 423, 1122, 63, 16780, 275, 2198, 63, 16780, 2958, 347, 3066, 8, 277, 12, 570, 1580, 29, 403, 304, 1039, 408, 1039, 520, 1107, 26, 314, 1318, 4072, 402, 314, 1627, 570, 1580, 12, 465, 282, 2849, 1059, 14, 1039, 408, 1039, 340, 570, 1580, 365, 488, 26, 570, 1580, 275, 291, 423, 493, 1580, 1039, 916, 1228, 8, 493, 1580, 12, 8434, 14, 875, 63, 1313, 304, 570, 1580, 275, 359, 493, 1580, 61, 1039, 372, 17159, 779, 277, 14, 1490, 8, 70, 680, 739, 342, 367, 289, 315, 570, 1580, 566, 2958, 347, 4454, 8, 277, 12, 1300, 964, 29, 403, 304, 1039, 408, 1039, 520, 1107, 26, 282, 16831, 2455, 626, 17795, 465, 282, 769, 402, 1039, 1124, 46, 676, 9860, 3244, 1040, 2251, 12, 1373, 367, 1924, 949, 324, 315, 314, 16831, 14, 1039, 408, 1039, 2074, 275, 1052, 1039, 340, 1300, 964, 365, 440, 488, 26, 1675, 2074, 459, 842, 63, 1541, 418, 275, 2400, 2727, 26, 2727, 14, 1095, 964, 389, 1095, 964, 1039, 372, 8271, 4540, 379, 26424, 2768, 8, 277, 14, 4832, 8, 277, 423, 15998, 493, 395, 202, 4228, 2400, 2547, 26, 291, 423, 739, 63, 842, 63, 1457, 8, 1745, 12, 1011, 958, 395, 202, 4228, 2644, 29, 277, 14, 2991, 8, 277, 423, 15998, 493, 430, 2958, 347, 2385, 8, 277, 304, 1039, 408, 1039, 520, 1107, 26, 282, 16831, 2455, 626, 17795, 465, 282, 769, 402, 3326, 12, 1373, 367, 1039, 1924, 1004, 315, 314, 11944, 13, 2094, 11262, 570, 14, 1039, 408, 1039, 372, 8271, 4540, 379, 26424, 2768, 8, 277, 14, 4832, 8, 277, 423, 15998, 493, 395, 202, 4228, 1586, 63, 604, 63, 1457, 12, 202, 4228, 2644, 29, 277, 14, 2991, 8, 277, 423, 15998, 493, 430, 2958, 347, 4719, 409, 8, 277, 12, 4719, 409, 63, 344, 304, 1039, 408, 1039, 520, 1107, 26, 314, 2748, 1369, 367, 314, 1627, 4719, 409, 14, 1039, 408, 1039, 1300, 964, 275, 4719, 409, 63, 344, 14, 1294, 19237, 16, 61, 1039, 1300, 964, 275, 1300, 964, 14, 1814, 360, 27293, 13 ]
[ 653, 292, 4889, 8466, 15650, 6065, 26, 653, 676, 14814, 7499, 8843, 23099, 202, 199, 3, 202, 199, 3, 1898, 334, 35, 9, 12521, 13, 7806, 24719, 15263, 7290, 202, 199, 3, 6642, 26, 28574, 699, 379, 759, 271, 665, 387, 348, 14, 6123, 759, 271, 32, 6799, 14, 957, 30, 202, 199, 3, 3515, 17379, 3079, 491, 2262, 665, 379, 320, 529, 32, 6799, 14, 957, 30, 202, 199, 3, 2851, 26, 665, 1014, 921, 7530, 2663, 14, 1308, 3133, 202, 199, 3, 2104, 4190, 2556, 12, 1937, 5113, 14, 17715, 2999, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 2999, 199, 504, 24706, 14, 2350, 492, 12178, 202, 199, 504, 2748, 14, 9464, 492, 13139, 202, 199, 504, 24706, 14, 4404, 2551, 492, 746, 63, 324, 27788, 6842, 63, 1313, 202, 199, 504, 24706, 14, 5819, 492, 3141, 63, 7128, 12, 2366, 63, 18, 63, 2975, 63, 6490, 12, 1059, 63, 1313, 2999, 199, 504, 24706, 14, 16780, 14, 5503, 14, 1974, 492, 627, 202, 199, 504, 24706, 14, 16780, 14, 5503, 14, 1246, 492, 627, 2999, 199, 533, 653, 676, 9860, 26424, 5929, 8, 26424, 5929, 304, 1128, 408, 1128, 7499, 8843, 7002, 367, 314, 17468, 9860, 16831, 12, 1314, 18336, 1470, 314, 510, 287, 78, 1128, 12178, 9860, 543, 2556, 3595, 314, 11944, 1423, 5523, 1128, 402, 4036, 949, 324, 1256, 14, 221, 710, 16831, 18581, 402, 2877, 4184, 26, 314, 1128, 11944, 13, 2094, 15538, 17279, 12, 436, 282, 663, 402, 298, 27462, 1128, 1584, 2, 1314, 5627, 314, 1423, 3628, 1202, 701, 314, 15538, 12, 1128, 641, 282, 1126, 13, 889, 324, 5597, 14, 221, 7048, 298, 27462, 570, 2, 3509, 1373, 503, 1655, 1128, 11944, 83, 12, 4066, 465, 12692, 353, 14700, 503, 12692, 353, 63, 265, 31638, 1924, 402, 1314, 365, 1128, 29378, 1901, 512, 30672, 13, 926, 1942, 4349, 4334, 874, 2797, 298, 3756, 2193, 1674, 221, 2104, 1128, 1924, 298, 3756, 409, 401, 314, 2787, 409, 570, 6571, 18714, 402, 314, 1128, 1423, 11689, 12, 3180, 543, 7251, 14, 1128, 408, 1128, 347, 636, 826, 721, 277, 12, 1738, 12, 17468, 493, 12, 2787, 1725, 4581, 20085, 949, 324, 83, 493, 29, 403, 12, 2198, 63, 493, 344, 63, 24226, 29, 403, 12, 20085, 2198, 63, 16780, 29, 403, 12, 2644, 534, 1624, 24, 735, 1039, 408, 1039, 520, 635, 1738, 26, 710, 1738, 2082, 367, 642, 16831, 14, 1039, 520, 635, 17468, 493, 26, 710, 536, 402, 314, 570, 3035, 314, 11944, 13, 1675, 1423, 15538, 334, 6188, 370, 1124, 1231, 20008, 1039, 520, 635, 2787, 1725, 26, 437, 769, 503, 13156, 9176, 314, 2787, 409, 1675, 570, 1580, 367, 642, 16831, 14, 1039, 520, 635, 2198, 63, 493, 344, 63, 24226, 26, 437, 5793, 626, 1077, 506, 6781, 1675, 370, 314, 570, 1580, 315, 642, 16831, 14, 221, 961, 1077, 506, 282, 805, 1675, 402, 1373, 1423, 334, 65, 570, 344, 9, 626, 2529, 282, 1059, 334, 1589, 892, 1675, 570, 344, 680, 1039, 520, 635, 2198, 63, 16780, 26, 710, 16831, 3035, 314, 2198, 14416, 1675, 5226, 370, 642, 16831, 14, 221, 5723, 2198, 14416, 787, 1675, 5784, 370, 7512, 314, 3123, 21116, 1202, 701, 17468, 9860, 14, 1039, 408, 1039, 327, 982, 2787, 1725, 365, 2013, 465, 282, 13156, 12, 6544, 652, 14, 1039, 340, 1228, 8, 1943, 1725, 12, 1059, 63, 1313, 304, 1675, 2787, 1725, 275, 2342, 63, 16780, 63, 493, 1580, 8, 1231, 12, 2787, 1725, 9, 1039, 2787, 1725, 275, 769, 8, 1943, 1725, 9, 1039, 327, 6026, 806, 314, 16831, 7002, 14, 1039, 7499, 8843, 5929, 855, 826, 721, 277, 12, 1738, 12, 359, 15998, 493, 12, 949, 324, 83, 493, 61, 435, 2787, 1725, 12, 202, 2892, 2644, 9, 4341, 327, 12651, 4154, 2787, 570, 1580, 1253, 17468, 570, 14, 1039, 291, 423, 15998, 493, 275, 17468, 493, 1039, 291, 423, 1943, 1725, 275, 2787, 1725, 1039, 291, 423, 889, 324, 83, 493, 275, 949, 324, 83, 493, 1039, 291, 423, 1122, 63, 493, 344, 63, 24226, 275, 2198, 63, 493, 344, 63, 24226, 1039, 291, 423, 1122, 63, 16780, 275, 2198, 63, 16780, 2958, 347, 3066, 8, 277, 12, 570, 1580, 29, 403, 304, 1039, 408, 1039, 520, 1107, 26, 314, 1318, 4072, 402, 314, 1627, 570, 1580, 12, 465, 282, 2849, 1059, 14, 1039, 408, 1039, 340, 570, 1580, 365, 488, 26, 570, 1580, 275, 291, 423, 493, 1580, 1039, 916, 1228, 8, 493, 1580, 12, 8434, 14, 875, 63, 1313, 304, 570, 1580, 275, 359, 493, 1580, 61, 1039, 372, 17159, 779, 277, 14, 1490, 8, 70, 680, 739, 342, 367, 289, 315, 570, 1580, 566, 2958, 347, 4454, 8, 277, 12, 1300, 964, 29, 403, 304, 1039, 408, 1039, 520, 1107, 26, 282, 16831, 2455, 626, 17795, 465, 282, 769, 402, 1039, 1124, 46, 676, 9860, 3244, 1040, 2251, 12, 1373, 367, 1924, 949, 324, 315, 314, 16831, 14, 1039, 408, 1039, 2074, 275, 1052, 1039, 340, 1300, 964, 365, 440, 488, 26, 1675, 2074, 459, 842, 63, 1541, 418, 275, 2400, 2727, 26, 2727, 14, 1095, 964, 389, 1095, 964, 1039, 372, 8271, 4540, 379, 26424, 2768, 8, 277, 14, 4832, 8, 277, 423, 15998, 493, 395, 202, 4228, 2400, 2547, 26, 291, 423, 739, 63, 842, 63, 1457, 8, 1745, 12, 1011, 958, 395, 202, 4228, 2644, 29, 277, 14, 2991, 8, 277, 423, 15998, 493, 430, 2958, 347, 2385, 8, 277, 304, 1039, 408, 1039, 520, 1107, 26, 282, 16831, 2455, 626, 17795, 465, 282, 769, 402, 3326, 12, 1373, 367, 1039, 1924, 1004, 315, 314, 11944, 13, 2094, 11262, 570, 14, 1039, 408, 1039, 372, 8271, 4540, 379, 26424, 2768, 8, 277, 14, 4832, 8, 277, 423, 15998, 493, 395, 202, 4228, 1586, 63, 604, 63, 1457, 12, 202, 4228, 2644, 29, 277, 14, 2991, 8, 277, 423, 15998, 493, 430, 2958, 347, 4719, 409, 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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 ]
jazkarta/edx-platform
openedx/core/lib/api/plugins.py
154
1517
""" Adds support for first class features that can be added to the edX platform. """ from stevedore.extension import ExtensionManager class PluginError(Exception): """ Base Exception for when an error was found regarding features. """ pass class PluginManager(object): """ Base class that manages plugins to the edX platform. """ @classmethod def get_available_plugins(cls): """ Returns a dict of all the plugins that have been made available through the platform. """ # Note: we're creating the extension manager lazily to ensure that the Python path # has been correctly set up. Trying to create this statically will fail, unfortunately. if not hasattr(cls, "_plugins"): plugins = {} extension_manager = ExtensionManager(namespace=cls.NAMESPACE) # pylint: disable=no-member for plugin_name in extension_manager.names(): plugins[plugin_name] = extension_manager[plugin_name].plugin cls._plugins = plugins return cls._plugins @classmethod def get_plugin(cls, name): """ Returns the plugin with the given name. """ plugins = cls.get_available_plugins() if name not in plugins: raise PluginError("No such plugin {name} for entry point {namespace}".format( name=name, namespace=cls.NAMESPACE # pylint: disable=no-member )) return plugins[name]
agpl-3.0
[ 624, 199, 14995, 2291, 367, 1642, 1021, 4534, 626, 883, 506, 3483, 370, 314, 3988, 56, 4298, 14, 199, 624, 199, 199, 504, 20345, 1354, 720, 14, 3435, 492, 13282, 2988, 421, 199, 533, 11349, 547, 8, 1726, 304, 272, 408, 272, 3523, 2186, 367, 1380, 376, 1125, 1990, 1911, 12602, 4534, 14, 272, 408, 272, 986, 421, 199, 533, 11349, 2988, 8, 785, 304, 272, 408, 272, 3523, 1021, 626, 31965, 8963, 370, 314, 3988, 56, 4298, 14, 272, 408, 272, 768, 3744, 272, 347, 664, 63, 4561, 63, 5265, 8, 1886, 304, 267, 408, 267, 1803, 282, 1211, 402, 1006, 314, 8963, 626, 1172, 2757, 6326, 2808, 4012, 314, 4298, 14, 267, 408, 267, 327, 3390, 26, 781, 3984, 6425, 314, 3329, 5256, 29667, 3444, 370, 4868, 626, 314, 2018, 931, 267, 327, 965, 2757, 6657, 663, 1536, 14, 7649, 316, 370, 1218, 642, 2955, 1183, 911, 2449, 12, 625, 21839, 14, 267, 340, 440, 2688, 8, 1886, 12, 2668, 5265, 2349, 288, 8963, 275, 1052, 288, 3329, 63, 2609, 275, 13282, 2988, 8, 3251, 29, 1886, 14, 13001, 9, 221, 327, 4287, 26, 3507, 29, 889, 13, 1114, 288, 367, 3589, 63, 354, 315, 3329, 63, 2609, 14, 1247, 837, 355, 8963, 59, 2718, 63, 354, 61, 275, 3329, 63, 2609, 59, 2718, 63, 354, 1055, 2718, 288, 843, 423, 5265, 275, 8963, 267, 372, 843, 423, 5265, 339, 768, 3744, 272, 347, 664, 63, 2718, 8, 1886, 12, 536, 304, 267, 408, 267, 1803, 314, 3589, 543, 314, 1627, 536, 14, 267, 408, 267, 8963, 275, 843, 14, 362, 63, 4561, 63, 5265, 342, 267, 340, 536, 440, 315, 8963, 26, 288, 746, 11349, 547, 480, 1944, 4066, 3589, 469, 354, 93, 367, 2397, 2376, 469, 3251, 5469, 908, 8, 355, 536, 29, 354, 12, 355, 3231, 29, 1886, 14, 13001, 221, 327, 4287, 26, 3507, 29, 889, 13, 1114, 288, 5082, 267, 372, 8963, 59, 354, 61, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 14995, 2291, 367, 1642, 1021, 4534, 626, 883, 506, 3483, 370, 314, 3988, 56, 4298, 14, 199, 624, 199, 199, 504, 20345, 1354, 720, 14, 3435, 492, 13282, 2988, 421, 199, 533, 11349, 547, 8, 1726, 304, 272, 408, 272, 3523, 2186, 367, 1380, 376, 1125, 1990, 1911, 12602, 4534, 14, 272, 408, 272, 986, 421, 199, 533, 11349, 2988, 8, 785, 304, 272, 408, 272, 3523, 1021, 626, 31965, 8963, 370, 314, 3988, 56, 4298, 14, 272, 408, 272, 768, 3744, 272, 347, 664, 63, 4561, 63, 5265, 8, 1886, 304, 267, 408, 267, 1803, 282, 1211, 402, 1006, 314, 8963, 626, 1172, 2757, 6326, 2808, 4012, 314, 4298, 14, 267, 408, 267, 327, 3390, 26, 781, 3984, 6425, 314, 3329, 5256, 29667, 3444, 370, 4868, 626, 314, 2018, 931, 267, 327, 965, 2757, 6657, 663, 1536, 14, 7649, 316, 370, 1218, 642, 2955, 1183, 911, 2449, 12, 625, 21839, 14, 267, 340, 440, 2688, 8, 1886, 12, 2668, 5265, 2349, 288, 8963, 275, 1052, 288, 3329, 63, 2609, 275, 13282, 2988, 8, 3251, 29, 1886, 14, 13001, 9, 221, 327, 4287, 26, 3507, 29, 889, 13, 1114, 288, 367, 3589, 63, 354, 315, 3329, 63, 2609, 14, 1247, 837, 355, 8963, 59, 2718, 63, 354, 61, 275, 3329, 63, 2609, 59, 2718, 63, 354, 1055, 2718, 288, 843, 423, 5265, 275, 8963, 267, 372, 843, 423, 5265, 339, 768, 3744, 272, 347, 664, 63, 2718, 8, 1886, 12, 536, 304, 267, 408, 267, 1803, 314, 3589, 543, 314, 1627, 536, 14, 267, 408, 267, 8963, 275, 843, 14, 362, 63, 4561, 63, 5265, 342, 267, 340, 536, 440, 315, 8963, 26, 288, 746, 11349, 547, 480, 1944, 4066, 3589, 469, 354, 93, 367, 2397, 2376, 469, 3251, 5469, 908, 8, 355, 536, 29, 354, 12, 355, 3231, 29, 1886, 14, 13001, 221, 327, 4287, 26, 3507, 29, 889, 13, 1114, 288, 5082, 267, 372, 8963, 59, 354, 61, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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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 ]
githubutilities/LeetCode
Python/validate-binary-search-tree.py
3
2085
# Time: O(n) # Space: O(1) # # Given a binary tree, determine if it is a valid binary search tree (BST). # # Assume a BST is defined as follows: # # The left subtree of a node contains only nodes with keys less than the node's key. # The right subtree of a node contains only nodes with keys greater than the node's key. # Both the left and right subtrees must also be binary search trees. # # Definition for a binary tree node class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None # Morris Traversal Solution class Solution: # @param root, a tree node # @return a list of integers def isValidBST(self, root): prev, cur = None, root while cur: if cur.left is None: if prev and prev.val >= cur.val: return False prev = cur cur = cur.right else: node = cur.left while node.right and node.right != cur: node = node.right if node.right is None: node.right = cur cur = cur.left else: if prev and prev.val >= cur.val: return False node.right = None prev = cur cur = cur.right return True # Time: O(n) # Space: O(h) class Solution2: # @param root, a tree node # @return a boolean def isValidBST(self, root): return self.isValidBSTRecu(root, float("-inf"), float("inf")) def isValidBSTRecu(self, root, low, high): if root is None: return True return low < root.val and root.val < high \ and self.isValidBSTRecu(root.left, low, root.val) \ and self.isValidBSTRecu(root.right, root.val, high) if __name__ == "__main__": root = TreeNode(2) root.left = TreeNode(1) root.right = TreeNode(3) print Solution().isValidBST(root)
mit
[ 3, 4703, 26, 221, 593, 8, 78, 9, 199, 3, 19326, 26, 593, 8, 17, 9, 199, 3, 221, 199, 3, 9138, 282, 3366, 3123, 12, 6705, 340, 652, 365, 282, 1686, 3366, 2754, 3123, 334, 34, 840, 680, 199, 3, 221, 199, 3, 16269, 282, 699, 840, 365, 3247, 465, 11924, 26, 199, 3, 221, 199, 3, 710, 3602, 26897, 402, 282, 1031, 3509, 1454, 3380, 543, 2883, 6656, 2419, 314, 1031, 1159, 790, 14, 199, 3, 710, 2451, 26897, 402, 282, 1031, 3509, 1454, 3380, 543, 2883, 8932, 2419, 314, 1031, 1159, 790, 14, 199, 3, 17650, 314, 3602, 436, 2451, 1007, 14635, 1471, 2597, 506, 3366, 2754, 14416, 14, 199, 3, 199, 199, 3, 29398, 367, 282, 221, 3366, 3123, 1031, 199, 533, 12178, 1716, 26, 272, 347, 636, 826, 721, 277, 12, 671, 304, 267, 291, 14, 637, 275, 671, 267, 291, 14, 3039, 275, 488, 267, 291, 14, 1019, 275, 488, 199, 199, 3, 603, 269, 5719, 12643, 16222, 9274, 199, 533, 9274, 26, 272, 327, 768, 635, 1738, 12, 282, 3123, 1031, 272, 327, 768, 1107, 282, 769, 402, 9446, 272, 347, 365, 3490, 34, 840, 8, 277, 12, 1738, 304, 267, 5071, 12, 1094, 275, 488, 12, 1738, 267, 1830, 1094, 26, 288, 340, 1094, 14, 3039, 365, 488, 26, 355, 340, 5071, 436, 5071, 14, 637, 2356, 1094, 14, 637, 26, 490, 372, 756, 355, 5071, 275, 1094, 355, 1094, 275, 1094, 14, 1019, 288, 587, 26, 355, 1031, 275, 1094, 14, 3039, 355, 1830, 1031, 14, 1019, 436, 1031, 14, 1019, 1137, 1094, 26, 490, 1031, 275, 1031, 14, 1019, 1467, 355, 340, 1031, 14, 1019, 365, 488, 26, 490, 1031, 14, 1019, 275, 1094, 490, 1094, 275, 1094, 14, 3039, 355, 587, 26, 490, 340, 5071, 436, 5071, 14, 637, 2356, 1094, 14, 637, 26, 717, 372, 756, 490, 1031, 14, 1019, 275, 488, 490, 5071, 275, 1094, 490, 1094, 275, 1094, 14, 1019, 21695, 372, 715, 421, 199, 3, 4703, 26, 221, 593, 8, 78, 9, 199, 3, 19326, 26, 593, 8, 72, 9, 199, 533, 9274, 18, 26, 272, 327, 768, 635, 1738, 12, 282, 3123, 1031, 272, 327, 768, 1107, 282, 5046, 272, 347, 365, 3490, 34, 840, 8, 277, 12, 1738, 304, 267, 372, 291, 14, 18728, 34, 840, 497, 15140, 8, 1231, 12, 2069, 6096, 4904, 1288, 2069, 480, 4904, 2237, 2286, 347, 365, 3490, 34, 840, 497, 15140, 8, 277, 12, 1738, 12, 6465, 12, 4721, 304, 267, 340, 1738, 365, 488, 26, 288, 372, 715, 2728, 372, 6465, 665, 1738, 14, 637, 436, 1738, 14, 637, 665, 4721, 971, 288, 436, 291, 14, 18728, 34, 840, 497, 15140, 8, 1231, 14, 3039, 12, 6465, 12, 1738, 14, 637, 9, 971, 288, 436, 291, 14, 18728, 34, 840, 497, 15140, 8, 1231, 14, 1019, 12, 1738, 14, 637, 12, 4721, 9, 13359, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 272, 1738, 275, 12178, 1716, 8, 18, 9, 272, 1738, 14, 3039, 275, 12178, 1716, 8, 17, 9, 272, 1738, 14, 1019, 275, 12178, 1716, 8, 19, 9, 272, 870, 9274, 1252, 18728, 34, 840, 8, 1231, 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 ]
[ 4703, 26, 221, 593, 8, 78, 9, 199, 3, 19326, 26, 593, 8, 17, 9, 199, 3, 221, 199, 3, 9138, 282, 3366, 3123, 12, 6705, 340, 652, 365, 282, 1686, 3366, 2754, 3123, 334, 34, 840, 680, 199, 3, 221, 199, 3, 16269, 282, 699, 840, 365, 3247, 465, 11924, 26, 199, 3, 221, 199, 3, 710, 3602, 26897, 402, 282, 1031, 3509, 1454, 3380, 543, 2883, 6656, 2419, 314, 1031, 1159, 790, 14, 199, 3, 710, 2451, 26897, 402, 282, 1031, 3509, 1454, 3380, 543, 2883, 8932, 2419, 314, 1031, 1159, 790, 14, 199, 3, 17650, 314, 3602, 436, 2451, 1007, 14635, 1471, 2597, 506, 3366, 2754, 14416, 14, 199, 3, 199, 199, 3, 29398, 367, 282, 221, 3366, 3123, 1031, 199, 533, 12178, 1716, 26, 272, 347, 636, 826, 721, 277, 12, 671, 304, 267, 291, 14, 637, 275, 671, 267, 291, 14, 3039, 275, 488, 267, 291, 14, 1019, 275, 488, 199, 199, 3, 603, 269, 5719, 12643, 16222, 9274, 199, 533, 9274, 26, 272, 327, 768, 635, 1738, 12, 282, 3123, 1031, 272, 327, 768, 1107, 282, 769, 402, 9446, 272, 347, 365, 3490, 34, 840, 8, 277, 12, 1738, 304, 267, 5071, 12, 1094, 275, 488, 12, 1738, 267, 1830, 1094, 26, 288, 340, 1094, 14, 3039, 365, 488, 26, 355, 340, 5071, 436, 5071, 14, 637, 2356, 1094, 14, 637, 26, 490, 372, 756, 355, 5071, 275, 1094, 355, 1094, 275, 1094, 14, 1019, 288, 587, 26, 355, 1031, 275, 1094, 14, 3039, 355, 1830, 1031, 14, 1019, 436, 1031, 14, 1019, 1137, 1094, 26, 490, 1031, 275, 1031, 14, 1019, 1467, 355, 340, 1031, 14, 1019, 365, 488, 26, 490, 1031, 14, 1019, 275, 1094, 490, 1094, 275, 1094, 14, 3039, 355, 587, 26, 490, 340, 5071, 436, 5071, 14, 637, 2356, 1094, 14, 637, 26, 717, 372, 756, 490, 1031, 14, 1019, 275, 488, 490, 5071, 275, 1094, 490, 1094, 275, 1094, 14, 1019, 21695, 372, 715, 421, 199, 3, 4703, 26, 221, 593, 8, 78, 9, 199, 3, 19326, 26, 593, 8, 72, 9, 199, 533, 9274, 18, 26, 272, 327, 768, 635, 1738, 12, 282, 3123, 1031, 272, 327, 768, 1107, 282, 5046, 272, 347, 365, 3490, 34, 840, 8, 277, 12, 1738, 304, 267, 372, 291, 14, 18728, 34, 840, 497, 15140, 8, 1231, 12, 2069, 6096, 4904, 1288, 2069, 480, 4904, 2237, 2286, 347, 365, 3490, 34, 840, 497, 15140, 8, 277, 12, 1738, 12, 6465, 12, 4721, 304, 267, 340, 1738, 365, 488, 26, 288, 372, 715, 2728, 372, 6465, 665, 1738, 14, 637, 436, 1738, 14, 637, 665, 4721, 971, 288, 436, 291, 14, 18728, 34, 840, 497, 15140, 8, 1231, 14, 3039, 12, 6465, 12, 1738, 14, 637, 9, 971, 288, 436, 291, 14, 18728, 34, 840, 497, 15140, 8, 1231, 14, 1019, 12, 1738, 14, 637, 12, 4721, 9, 13359, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 272, 1738, 275, 12178, 1716, 8, 18, 9, 272, 1738, 14, 3039, 275, 12178, 1716, 8, 17, 9, 272, 1738, 14, 1019, 275, 12178, 1716, 8, 19, 9, 272, 870, 9274, 1252, 18728, 34, 840, 8, 1231, 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, 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,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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 ]
splunk/splunk-app-twitter
twitter2/bin/requests/packages/urllib3/packages/six.py
2375
11628
"""Utilities for writing code that runs on Python 2 and 3""" #Copyright (c) 2010-2011 Benjamin Peterson #Permission is hereby granted, free of charge, to any person obtaining a copy of #this software and associated documentation files (the "Software"), to deal in #the Software without restriction, including without limitation the rights to #use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of #the Software, and to permit persons to whom the Software is furnished to do so, #subject to the following conditions: #The above copyright notice and this permission notice shall be included in all #copies or substantial portions of the Software. #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS #FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR #COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER #IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN #CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import operator import sys import types __author__ = "Benjamin Peterson <benjamin@python.org>" __version__ = "1.2.0" # Revision 41c74fef2ded # True if we are running on Python 3. PY3 = sys.version_info[0] == 3 if PY3: string_types = str, integer_types = int, class_types = type, text_type = str binary_type = bytes MAXSIZE = sys.maxsize else: string_types = basestring, integer_types = (int, long) class_types = (type, types.ClassType) text_type = unicode binary_type = str if sys.platform.startswith("java"): # Jython always uses 32 bits. MAXSIZE = int((1 << 31) - 1) else: # It's possible to have sizeof(long) != sizeof(Py_ssize_t). class X(object): def __len__(self): return 1 << 31 try: len(X()) except OverflowError: # 32-bit MAXSIZE = int((1 << 31) - 1) else: # 64-bit MAXSIZE = int((1 << 63) - 1) del X def _add_doc(func, doc): """Add documentation to a function.""" func.__doc__ = doc def _import_module(name): """Import module, returning the module after the last dot.""" __import__(name) return sys.modules[name] class _LazyDescr(object): def __init__(self, name): self.name = name def __get__(self, obj, tp): result = self._resolve() setattr(obj, self.name, result) # This is a bit ugly, but it avoids running this again. delattr(tp, self.name) return result class MovedModule(_LazyDescr): def __init__(self, name, old, new=None): super(MovedModule, self).__init__(name) if PY3: if new is None: new = name self.mod = new else: self.mod = old def _resolve(self): return _import_module(self.mod) class MovedAttribute(_LazyDescr): def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None): super(MovedAttribute, self).__init__(name) if PY3: if new_mod is None: new_mod = name self.mod = new_mod if new_attr is None: if old_attr is None: new_attr = name else: new_attr = old_attr self.attr = new_attr else: self.mod = old_mod if old_attr is None: old_attr = name self.attr = old_attr def _resolve(self): module = _import_module(self.mod) return getattr(module, self.attr) class _MovedItems(types.ModuleType): """Lazy loading of moved objects""" _moved_attributes = [ MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"), MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"), MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"), MovedAttribute("map", "itertools", "builtins", "imap", "map"), MovedAttribute("reload_module", "__builtin__", "imp", "reload"), MovedAttribute("reduce", "__builtin__", "functools"), MovedAttribute("StringIO", "StringIO", "io"), MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"), MovedAttribute("zip", "itertools", "builtins", "izip", "zip"), MovedModule("builtins", "__builtin__"), MovedModule("configparser", "ConfigParser"), MovedModule("copyreg", "copy_reg"), MovedModule("http_cookiejar", "cookielib", "http.cookiejar"), MovedModule("http_cookies", "Cookie", "http.cookies"), MovedModule("html_entities", "htmlentitydefs", "html.entities"), MovedModule("html_parser", "HTMLParser", "html.parser"), MovedModule("http_client", "httplib", "http.client"), MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"), MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"), MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"), MovedModule("cPickle", "cPickle", "pickle"), MovedModule("queue", "Queue"), MovedModule("reprlib", "repr"), MovedModule("socketserver", "SocketServer"), MovedModule("tkinter", "Tkinter"), MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"), MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"), MovedModule("tkinter_scrolledtext", "ScrolledText", "tkinter.scrolledtext"), MovedModule("tkinter_simpledialog", "SimpleDialog", "tkinter.simpledialog"), MovedModule("tkinter_tix", "Tix", "tkinter.tix"), MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"), MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"), MovedModule("tkinter_colorchooser", "tkColorChooser", "tkinter.colorchooser"), MovedModule("tkinter_commondialog", "tkCommonDialog", "tkinter.commondialog"), MovedModule("tkinter_tkfiledialog", "tkFileDialog", "tkinter.filedialog"), MovedModule("tkinter_font", "tkFont", "tkinter.font"), MovedModule("tkinter_messagebox", "tkMessageBox", "tkinter.messagebox"), MovedModule("tkinter_tksimpledialog", "tkSimpleDialog", "tkinter.simpledialog"), MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"), MovedModule("winreg", "_winreg"), ] for attr in _moved_attributes: setattr(_MovedItems, attr.name, attr) del attr moves = sys.modules[__name__ + ".moves"] = _MovedItems("moves") def add_move(move): """Add an item to six.moves.""" setattr(_MovedItems, move.name, move) def remove_move(name): """Remove item from six.moves.""" try: delattr(_MovedItems, name) except AttributeError: try: del moves.__dict__[name] except KeyError: raise AttributeError("no such move, %r" % (name,)) if PY3: _meth_func = "__func__" _meth_self = "__self__" _func_code = "__code__" _func_defaults = "__defaults__" _iterkeys = "keys" _itervalues = "values" _iteritems = "items" else: _meth_func = "im_func" _meth_self = "im_self" _func_code = "func_code" _func_defaults = "func_defaults" _iterkeys = "iterkeys" _itervalues = "itervalues" _iteritems = "iteritems" try: advance_iterator = next except NameError: def advance_iterator(it): return it.next() next = advance_iterator if PY3: def get_unbound_function(unbound): return unbound Iterator = object def callable(obj): return any("__call__" in klass.__dict__ for klass in type(obj).__mro__) else: def get_unbound_function(unbound): return unbound.im_func class Iterator(object): def next(self): return type(self).__next__(self) callable = callable _add_doc(get_unbound_function, """Get the function out of a possibly unbound function""") get_method_function = operator.attrgetter(_meth_func) get_method_self = operator.attrgetter(_meth_self) get_function_code = operator.attrgetter(_func_code) get_function_defaults = operator.attrgetter(_func_defaults) def iterkeys(d): """Return an iterator over the keys of a dictionary.""" return iter(getattr(d, _iterkeys)()) def itervalues(d): """Return an iterator over the values of a dictionary.""" return iter(getattr(d, _itervalues)()) def iteritems(d): """Return an iterator over the (key, value) pairs of a dictionary.""" return iter(getattr(d, _iteritems)()) if PY3: def b(s): return s.encode("latin-1") def u(s): return s if sys.version_info[1] <= 1: def int2byte(i): return bytes((i,)) else: # This is about 2x faster than the implementation above on 3.2+ int2byte = operator.methodcaller("to_bytes", 1, "big") import io StringIO = io.StringIO BytesIO = io.BytesIO else: def b(s): return s def u(s): return unicode(s, "unicode_escape") int2byte = chr import StringIO StringIO = BytesIO = StringIO.StringIO _add_doc(b, """Byte literal""") _add_doc(u, """Text literal""") if PY3: import builtins exec_ = getattr(builtins, "exec") def reraise(tp, value, tb=None): if value.__traceback__ is not tb: raise value.with_traceback(tb) raise value print_ = getattr(builtins, "print") del builtins else: def exec_(code, globs=None, locs=None): """Execute code in a namespace.""" if globs is None: frame = sys._getframe(1) globs = frame.f_globals if locs is None: locs = frame.f_locals del frame elif locs is None: locs = globs exec("""exec code in globs, locs""") exec_("""def reraise(tp, value, tb=None): raise tp, value, tb """) def print_(*args, **kwargs): """The new-style print function.""" fp = kwargs.pop("file", sys.stdout) if fp is None: return def write(data): if not isinstance(data, basestring): data = str(data) fp.write(data) want_unicode = False sep = kwargs.pop("sep", None) if sep is not None: if isinstance(sep, unicode): want_unicode = True elif not isinstance(sep, str): raise TypeError("sep must be None or a string") end = kwargs.pop("end", None) if end is not None: if isinstance(end, unicode): want_unicode = True elif not isinstance(end, str): raise TypeError("end must be None or a string") if kwargs: raise TypeError("invalid keyword arguments to print()") if not want_unicode: for arg in args: if isinstance(arg, unicode): want_unicode = True break if want_unicode: newline = unicode("\n") space = unicode(" ") else: newline = "\n" space = " " if sep is None: sep = space if end is None: end = newline for i, arg in enumerate(args): if i: write(sep) write(arg) write(end) _add_doc(reraise, """Reraise an exception.""") def with_metaclass(meta, base=object): """Create a base class with a metaclass.""" return meta("NewBase", (base,), {})
apache-2.0
[ 624, 22905, 367, 3575, 1233, 626, 7858, 641, 2018, 499, 436, 650, 624, 199, 199, 3, 7384, 334, 67, 9, 7129, 13, 8128, 26844, 16997, 262, 22912, 834, 199, 199, 3, 7980, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 1331, 402, 199, 3, 3749, 2032, 436, 4568, 3794, 1584, 334, 1589, 298, 10337, 1288, 370, 7962, 315, 199, 3, 1589, 2290, 1928, 10588, 12, 5893, 1928, 12305, 314, 4481, 370, 199, 3, 1180, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 11207, 12, 13473, 12, 436, 15, 269, 12743, 6866, 402, 199, 3, 1589, 2290, 12, 436, 370, 11291, 12103, 370, 12676, 314, 2290, 365, 13985, 370, 886, 880, 12, 199, 3, 5875, 370, 314, 2569, 3704, 26, 199, 199, 3, 1918, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 315, 1006, 199, 3, 16847, 503, 13393, 12468, 402, 314, 2290, 14, 199, 199, 3, 18061, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 7168, 1549, 199, 3, 8947, 5177, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 3169, 12, 3092, 199, 3, 2707, 437, 3115, 3104, 2401, 13229, 14, 1621, 4825, 6461, 7000, 2334, 10610, 1549, 199, 3, 32324, 5716, 8164, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 5603, 12, 7061, 199, 3, 568, 1261, 9612, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 4442, 12, 5738, 1634, 1549, 1621, 199, 3, 18389, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 5010, 13198, 1621, 2334, 4141, 14, 199, 199, 646, 4182, 199, 646, 984, 199, 646, 2943, 199, 199, 363, 2502, 363, 275, 298, 31231, 16997, 262, 22912, 834, 665, 18486, 16997, 262, 32, 1548, 14, 1308, 4335, 199, 363, 1023, 363, 275, 298, 17, 14, 18, 14, 16, 2, 221, 327, 27095, 13385, 67, 1342, 32688, 18, 770, 421, 199, 3, 715, 340, 781, 787, 3879, 641, 2018, 650, 14, 199, 4521, 19, 275, 984, 14, 1023, 63, 815, 59, 16, 61, 508, 650, 199, 199, 692, 7843, 19, 26, 272, 1059, 63, 1313, 275, 620, 12, 272, 3000, 63, 1313, 275, 1109, 12, 272, 1021, 63, 1313, 275, 730, 12, 272, 1318, 63, 466, 275, 620, 272, 3366, 63, 466, 275, 2783, 339, 9141, 4305, 275, 984, 14, 13634, 199, 2836, 26, 272, 1059, 63, 1313, 275, 7116, 12, 272, 3000, 63, 1313, 275, 334, 442, 12, 1846, 9, 272, 1021, 63, 1313, 275, 334, 466, 12, 2943, 14, 31165, 9, 272, 1318, 63, 466, 275, 2649, 272, 3366, 63, 466, 275, 620, 339, 340, 984, 14, 3246, 14, 2460, 480, 6138, 2349, 267, 327, 25333, 3544, 4440, 4337, 5821, 14, 267, 9141, 4305, 275, 1109, 1332, 17, 5213, 7105, 9, 446, 413, 9, 272, 587, 26, 267, 327, 2779, 1159, 3962, 370, 1172, 13855, 8, 2809, 9, 1137, 13855, 8, 2713, 63, 30104, 63, 84, 680, 267, 1021, 1323, 8, 785, 304, 288, 347, 636, 552, 721, 277, 304, 355, 372, 413, 5213, 7105, 267, 862, 26, 288, 822, 8, 56, 1012, 267, 871, 23870, 26, 288, 327, 4337, 13, 2075, 288, 9141, 4305, 275, 1109, 1332, 17, 5213, 7105, 9, 446, 413, 9, 267, 587, 26, 288, 327, 5049, 13, 2075, 288, 9141, 4305, 275, 1109, 1332, 17, 5213, 13668, 9, 446, 413, 9, 288, 2150, 1323, 421, 199, 318, 485, 525, 63, 1301, 8, 1532, 12, 1382, 304, 272, 408, 1123, 3794, 370, 282, 805, 1041, 272, 2562, 855, 1301, 363, 275, 1382, 421, 199, 318, 485, 646, 63, 578, 8, 354, 304, 272, 408, 6295, 859, 12, 8152, 314, 859, 2410, 314, 2061, 6308, 1041, 272, 636, 646, 721, 354, 9, 272, 372, 984, 14, 3112, 59, 354, 61, 421, 199, 533, 485, 14269, 28782, 8, 785, 304, 339, 347, 636, 826, 721, 277, 12, 536, 304, 267, 291, 14, 354, 275, 536, 339, 347, 636, 362, 721, 277, 12, 1559, 12, 9253, 304, 267, 754, 275, 291, 423, 6983, 342, 267, 5371, 8, 1113, 12, 291, 14, 354, 12, 754, 9, 267, 327, 961, 365, 282, 4546, 23761, 12, 1325, 652, 23674, 3879, 642, 4020, 14, 267, 24358, 8, 683, 12, 291, 14, 354, 9, 267, 372, 754, 421, 199, 533, 11147, 1547, 14269, 28782, 304, 339, 347, 636, 826, 721, 277, 12, 536, 12, 2269, 12, 892, 29, 403, 304, 267, 1613, 8, 20774, 2377, 12, 291, 2843, 826, 721, 354, 9, 267, 340, 7843, 19, 26, 288, 340, 892, 365, 488, 26, 355, 892, 275, 536, 288, 291, 14, 1494, 275, 892, 267, 587, 26, 288, 291, 14, 1494, 275, 2269, 339, 347, 485, 6983, 8, 277, 304, 267, 372, 485, 646, 63, 578, 8, 277, 14, 1494, 9, 421, 199, 533, 8863, 1547, 14269, 28782, 304, 339, 347, 636, 826, 721, 277, 12, 536, 12, 2269, 63, 1494, 12, 892, 63, 1494, 12, 2269, 63, 962, 29, 403, 12, 892, 63, 962, 29, 403, 304, 267, 1613, 8, 20774, 1646, 12, 291, 2843, 826, 721, 354, 9, 267, 340, 7843, 19, 26, 288, 340, 892, 63, 1494, 365, 488, 26, 355, 892, 63, 1494, 275, 536, 288, 291, 14, 1494, 275, 892, 63, 1494, 288, 340, 892, 63, 962, 365, 488, 26, 355, 340, 2269, 63, 962, 365, 488, 26, 490, 892, 63, 962, 275, 536, 355, 587, 26, 490, 892, 63, 962, 275, 2269, 63, 962, 288, 291, 14, 962, 275, 892, 63, 962, 267, 587, 26, 288, 291, 14, 1494, 275, 2269, 63, 1494, 288, 340, 2269, 63, 962, 365, 488, 26, 355, 2269, 63, 962, 275, 536, 288, 291, 14, 962, 275, 2269, 63, 962, 339, 347, 485, 6983, 8, 277, 304, 267, 859, 275, 485, 646, 63, 578, 8, 277, 14, 1494, 9, 267, 372, 2519, 8, 578, 12, 291, 14, 962, 9, 4388, 199, 533, 485, 20774, 7412, 8, 1313, 14, 21820, 304, 272, 408, 14269, 8697, 402, 12155, 2251, 624, 421, 199, 63, 3539, 63, 2987, 275, 359, 272, 8863, 480, 67, 6424, 401, 298, 67, 6424, 401, 298, 2308, 401, 298, 6424, 1288, 272, 8863, 480, 1541, 401, 298, 17691, 401, 298, 10372, 401, 298, 73, 1541, 401, 298, 1541, 1288, 272, 8863, 480, 1210, 401, 4396, 5351, 13915, 298 ]
[ 22905, 367, 3575, 1233, 626, 7858, 641, 2018, 499, 436, 650, 624, 199, 199, 3, 7384, 334, 67, 9, 7129, 13, 8128, 26844, 16997, 262, 22912, 834, 199, 199, 3, 7980, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 1331, 402, 199, 3, 3749, 2032, 436, 4568, 3794, 1584, 334, 1589, 298, 10337, 1288, 370, 7962, 315, 199, 3, 1589, 2290, 1928, 10588, 12, 5893, 1928, 12305, 314, 4481, 370, 199, 3, 1180, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 11207, 12, 13473, 12, 436, 15, 269, 12743, 6866, 402, 199, 3, 1589, 2290, 12, 436, 370, 11291, 12103, 370, 12676, 314, 2290, 365, 13985, 370, 886, 880, 12, 199, 3, 5875, 370, 314, 2569, 3704, 26, 199, 199, 3, 1918, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 315, 1006, 199, 3, 16847, 503, 13393, 12468, 402, 314, 2290, 14, 199, 199, 3, 18061, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 7168, 1549, 199, 3, 8947, 5177, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 3169, 12, 3092, 199, 3, 2707, 437, 3115, 3104, 2401, 13229, 14, 1621, 4825, 6461, 7000, 2334, 10610, 1549, 199, 3, 32324, 5716, 8164, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 5603, 12, 7061, 199, 3, 568, 1261, 9612, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 4442, 12, 5738, 1634, 1549, 1621, 199, 3, 18389, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 5010, 13198, 1621, 2334, 4141, 14, 199, 199, 646, 4182, 199, 646, 984, 199, 646, 2943, 199, 199, 363, 2502, 363, 275, 298, 31231, 16997, 262, 22912, 834, 665, 18486, 16997, 262, 32, 1548, 14, 1308, 4335, 199, 363, 1023, 363, 275, 298, 17, 14, 18, 14, 16, 2, 221, 327, 27095, 13385, 67, 1342, 32688, 18, 770, 421, 199, 3, 715, 340, 781, 787, 3879, 641, 2018, 650, 14, 199, 4521, 19, 275, 984, 14, 1023, 63, 815, 59, 16, 61, 508, 650, 199, 199, 692, 7843, 19, 26, 272, 1059, 63, 1313, 275, 620, 12, 272, 3000, 63, 1313, 275, 1109, 12, 272, 1021, 63, 1313, 275, 730, 12, 272, 1318, 63, 466, 275, 620, 272, 3366, 63, 466, 275, 2783, 339, 9141, 4305, 275, 984, 14, 13634, 199, 2836, 26, 272, 1059, 63, 1313, 275, 7116, 12, 272, 3000, 63, 1313, 275, 334, 442, 12, 1846, 9, 272, 1021, 63, 1313, 275, 334, 466, 12, 2943, 14, 31165, 9, 272, 1318, 63, 466, 275, 2649, 272, 3366, 63, 466, 275, 620, 339, 340, 984, 14, 3246, 14, 2460, 480, 6138, 2349, 267, 327, 25333, 3544, 4440, 4337, 5821, 14, 267, 9141, 4305, 275, 1109, 1332, 17, 5213, 7105, 9, 446, 413, 9, 272, 587, 26, 267, 327, 2779, 1159, 3962, 370, 1172, 13855, 8, 2809, 9, 1137, 13855, 8, 2713, 63, 30104, 63, 84, 680, 267, 1021, 1323, 8, 785, 304, 288, 347, 636, 552, 721, 277, 304, 355, 372, 413, 5213, 7105, 267, 862, 26, 288, 822, 8, 56, 1012, 267, 871, 23870, 26, 288, 327, 4337, 13, 2075, 288, 9141, 4305, 275, 1109, 1332, 17, 5213, 7105, 9, 446, 413, 9, 267, 587, 26, 288, 327, 5049, 13, 2075, 288, 9141, 4305, 275, 1109, 1332, 17, 5213, 13668, 9, 446, 413, 9, 288, 2150, 1323, 421, 199, 318, 485, 525, 63, 1301, 8, 1532, 12, 1382, 304, 272, 408, 1123, 3794, 370, 282, 805, 1041, 272, 2562, 855, 1301, 363, 275, 1382, 421, 199, 318, 485, 646, 63, 578, 8, 354, 304, 272, 408, 6295, 859, 12, 8152, 314, 859, 2410, 314, 2061, 6308, 1041, 272, 636, 646, 721, 354, 9, 272, 372, 984, 14, 3112, 59, 354, 61, 421, 199, 533, 485, 14269, 28782, 8, 785, 304, 339, 347, 636, 826, 721, 277, 12, 536, 304, 267, 291, 14, 354, 275, 536, 339, 347, 636, 362, 721, 277, 12, 1559, 12, 9253, 304, 267, 754, 275, 291, 423, 6983, 342, 267, 5371, 8, 1113, 12, 291, 14, 354, 12, 754, 9, 267, 327, 961, 365, 282, 4546, 23761, 12, 1325, 652, 23674, 3879, 642, 4020, 14, 267, 24358, 8, 683, 12, 291, 14, 354, 9, 267, 372, 754, 421, 199, 533, 11147, 1547, 14269, 28782, 304, 339, 347, 636, 826, 721, 277, 12, 536, 12, 2269, 12, 892, 29, 403, 304, 267, 1613, 8, 20774, 2377, 12, 291, 2843, 826, 721, 354, 9, 267, 340, 7843, 19, 26, 288, 340, 892, 365, 488, 26, 355, 892, 275, 536, 288, 291, 14, 1494, 275, 892, 267, 587, 26, 288, 291, 14, 1494, 275, 2269, 339, 347, 485, 6983, 8, 277, 304, 267, 372, 485, 646, 63, 578, 8, 277, 14, 1494, 9, 421, 199, 533, 8863, 1547, 14269, 28782, 304, 339, 347, 636, 826, 721, 277, 12, 536, 12, 2269, 63, 1494, 12, 892, 63, 1494, 12, 2269, 63, 962, 29, 403, 12, 892, 63, 962, 29, 403, 304, 267, 1613, 8, 20774, 1646, 12, 291, 2843, 826, 721, 354, 9, 267, 340, 7843, 19, 26, 288, 340, 892, 63, 1494, 365, 488, 26, 355, 892, 63, 1494, 275, 536, 288, 291, 14, 1494, 275, 892, 63, 1494, 288, 340, 892, 63, 962, 365, 488, 26, 355, 340, 2269, 63, 962, 365, 488, 26, 490, 892, 63, 962, 275, 536, 355, 587, 26, 490, 892, 63, 962, 275, 2269, 63, 962, 288, 291, 14, 962, 275, 892, 63, 962, 267, 587, 26, 288, 291, 14, 1494, 275, 2269, 63, 1494, 288, 340, 2269, 63, 962, 365, 488, 26, 355, 2269, 63, 962, 275, 536, 288, 291, 14, 962, 275, 2269, 63, 962, 339, 347, 485, 6983, 8, 277, 304, 267, 859, 275, 485, 646, 63, 578, 8, 277, 14, 1494, 9, 267, 372, 2519, 8, 578, 12, 291, 14, 962, 9, 4388, 199, 533, 485, 20774, 7412, 8, 1313, 14, 21820, 304, 272, 408, 14269, 8697, 402, 12155, 2251, 624, 421, 199, 63, 3539, 63, 2987, 275, 359, 272, 8863, 480, 67, 6424, 401, 298, 67, 6424, 401, 298, 2308, 401, 298, 6424, 1288, 272, 8863, 480, 1541, 401, 298, 17691, 401, 298, 10372, 401, 298, 73, 1541, 401, 298, 1541, 1288, 272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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
karthik-sethuraman/Snowmass-ONFOpenTransport
RI/flask_server/tapi_server/models/tapi_common_service_interface_point_ref.py
4
2307
# coding: utf-8 from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from tapi_server.models.base_model_ import Model from tapi_server import util class TapiCommonServiceInterfacePointRef(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, service_interface_point_uuid=None): # noqa: E501 """TapiCommonServiceInterfacePointRef - a model defined in OpenAPI :param service_interface_point_uuid: The service_interface_point_uuid of this TapiCommonServiceInterfacePointRef. # noqa: E501 :type service_interface_point_uuid: str """ self.openapi_types = { 'service_interface_point_uuid': str } self.attribute_map = { 'service_interface_point_uuid': 'service-interface-point-uuid' } self._service_interface_point_uuid = service_interface_point_uuid @classmethod def from_dict(cls, dikt) -> 'TapiCommonServiceInterfacePointRef': """Returns the dict as a model :param dikt: A dict. :type: dict :return: The tapi.common.ServiceInterfacePointRef of this TapiCommonServiceInterfacePointRef. # noqa: E501 :rtype: TapiCommonServiceInterfacePointRef """ return util.deserialize_model(dikt, cls) @property def service_interface_point_uuid(self): """Gets the service_interface_point_uuid of this TapiCommonServiceInterfacePointRef. none # noqa: E501 :return: The service_interface_point_uuid of this TapiCommonServiceInterfacePointRef. :rtype: str """ return self._service_interface_point_uuid @service_interface_point_uuid.setter def service_interface_point_uuid(self, service_interface_point_uuid): """Sets the service_interface_point_uuid of this TapiCommonServiceInterfacePointRef. none # noqa: E501 :param service_interface_point_uuid: The service_interface_point_uuid of this TapiCommonServiceInterfacePointRef. :type service_interface_point_uuid: str """ self._service_interface_point_uuid = service_interface_point_uuid
apache-2.0
[ 3, 2803, 26, 2774, 13, 24, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 504, 2197, 492, 1434, 12, 2197, 221, 327, 8151, 26, 481, 8854, 199, 199, 504, 14090, 492, 3820, 12, 7448, 221, 327, 8151, 26, 481, 8854, 199, 199, 504, 307, 1246, 63, 1000, 14, 992, 14, 1095, 63, 1238, 63, 492, 5822, 199, 504, 307, 1246, 63, 1000, 492, 4884, 421, 199, 533, 377, 1246, 7844, 3167, 4267, 3428, 2891, 8, 1685, 304, 272, 408, 19855, 26, 961, 1021, 365, 2599, 4046, 701, 3232, 3735, 15042, 334, 2859, 921, 1490, 1246, 13, 4679, 14, 15970, 680, 339, 4226, 440, 5283, 314, 1021, 10250, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 2435, 63, 3266, 63, 1403, 63, 2580, 29, 403, 304, 221, 327, 8151, 26, 662, 8216, 267, 408, 52, 1246, 7844, 3167, 4267, 3428, 2891, 446, 282, 1402, 3247, 315, 3232, 3735, 398, 520, 635, 2435, 63, 3266, 63, 1403, 63, 2580, 26, 710, 2435, 63, 3266, 63, 1403, 63, 2580, 402, 642, 377, 1246, 7844, 3167, 4267, 3428, 2891, 14, 221, 327, 8151, 26, 662, 8216, 267, 520, 466, 2435, 63, 3266, 63, 1403, 63, 2580, 26, 620, 267, 408, 267, 291, 14, 1490, 1246, 63, 1313, 275, 469, 288, 283, 1364, 63, 3266, 63, 1403, 63, 2580, 356, 620, 267, 789, 398, 291, 14, 3215, 63, 1130, 275, 469, 288, 283, 1364, 63, 3266, 63, 1403, 63, 2580, 356, 283, 1364, 13, 3266, 13, 1403, 13, 2580, 7, 267, 789, 398, 291, 423, 1364, 63, 3266, 63, 1403, 63, 2580, 275, 2435, 63, 3266, 63, 1403, 63, 2580, 339, 768, 3744, 272, 347, 687, 63, 807, 8, 1886, 12, 487, 5973, 9, 1035, 283, 52, 1246, 7844, 3167, 4267, 3428, 2891, 356, 267, 408, 3407, 314, 1211, 465, 282, 1402, 398, 520, 635, 487, 5973, 26, 437, 1211, 14, 267, 520, 466, 26, 1211, 267, 520, 1107, 26, 710, 307, 1246, 14, 2330, 14, 3167, 4267, 3428, 2891, 402, 642, 377, 1246, 7844, 3167, 4267, 3428, 2891, 14, 221, 327, 8151, 26, 662, 8216, 267, 520, 4500, 26, 377, 1246, 7844, 3167, 4267, 3428, 2891, 267, 408, 267, 372, 4884, 14, 11143, 63, 1238, 8, 328, 5973, 12, 843, 9, 339, 768, 1829, 272, 347, 2435, 63, 3266, 63, 1403, 63, 2580, 8, 277, 304, 267, 408, 14426, 314, 2435, 63, 3266, 63, 1403, 63, 2580, 402, 642, 377, 1246, 7844, 3167, 4267, 3428, 2891, 14, 398, 7179, 221, 327, 8151, 26, 662, 8216, 398, 520, 1107, 26, 710, 2435, 63, 3266, 63, 1403, 63, 2580, 402, 642, 377, 1246, 7844, 3167, 4267, 3428, 2891, 14, 267, 520, 4500, 26, 620, 267, 408, 267, 372, 291, 423, 1364, 63, 3266, 63, 1403, 63, 2580, 339, 768, 1364, 63, 3266, 63, 1403, 63, 2580, 14, 8345, 272, 347, 2435, 63, 3266, 63, 1403, 63, 2580, 8, 277, 12, 2435, 63, 3266, 63, 1403, 63, 2580, 304, 267, 408, 9899, 314, 2435, 63, 3266, 63, 1403, 63, 2580, 402, 642, 377, 1246, 7844, 3167, 4267, 3428, 2891, 14, 398, 7179, 221, 327, 8151, 26, 662, 8216, 398, 520, 635, 2435, 63, 3266, 63, 1403, 63, 2580, 26, 710, 2435, 63, 3266, 63, 1403, 63, 2580, 402, 642, 377, 1246, 7844, 3167, 4267, 3428, 2891, 14, 267, 520, 466, 2435, 63, 3266, 63, 1403, 63, 2580, 26, 620, 267, 408, 398, 291, 423, 1364, 63, 3266, 63, 1403, 63, 2580, 275, 2435, 63, 3266, 63, 1403, 63, 2580, 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 ]
[ 2803, 26, 2774, 13, 24, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 504, 2197, 492, 1434, 12, 2197, 221, 327, 8151, 26, 481, 8854, 199, 199, 504, 14090, 492, 3820, 12, 7448, 221, 327, 8151, 26, 481, 8854, 199, 199, 504, 307, 1246, 63, 1000, 14, 992, 14, 1095, 63, 1238, 63, 492, 5822, 199, 504, 307, 1246, 63, 1000, 492, 4884, 421, 199, 533, 377, 1246, 7844, 3167, 4267, 3428, 2891, 8, 1685, 304, 272, 408, 19855, 26, 961, 1021, 365, 2599, 4046, 701, 3232, 3735, 15042, 334, 2859, 921, 1490, 1246, 13, 4679, 14, 15970, 680, 339, 4226, 440, 5283, 314, 1021, 10250, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 2435, 63, 3266, 63, 1403, 63, 2580, 29, 403, 304, 221, 327, 8151, 26, 662, 8216, 267, 408, 52, 1246, 7844, 3167, 4267, 3428, 2891, 446, 282, 1402, 3247, 315, 3232, 3735, 398, 520, 635, 2435, 63, 3266, 63, 1403, 63, 2580, 26, 710, 2435, 63, 3266, 63, 1403, 63, 2580, 402, 642, 377, 1246, 7844, 3167, 4267, 3428, 2891, 14, 221, 327, 8151, 26, 662, 8216, 267, 520, 466, 2435, 63, 3266, 63, 1403, 63, 2580, 26, 620, 267, 408, 267, 291, 14, 1490, 1246, 63, 1313, 275, 469, 288, 283, 1364, 63, 3266, 63, 1403, 63, 2580, 356, 620, 267, 789, 398, 291, 14, 3215, 63, 1130, 275, 469, 288, 283, 1364, 63, 3266, 63, 1403, 63, 2580, 356, 283, 1364, 13, 3266, 13, 1403, 13, 2580, 7, 267, 789, 398, 291, 423, 1364, 63, 3266, 63, 1403, 63, 2580, 275, 2435, 63, 3266, 63, 1403, 63, 2580, 339, 768, 3744, 272, 347, 687, 63, 807, 8, 1886, 12, 487, 5973, 9, 1035, 283, 52, 1246, 7844, 3167, 4267, 3428, 2891, 356, 267, 408, 3407, 314, 1211, 465, 282, 1402, 398, 520, 635, 487, 5973, 26, 437, 1211, 14, 267, 520, 466, 26, 1211, 267, 520, 1107, 26, 710, 307, 1246, 14, 2330, 14, 3167, 4267, 3428, 2891, 402, 642, 377, 1246, 7844, 3167, 4267, 3428, 2891, 14, 221, 327, 8151, 26, 662, 8216, 267, 520, 4500, 26, 377, 1246, 7844, 3167, 4267, 3428, 2891, 267, 408, 267, 372, 4884, 14, 11143, 63, 1238, 8, 328, 5973, 12, 843, 9, 339, 768, 1829, 272, 347, 2435, 63, 3266, 63, 1403, 63, 2580, 8, 277, 304, 267, 408, 14426, 314, 2435, 63, 3266, 63, 1403, 63, 2580, 402, 642, 377, 1246, 7844, 3167, 4267, 3428, 2891, 14, 398, 7179, 221, 327, 8151, 26, 662, 8216, 398, 520, 1107, 26, 710, 2435, 63, 3266, 63, 1403, 63, 2580, 402, 642, 377, 1246, 7844, 3167, 4267, 3428, 2891, 14, 267, 520, 4500, 26, 620, 267, 408, 267, 372, 291, 423, 1364, 63, 3266, 63, 1403, 63, 2580, 339, 768, 1364, 63, 3266, 63, 1403, 63, 2580, 14, 8345, 272, 347, 2435, 63, 3266, 63, 1403, 63, 2580, 8, 277, 12, 2435, 63, 3266, 63, 1403, 63, 2580, 304, 267, 408, 9899, 314, 2435, 63, 3266, 63, 1403, 63, 2580, 402, 642, 377, 1246, 7844, 3167, 4267, 3428, 2891, 14, 398, 7179, 221, 327, 8151, 26, 662, 8216, 398, 520, 635, 2435, 63, 3266, 63, 1403, 63, 2580, 26, 710, 2435, 63, 3266, 63, 1403, 63, 2580, 402, 642, 377, 1246, 7844, 3167, 4267, 3428, 2891, 14, 267, 520, 466, 2435, 63, 3266, 63, 1403, 63, 2580, 26, 620, 267, 408, 398, 291, 423, 1364, 63, 3266, 63, 1403, 63, 2580, 275, 2435, 63, 3266, 63, 1403, 63, 2580, 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, 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,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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 ]
dfalt974/SickRage
lib/unidecode/util.py
51
1790
# vim:ts=4 sw=4 expandtab softtabstop=4 from __future__ import print_function import optparse import locale import os import sys import warnings from unidecode import unidecode PY3 = sys.version_info[0] >= 3 def fatal(msg): sys.stderr.write(msg + "\n") sys.exit(1) def main(): default_encoding = locale.getpreferredencoding() parser = optparse.OptionParser('%prog [options] [FILE]', description="Transliterate Unicode text into ASCII. FILE is path to file to transliterate. " "Standard input is used if FILE is omitted and -c is not specified.") parser.add_option('-e', '--encoding', metavar='ENCODING', default=default_encoding, help='Specify an encoding (default is %s)' % (default_encoding,)) parser.add_option('-c', metavar='TEXT', dest='text', help='Transliterate TEXT instead of FILE') options, args = parser.parse_args() encoding = options.encoding if args: if options.text: fatal("Can't use both FILE and -c option") else: with open(args[0], 'rb') as f: stream = f.read() elif options.text: if PY3: stream = os.fsencode(options.text) else: stream = options.text # add a newline to the string if it comes from the # command line so that the result is printed nicely # on the console. stream += '\n'.encode('ascii') else: if PY3: stream = sys.stdin.buffer.read() else: stream = sys.stdin.read() try: stream = stream.decode(encoding) except UnicodeDecodeError as e: fatal('Unable to decode input: %s, start: %d, end: %d' % (e.reason, e.start, e.end)) sys.stdout.write(unidecode(stream))
gpl-3.0
[ 3, 6695, 26, 1086, 29, 20, 5584, 29, 20, 26414, 25966, 29, 20, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 646, 8691, 199, 646, 5867, 199, 646, 747, 199, 646, 984, 199, 646, 3598, 199, 199, 504, 625, 2655, 600, 492, 625, 2655, 600, 199, 199, 4521, 19, 275, 984, 14, 1023, 63, 815, 59, 16, 61, 2356, 650, 199, 199, 318, 14294, 8, 1328, 304, 272, 984, 14, 3083, 14, 952, 8, 1328, 435, 1867, 78, 531, 272, 984, 14, 2224, 8, 17, 9, 199, 199, 318, 2446, 837, 272, 849, 63, 2991, 275, 5867, 14, 362, 24283, 264, 848, 1523, 342, 339, 1798, 275, 8691, 14, 14553, 3508, 6595, 359, 1419, 61, 359, 3817, 4300, 288, 1369, 628, 3188, 4544, 323, 6140, 1318, 1901, 10485, 14, 13024, 365, 931, 370, 570, 370, 1752, 4544, 323, 14, 298, 288, 298, 9232, 1324, 365, 1202, 340, 13024, 365, 11684, 436, 446, 67, 365, 440, 2013, 2685, 272, 1798, 14, 525, 63, 1422, 3654, 69, 297, 2850, 2991, 297, 8214, 534, 16314, 297, 849, 29, 885, 63, 2991, 12, 288, 1720, 534, 17768, 376, 2644, 334, 885, 365, 450, 83, 3171, 450, 334, 885, 63, 2991, 4641, 272, 1798, 14, 525, 63, 1422, 3654, 67, 297, 8214, 534, 3876, 297, 2053, 534, 505, 297, 288, 1720, 534, 3188, 4544, 323, 11951, 3140, 402, 13024, 358, 339, 1511, 12, 1249, 275, 1798, 14, 1122, 63, 589, 342, 339, 2644, 275, 1511, 14, 2991, 339, 340, 1249, 26, 267, 340, 1511, 14, 505, 26, 288, 14294, 480, 6049, 1133, 675, 3865, 13024, 436, 446, 67, 945, 531, 267, 587, 26, 288, 543, 1551, 8, 589, 59, 16, 467, 283, 4848, 358, 465, 289, 26, 355, 2547, 275, 289, 14, 739, 342, 272, 916, 1511, 14, 505, 26, 267, 340, 7843, 19, 26, 288, 2547, 275, 747, 14, 70, 2464, 600, 8, 1419, 14, 505, 9, 267, 587, 26, 288, 2547, 275, 1511, 14, 505, 267, 327, 1050, 282, 8057, 370, 314, 1059, 340, 652, 12477, 687, 314, 267, 327, 1414, 1004, 880, 626, 314, 754, 365, 12487, 14213, 590, 267, 327, 641, 314, 8559, 14, 267, 2547, 847, 1557, 78, 1370, 2143, 360, 4371, 358, 272, 587, 26, 267, 340, 7843, 19, 26, 288, 2547, 275, 984, 14, 6626, 14, 2738, 14, 739, 342, 267, 587, 26, 288, 2547, 275, 984, 14, 6626, 14, 739, 342, 339, 862, 26, 267, 2547, 275, 2547, 14, 2708, 8, 2991, 9, 272, 871, 18965, 465, 325, 26, 267, 14294, 360, 6005, 370, 4849, 1324, 26, 450, 83, 12, 1343, 26, 450, 68, 12, 1284, 26, 450, 68, 7, 450, 334, 69, 14, 5764, 12, 325, 14, 928, 12, 325, 14, 500, 430, 339, 984, 14, 2703, 14, 952, 8, 324, 2655, 600, 8, 1745, 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 ]
[ 6695, 26, 1086, 29, 20, 5584, 29, 20, 26414, 25966, 29, 20, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 646, 8691, 199, 646, 5867, 199, 646, 747, 199, 646, 984, 199, 646, 3598, 199, 199, 504, 625, 2655, 600, 492, 625, 2655, 600, 199, 199, 4521, 19, 275, 984, 14, 1023, 63, 815, 59, 16, 61, 2356, 650, 199, 199, 318, 14294, 8, 1328, 304, 272, 984, 14, 3083, 14, 952, 8, 1328, 435, 1867, 78, 531, 272, 984, 14, 2224, 8, 17, 9, 199, 199, 318, 2446, 837, 272, 849, 63, 2991, 275, 5867, 14, 362, 24283, 264, 848, 1523, 342, 339, 1798, 275, 8691, 14, 14553, 3508, 6595, 359, 1419, 61, 359, 3817, 4300, 288, 1369, 628, 3188, 4544, 323, 6140, 1318, 1901, 10485, 14, 13024, 365, 931, 370, 570, 370, 1752, 4544, 323, 14, 298, 288, 298, 9232, 1324, 365, 1202, 340, 13024, 365, 11684, 436, 446, 67, 365, 440, 2013, 2685, 272, 1798, 14, 525, 63, 1422, 3654, 69, 297, 2850, 2991, 297, 8214, 534, 16314, 297, 849, 29, 885, 63, 2991, 12, 288, 1720, 534, 17768, 376, 2644, 334, 885, 365, 450, 83, 3171, 450, 334, 885, 63, 2991, 4641, 272, 1798, 14, 525, 63, 1422, 3654, 67, 297, 8214, 534, 3876, 297, 2053, 534, 505, 297, 288, 1720, 534, 3188, 4544, 323, 11951, 3140, 402, 13024, 358, 339, 1511, 12, 1249, 275, 1798, 14, 1122, 63, 589, 342, 339, 2644, 275, 1511, 14, 2991, 339, 340, 1249, 26, 267, 340, 1511, 14, 505, 26, 288, 14294, 480, 6049, 1133, 675, 3865, 13024, 436, 446, 67, 945, 531, 267, 587, 26, 288, 543, 1551, 8, 589, 59, 16, 467, 283, 4848, 358, 465, 289, 26, 355, 2547, 275, 289, 14, 739, 342, 272, 916, 1511, 14, 505, 26, 267, 340, 7843, 19, 26, 288, 2547, 275, 747, 14, 70, 2464, 600, 8, 1419, 14, 505, 9, 267, 587, 26, 288, 2547, 275, 1511, 14, 505, 267, 327, 1050, 282, 8057, 370, 314, 1059, 340, 652, 12477, 687, 314, 267, 327, 1414, 1004, 880, 626, 314, 754, 365, 12487, 14213, 590, 267, 327, 641, 314, 8559, 14, 267, 2547, 847, 1557, 78, 1370, 2143, 360, 4371, 358, 272, 587, 26, 267, 340, 7843, 19, 26, 288, 2547, 275, 984, 14, 6626, 14, 2738, 14, 739, 342, 267, 587, 26, 288, 2547, 275, 984, 14, 6626, 14, 739, 342, 339, 862, 26, 267, 2547, 275, 2547, 14, 2708, 8, 2991, 9, 272, 871, 18965, 465, 325, 26, 267, 14294, 360, 6005, 370, 4849, 1324, 26, 450, 83, 12, 1343, 26, 450, 68, 12, 1284, 26, 450, 68, 7, 450, 334, 69, 14, 5764, 12, 325, 14, 928, 12, 325, 14, 500, 430, 339, 984, 14, 2703, 14, 952, 8, 324, 2655, 600, 8, 1745, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
MuffinMedic/CloudBot
plugins/metars.py
4
1295
import requests from cloudbot import hook api_url_metar = "http://api.av-wx.com/metar/" api_url_taf = "http://api.av-wx.com/taf/" @hook.command() def metar(text): """[ICAO station code] - returns the metars information for the specified station. A list of station codes can be found here: http://weather.rap.ucar.edu/surface/stations.txt""" station = text.split(' ')[0].upper() if not len(station) is 4: return "please specify a valid station code see http://weather.rap.ucar.edu/surface/stations.txt for a list." request = requests.get(api_url_metar + station) request.raise_for_status() r = request.json()['reports'][0] out = r['name'] + ": " + r['raw_text'] return out @hook.command() def taf(text): """[ICAO station code] - returns the taf information for the specified station. A list of station codes can be found here: http://weather.rap.ucar.edu/surface/stations.txt""" station = text.split(' ')[0].upper() if not len(station) is 4: return "please specify a valid station code see http://weather.rap.ucar.edu/surface/stations.txt for a list." request = requests.get(api_url_taf + station) request.raise_for_status() r = request.json()['reports'][0] out = r['name'] + ": " + r['raw_text'] return out
gpl-3.0
[ 646, 4145, 199, 199, 504, 2463, 8301, 357, 492, 5759, 199, 199, 1246, 63, 633, 63, 278, 5369, 275, 298, 1014, 921, 1246, 14, 1214, 13, 6323, 14, 957, 15, 278, 5369, 6687, 199, 1246, 63, 633, 63, 502, 70, 275, 298, 1014, 921, 1246, 14, 1214, 13, 6323, 14, 957, 15, 502, 70, 6687, 421, 199, 32, 3664, 14, 1531, 342, 199, 318, 562, 5369, 8, 505, 304, 272, 408, 59, 948, 23320, 16518, 1233, 61, 446, 2529, 314, 7647, 4291, 2556, 367, 314, 2013, 16518, 14, 437, 769, 402, 16518, 9479, 883, 506, 1911, 2348, 26, 1455, 921, 23026, 14, 1330, 14, 947, 285, 14, 8654, 15, 10992, 15, 270, 1298, 14, 2424, 624, 272, 16518, 275, 1318, 14, 1294, 360, 27618, 16, 1055, 4142, 342, 272, 340, 440, 822, 8, 10600, 9, 365, 841, 26, 267, 372, 298, 27567, 4165, 282, 1686, 16518, 1233, 1937, 1455, 921, 23026, 14, 1330, 14, 947, 285, 14, 8654, 15, 10992, 15, 270, 1298, 14, 2424, 367, 282, 769, 2122, 339, 1056, 275, 4145, 14, 362, 8, 1246, 63, 633, 63, 278, 5369, 435, 16518, 9, 272, 1056, 14, 3730, 63, 509, 63, 1205, 342, 272, 519, 275, 1056, 14, 1001, 12047, 15629, 3488, 16, 61, 272, 734, 275, 519, 459, 354, 418, 435, 7244, 298, 435, 519, 459, 1773, 63, 505, 418, 272, 372, 734, 421, 199, 32, 3664, 14, 1531, 342, 199, 318, 307, 2756, 8, 505, 304, 272, 408, 59, 948, 23320, 16518, 1233, 61, 446, 2529, 314, 307, 2756, 2556, 367, 314, 2013, 16518, 14, 437, 769, 402, 16518, 9479, 883, 506, 1911, 2348, 26, 1455, 921, 23026, 14, 1330, 14, 947, 285, 14, 8654, 15, 10992, 15, 270, 1298, 14, 2424, 624, 272, 16518, 275, 1318, 14, 1294, 360, 27618, 16, 1055, 4142, 342, 272, 340, 440, 822, 8, 10600, 9, 365, 841, 26, 267, 372, 298, 27567, 4165, 282, 1686, 16518, 1233, 1937, 1455, 921, 23026, 14, 1330, 14, 947, 285, 14, 8654, 15, 10992, 15, 270, 1298, 14, 2424, 367, 282, 769, 2122, 339, 1056, 275, 4145, 14, 362, 8, 1246, 63, 633, 63, 502, 70, 435, 16518, 9, 272, 1056, 14, 3730, 63, 509, 63, 1205, 342, 272, 519, 275, 1056, 14, 1001, 12047, 15629, 3488, 16, 61, 272, 734, 275, 519, 459, 354, 418, 435, 7244, 298, 435, 519, 459, 1773, 63, 505, 418, 272, 372, 734, 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 ]
[ 4145, 199, 199, 504, 2463, 8301, 357, 492, 5759, 199, 199, 1246, 63, 633, 63, 278, 5369, 275, 298, 1014, 921, 1246, 14, 1214, 13, 6323, 14, 957, 15, 278, 5369, 6687, 199, 1246, 63, 633, 63, 502, 70, 275, 298, 1014, 921, 1246, 14, 1214, 13, 6323, 14, 957, 15, 502, 70, 6687, 421, 199, 32, 3664, 14, 1531, 342, 199, 318, 562, 5369, 8, 505, 304, 272, 408, 59, 948, 23320, 16518, 1233, 61, 446, 2529, 314, 7647, 4291, 2556, 367, 314, 2013, 16518, 14, 437, 769, 402, 16518, 9479, 883, 506, 1911, 2348, 26, 1455, 921, 23026, 14, 1330, 14, 947, 285, 14, 8654, 15, 10992, 15, 270, 1298, 14, 2424, 624, 272, 16518, 275, 1318, 14, 1294, 360, 27618, 16, 1055, 4142, 342, 272, 340, 440, 822, 8, 10600, 9, 365, 841, 26, 267, 372, 298, 27567, 4165, 282, 1686, 16518, 1233, 1937, 1455, 921, 23026, 14, 1330, 14, 947, 285, 14, 8654, 15, 10992, 15, 270, 1298, 14, 2424, 367, 282, 769, 2122, 339, 1056, 275, 4145, 14, 362, 8, 1246, 63, 633, 63, 278, 5369, 435, 16518, 9, 272, 1056, 14, 3730, 63, 509, 63, 1205, 342, 272, 519, 275, 1056, 14, 1001, 12047, 15629, 3488, 16, 61, 272, 734, 275, 519, 459, 354, 418, 435, 7244, 298, 435, 519, 459, 1773, 63, 505, 418, 272, 372, 734, 421, 199, 32, 3664, 14, 1531, 342, 199, 318, 307, 2756, 8, 505, 304, 272, 408, 59, 948, 23320, 16518, 1233, 61, 446, 2529, 314, 307, 2756, 2556, 367, 314, 2013, 16518, 14, 437, 769, 402, 16518, 9479, 883, 506, 1911, 2348, 26, 1455, 921, 23026, 14, 1330, 14, 947, 285, 14, 8654, 15, 10992, 15, 270, 1298, 14, 2424, 624, 272, 16518, 275, 1318, 14, 1294, 360, 27618, 16, 1055, 4142, 342, 272, 340, 440, 822, 8, 10600, 9, 365, 841, 26, 267, 372, 298, 27567, 4165, 282, 1686, 16518, 1233, 1937, 1455, 921, 23026, 14, 1330, 14, 947, 285, 14, 8654, 15, 10992, 15, 270, 1298, 14, 2424, 367, 282, 769, 2122, 339, 1056, 275, 4145, 14, 362, 8, 1246, 63, 633, 63, 502, 70, 435, 16518, 9, 272, 1056, 14, 3730, 63, 509, 63, 1205, 342, 272, 519, 275, 1056, 14, 1001, 12047, 15629, 3488, 16, 61, 272, 734, 275, 519, 459, 354, 418, 435, 7244, 298, 435, 519, 459, 1773, 63, 505, 418, 272, 372, 734, 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, 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 ]
bashu/django-easy-seo
seo/south_migrations/0004_auto__del_url__del_unique_url_url_site.py
1
2904
# -*- coding: 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): # Removing unique constraint on 'Url', fields ['url', 'site'] db.delete_unique('seo_url', ['url', 'site_id']) # Deleting model 'Url' db.delete_table('seo_url') def backwards(self, orm): # Adding model 'Url' db.create_table('seo_url', ( ('url', self.gf('django.db.models.fields.CharField')(default='/', max_length=200)), ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('site', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['sites.Site'], null=True, blank=True)), )) db.send_create_signal('seo', ['Url']) # Adding unique constraint on 'Url', fields ['url', 'site'] db.create_unique('seo_url', ['url', 'site_id']) models = { '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'}) }, 'seo.seo': { 'Meta': {'unique_together': "(('content_type', 'object_id'),)", 'object_name': 'Seo'}, 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), 'description': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'keywords': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1000', 'blank': 'True'}), 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), 'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']", 'null': 'True', 'blank': 'True'}), 'title': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}) }, 'sites.site': { 'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"}, 'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) } } complete_apps = ['seo']
gpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 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, 421, 199, 533, 12090, 8, 24822, 304, 339, 347, 17465, 8, 277, 12, 9813, 304, 267, 327, 29343, 3747, 5828, 641, 283, 6417, 297, 1504, 788, 633, 297, 283, 2124, 418, 267, 1592, 14, 1807, 63, 3235, 360, 261, 79, 63, 633, 297, 788, 633, 297, 283, 2124, 63, 344, 1105, 398, 327, 15920, 1402, 283, 6417, 7, 267, 1592, 14, 1807, 63, 1224, 360, 261, 79, 63, 633, 358, 2378, 347, 8552, 8, 277, 12, 9813, 304, 267, 327, 12934, 1402, 283, 6417, 7, 267, 1592, 14, 981, 63, 1224, 360, 261, 79, 63, 633, 297, 334, 288, 661, 633, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 885, 25412, 1390, 63, 1267, 29, 1840, 1826, 288, 661, 344, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 4378, 7533, 3327, 63, 498, 29, 549, 1826, 288, 661, 2124, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 7533, 475, 29, 1025, 459, 8619, 14, 8972, 995, 2973, 29, 549, 12, 4596, 29, 549, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 261, 79, 297, 788, 6417, 1105, 398, 327, 12934, 3747, 5828, 641, 283, 6417, 297, 1504, 788, 633, 297, 283, 2124, 418, 267, 1592, 14, 981, 63, 3235, 360, 261, 79, 63, 633, 297, 788, 633, 297, 283, 2124, 63, 344, 1105, 2378, 1709, 275, 469, 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, 261, 79, 14, 261, 79, 356, 469, 288, 283, 3396, 356, 791, 3235, 63, 6314, 356, 9510, 1317, 63, 466, 297, 283, 785, 63, 344, 9878, 283, 785, 63, 354, 356, 283, 1513, 79, 2267, 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, 1802, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 885, 356, 19605, 283, 988, 63, 1267, 356, 283, 1840, 297, 283, 2500, 356, 283, 549, 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, 7511, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 885, 356, 19605, 283, 988, 63, 1267, 356, 283, 5279, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 785, 63, 344, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 8591, 297, 990, 8613, 288, 283, 2124, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 297, 990, 791, 475, 356, 298, 1025, 459, 8619, 14, 8972, 6256, 283, 2307, 356, 283, 549, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 1213, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 885, 356, 19605, 283, 988, 63, 1267, 356, 283, 1840, 297, 283, 2500, 356, 283, 549, 3071, 267, 1660, 267, 283, 8619, 14, 2124, 356, 469, 288, 283, 3396, 356, 791, 7128, 356, 16111, 2261, 21099, 283, 785, 63, 354, 356, 283, 8972, 297, 283, 697, 63, 1224, 356, 3546, 1176, 63, 2124, 15208, 288, 283, 2261, 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, 354, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1400, 3071, 267, 789, 272, 789, 339, 4890, 63, 5181, 275, 788, 261, 79, 418, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 646, 2197, 199, 504, 12919, 14, 697, 492, 1592, 199, 504, 12919, 14, 86, 18, 492, 24765, 199, 504, 1639, 14, 697, 492, 1709, 421, 199, 533, 12090, 8, 24822, 304, 339, 347, 17465, 8, 277, 12, 9813, 304, 267, 327, 29343, 3747, 5828, 641, 283, 6417, 297, 1504, 788, 633, 297, 283, 2124, 418, 267, 1592, 14, 1807, 63, 3235, 360, 261, 79, 63, 633, 297, 788, 633, 297, 283, 2124, 63, 344, 1105, 398, 327, 15920, 1402, 283, 6417, 7, 267, 1592, 14, 1807, 63, 1224, 360, 261, 79, 63, 633, 358, 2378, 347, 8552, 8, 277, 12, 9813, 304, 267, 327, 12934, 1402, 283, 6417, 7, 267, 1592, 14, 981, 63, 1224, 360, 261, 79, 63, 633, 297, 334, 288, 661, 633, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 885, 25412, 1390, 63, 1267, 29, 1840, 1826, 288, 661, 344, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 4378, 7533, 3327, 63, 498, 29, 549, 1826, 288, 661, 2124, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 7533, 475, 29, 1025, 459, 8619, 14, 8972, 995, 2973, 29, 549, 12, 4596, 29, 549, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 261, 79, 297, 788, 6417, 1105, 398, 327, 12934, 3747, 5828, 641, 283, 6417, 297, 1504, 788, 633, 297, 283, 2124, 418, 267, 1592, 14, 981, 63, 3235, 360, 261, 79, 63, 633, 297, 788, 633, 297, 283, 2124, 63, 344, 1105, 2378, 1709, 275, 469, 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, 261, 79, 14, 261, 79, 356, 469, 288, 283, 3396, 356, 791, 3235, 63, 6314, 356, 9510, 1317, 63, 466, 297, 283, 785, 63, 344, 9878, 283, 785, 63, 354, 356, 283, 1513, 79, 2267, 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, 1802, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 885, 356, 19605, 283, 988, 63, 1267, 356, 283, 1840, 297, 283, 2500, 356, 283, 549, 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, 7511, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 885, 356, 19605, 283, 988, 63, 1267, 356, 283, 5279, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 785, 63, 344, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 8591, 297, 990, 8613, 288, 283, 2124, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 297, 990, 791, 475, 356, 298, 1025, 459, 8619, 14, 8972, 6256, 283, 2307, 356, 283, 549, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 1213, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 885, 356, 19605, 283, 988, 63, 1267, 356, 283, 1840, 297, 283, 2500, 356, 283, 549, 3071, 267, 1660, 267, 283, 8619, 14, 2124, 356, 469, 288, 283, 3396, 356, 791, 7128, 356, 16111, 2261, 21099, 283, 785, 63, 354, 356, 283, 8972, 297, 283, 697, 63, 1224, 356, 3546, 1176, 63, 2124, 15208, 288, 283, 2261, 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, 354, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1400, 3071, 267, 789, 272, 789, 339, 4890, 63, 5181, 275, 788, 261, 79, 418, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 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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 ]
HopeFOAM/HopeFOAM
ThirdParty-0.1/ParaView-5.0.1/VTK/IO/Geometry/Testing/Python/TestPolygonWriters.py
20
4259
#!/usr/bin/env python import vtk from vtk.test import Testing from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() # Create the RenderWindow, Renderer and both Actors # ren1 = vtk.vtkRenderer() renWin = vtk.vtkRenderWindow() renWin.AddRenderer(ren1) iren = vtk.vtkRenderWindowInteractor() iren.SetRenderWindow(renWin) # read data # input = vtk.vtkPolyDataReader() input.SetFileName("" + str(VTK_DATA_ROOT) + "/Data/brainImageSmooth.vtk") # # generate vectors clean = vtk.vtkCleanPolyData() clean.SetInputConnection(input.GetOutputPort()) smooth = vtk.vtkWindowedSincPolyDataFilter() smooth.SetInputConnection(clean.GetOutputPort()) smooth.GenerateErrorVectorsOn() smooth.GenerateErrorScalarsOn() smooth.Update() mapper = vtk.vtkPolyDataMapper() mapper.SetInputConnection(smooth.GetOutputPort()) mapper.SetScalarRange(smooth.GetOutput().GetScalarRange()) brain = vtk.vtkActor() brain.SetMapper(mapper) # Add the actors to the renderer, set the background and size # ren1.AddActor(brain) renWin.SetSize(320,240) ren1.GetActiveCamera().SetPosition(149.653,-65.3464,96.0401) ren1.GetActiveCamera().SetFocalPoint(146.003,22.3839,0.260541) ren1.GetActiveCamera().SetViewAngle(30) ren1.GetActiveCamera().SetViewUp(-0.255578,-0.717754,-0.647695) ren1.GetActiveCamera().SetClippingRange(79.2526,194.052) iren.Initialize() renWin.Render() # render the image # # prevent the tk window from showing up then start the event loop # # If the current directory is writable, then test the witers # if (catch.catch(globals(),"""channel = open("test.tmp", "w")""") == 0): channel.close() file.delete("-force", "test.tmp") # # # test the writers dsw = vtk.vtkDataSetWriter() dsw.SetInputConnection(smooth.GetOutputPort()) dsw.SetFileName("brain.dsw") dsw.Write() file.delete("-force", "brain.dsw") pdw = vtk.vtkPolyDataWriter() pdw.SetInputConnection(smooth.GetOutputPort()) pdw.SetFileName("brain.pdw") pdw.Write() file.delete("-force", "brain.pdw") if (info.command(globals(), locals(), "vtkIVWriter") != ""): iv = vtk.vtkIVWriter() iv.SetInputConnection(smooth.GetOutputPort()) iv.SetFileName("brain.iv") iv.Write() file.delete("-force", "brain.iv") pass # # the next writers only handle triangles triangles = vtk.vtkTriangleFilter() triangles.SetInputConnection(smooth.GetOutputPort()) if (info.command(globals(), locals(), "vtkIVWriter") != ""): iv2 = vtk.vtkIVWriter() iv2.SetInputConnection(triangles.GetOutputPort()) iv2.SetFileName("brain2.iv") iv2.Write() file.delete("-force", "brain2.iv") pass if (info.command(globals(), locals(), "vtkIVWriter") != ""): edges = vtk.vtkExtractEdges() edges.SetInputConnection(triangles.GetOutputPort()) iv3 = vtk.vtkIVWriter() iv3.SetInputConnection(edges.GetOutputPort()) iv3.SetFileName("brain3.iv") iv3.Write() file.delete("-force", "brain3.iv") pass byu = vtk.vtkBYUWriter() byu.SetGeometryFileName("brain.g") byu.SetScalarFileName("brain.s") byu.SetDisplacementFileName("brain.d") byu.SetInputConnection(triangles.GetOutputPort()) byu.Write() file.delete("-force", "brain.g") file.delete("-force", "brain.s") file.delete("-force", "brain.d") mcubes = vtk.vtkMCubesWriter() mcubes.SetInputConnection(triangles.GetOutputPort()) mcubes.SetFileName("brain.tri") mcubes.SetLimitsFileName("brain.lim") mcubes.Write() file.delete("-force", "brain.lim") file.delete("-force", "brain.tri") stl = vtk.vtkSTLWriter() stl.SetInputConnection(triangles.GetOutputPort()) stl.SetFileName("brain.stl") stl.Write() file.delete("-force", "brain.stl") stlBinary = vtk.vtkSTLWriter() stlBinary.SetInputConnection(triangles.GetOutputPort()) stlBinary.SetFileName("brainBinary.stl") stlBinary.SetFileType(2) stlBinary.Write() file.delete("-force", "brainBinary.stl") cgm = vtk.vtkCGMWriter() cgm.SetInputConnection(triangles.GetOutputPort()) cgm.SetFileName("brain.cgm") cgm.Write() file.delete("-force", "brain.cgm") pass # --- end of script --
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 646, 11144, 199, 504, 11144, 14, 396, 492, 11940, 199, 504, 11144, 14, 1974, 14, 9923, 492, 11144, 25702, 6405, 199, 8156, 43, 63, 3998, 63, 5441, 275, 11144, 25702, 6405, 342, 199, 199, 3, 2790, 314, 17769, 4301, 12, 10055, 5813, 436, 3865, 437, 13451, 199, 3, 199, 828, 17, 275, 11144, 14, 11919, 11355, 342, 199, 828, 8886, 275, 11144, 14, 11919, 9216, 4301, 342, 199, 828, 8886, 14, 1123, 11355, 8, 828, 17, 9, 199, 73, 828, 275, 11144, 14, 11919, 9216, 4301, 607, 2967, 630, 342, 199, 73, 828, 14, 1084, 9216, 4301, 8, 828, 8886, 9, 199, 3, 1586, 666, 199, 3, 199, 1210, 275, 11144, 14, 11919, 12747, 1451, 5929, 342, 199, 1210, 14, 1084, 7733, 11986, 435, 620, 8, 8156, 43, 63, 3998, 63, 5441, 9, 435, 3286, 1451, 15, 22246, 3491, 51, 11607, 14, 11919, 531, 199, 3, 199, 3, 3550, 11102, 199, 3118, 275, 11144, 14, 11919, 6580, 12747, 1451, 342, 199, 3118, 14, 32195, 8, 1210, 14, 30810, 1012, 199, 19169, 275, 11144, 14, 11919, 4301, 379, 51, 6559, 12747, 1451, 4131, 342, 199, 19169, 14, 32195, 8, 3118, 14, 30810, 1012, 199, 19169, 14, 6864, 547, 31465, 3314, 342, 199, 19169, 14, 6864, 547, 10249, 4291, 3314, 342, 199, 19169, 14, 4152, 342, 199, 7153, 275, 11144, 14, 11919, 12747, 1451, 11880, 342, 199, 7153, 14, 32195, 8, 19169, 14, 30810, 1012, 199, 7153, 14, 1084, 13090, 4709, 8, 19169, 14, 18614, 1252, 1002, 13090, 4709, 1012, 199, 22246, 275, 11144, 14, 11919, 12258, 342, 199, 22246, 14, 1084, 11880, 8, 7153, 9, 199, 3, 2654, 314, 282, 13451, 370, 314, 11889, 12, 663, 314, 8020, 436, 1568, 199, 3, 199, 828, 17, 14, 1123, 12258, 8, 22246, 9, 199, 828, 8886, 14, 1084, 2320, 8, 12122, 12, 9873, 9, 199, 828, 17, 14, 1002, 7472, 18425, 1252, 1084, 5625, 8, 10721, 14, 25401, 3057, 2182, 14, 1082, 772, 12, 2534, 14, 28025, 9, 199, 828, 17, 14, 1002, 7472, 18425, 1252, 1084, 38, 24560, 3428, 8, 11432, 14, 8262, 12, 1081, 14, 1703, 1355, 12, 16, 14, 13085, 21278, 9, 199, 828, 17, 14, 1002, 7472, 18425, 1252, 1084, 2768, 16943, 8, 1216, 9, 199, 828, 17, 14, 1002, 7472, 18425, 1252, 1084, 2768, 1721, 2801, 16, 14, 31394, 2277, 3057, 16, 14, 3172, 1138, 1477, 3057, 16, 14, 8557, 20017, 9, 199, 828, 17, 14, 1002, 7472, 18425, 1252, 1084, 20653, 3637, 4709, 8, 1965, 14, 821, 1479, 12, 10860, 14, 19730, 9, 199, 73, 828, 14, 9345, 342, 199, 828, 8886, 14, 9216, 342, 199, 3, 3795, 314, 1834, 199, 3, 199, 3, 7981, 314, 10157, 4353, 687, 21207, 1536, 2066, 1343, 314, 1566, 4438, 199, 3, 199, 3, 982, 314, 1453, 2082, 365, 17267, 12, 2066, 511, 314, 336, 15266, 199, 3, 199, 692, 334, 9341, 14, 9341, 8, 8473, 1062, 624, 2775, 275, 1551, 480, 396, 14, 2791, 401, 298, 87, 531, 6141, 508, 378, 304, 272, 3623, 14, 1600, 342, 272, 570, 14, 1807, 6096, 3990, 401, 298, 396, 14, 2791, 531, 272, 327, 272, 327, 272, 327, 511, 314, 2211, 878, 272, 366, 3519, 275, 11144, 14, 11919, 30720, 6261, 342, 272, 366, 3519, 14, 32195, 8, 19169, 14, 30810, 1012, 272, 366, 3519, 14, 1084, 7733, 480, 22246, 14, 795, 87, 531, 272, 366, 3519, 14, 3534, 342, 272, 570, 14, 1807, 6096, 3990, 401, 298, 22246, 14, 795, 87, 531, 272, 6454, 87, 275, 11144, 14, 11919, 12747, 1451, 6261, 342, 272, 6454, 87, 14, 32195, 8, 19169, 14, 30810, 1012, 272, 6454, 87, 14, 1084, 7733, 480, 22246, 14, 8961, 87, 531, 272, 6454, 87, 14, 3534, 342, 272, 570, 14, 1807, 6096, 3990, 401, 298, 22246, 14, 8961, 87, 531, 272, 340, 334, 815, 14, 1531, 8, 8473, 1062, 9480, 1062, 221, 298, 11919, 6882, 6261, 531, 1137, 26430, 267, 18831, 275, 11144, 14, 11919, 6882, 6261, 342, 267, 18831, 14, 32195, 8, 19169, 14, 30810, 1012, 267, 18831, 14, 1084, 7733, 480, 22246, 14, 1003, 531, 267, 18831, 14, 3534, 342, 267, 570, 14, 1807, 6096, 3990, 401, 298, 22246, 14, 1003, 531, 267, 986, 272, 327, 272, 327, 314, 2163, 2211, 878, 1454, 2429, 3229, 13162, 272, 3229, 13162, 275, 11144, 14, 11919, 30402, 4131, 342, 272, 3229, 13162, 14, 32195, 8, 19169, 14, 30810, 1012, 272, 340, 334, 815, 14, 1531, 8, 8473, 1062, 9480, 1062, 221, 298, 11919, 6882, 6261, 531, 1137, 26430, 267, 18831, 18, 275, 11144, 14, 11919, 6882, 6261, 342, 267, 18831, 18, 14, 32195, 8, 599, 13162, 14, 30810, 1012, 267, 18831, 18, 14, 1084, 7733, 480, 22246, 18, 14, 1003, 531, 267, 18831, 18, 14, 3534, 342, 267, 570, 14, 1807, 6096, 3990, 401, 298, 22246, 18, 14, 1003, 531, 267, 986, 272, 340, 334, 815, 14, 1531, 8, 8473, 1062, 9480, 1062, 221, 298, 11919, 6882, 6261, 531, 1137, 26430, 267, 8207, 275, 11144, 14, 11919, 12147, 24121, 342, 267, 8207, 14, 32195, 8, 599, 13162, 14, 30810, 1012, 267, 18831, 19, 275, 11144, 14, 11919, 6882, 6261, 342, 267, 18831, 19, 14, 32195, 8, 6929, 14, 30810, 1012, 267, 18831, 19, 14, 1084, 7733, 480, 22246, 19, 14, 1003, 531, 267, 18831, 19, 14, 3534, 342, 267, 570, 14, 1807, 6096, 3990, 401, 298, 22246, 19, 14, 1003, 531, 267, 986, 272, 701, 85, 275, 11144, 14, 11919, 8285, 53, 6261, 342, 272, 701, 85, 14, 1084, 6831, 7733, 480, 22246, 14, 71, 531, 272, 701, 85, 14, 1084, 13090, 7733, 480, 22246, 14, 83, 531, 272, 701, 85, 14, 1084, 32616, 7733, 480, 22246, 14, 68, 531, 272, 701, 85, 14, 32195, 8, 599, 13162, 14, 30810, 1012, 272, 701, 85, 14, 3534, 342, 272, 570, 14, 1807, 6096, 3990, 401, 298, 22246, 14, 71, 531, 272, 570, 14, 1807, 6096, 3990, 401, 298, 22246, 14, 83, 531, 272, 570, 14, 1807, 6096, 3990, 401, 298, 22246, 14, 68, 531, 272, 16377, 456, 397, 275, 11144, 14, 11919, 7608, 456, 397, 6261, 342, 272, 16377, 456, 397, 14, 32195, 8, 599, 13162, 14, 30810, 1012, 272, 16377, 456, 397, 14, 1084, 7733 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 646, 11144, 199, 504, 11144, 14, 396, 492, 11940, 199, 504, 11144, 14, 1974, 14, 9923, 492, 11144, 25702, 6405, 199, 8156, 43, 63, 3998, 63, 5441, 275, 11144, 25702, 6405, 342, 199, 199, 3, 2790, 314, 17769, 4301, 12, 10055, 5813, 436, 3865, 437, 13451, 199, 3, 199, 828, 17, 275, 11144, 14, 11919, 11355, 342, 199, 828, 8886, 275, 11144, 14, 11919, 9216, 4301, 342, 199, 828, 8886, 14, 1123, 11355, 8, 828, 17, 9, 199, 73, 828, 275, 11144, 14, 11919, 9216, 4301, 607, 2967, 630, 342, 199, 73, 828, 14, 1084, 9216, 4301, 8, 828, 8886, 9, 199, 3, 1586, 666, 199, 3, 199, 1210, 275, 11144, 14, 11919, 12747, 1451, 5929, 342, 199, 1210, 14, 1084, 7733, 11986, 435, 620, 8, 8156, 43, 63, 3998, 63, 5441, 9, 435, 3286, 1451, 15, 22246, 3491, 51, 11607, 14, 11919, 531, 199, 3, 199, 3, 3550, 11102, 199, 3118, 275, 11144, 14, 11919, 6580, 12747, 1451, 342, 199, 3118, 14, 32195, 8, 1210, 14, 30810, 1012, 199, 19169, 275, 11144, 14, 11919, 4301, 379, 51, 6559, 12747, 1451, 4131, 342, 199, 19169, 14, 32195, 8, 3118, 14, 30810, 1012, 199, 19169, 14, 6864, 547, 31465, 3314, 342, 199, 19169, 14, 6864, 547, 10249, 4291, 3314, 342, 199, 19169, 14, 4152, 342, 199, 7153, 275, 11144, 14, 11919, 12747, 1451, 11880, 342, 199, 7153, 14, 32195, 8, 19169, 14, 30810, 1012, 199, 7153, 14, 1084, 13090, 4709, 8, 19169, 14, 18614, 1252, 1002, 13090, 4709, 1012, 199, 22246, 275, 11144, 14, 11919, 12258, 342, 199, 22246, 14, 1084, 11880, 8, 7153, 9, 199, 3, 2654, 314, 282, 13451, 370, 314, 11889, 12, 663, 314, 8020, 436, 1568, 199, 3, 199, 828, 17, 14, 1123, 12258, 8, 22246, 9, 199, 828, 8886, 14, 1084, 2320, 8, 12122, 12, 9873, 9, 199, 828, 17, 14, 1002, 7472, 18425, 1252, 1084, 5625, 8, 10721, 14, 25401, 3057, 2182, 14, 1082, 772, 12, 2534, 14, 28025, 9, 199, 828, 17, 14, 1002, 7472, 18425, 1252, 1084, 38, 24560, 3428, 8, 11432, 14, 8262, 12, 1081, 14, 1703, 1355, 12, 16, 14, 13085, 21278, 9, 199, 828, 17, 14, 1002, 7472, 18425, 1252, 1084, 2768, 16943, 8, 1216, 9, 199, 828, 17, 14, 1002, 7472, 18425, 1252, 1084, 2768, 1721, 2801, 16, 14, 31394, 2277, 3057, 16, 14, 3172, 1138, 1477, 3057, 16, 14, 8557, 20017, 9, 199, 828, 17, 14, 1002, 7472, 18425, 1252, 1084, 20653, 3637, 4709, 8, 1965, 14, 821, 1479, 12, 10860, 14, 19730, 9, 199, 73, 828, 14, 9345, 342, 199, 828, 8886, 14, 9216, 342, 199, 3, 3795, 314, 1834, 199, 3, 199, 3, 7981, 314, 10157, 4353, 687, 21207, 1536, 2066, 1343, 314, 1566, 4438, 199, 3, 199, 3, 982, 314, 1453, 2082, 365, 17267, 12, 2066, 511, 314, 336, 15266, 199, 3, 199, 692, 334, 9341, 14, 9341, 8, 8473, 1062, 624, 2775, 275, 1551, 480, 396, 14, 2791, 401, 298, 87, 531, 6141, 508, 378, 304, 272, 3623, 14, 1600, 342, 272, 570, 14, 1807, 6096, 3990, 401, 298, 396, 14, 2791, 531, 272, 327, 272, 327, 272, 327, 511, 314, 2211, 878, 272, 366, 3519, 275, 11144, 14, 11919, 30720, 6261, 342, 272, 366, 3519, 14, 32195, 8, 19169, 14, 30810, 1012, 272, 366, 3519, 14, 1084, 7733, 480, 22246, 14, 795, 87, 531, 272, 366, 3519, 14, 3534, 342, 272, 570, 14, 1807, 6096, 3990, 401, 298, 22246, 14, 795, 87, 531, 272, 6454, 87, 275, 11144, 14, 11919, 12747, 1451, 6261, 342, 272, 6454, 87, 14, 32195, 8, 19169, 14, 30810, 1012, 272, 6454, 87, 14, 1084, 7733, 480, 22246, 14, 8961, 87, 531, 272, 6454, 87, 14, 3534, 342, 272, 570, 14, 1807, 6096, 3990, 401, 298, 22246, 14, 8961, 87, 531, 272, 340, 334, 815, 14, 1531, 8, 8473, 1062, 9480, 1062, 221, 298, 11919, 6882, 6261, 531, 1137, 26430, 267, 18831, 275, 11144, 14, 11919, 6882, 6261, 342, 267, 18831, 14, 32195, 8, 19169, 14, 30810, 1012, 267, 18831, 14, 1084, 7733, 480, 22246, 14, 1003, 531, 267, 18831, 14, 3534, 342, 267, 570, 14, 1807, 6096, 3990, 401, 298, 22246, 14, 1003, 531, 267, 986, 272, 327, 272, 327, 314, 2163, 2211, 878, 1454, 2429, 3229, 13162, 272, 3229, 13162, 275, 11144, 14, 11919, 30402, 4131, 342, 272, 3229, 13162, 14, 32195, 8, 19169, 14, 30810, 1012, 272, 340, 334, 815, 14, 1531, 8, 8473, 1062, 9480, 1062, 221, 298, 11919, 6882, 6261, 531, 1137, 26430, 267, 18831, 18, 275, 11144, 14, 11919, 6882, 6261, 342, 267, 18831, 18, 14, 32195, 8, 599, 13162, 14, 30810, 1012, 267, 18831, 18, 14, 1084, 7733, 480, 22246, 18, 14, 1003, 531, 267, 18831, 18, 14, 3534, 342, 267, 570, 14, 1807, 6096, 3990, 401, 298, 22246, 18, 14, 1003, 531, 267, 986, 272, 340, 334, 815, 14, 1531, 8, 8473, 1062, 9480, 1062, 221, 298, 11919, 6882, 6261, 531, 1137, 26430, 267, 8207, 275, 11144, 14, 11919, 12147, 24121, 342, 267, 8207, 14, 32195, 8, 599, 13162, 14, 30810, 1012, 267, 18831, 19, 275, 11144, 14, 11919, 6882, 6261, 342, 267, 18831, 19, 14, 32195, 8, 6929, 14, 30810, 1012, 267, 18831, 19, 14, 1084, 7733, 480, 22246, 19, 14, 1003, 531, 267, 18831, 19, 14, 3534, 342, 267, 570, 14, 1807, 6096, 3990, 401, 298, 22246, 19, 14, 1003, 531, 267, 986, 272, 701, 85, 275, 11144, 14, 11919, 8285, 53, 6261, 342, 272, 701, 85, 14, 1084, 6831, 7733, 480, 22246, 14, 71, 531, 272, 701, 85, 14, 1084, 13090, 7733, 480, 22246, 14, 83, 531, 272, 701, 85, 14, 1084, 32616, 7733, 480, 22246, 14, 68, 531, 272, 701, 85, 14, 32195, 8, 599, 13162, 14, 30810, 1012, 272, 701, 85, 14, 3534, 342, 272, 570, 14, 1807, 6096, 3990, 401, 298, 22246, 14, 71, 531, 272, 570, 14, 1807, 6096, 3990, 401, 298, 22246, 14, 83, 531, 272, 570, 14, 1807, 6096, 3990, 401, 298, 22246, 14, 68, 531, 272, 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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 ]
chudaol/edx-platform
common/djangoapps/cache_toolbox/middleware.py
211
4009
""" Cache-backed ``AuthenticationMiddleware`` ----------------------------------------- ``CacheBackedAuthenticationMiddleware`` is an ``django.contrib.auth.middleware.AuthenticationMiddleware`` replacement to avoid querying the database for a ``User`` instance in each request. Whilst the built-in ``AuthenticationMiddleware`` mechanism will only obtain the ``User`` instance when it is required, the vast majority of sites will do so on every page to render "Logged in as 'X'" text as well to evaluate the result of ``user.is_authenticated()`` and ``user.is_superuser`` to provide conditional functionality. This middleware eliminates the cost of retrieving this ``User`` instance by caching it using the ``cache_toolbox`` instance caching mechanisms. Depending on your average number of queries per page, saving one query per request can---in aggregate---reduce load on your database. In addition, avoiding the database entirely for pages can avoid incurring any connection latency in your environment, resulting in faster page loads for your users. Saving this data in the cache can also be used as a way of authenticating users in systems outside of Django that should not access your database. For example, a "maintenance mode" page would be able to render a personalised message without touching the database at all but rather authenticating via the cache. ``CacheBackedAuthenticationMiddleware`` is ``AUTHENTICATION_BACKENDS`` agnostic. Implementation ~~~~~~~~~~~~~~ The cache and session backends are still accessed on each request - we are simply assuming that they are cheaper (or otherwise more preferable) to access than your database. (In the future, signed cookies may allow us to avoid this lookup altogether -- whilst we could not safely save ``User.password`` in a cookie, we could use delayed loading to pull it out when needed.) Another alternative solution would be to store the attributes in the user's session instead of in the cache. This would save the cache hit on every request as all the relevant data would be pulled in one go from the session backend. However, this has two main disadvantages: * Session keys are not deterministic -- after making changes to an ``auth_user`` row in the database, you cannot determine the user's session key to flush the now out-of-sync data (and doing so would log them out anyway). * Stores data per-session rather than per-user -- if a user logs in from multiple computers the data is duplicated in each session. This problem is compounded by most projects wishing to avoid expiring session data as long as possible (in addition to storing sessions in persistent stores). Usage ~~~~~ To use, find ``MIDDLEWARE_CLASSES`` in your ``settings.py`` and replace:: MIDDLEWARE_CLASSES = [ ... 'django.contrib.auth.middleware.AuthenticationMiddleware', ... ] with:: MIDDLEWARE_CLASSES = [ ... 'cache_toolbox.middleware.CacheBackedAuthenticationMiddleware', ... ] You should confirm you are using a ``SESSION_ENGINE`` that doesn't query the database for each request. The built-in ``cached_db`` engine is the safest choice for most environments but you may be happy with the trade-offs of the ``memcached`` backend - see the Django documentation for more details. """ from django.contrib.auth import SESSION_KEY from django.contrib.auth.models import User from django.contrib.auth.middleware import AuthenticationMiddleware from .model import cache_model class CacheBackedAuthenticationMiddleware(AuthenticationMiddleware): def __init__(self): cache_model(User) def process_request(self, request): try: # Try and construct a User instance from data stored in the cache request.user = User.get_cached(request.session[SESSION_KEY]) except: # Fallback to constructing the User from the database. super(CacheBackedAuthenticationMiddleware, self).process_request(request)
agpl-3.0
[ 624, 199, 4437, 13, 894, 379, 1124, 10348, 6608, 1040, 199, 1444, 9960, 199, 199, 1040, 4437, 4540, 379, 10348, 6608, 1040, 365, 376, 199, 1040, 1176, 14, 2828, 14, 1178, 14, 5754, 14, 10348, 6608, 1040, 8343, 370, 199, 27403, 27405, 314, 3050, 367, 282, 1124, 1899, 1040, 1256, 315, 1924, 1056, 14, 199, 199, 5879, 382, 270, 314, 6137, 13, 262, 1124, 10348, 6608, 1040, 14729, 911, 1454, 3332, 314, 199, 1040, 1899, 1040, 1256, 1380, 652, 365, 1415, 12, 314, 373, 1810, 610, 74, 3822, 402, 15424, 911, 886, 880, 641, 199, 14287, 2034, 370, 3795, 298, 28985, 315, 465, 283, 56, 4065, 1318, 465, 5521, 370, 9352, 314, 754, 402, 199, 1040, 751, 14, 374, 63, 12177, 8497, 436, 1124, 751, 14, 374, 63, 11434, 1040, 370, 5647, 12303, 199, 1593, 6712, 14, 199, 199, 2765, 10816, 20714, 2335, 314, 7918, 402, 23812, 642, 1124, 1899, 1040, 1256, 701, 199, 22738, 652, 1808, 314, 1124, 1637, 63, 3557, 1977, 1040, 1256, 13627, 562, 10832, 706, 14, 199, 199, 872, 6455, 641, 2195, 8095, 1329, 402, 9212, 1126, 2034, 12, 13369, 1373, 1827, 1126, 199, 1069, 883, 2595, 262, 9531, 2595, 5270, 2248, 641, 2195, 3050, 14, 1010, 10234, 12, 199, 27403, 316, 314, 3050, 21926, 367, 6497, 883, 5126, 315, 895, 5985, 1263, 1950, 199, 19645, 315, 2195, 3734, 12, 9183, 315, 12930, 2034, 14404, 367, 2195, 4390, 14, 199, 199, 30125, 642, 666, 315, 314, 2581, 883, 2597, 506, 1202, 465, 282, 4340, 402, 28532, 1958, 4390, 199, 262, 10460, 9682, 402, 5634, 626, 1077, 440, 2879, 2195, 3050, 14, 221, 2104, 199, 2694, 12, 282, 298, 19725, 818, 2, 2034, 3955, 506, 7688, 370, 3795, 282, 25994, 9096, 199, 1188, 1928, 12943, 316, 314, 3050, 737, 1006, 1325, 7830, 28532, 1958, 4799, 314, 199, 1637, 14, 199, 199, 1040, 4437, 4540, 379, 10348, 6608, 1040, 365, 1124, 29599, 63, 28988, 1040, 282, 784, 941, 530, 14, 199, 199, 7921, 199, 22935, 1714, 199, 199, 1918, 2581, 436, 2351, 14745, 787, 5139, 13810, 641, 1924, 1056, 446, 781, 787, 199, 11184, 590, 18002, 626, 2985, 787, 17546, 9804, 334, 269, 4257, 1655, 16602, 461, 9, 370, 2879, 199, 13797, 2195, 3050, 14, 334, 607, 314, 6466, 12, 10514, 10049, 1443, 2040, 2739, 370, 5126, 642, 199, 3892, 741, 6314, 1553, 704, 382, 270, 781, 4293, 440, 19353, 3354, 1124, 1899, 14, 2060, 1040, 315, 282, 199, 5306, 12, 781, 4293, 675, 24725, 8697, 370, 10299, 652, 734, 1380, 4346, 4959, 199, 199, 23296, 13943, 8744, 3955, 506, 370, 3877, 314, 3004, 315, 314, 922, 1159, 199, 1730, 3140, 402, 315, 314, 2581, 14, 961, 3955, 3354, 314, 2581, 9793, 641, 4036, 1056, 199, 305, 1006, 314, 12082, 666, 3955, 506, 25239, 1146, 315, 1373, 2621, 687, 314, 2351, 4865, 14, 199, 18335, 5907, 12, 642, 965, 2877, 2446, 2153, 21650, 867, 7441, 26, 421, 627, 8596, 2883, 787, 440, 25286, 1553, 2410, 10663, 4493, 370, 376, 2043, 1124, 1178, 63, 751, 1040, 1962, 315, 314, 3050, 12, 1265, 3913, 6705, 314, 922, 1159, 2351, 2043, 790, 370, 8976, 314, 3063, 734, 13, 1618, 13, 5186, 666, 334, 460, 9689, 880, 3955, 943, 3062, 734, 2043, 15988, 680, 421, 627, 31299, 666, 1126, 13, 1730, 7830, 2419, 1126, 13, 751, 1553, 340, 282, 922, 9610, 315, 687, 2043, 3663, 1013, 19717, 314, 666, 365, 21747, 315, 1924, 2351, 14, 961, 5160, 365, 2043, 11395, 4585, 701, 4750, 11336, 13809, 316, 370, 5126, 1437, 16648, 2351, 666, 465, 1846, 2043, 465, 3962, 334, 262, 10234, 370, 16915, 12184, 315, 16149, 14086, 680, 199, 199, 7692, 199, 2878, 94, 199, 199, 1378, 675, 12, 2342, 1124, 19987, 63, 13748, 1040, 315, 2195, 1124, 1751, 14, 647, 1040, 436, 3350, 447, 339, 30718, 63, 13748, 275, 359, 267, 2263, 267, 283, 1176, 14, 2828, 14, 1178, 14, 5754, 14, 10348, 6608, 297, 267, 2263, 272, 1622, 199, 199, 1045, 447, 339, 30718, 63, 13748, 275, 359, 267, 2263, 267, 283, 1637, 63, 3557, 1977, 14, 5754, 14, 4437, 4540, 379, 10348, 6608, 297, 267, 2263, 272, 1622, 199, 199, 5556, 1077, 12679, 1265, 787, 1808, 282, 1124, 12763, 63, 15956, 1040, 626, 3181, 1133, 1827, 314, 199, 4659, 367, 1924, 1056, 14, 710, 6137, 13, 262, 1124, 5245, 63, 697, 1040, 6869, 365, 314, 17925, 597, 199, 5095, 367, 4750, 22196, 1325, 1265, 1443, 506, 394, 18869, 543, 314, 21032, 13, 1997, 83, 402, 314, 199, 1040, 32567, 1040, 4865, 446, 1937, 314, 5634, 3794, 367, 1655, 2436, 14, 199, 199, 624, 199, 199, 504, 1639, 14, 2828, 14, 1178, 492, 428, 9577, 63, 3078, 199, 504, 1639, 14, 2828, 14, 1178, 14, 992, 492, 2876, 199, 504, 1639, 14, 2828, 14, 1178, 14, 5754, 492, 15995, 6608, 199, 199, 504, 1275, 1238, 492, 2581, 63, 1238, 421, 199, 533, 11977, 4540, 379, 10348, 6608, 8, 10348, 6608, 304, 272, 347, 636, 826, 721, 277, 304, 267, 2581, 63, 1238, 8, 1899, 9, 339, 347, 2112, 63, 1069, 8, 277, 12, 1056, 304, 267, 862, 26, 288, 327, 7649, 436, 6982, 282, 2876, 1256, 687, 666, 5489, 315, 314, 2581, 288, 1056, 14, 751, 275, 2876, 14, 362, 63, 5245, 8, 1069, 14, 1730, 59, 12763, 63, 3078, 566, 267, 871, 26, 288, 327, 481, 5421, 370, 22048, 314, 2876, 687, 314, 3050, 14, 288, 1613, 8, 4437, 4540, 379, 10348, 6608, 12, 291, 680, 1412, 63, 1069, 8, 1069, 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 ]
[ 199, 4437, 13, 894, 379, 1124, 10348, 6608, 1040, 199, 1444, 9960, 199, 199, 1040, 4437, 4540, 379, 10348, 6608, 1040, 365, 376, 199, 1040, 1176, 14, 2828, 14, 1178, 14, 5754, 14, 10348, 6608, 1040, 8343, 370, 199, 27403, 27405, 314, 3050, 367, 282, 1124, 1899, 1040, 1256, 315, 1924, 1056, 14, 199, 199, 5879, 382, 270, 314, 6137, 13, 262, 1124, 10348, 6608, 1040, 14729, 911, 1454, 3332, 314, 199, 1040, 1899, 1040, 1256, 1380, 652, 365, 1415, 12, 314, 373, 1810, 610, 74, 3822, 402, 15424, 911, 886, 880, 641, 199, 14287, 2034, 370, 3795, 298, 28985, 315, 465, 283, 56, 4065, 1318, 465, 5521, 370, 9352, 314, 754, 402, 199, 1040, 751, 14, 374, 63, 12177, 8497, 436, 1124, 751, 14, 374, 63, 11434, 1040, 370, 5647, 12303, 199, 1593, 6712, 14, 199, 199, 2765, 10816, 20714, 2335, 314, 7918, 402, 23812, 642, 1124, 1899, 1040, 1256, 701, 199, 22738, 652, 1808, 314, 1124, 1637, 63, 3557, 1977, 1040, 1256, 13627, 562, 10832, 706, 14, 199, 199, 872, 6455, 641, 2195, 8095, 1329, 402, 9212, 1126, 2034, 12, 13369, 1373, 1827, 1126, 199, 1069, 883, 2595, 262, 9531, 2595, 5270, 2248, 641, 2195, 3050, 14, 1010, 10234, 12, 199, 27403, 316, 314, 3050, 21926, 367, 6497, 883, 5126, 315, 895, 5985, 1263, 1950, 199, 19645, 315, 2195, 3734, 12, 9183, 315, 12930, 2034, 14404, 367, 2195, 4390, 14, 199, 199, 30125, 642, 666, 315, 314, 2581, 883, 2597, 506, 1202, 465, 282, 4340, 402, 28532, 1958, 4390, 199, 262, 10460, 9682, 402, 5634, 626, 1077, 440, 2879, 2195, 3050, 14, 221, 2104, 199, 2694, 12, 282, 298, 19725, 818, 2, 2034, 3955, 506, 7688, 370, 3795, 282, 25994, 9096, 199, 1188, 1928, 12943, 316, 314, 3050, 737, 1006, 1325, 7830, 28532, 1958, 4799, 314, 199, 1637, 14, 199, 199, 1040, 4437, 4540, 379, 10348, 6608, 1040, 365, 1124, 29599, 63, 28988, 1040, 282, 784, 941, 530, 14, 199, 199, 7921, 199, 22935, 1714, 199, 199, 1918, 2581, 436, 2351, 14745, 787, 5139, 13810, 641, 1924, 1056, 446, 781, 787, 199, 11184, 590, 18002, 626, 2985, 787, 17546, 9804, 334, 269, 4257, 1655, 16602, 461, 9, 370, 2879, 199, 13797, 2195, 3050, 14, 334, 607, 314, 6466, 12, 10514, 10049, 1443, 2040, 2739, 370, 5126, 642, 199, 3892, 741, 6314, 1553, 704, 382, 270, 781, 4293, 440, 19353, 3354, 1124, 1899, 14, 2060, 1040, 315, 282, 199, 5306, 12, 781, 4293, 675, 24725, 8697, 370, 10299, 652, 734, 1380, 4346, 4959, 199, 199, 23296, 13943, 8744, 3955, 506, 370, 3877, 314, 3004, 315, 314, 922, 1159, 199, 1730, 3140, 402, 315, 314, 2581, 14, 961, 3955, 3354, 314, 2581, 9793, 641, 4036, 1056, 199, 305, 1006, 314, 12082, 666, 3955, 506, 25239, 1146, 315, 1373, 2621, 687, 314, 2351, 4865, 14, 199, 18335, 5907, 12, 642, 965, 2877, 2446, 2153, 21650, 867, 7441, 26, 421, 627, 8596, 2883, 787, 440, 25286, 1553, 2410, 10663, 4493, 370, 376, 2043, 1124, 1178, 63, 751, 1040, 1962, 315, 314, 3050, 12, 1265, 3913, 6705, 314, 922, 1159, 2351, 2043, 790, 370, 8976, 314, 3063, 734, 13, 1618, 13, 5186, 666, 334, 460, 9689, 880, 3955, 943, 3062, 734, 2043, 15988, 680, 421, 627, 31299, 666, 1126, 13, 1730, 7830, 2419, 1126, 13, 751, 1553, 340, 282, 922, 9610, 315, 687, 2043, 3663, 1013, 19717, 314, 666, 365, 21747, 315, 1924, 2351, 14, 961, 5160, 365, 2043, 11395, 4585, 701, 4750, 11336, 13809, 316, 370, 5126, 1437, 16648, 2351, 666, 465, 1846, 2043, 465, 3962, 334, 262, 10234, 370, 16915, 12184, 315, 16149, 14086, 680, 199, 199, 7692, 199, 2878, 94, 199, 199, 1378, 675, 12, 2342, 1124, 19987, 63, 13748, 1040, 315, 2195, 1124, 1751, 14, 647, 1040, 436, 3350, 447, 339, 30718, 63, 13748, 275, 359, 267, 2263, 267, 283, 1176, 14, 2828, 14, 1178, 14, 5754, 14, 10348, 6608, 297, 267, 2263, 272, 1622, 199, 199, 1045, 447, 339, 30718, 63, 13748, 275, 359, 267, 2263, 267, 283, 1637, 63, 3557, 1977, 14, 5754, 14, 4437, 4540, 379, 10348, 6608, 297, 267, 2263, 272, 1622, 199, 199, 5556, 1077, 12679, 1265, 787, 1808, 282, 1124, 12763, 63, 15956, 1040, 626, 3181, 1133, 1827, 314, 199, 4659, 367, 1924, 1056, 14, 710, 6137, 13, 262, 1124, 5245, 63, 697, 1040, 6869, 365, 314, 17925, 597, 199, 5095, 367, 4750, 22196, 1325, 1265, 1443, 506, 394, 18869, 543, 314, 21032, 13, 1997, 83, 402, 314, 199, 1040, 32567, 1040, 4865, 446, 1937, 314, 5634, 3794, 367, 1655, 2436, 14, 199, 199, 624, 199, 199, 504, 1639, 14, 2828, 14, 1178, 492, 428, 9577, 63, 3078, 199, 504, 1639, 14, 2828, 14, 1178, 14, 992, 492, 2876, 199, 504, 1639, 14, 2828, 14, 1178, 14, 5754, 492, 15995, 6608, 199, 199, 504, 1275, 1238, 492, 2581, 63, 1238, 421, 199, 533, 11977, 4540, 379, 10348, 6608, 8, 10348, 6608, 304, 272, 347, 636, 826, 721, 277, 304, 267, 2581, 63, 1238, 8, 1899, 9, 339, 347, 2112, 63, 1069, 8, 277, 12, 1056, 304, 267, 862, 26, 288, 327, 7649, 436, 6982, 282, 2876, 1256, 687, 666, 5489, 315, 314, 2581, 288, 1056, 14, 751, 275, 2876, 14, 362, 63, 5245, 8, 1069, 14, 1730, 59, 12763, 63, 3078, 566, 267, 871, 26, 288, 327, 481, 5421, 370, 22048, 314, 2876, 687, 314, 3050, 14, 288, 1613, 8, 4437, 4540, 379, 10348, 6608, 12, 291, 680, 1412, 63, 1069, 8, 1069, 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, 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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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
paulocastro31/android_kernel_motorola_msm8226
tools/perf/python/twatch.py
7370
1334
#! /usr/bin/python # -*- python -*- # -*- coding: utf-8 -*- # twatch - Experimental use of the perf python interface # Copyright (C) 2011 Arnaldo Carvalho de Melo <acme@redhat.com> # # This application 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; version 2. # # This application 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. import perf def main(): cpus = perf.cpu_map() threads = perf.thread_map() evsel = perf.evsel(task = 1, comm = 1, mmap = 0, wakeup_events = 1, watermark = 1, sample_id_all = 1, sample_type = perf.SAMPLE_PERIOD | perf.SAMPLE_TID | perf.SAMPLE_CPU | perf.SAMPLE_TID) evsel.open(cpus = cpus, threads = threads); evlist = perf.evlist(cpus, threads) evlist.add(evsel) evlist.mmap() while True: evlist.poll(timeout = -1) for cpu in cpus: event = evlist.read_on_cpu(cpu) if not event: continue print "cpu: %2d, pid: %4d, tid: %4d" % (event.sample_cpu, event.sample_pid, event.sample_tid), print event if __name__ == '__main__': main()
gpl-2.0
[ 3168, 1182, 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2366, 1882, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 257, 307, 6821, 446, 23997, 279, 675, 402, 314, 8582, 2366, 3217, 199, 3, 257, 1898, 334, 35, 9, 7760, 1952, 78, 279, 1117, 14243, 637, 526, 477, 3194, 320, 665, 18107, 32, 17164, 14, 957, 30, 199, 3, 199, 3, 257, 961, 4223, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 199, 3, 257, 2811, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 199, 3, 257, 465, 3267, 701, 314, 2868, 2290, 2752, 27, 1015, 499, 14, 199, 3, 199, 3, 257, 961, 4223, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 257, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 257, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 199, 3, 257, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 199, 646, 8582, 199, 199, 318, 2446, 837, 199, 198, 8896, 275, 8582, 14, 3541, 63, 1130, 342, 199, 198, 6962, 275, 8582, 14, 2671, 63, 1130, 342, 199, 198, 6857, 5891, 275, 8582, 14, 6857, 5891, 8, 1765, 275, 413, 12, 1923, 275, 413, 12, 21991, 275, 378, 12, 1585, 257, 21560, 384, 63, 4368, 275, 413, 12, 22834, 1657, 275, 413, 12, 1585, 257, 2690, 63, 344, 63, 452, 275, 413, 12, 1585, 257, 2690, 63, 466, 275, 8582, 14, 15827, 63, 27081, 1204, 8582, 14, 15827, 63, 52, 998, 1204, 8582, 14, 15827, 63, 11011, 1204, 8582, 14, 15827, 63, 52, 998, 9, 199, 198, 6857, 5891, 14, 1490, 8, 8896, 275, 24174, 12, 7183, 275, 7183, 2736, 199, 198, 6857, 513, 275, 8582, 14, 6857, 513, 8, 8896, 12, 7183, 9, 199, 198, 6857, 513, 14, 525, 8, 6857, 5891, 9, 199, 198, 6857, 513, 14, 20671, 342, 199, 198, 6710, 715, 26, 507, 198, 6857, 513, 14, 6843, 8, 2593, 275, 446, 17, 9, 507, 198, 509, 5033, 315, 24174, 26, 686, 198, 1430, 275, 8145, 513, 14, 739, 63, 265, 63, 3541, 8, 3541, 9, 686, 198, 692, 440, 1566, 26, 1585, 198, 6958, 686, 198, 1361, 298, 3541, 26, 450, 18, 68, 12, 4422, 26, 450, 20, 68, 12, 11559, 26, 450, 20, 68, 2, 450, 334, 1430, 14, 3271, 63, 3541, 12, 11674, 198, 1430, 14, 3271, 63, 3150, 12, 11674, 198, 1430, 14, 3271, 63, 5700, 395, 686, 198, 1361, 1566, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 2446, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1182, 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2366, 1882, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 257, 307, 6821, 446, 23997, 279, 675, 402, 314, 8582, 2366, 3217, 199, 3, 257, 1898, 334, 35, 9, 7760, 1952, 78, 279, 1117, 14243, 637, 526, 477, 3194, 320, 665, 18107, 32, 17164, 14, 957, 30, 199, 3, 199, 3, 257, 961, 4223, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 199, 3, 257, 2811, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 199, 3, 257, 465, 3267, 701, 314, 2868, 2290, 2752, 27, 1015, 499, 14, 199, 3, 199, 3, 257, 961, 4223, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 257, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 257, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 199, 3, 257, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 199, 646, 8582, 199, 199, 318, 2446, 837, 199, 198, 8896, 275, 8582, 14, 3541, 63, 1130, 342, 199, 198, 6962, 275, 8582, 14, 2671, 63, 1130, 342, 199, 198, 6857, 5891, 275, 8582, 14, 6857, 5891, 8, 1765, 275, 413, 12, 1923, 275, 413, 12, 21991, 275, 378, 12, 1585, 257, 21560, 384, 63, 4368, 275, 413, 12, 22834, 1657, 275, 413, 12, 1585, 257, 2690, 63, 344, 63, 452, 275, 413, 12, 1585, 257, 2690, 63, 466, 275, 8582, 14, 15827, 63, 27081, 1204, 8582, 14, 15827, 63, 52, 998, 1204, 8582, 14, 15827, 63, 11011, 1204, 8582, 14, 15827, 63, 52, 998, 9, 199, 198, 6857, 5891, 14, 1490, 8, 8896, 275, 24174, 12, 7183, 275, 7183, 2736, 199, 198, 6857, 513, 275, 8582, 14, 6857, 513, 8, 8896, 12, 7183, 9, 199, 198, 6857, 513, 14, 525, 8, 6857, 5891, 9, 199, 198, 6857, 513, 14, 20671, 342, 199, 198, 6710, 715, 26, 507, 198, 6857, 513, 14, 6843, 8, 2593, 275, 446, 17, 9, 507, 198, 509, 5033, 315, 24174, 26, 686, 198, 1430, 275, 8145, 513, 14, 739, 63, 265, 63, 3541, 8, 3541, 9, 686, 198, 692, 440, 1566, 26, 1585, 198, 6958, 686, 198, 1361, 298, 3541, 26, 450, 18, 68, 12, 4422, 26, 450, 20, 68, 12, 11559, 26, 450, 20, 68, 2, 450, 334, 1430, 14, 3271, 63, 3541, 12, 11674, 198, 1430, 14, 3271, 63, 3150, 12, 11674, 198, 1430, 14, 3271, 63, 5700, 395, 686, 198, 1361, 1566, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 2446, 342, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
cc272309126/panda3d
direct/src/tkwidgets/MemoryExplorer.py
11
11923
from direct.showbase.DirectObject import DirectObject from direct.showbase.TkGlobal import * from Tkinter import * from Tree import * import Pmw #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- DEFAULT_BT_WIDTH = 50.0 #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- class MemoryExplorer(Pmw.MegaWidget, DirectObject): #-------------------------------------------------------------------------- # Init #-------------------------------------------------------------------------- def __init__(self, parent = None, nodePath = render, **kw): optiondefs = (('menuItems', [], Pmw.INITOPT),) self.defineoptions(kw, optiondefs) Pmw.MegaWidget.__init__(self, parent) self.nodePath = nodePath self.renderItem = None self.render2dItem = None self.buttons = [] self.labels = [] self.rootItem = None self.btWidth = DEFAULT_BT_WIDTH self.createScrolledFrame() self.createScale() self.createRefreshBT() self.balloon = Pmw.Balloon(self.interior()) def createScrolledFrame(self): self.frame = Pmw.ScrolledFrame(self.interior(), labelpos = 'n', label_text = 'ScrolledFrame', usehullsize = 1, hull_width = 200, hull_height = 220,) self.frame.pack(padx = 3, pady = 3, fill = BOTH, expand = 1) def createScale(self): self.scaleCtrl = Scale(self.interior(), label = "Graph Scale", from_= 0.0, to = 20.0, resolution = 0.1, orient = HORIZONTAL, command = self.onScaleUpdate) self.scaleCtrl.pack(side = LEFT, fill = BOTH, expand = 1) self.scaleCtrl.set(0.0) def createRefreshBT(self): self.refreshBT = Button(self.interior(), text = 'Refresh', command = self.refresh) self.refreshBT.pack(side = LEFT, fill = BOTH, expand = 1) #-------------------------------------------------------------------------- # Item Ctrls #-------------------------------------------------------------------------- def createDefaultCtrls(self): if self.renderItem == None or self.render2dItem == None: return totalBytes = self.renderItem.getVertexBytes()+self.render2dItem.getVertexBytes() self.addChildCtrl(self.renderItem, totalBytes) self.addChildCtrl(self.render2dItem, totalBytes) self.setTitle("ALL", totalBytes) def setTitle(self, parent, bytes): self.frame["label_text"] = "[%s] - %s bytes" % (parent, bytes) def resetCtrls(self): for button in self.buttons: self.balloon.unbind(button) button.destroy() self.buttons = [] for label in self.labels: label.destroy() self.labels = [] def getNewButton(self, width, ratio): newBT = Button(self.frame.interior(), anchor = W, width = width) if ratio == 0.0: newBT['bg'] = "grey" newBT['text'] = "." else: newBT['bg'] = Pmw.Color.hue2name(0.0, 1.0-ratio) newBT['text'] = "%0.2f%%" % (ratio*100.0) return newBT def addSelfCtrl(self, item, totalBytes): self.addLabel("[self] : %s bytes" % item.getSelfVertexBytes()) bt = self.addButton(item.getSelfVertexBytes(), totalBytes, self.onSelfButtonLClick, self.onSelfButtonRClick, item) def addChildCtrl(self, item, totalBytes): self.addLabel("%s [+%s] : %s bytes" % (item.getName(), item.getNumChildren(), item.getVertexBytes())) bt = self.addButton(item.getVertexBytes(), totalBytes, self.onChildButtonLClick, self.onChildButtonRClick, item) def addButton(self, vertexBytes, totalBytes, funcLClick, funcRClick, item): width = self.getBTWidth(vertexBytes, totalBytes) if totalBytes == 0: ratio = 0.0 else: ratio = vertexBytes/float(totalBytes) bt = self.getNewButton(width, ratio) def callbackL(event): funcLClick(item) def callbackR(event): funcRClick(item) bt.bind("<Button-1>", callbackL) bt.bind("<Button-3>", callbackR) bt.pack(side = TOP, anchor = NW) self.buttons.append(bt) self.balloon.bind(bt, item.getPathName()) return bt def addLabel(self, label): label = Label(self.frame.interior(), text = label) label.pack(side = TOP, anchor = NW, expand = 0) self.labels.append(label) def getBTWidth(self, vertexBytes, totalBytes): if totalBytes == 0: return 1 width = int(self.btWidth * vertexBytes / totalBytes) if width == 0: width = 1 return width #-------------------------------------------------------------------------- # Callback #-------------------------------------------------------------------------- def onScaleUpdate(self, arg): self.btWidth = DEFAULT_BT_WIDTH + DEFAULT_BT_WIDTH * float(arg) if self.rootItem: self.updateBTWidth() else: self.updateDefaultBTWidth() def updateBTWidth(self): self.buttons[0]['width'] = self.getBTWidth(self.rootItem.getSelfVertexBytes(), self.rootItem.getVertexBytes()) btIndex = 1 for item in self.rootItem.getChildren(): self.buttons[btIndex]['width'] = self.getBTWidth(item.getVertexBytes(), self.rootItem.getVertexBytes()) btIndex += 1 def updateDefaultBTWidth(self): if self.renderItem == None or self.render2dItem == None: return totalBytes = self.renderItem.getVertexBytes() + self.render2dItem.getVertexBytes() self.buttons[0]['width'] = self.getBTWidth(self.renderItem.getVertexBytes(), totalBytes) self.buttons[1]['width'] = self.getBTWidth(self.render2dItem.getVertexBytes(), totalBytes) def onSelfButtonLClick(self, item): pass def onSelfButtonRClick(self, item): parentItem = item.getParent() self.resetCtrls() self.addItemCtrls(parentItem) def onChildButtonLClick(self, item): if item.getNumChildren() == 0: return self.resetCtrls() self.addItemCtrls(item) def onChildButtonRClick(self, item): parentItem = item.getParent() if parentItem: self.resetCtrls() self.addItemCtrls(parentItem.getParent()) def addItemCtrls(self, item): self.rootItem = item if item == None: self.createDefaultCtrls() else: self.addSelfCtrl(item, item.getVertexBytes()) for child in item.getChildren(): self.addChildCtrl(child, item.getVertexBytes()) self.setTitle(item.getPathName(), item.getVertexBytes()) #-------------------------------------------------------------------------- # List & Analyze #-------------------------------------------------------------------------- def makeList(self): self.renderItem = MemoryExplorerItem(None, render) self.buildList(self.renderItem) self.render2dItem = MemoryExplorerItem(None, render2d) self.buildList(self.render2dItem) def buildList(self, parentItem): for nodePath in parentItem.nodePath.getChildren(): item = MemoryExplorerItem(parentItem, nodePath) parentItem.addChild(item) self.buildList(item) def analyze(self): self.renderItem.analyze() self.render2dItem.analyze() def refresh(self): self.makeList() self.analyze() self.resetCtrls() self.createDefaultCtrls() #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- class MemoryExplorerItem: def __init__(self, parent, nodePath): self.parent = parent self.nodePath = nodePath self.children = [] self.selfVertexBytes = 0 self.childrenVertexBytes = 0 self.numFaces = 0 self.textureBytes = 0 if parent: self.pathName = parent.pathName + "/" + nodePath.getName() else: self.pathName = nodePath.getName() def getParent(self): return self.parent def addChild(self, child): self.children.append(child) def getNumChildren(self): return len(self.children) def getChildrenAsList(self): return self.children def getName(self): return self.nodePath.getName() def getPathName(self): return self.pathName def getVertexBytes(self): return self.selfVertexBytes + self.childrenVertexBytes def getSelfVertexBytes(self): return self.selfVertexBytes def analyze(self): self.selfVertexBytes = 0 self.childrenVertexBytes = 0 self.numFaces = 0 self.textureBytes = 0 self.calcTextureBytes() if self.nodePath.node().isGeomNode(): geomNode = self.nodePath.node() for i in range(geomNode.getNumGeoms()): geom = geomNode.getGeom(i) self.calcVertexBytes(geom) self.calcNumFaces(geom) self.analyzeChildren() def calcVertexBytes(self, geom): vData = geom.getVertexData() for j in range(vData.getNumArrays()): array = vData.getArray(j) self.selfVertexBytes += array.getDataSizeBytes() def calcTextureBytes(self): texCol = self.nodePath.findAllTextures() for i in range(texCol.getNumTextures()): tex = texCol.getTexture(i) self.textureBytes += tex.estimateTextureMemory() # what about shared textures by multiple nodes ? def calcNumFaces(self, geom): for k in range(geom.getNumPrimitives()): primitive = geom.getPrimitive(k) self.numFaces += primitive.getNumFaces() def analyzeChildren(self): for child in self.children: child.analyze() self.childrenVertexBytes += child.getVertexBytes() self.numFaces += child.numFaces def ls(self, indent = ""): print(indent + self.nodePath.getName() + " " + str(self.vertexBytes) + " " + str(self.numFaces) + " " + str(self.textureBytes)) indent = indent + " " for child in self.children: child.ls(indent)
bsd-3-clause
[ 504, 4125, 14, 2384, 1095, 14, 16281, 1692, 492, 21128, 1692, 199, 504, 4125, 14, 2384, 1095, 14, 15189, 7025, 492, 627, 199, 504, 16826, 492, 627, 199, 504, 12178, 492, 627, 199, 646, 510, 14716, 199, 199, 7656, 9460, 199, 7656, 9460, 199, 3472, 63, 19162, 63, 11139, 275, 5238, 14, 16, 199, 199, 7656, 9460, 199, 7656, 9460, 199, 533, 15825, 4527, 22732, 8, 48, 14716, 14, 1352, 5294, 3339, 12, 21128, 1692, 304, 339, 14309, 9460, 272, 327, 21026, 272, 14309, 9460, 14821, 347, 636, 826, 721, 277, 12, 1676, 275, 488, 12, 1031, 2042, 275, 3795, 12, 1011, 829, 304, 267, 945, 8710, 275, 13636, 4470, 7412, 297, 257, 990, 257, 510, 14716, 14, 8727, 5123, 16945, 267, 291, 14, 4640, 1419, 8, 829, 12, 945, 8710, 9, 267, 510, 14716, 14, 1352, 5294, 3339, 855, 826, 721, 277, 12, 1676, 9, 398, 291, 14, 932, 2042, 275, 1031, 2042, 267, 291, 14, 3352, 2081, 275, 488, 4960, 291, 14, 3352, 18, 68, 2081, 275, 488, 398, 291, 14, 15687, 275, 942, 267, 291, 14, 3512, 275, 942, 267, 291, 14, 1231, 2081, 275, 488, 398, 291, 14, 13061, 6216, 275, 6186, 63, 19162, 63, 11139, 260, 2728, 291, 14, 981, 29145, 3160, 342, 18418, 291, 14, 981, 9944, 342, 267, 291, 14, 981, 18730, 19162, 342, 2728, 291, 14, 4982, 27734, 275, 510, 14716, 14, 13129, 27734, 8, 277, 14, 5707, 17942, 1012, 339, 347, 1218, 29145, 3160, 8, 277, 304, 267, 291, 14, 1943, 275, 510, 14716, 14, 29145, 3160, 8, 277, 14, 5707, 17942, 1062, 4318, 1768, 1712, 275, 283, 78, 297, 4318, 1768, 63, 505, 275, 283, 29145, 3160, 297, 4318, 675, 72, 979, 890, 275, 413, 12, 4318, 394, 979, 63, 2063, 275, 1926, 12, 4318, 394, 979, 63, 3333, 275, 25647, 4258, 398, 291, 14, 1943, 14, 1389, 8, 6226, 88, 275, 650, 12, 22626, 275, 650, 12, 5554, 275, 699, 22949, 12, 6544, 275, 413, 9, 339, 347, 1218, 9944, 8, 277, 304, 267, 291, 14, 3467, 9778, 275, 22869, 8, 277, 14, 5707, 17942, 1062, 3044, 1768, 275, 298, 4578, 22869, 401, 3044, 687, 10683, 378, 14, 16, 12, 3044, 370, 275, 3388, 14, 16, 12, 3044, 12401, 275, 378, 14, 17, 12, 3044, 25626, 275, 8724, 12, 3044, 1414, 275, 291, 14, 265, 9944, 4152, 9, 2728, 291, 14, 3467, 9778, 14, 1389, 8, 2441, 275, 6578, 12, 5554, 275, 699, 22949, 12, 6544, 275, 413, 9, 267, 291, 14, 3467, 9778, 14, 409, 8, 16, 14, 16, 9, 5493, 347, 1218, 18730, 19162, 8, 277, 304, 267, 291, 14, 6635, 19162, 275, 16005, 8, 277, 14, 5707, 17942, 1062, 1318, 275, 283, 18730, 297, 1414, 275, 291, 14, 6635, 9, 267, 291, 14, 6635, 19162, 14, 1389, 8, 2441, 275, 6578, 12, 5554, 275, 699, 22949, 12, 6544, 275, 413, 9, 339, 14309, 9460, 272, 327, 7020, 445, 454, 478, 272, 14309, 9460, 3698, 272, 347, 1218, 2698, 35, 454, 478, 8, 277, 304, 267, 340, 291, 14, 3352, 2081, 508, 488, 503, 291, 14, 3352, 18, 68, 2081, 508, 488, 26, 288, 372, 2728, 3141, 5571, 275, 291, 14, 3352, 2081, 14, 362, 9787, 5571, 24543, 277, 14, 3352, 18, 68, 2081, 14, 362, 9787, 5571, 342, 2728, 291, 14, 23897, 9778, 8, 277, 14, 3352, 2081, 12, 3141, 5571, 9, 267, 291, 14, 23897, 9778, 8, 277, 14, 3352, 18, 68, 2081, 12, 3141, 5571, 9, 398, 291, 14, 31675, 480, 1761, 401, 3141, 5571, 9, 2432, 272, 347, 663, 6888, 8, 277, 12, 1676, 12, 2783, 304, 267, 291, 14, 1943, 905, 1302, 63, 505, 937, 275, 26503, 83, 61, 446, 450, 83, 2783, 2, 450, 334, 1708, 12, 2783, 9, 260, 339, 347, 5305, 35, 454, 478, 8, 277, 304, 27144, 367, 5528, 315, 291, 14, 15687, 26, 288, 291, 14, 4982, 27734, 14, 324, 3409, 8, 3887, 9, 288, 5528, 14, 7237, 342, 267, 291, 14, 15687, 275, 942, 398, 367, 1768, 315, 291, 14, 3512, 26, 288, 1768, 14, 7237, 342, 267, 291, 14, 3512, 275, 942, 339, 347, 664, 4665, 4259, 8, 277, 12, 3462, 12, 10463, 304, 3515, 267, 892, 19162, 275, 221, 16005, 8, 277, 14, 1943, 14, 5707, 17942, 1062, 12793, 717, 12514, 275, 644, 12, 717, 3462, 275, 3462, 9, 398, 340, 10463, 508, 378, 14, 16, 26, 288, 892, 19162, 459, 6856, 418, 275, 298, 16708, 2, 288, 892, 19162, 459, 505, 418, 275, 14530, 267, 587, 26, 288, 892, 19162, 459, 6856, 418, 275, 510, 14716, 14, 4117, 14, 25016, 18, 354, 8, 16, 14, 16, 12, 413, 14, 16, 13, 6884, 9, 288, 892, 19162, 459, 505, 418, 275, 2071, 16, 14, 18, 70, 8530, 2, 450, 334, 6884, 10, 1960, 14, 16, 9, 398, 372, 892, 19162, 339, 347, 1050, 12887, 9778, 8, 277, 12, 1242, 12, 3141, 5571, 304, 267, 291, 14, 525, 4314, 10994, 277, 61, 520, 450, 83, 2783, 2, 450, 1242, 14, 362, 12887, 9787, 5571, 1012, 398, 22342, 275, 291, 14, 525, 4259, 8, 1053, 14, 362, 12887, 9787, 5571, 1062, 1169, 3141, 5571, 12, 1169, 291, 14, 265, 12887, 4259, 7027, 8442, 12, 1169, 291, 14, 265, 12887, 4259, 8205, 8442, 12, 1169, 1242, 9, 20950, 347, 1050, 3493, 9778, 8, 277, 12, 1242, 12, 3141, 5571, 304, 267, 291, 14, 525, 4314, 3647, 83, 359, 25389, 83, 61, 520, 450, 83, 2783, 2, 450, 334, 1053, 14, 16405, 1062, 6059, 1242, 14, 362, 5667, 7139, 1062, 6059, 1242, 14, 362, 9787, 5571, 4059, 2728, 22342, 275, 291, 14, 525, 4259, 8, 1053, 14, 362, 9787, 5571, 1062, 1169, 3141, 5571, 12, 1169, 291, 14, 265, 3493, 4259, 7027, 8442, 12, 1169, 291, 14, 265, 3493, 4259, 8205, 8442, 12, 1169, 1242, 9, 339, 347, 1050, 4259, 8, 277, 12, 12759, 5571, 12, 3141, 5571, 12, 2562, 7027, 8442, 12, 2562, 8205, 8442, 12, 1242, 304, 267, 3462, 275, 291, 14, 362, 19162, 6216, 8, 11417, 5571, 12, 3141, 5571, 9, 398, 340, 3141, 5571, 508, 378, 26, 288, 10463, 275, 378, 14, 16, 267, 587, 26, 288, 10463, 275, 12759, 5571, 15, 1609, 8, 2923, 5571, 9, 398 ]
[ 4125, 14, 2384, 1095, 14, 16281, 1692, 492, 21128, 1692, 199, 504, 4125, 14, 2384, 1095, 14, 15189, 7025, 492, 627, 199, 504, 16826, 492, 627, 199, 504, 12178, 492, 627, 199, 646, 510, 14716, 199, 199, 7656, 9460, 199, 7656, 9460, 199, 3472, 63, 19162, 63, 11139, 275, 5238, 14, 16, 199, 199, 7656, 9460, 199, 7656, 9460, 199, 533, 15825, 4527, 22732, 8, 48, 14716, 14, 1352, 5294, 3339, 12, 21128, 1692, 304, 339, 14309, 9460, 272, 327, 21026, 272, 14309, 9460, 14821, 347, 636, 826, 721, 277, 12, 1676, 275, 488, 12, 1031, 2042, 275, 3795, 12, 1011, 829, 304, 267, 945, 8710, 275, 13636, 4470, 7412, 297, 257, 990, 257, 510, 14716, 14, 8727, 5123, 16945, 267, 291, 14, 4640, 1419, 8, 829, 12, 945, 8710, 9, 267, 510, 14716, 14, 1352, 5294, 3339, 855, 826, 721, 277, 12, 1676, 9, 398, 291, 14, 932, 2042, 275, 1031, 2042, 267, 291, 14, 3352, 2081, 275, 488, 4960, 291, 14, 3352, 18, 68, 2081, 275, 488, 398, 291, 14, 15687, 275, 942, 267, 291, 14, 3512, 275, 942, 267, 291, 14, 1231, 2081, 275, 488, 398, 291, 14, 13061, 6216, 275, 6186, 63, 19162, 63, 11139, 260, 2728, 291, 14, 981, 29145, 3160, 342, 18418, 291, 14, 981, 9944, 342, 267, 291, 14, 981, 18730, 19162, 342, 2728, 291, 14, 4982, 27734, 275, 510, 14716, 14, 13129, 27734, 8, 277, 14, 5707, 17942, 1012, 339, 347, 1218, 29145, 3160, 8, 277, 304, 267, 291, 14, 1943, 275, 510, 14716, 14, 29145, 3160, 8, 277, 14, 5707, 17942, 1062, 4318, 1768, 1712, 275, 283, 78, 297, 4318, 1768, 63, 505, 275, 283, 29145, 3160, 297, 4318, 675, 72, 979, 890, 275, 413, 12, 4318, 394, 979, 63, 2063, 275, 1926, 12, 4318, 394, 979, 63, 3333, 275, 25647, 4258, 398, 291, 14, 1943, 14, 1389, 8, 6226, 88, 275, 650, 12, 22626, 275, 650, 12, 5554, 275, 699, 22949, 12, 6544, 275, 413, 9, 339, 347, 1218, 9944, 8, 277, 304, 267, 291, 14, 3467, 9778, 275, 22869, 8, 277, 14, 5707, 17942, 1062, 3044, 1768, 275, 298, 4578, 22869, 401, 3044, 687, 10683, 378, 14, 16, 12, 3044, 370, 275, 3388, 14, 16, 12, 3044, 12401, 275, 378, 14, 17, 12, 3044, 25626, 275, 8724, 12, 3044, 1414, 275, 291, 14, 265, 9944, 4152, 9, 2728, 291, 14, 3467, 9778, 14, 1389, 8, 2441, 275, 6578, 12, 5554, 275, 699, 22949, 12, 6544, 275, 413, 9, 267, 291, 14, 3467, 9778, 14, 409, 8, 16, 14, 16, 9, 5493, 347, 1218, 18730, 19162, 8, 277, 304, 267, 291, 14, 6635, 19162, 275, 16005, 8, 277, 14, 5707, 17942, 1062, 1318, 275, 283, 18730, 297, 1414, 275, 291, 14, 6635, 9, 267, 291, 14, 6635, 19162, 14, 1389, 8, 2441, 275, 6578, 12, 5554, 275, 699, 22949, 12, 6544, 275, 413, 9, 339, 14309, 9460, 272, 327, 7020, 445, 454, 478, 272, 14309, 9460, 3698, 272, 347, 1218, 2698, 35, 454, 478, 8, 277, 304, 267, 340, 291, 14, 3352, 2081, 508, 488, 503, 291, 14, 3352, 18, 68, 2081, 508, 488, 26, 288, 372, 2728, 3141, 5571, 275, 291, 14, 3352, 2081, 14, 362, 9787, 5571, 24543, 277, 14, 3352, 18, 68, 2081, 14, 362, 9787, 5571, 342, 2728, 291, 14, 23897, 9778, 8, 277, 14, 3352, 2081, 12, 3141, 5571, 9, 267, 291, 14, 23897, 9778, 8, 277, 14, 3352, 18, 68, 2081, 12, 3141, 5571, 9, 398, 291, 14, 31675, 480, 1761, 401, 3141, 5571, 9, 2432, 272, 347, 663, 6888, 8, 277, 12, 1676, 12, 2783, 304, 267, 291, 14, 1943, 905, 1302, 63, 505, 937, 275, 26503, 83, 61, 446, 450, 83, 2783, 2, 450, 334, 1708, 12, 2783, 9, 260, 339, 347, 5305, 35, 454, 478, 8, 277, 304, 27144, 367, 5528, 315, 291, 14, 15687, 26, 288, 291, 14, 4982, 27734, 14, 324, 3409, 8, 3887, 9, 288, 5528, 14, 7237, 342, 267, 291, 14, 15687, 275, 942, 398, 367, 1768, 315, 291, 14, 3512, 26, 288, 1768, 14, 7237, 342, 267, 291, 14, 3512, 275, 942, 339, 347, 664, 4665, 4259, 8, 277, 12, 3462, 12, 10463, 304, 3515, 267, 892, 19162, 275, 221, 16005, 8, 277, 14, 1943, 14, 5707, 17942, 1062, 12793, 717, 12514, 275, 644, 12, 717, 3462, 275, 3462, 9, 398, 340, 10463, 508, 378, 14, 16, 26, 288, 892, 19162, 459, 6856, 418, 275, 298, 16708, 2, 288, 892, 19162, 459, 505, 418, 275, 14530, 267, 587, 26, 288, 892, 19162, 459, 6856, 418, 275, 510, 14716, 14, 4117, 14, 25016, 18, 354, 8, 16, 14, 16, 12, 413, 14, 16, 13, 6884, 9, 288, 892, 19162, 459, 505, 418, 275, 2071, 16, 14, 18, 70, 8530, 2, 450, 334, 6884, 10, 1960, 14, 16, 9, 398, 372, 892, 19162, 339, 347, 1050, 12887, 9778, 8, 277, 12, 1242, 12, 3141, 5571, 304, 267, 291, 14, 525, 4314, 10994, 277, 61, 520, 450, 83, 2783, 2, 450, 1242, 14, 362, 12887, 9787, 5571, 1012, 398, 22342, 275, 291, 14, 525, 4259, 8, 1053, 14, 362, 12887, 9787, 5571, 1062, 1169, 3141, 5571, 12, 1169, 291, 14, 265, 12887, 4259, 7027, 8442, 12, 1169, 291, 14, 265, 12887, 4259, 8205, 8442, 12, 1169, 1242, 9, 20950, 347, 1050, 3493, 9778, 8, 277, 12, 1242, 12, 3141, 5571, 304, 267, 291, 14, 525, 4314, 3647, 83, 359, 25389, 83, 61, 520, 450, 83, 2783, 2, 450, 334, 1053, 14, 16405, 1062, 6059, 1242, 14, 362, 5667, 7139, 1062, 6059, 1242, 14, 362, 9787, 5571, 4059, 2728, 22342, 275, 291, 14, 525, 4259, 8, 1053, 14, 362, 9787, 5571, 1062, 1169, 3141, 5571, 12, 1169, 291, 14, 265, 3493, 4259, 7027, 8442, 12, 1169, 291, 14, 265, 3493, 4259, 8205, 8442, 12, 1169, 1242, 9, 339, 347, 1050, 4259, 8, 277, 12, 12759, 5571, 12, 3141, 5571, 12, 2562, 7027, 8442, 12, 2562, 8205, 8442, 12, 1242, 304, 267, 3462, 275, 291, 14, 362, 19162, 6216, 8, 11417, 5571, 12, 3141, 5571, 9, 398, 340, 3141, 5571, 508, 378, 26, 288, 10463, 275, 378, 14, 16, 267, 587, 26, 288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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
sschiau/swift
utils/gyb_syntax_support/Traits.py
39
1558
from Child import Child class Trait(object): def __init__(self, trait_name, description=None, children=None): self.trait_name = trait_name self.children = children self.description = description TRAITS = [ Trait('DeclGroup', children=[ Child('Attributes', kind='AttributeList', is_optional=True), Child('Modifiers', kind='ModifierList', is_optional=True), Child('Members', kind='MemberDeclBlock'), ]), Trait('Braced', children=[ Child('LeftBrace', kind='LeftBraceToken'), Child('RightBrace', kind='RightBraceToken'), ]), Trait('IdentifiedDecl', children=[ Child('Identifier', kind='IdentifierToken'), ]), Trait('WithCodeBlock', children=[ Child('Body', kind='CodeBlock'), ]), Trait('Parenthesized', children=[ Child('LeftParen', kind='LeftParenToken'), Child('RightParen', kind='RightParenToken'), ]), Trait('WithTrailingComma', children=[ Child('TrailingComma', kind='CommaToken', is_optional=True), ]), Trait('Labeled', children=[ Child('LabelName', kind='IdentifierToken', is_optional=True), Child('LabelColon', kind='ColonToken', is_optional=True), ]), Trait('WithStatements', children=[ Child('Statements', kind='CodeBlockItemList'), ]), ]
apache-2.0
[ 504, 12988, 492, 12988, 421, 199, 533, 12643, 390, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 30576, 63, 354, 12, 1369, 29, 403, 12, 4978, 29, 403, 304, 267, 291, 14, 22687, 63, 354, 275, 30576, 63, 354, 267, 291, 14, 3223, 275, 4978, 267, 291, 14, 1802, 275, 1369, 421, 199, 13954, 5930, 275, 359, 272, 12643, 390, 360, 20856, 2448, 297, 881, 4978, 1524, 1598, 12988, 360, 5379, 297, 4928, 534, 1646, 1296, 297, 365, 63, 4144, 29, 549, 395, 1598, 12988, 360, 7469, 6069, 297, 4928, 534, 23871, 1296, 297, 365, 63, 4144, 29, 549, 395, 1598, 12988, 360, 23056, 297, 4928, 534, 7021, 20856, 3142, 659, 881, 17318, 339, 12643, 390, 360, 34, 5986, 68, 297, 881, 4978, 1524, 1598, 12988, 360, 8185, 34, 5986, 297, 4928, 534, 8185, 34, 5986, 3264, 659, 1598, 12988, 360, 9121, 34, 5986, 297, 4928, 534, 9121, 34, 5986, 3264, 659, 881, 17318, 339, 12643, 390, 360, 17062, 8981, 20856, 297, 881, 4978, 1524, 1598, 12988, 360, 7544, 297, 4928, 534, 7544, 3264, 659, 881, 17318, 339, 12643, 390, 360, 3007, 3034, 3142, 297, 881, 4978, 1524, 1598, 12988, 360, 8173, 297, 4928, 534, 3034, 3142, 659, 881, 17318, 339, 12643, 390, 360, 4232, 828, 1589, 15308, 297, 881, 4978, 1524, 1598, 12988, 360, 8185, 4232, 828, 297, 4928, 534, 8185, 4232, 828, 3264, 659, 1598, 12988, 360, 9121, 4232, 828, 297, 4928, 534, 9121, 4232, 828, 3264, 659, 881, 17318, 339, 12643, 390, 360, 3007, 2437, 5662, 25732, 297, 881, 4978, 1524, 1598, 12988, 360, 2437, 5662, 25732, 297, 4928, 534, 25732, 3264, 297, 365, 63, 4144, 29, 549, 395, 881, 17318, 339, 12643, 390, 360, 26545, 297, 881, 4978, 1524, 1598, 12988, 360, 4314, 985, 297, 4928, 534, 7544, 3264, 297, 365, 63, 4144, 29, 549, 395, 1598, 12988, 360, 4314, 2001, 265, 297, 4928, 534, 2001, 265, 3264, 297, 365, 63, 4144, 29, 549, 395, 881, 17318, 339, 12643, 390, 360, 3007, 2223, 1470, 297, 881, 4978, 1524, 1598, 12988, 360, 2223, 1470, 297, 4928, 534, 3034, 3142, 2081, 1296, 659, 881, 17318, 199, 61, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 12988, 492, 12988, 421, 199, 533, 12643, 390, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 30576, 63, 354, 12, 1369, 29, 403, 12, 4978, 29, 403, 304, 267, 291, 14, 22687, 63, 354, 275, 30576, 63, 354, 267, 291, 14, 3223, 275, 4978, 267, 291, 14, 1802, 275, 1369, 421, 199, 13954, 5930, 275, 359, 272, 12643, 390, 360, 20856, 2448, 297, 881, 4978, 1524, 1598, 12988, 360, 5379, 297, 4928, 534, 1646, 1296, 297, 365, 63, 4144, 29, 549, 395, 1598, 12988, 360, 7469, 6069, 297, 4928, 534, 23871, 1296, 297, 365, 63, 4144, 29, 549, 395, 1598, 12988, 360, 23056, 297, 4928, 534, 7021, 20856, 3142, 659, 881, 17318, 339, 12643, 390, 360, 34, 5986, 68, 297, 881, 4978, 1524, 1598, 12988, 360, 8185, 34, 5986, 297, 4928, 534, 8185, 34, 5986, 3264, 659, 1598, 12988, 360, 9121, 34, 5986, 297, 4928, 534, 9121, 34, 5986, 3264, 659, 881, 17318, 339, 12643, 390, 360, 17062, 8981, 20856, 297, 881, 4978, 1524, 1598, 12988, 360, 7544, 297, 4928, 534, 7544, 3264, 659, 881, 17318, 339, 12643, 390, 360, 3007, 3034, 3142, 297, 881, 4978, 1524, 1598, 12988, 360, 8173, 297, 4928, 534, 3034, 3142, 659, 881, 17318, 339, 12643, 390, 360, 4232, 828, 1589, 15308, 297, 881, 4978, 1524, 1598, 12988, 360, 8185, 4232, 828, 297, 4928, 534, 8185, 4232, 828, 3264, 659, 1598, 12988, 360, 9121, 4232, 828, 297, 4928, 534, 9121, 4232, 828, 3264, 659, 881, 17318, 339, 12643, 390, 360, 3007, 2437, 5662, 25732, 297, 881, 4978, 1524, 1598, 12988, 360, 2437, 5662, 25732, 297, 4928, 534, 25732, 3264, 297, 365, 63, 4144, 29, 549, 395, 881, 17318, 339, 12643, 390, 360, 26545, 297, 881, 4978, 1524, 1598, 12988, 360, 4314, 985, 297, 4928, 534, 7544, 3264, 297, 365, 63, 4144, 29, 549, 395, 1598, 12988, 360, 4314, 2001, 265, 297, 4928, 534, 2001, 265, 3264, 297, 365, 63, 4144, 29, 549, 395, 881, 17318, 339, 12643, 390, 360, 3007, 2223, 1470, 297, 881, 4978, 1524, 1598, 12988, 360, 2223, 1470, 297, 4928, 534, 3034, 3142, 2081, 1296, 659, 881, 17318, 199, 61, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
Asquera/bigcouch
couchjs/scons/scons-local-2.0.1/SCons/Platform/posix.py
61
8697
"""SCons.Platform.posix Platform-specific initialization for POSIX (Linux, UNIX, etc.) systems. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Platform/posix.py 5134 2010/08/16 23:02:40 bdeegan" import errno import os import os.path import subprocess import sys import select import SCons.Util from SCons.Platform import TempFileMunge exitvalmap = { 2 : 127, 13 : 126, } def escape(arg): "escape shell special characters" slash = '\\' special = '"$()' arg = arg.replace(slash, slash+slash) for c in special: arg = arg.replace(c, slash+c) return '"' + arg + '"' def exec_system(l, env): stat = os.system(' '.join(l)) if stat & 0xff: return stat | 0x80 return stat >> 8 def exec_spawnvpe(l, env): stat = os.spawnvpe(os.P_WAIT, l[0], l, env) # os.spawnvpe() returns the actual exit code, not the encoding # returned by os.waitpid() or os.system(). return stat def exec_fork(l, env): pid = os.fork() if not pid: # Child process. exitval = 127 try: os.execvpe(l[0], l, env) except OSError, e: exitval = exitvalmap.get(e[0], e[0]) sys.stderr.write("scons: %s: %s\n" % (l[0], e[1])) os._exit(exitval) else: # Parent process. pid, stat = os.waitpid(pid, 0) if stat & 0xff: return stat | 0x80 return stat >> 8 def _get_env_command(sh, escape, cmd, args, env): s = ' '.join(args) if env: l = ['env', '-'] + \ [escape(t[0])+'='+escape(t[1]) for t in env.items()] + \ [sh, '-c', escape(s)] s = ' '.join(l) return s def env_spawn(sh, escape, cmd, args, env): return exec_system([_get_env_command( sh, escape, cmd, args, env)], env) def spawnvpe_spawn(sh, escape, cmd, args, env): return exec_spawnvpe([sh, '-c', ' '.join(args)], env) def fork_spawn(sh, escape, cmd, args, env): return exec_fork([sh, '-c', ' '.join(args)], env) def process_cmd_output(cmd_stdout, cmd_stderr, stdout, stderr): stdout_eof = stderr_eof = 0 while not (stdout_eof and stderr_eof): try: (i,o,e) = select.select([cmd_stdout, cmd_stderr], [], []) if cmd_stdout in i: str = cmd_stdout.read() if len(str) == 0: stdout_eof = 1 elif stdout is not None: stdout.write(str) if cmd_stderr in i: str = cmd_stderr.read() if len(str) == 0: #sys.__stderr__.write( "stderr_eof=1\n" ) stderr_eof = 1 else: #sys.__stderr__.write( "str(stderr) = %s\n" % str ) stderr.write(str) except select.error, (_errno, _strerror): if _errno != errno.EINTR: raise def exec_popen3(l, env, stdout, stderr): proc = subprocess.Popen(' '.join(l), stdout=stdout, stderr=stderr, shell=True) stat = proc.wait() if stat & 0xff: return stat | 0x80 return stat >> 8 def exec_piped_fork(l, env, stdout, stderr): # spawn using fork / exec and providing a pipe for the command's # stdout / stderr stream if stdout != stderr: (rFdOut, wFdOut) = os.pipe() (rFdErr, wFdErr) = os.pipe() else: (rFdOut, wFdOut) = os.pipe() rFdErr = rFdOut wFdErr = wFdOut # do the fork pid = os.fork() if not pid: # Child process os.close( rFdOut ) if rFdOut != rFdErr: os.close( rFdErr ) os.dup2( wFdOut, 1 ) # is there some symbolic way to do that ? os.dup2( wFdErr, 2 ) os.close( wFdOut ) if stdout != stderr: os.close( wFdErr ) exitval = 127 try: os.execvpe(l[0], l, env) except OSError, e: exitval = exitvalmap.get(e[0], e[0]) stderr.write("scons: %s: %s\n" % (l[0], e[1])) os._exit(exitval) else: # Parent process pid, stat = os.waitpid(pid, 0) os.close( wFdOut ) if stdout != stderr: os.close( wFdErr ) childOut = os.fdopen( rFdOut ) if stdout != stderr: childErr = os.fdopen( rFdErr ) else: childErr = childOut process_cmd_output(childOut, childErr, stdout, stderr) os.close( rFdOut ) if stdout != stderr: os.close( rFdErr ) if stat & 0xff: return stat | 0x80 return stat >> 8 def piped_env_spawn(sh, escape, cmd, args, env, stdout, stderr): # spawn using Popen3 combined with the env command # the command name and the command's stdout is written to stdout # the command's stderr is written to stderr return exec_popen3([_get_env_command(sh, escape, cmd, args, env)], env, stdout, stderr) def piped_fork_spawn(sh, escape, cmd, args, env, stdout, stderr): # spawn using fork / exec and providing a pipe for the command's # stdout / stderr stream return exec_piped_fork([sh, '-c', ' '.join(args)], env, stdout, stderr) def generate(env): # If os.spawnvpe() exists, we use it to spawn commands. Otherwise # if the env utility exists, we use os.system() to spawn commands, # finally we fall back on os.fork()/os.exec(). # # os.spawnvpe() is prefered because it is the most efficient. But # for Python versions without it, os.system() is prefered because it # is claimed that it works better with threads (i.e. -j) and is more # efficient than forking Python. # # NB: Other people on the scons-users mailing list have claimed that # os.fork()/os.exec() works better than os.system(). There may just # not be a default that works best for all users. if 'spawnvpe' in os.__dict__: spawn = spawnvpe_spawn elif env.Detect('env'): spawn = env_spawn else: spawn = fork_spawn if env.Detect('env'): pspawn = piped_env_spawn else: pspawn = piped_fork_spawn if 'ENV' not in env: env['ENV'] = {} env['ENV']['PATH'] = '/usr/local/bin:/opt/bin:/bin:/usr/bin' env['OBJPREFIX'] = '' env['OBJSUFFIX'] = '.o' env['SHOBJPREFIX'] = '$OBJPREFIX' env['SHOBJSUFFIX'] = '$OBJSUFFIX' env['PROGPREFIX'] = '' env['PROGSUFFIX'] = '' env['LIBPREFIX'] = 'lib' env['LIBSUFFIX'] = '.a' env['SHLIBPREFIX'] = '$LIBPREFIX' env['SHLIBSUFFIX'] = '.so' env['LIBPREFIXES'] = [ '$LIBPREFIX' ] env['LIBSUFFIXES'] = [ '$LIBSUFFIX', '$SHLIBSUFFIX' ] env['PSPAWN'] = pspawn env['SPAWN'] = spawn env['SHELL'] = 'sh' env['ESCAPE'] = escape env['TEMPFILE'] = TempFileMunge env['TEMPFILEPREFIX'] = '@' #Based on LINUX: ARG_MAX=ARG_MAX=131072 - 3000 for environment expansion #Note: specific platforms might rise or lower this value env['MAXLINELENGTH'] = 128072 # This platform supports RPATH specifications. env['__RPATH'] = '$_RPATH' # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
apache-2.0
[ 624, 18521, 14, 10397, 14, 9228, 199, 199, 10397, 13, 6100, 11097, 367, 18169, 334, 14091, 12, 22242, 12, 5423, 4959, 10460, 14, 199, 199, 10924, 12252, 9296, 1133, 506, 1263, 1929, 370, 492, 642, 859, 5370, 14, 221, 2779, 199, 14117, 9987, 506, 8439, 4012, 314, 7809, 8218, 14, 10397, 14, 10397, 342, 199, 5592, 1083, 14, 199, 624, 199, 199, 3, 199, 3, 1898, 334, 67, 9, 12521, 12, 14790, 12, 13004, 12, 8353, 12, 11811, 12, 8315, 12, 10219, 12, 9079, 12, 8937, 12, 7129, 710, 8218, 2752, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 199, 3, 282, 1331, 402, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 199, 3, 298, 10337, 1288, 370, 7962, 315, 314, 2290, 1928, 10588, 12, 5893, 199, 3, 1928, 12305, 314, 4481, 370, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 199, 3, 11207, 12, 13473, 12, 436, 15, 269, 12743, 6866, 402, 314, 2290, 12, 436, 370, 199, 3, 11291, 12103, 370, 12676, 314, 2290, 365, 13985, 370, 886, 880, 12, 5420, 370, 199, 3, 314, 2569, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 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, 199, 3, 3826, 12, 7168, 1549, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 199, 3, 2990, 1634, 3169, 12, 3092, 2381, 437, 3115, 3104, 2401, 199, 3, 13229, 14, 1621, 4825, 6461, 7000, 2334, 10610, 1549, 5877, 8164, 6262, 199, 3, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 5603, 12, 7061, 1621, 1261, 9612, 199, 3, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 4442, 12, 5738, 1634, 1549, 1621, 11287, 199, 3, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 5010, 13198, 1621, 2334, 4141, 14, 199, 3, 199, 199, 363, 5792, 363, 275, 298, 2164, 15, 3908, 15, 18521, 15, 10397, 15, 9228, 14, 647, 959, 7582, 7129, 15, 2036, 15, 975, 6546, 26, 996, 26, 2167, 330, 271, 5902, 290, 2, 199, 199, 646, 7554, 199, 646, 747, 199, 646, 747, 14, 515, 199, 646, 3873, 199, 646, 984, 199, 646, 3504, 199, 199, 646, 8218, 14, 9562, 199, 504, 8218, 14, 10397, 492, 12540, 1173, 45, 16993, 199, 199, 2224, 637, 1130, 275, 469, 272, 499, 520, 12792, 12, 272, 4944, 520, 21572, 12, 199, 93, 199, 199, 318, 4772, 8, 1273, 304, 272, 298, 3765, 5218, 4539, 4110, 2, 272, 14457, 275, 22548, 272, 4539, 275, 5522, 4, 11716, 339, 1680, 275, 1680, 14, 1814, 8, 7001, 12, 14457, 11, 7001, 9, 272, 367, 286, 315, 4539, 26, 267, 1680, 275, 1680, 14, 1814, 8, 67, 12, 14457, 11, 67, 9, 339, 372, 14788, 435, 1680, 435, 14788, 199, 199, 318, 2146, 63, 2253, 8, 76, 12, 2589, 304, 272, 5672, 275, 747, 14, 2253, 360, 1987, 904, 8, 76, 430, 272, 340, 5672, 1253, 378, 3581, 26, 267, 372, 5672, 1204, 378, 88, 1257, 272, 372, 5672, 4331, 1695, 199, 199, 318, 2146, 63, 10212, 86, 321, 8, 76, 12, 2589, 304, 272, 5672, 275, 747, 14, 10212, 86, 321, 8, 736, 14, 48, 63, 12458, 12, 634, 59, 16, 467, 634, 12, 2589, 9, 272, 327, 747, 14, 10212, 86, 321, 342, 2529, 314, 3503, 4458, 1233, 12, 440, 314, 2644, 272, 327, 2138, 701, 747, 14, 2573, 3150, 342, 503, 747, 14, 2253, 1252, 272, 372, 5672, 199, 199, 318, 2146, 63, 11796, 8, 76, 12, 2589, 304, 5591, 4422, 275, 747, 14, 11796, 342, 272, 340, 440, 4422, 26, 267, 327, 12988, 2112, 14, 267, 4458, 637, 275, 12792, 267, 862, 26, 288, 747, 14, 1628, 86, 321, 8, 76, 59, 16, 467, 634, 12, 2589, 9, 267, 871, 6440, 12, 325, 26, 288, 4458, 637, 275, 4458, 637, 1130, 14, 362, 8, 69, 59, 16, 467, 325, 59, 16, 566, 288, 984, 14, 3083, 14, 952, 480, 21529, 26, 450, 83, 26, 450, 83, 60, 78, 2, 450, 334, 76, 59, 16, 467, 325, 59, 17, 2459, 267, 747, 423, 2224, 8, 2224, 637, 9, 272, 587, 26, 267, 327, 16396, 2112, 14, 267, 4422, 12, 5672, 275, 747, 14, 2573, 3150, 8, 3150, 12, 378, 9, 267, 340, 5672, 1253, 378, 3581, 26, 288, 372, 5672, 1204, 378, 88, 1257, 267, 372, 5672, 4331, 1695, 199, 199, 318, 485, 362, 63, 1813, 63, 1531, 8, 609, 12, 4772, 12, 2088, 12, 1249, 12, 2589, 304, 272, 308, 275, 283, 1987, 904, 8, 589, 9, 272, 340, 2589, 26, 267, 634, 275, 788, 1813, 297, 2475, 418, 435, 971, 288, 359, 3765, 8, 84, 59, 16, 566, 4786, 22078, 3765, 8, 84, 59, 17, 566, 367, 307, 315, 2589, 14, 1744, 5106, 435, 971, 288, 359, 609, 12, 2475, 67, 297, 4772, 8, 83, 1874, 267, 308, 275, 283, 1987, 904, 8, 76, 9, 272, 372, 308, 199, 199, 318, 2589, 63, 10212, 8, 609, 12, 4772, 12, 2088, 12, 1249, 12, 2589, 304, 272, 372, 2146, 63, 2253, 779, 63, 362, 63, 1813, 63, 1531, 8, 1033, 12, 4772, 12, 2088, 12, 1249, 12, 2589, 4360, 2589, 9, 199, 199, 318, 15187, 86, 321, 63, 10212, 8, 609, 12, 4772, 12, 2088, 12, 1249, 12, 2589, 304, 272, 372, 2146, 63, 10212, 86, 321, 779, 609, 12, 2475, 67, 297, 283, 1987, 904, 8, 589, 4360, 2589, 9, 199, 199, 318, 14926, 63, 10212, 8, 609, 12, 4772, 12, 2088, 12, 1249, 12, 2589, 304, 272, 372, 2146, 63, 11796, 779, 609, 12, 2475, 67, 297, 283, 1987, 904, 8, 589, 4360, 2589, 9, 199, 199, 318, 2112, 63, 1760, 63, 1199, 8, 1760, 63, 2703, 12, 2088, 63, 3083, 12, 3839, 12, 4635, 304, 272, 3839, 63, 11670, 275, 4635, 63, 11670, 275, 378, 272, 1830, 440, 334, 2703, 63, 11670, 436, 4635, 63, 11670, 304, 267, 862, 26, 288, 334, 73, 12, 79, 12, 69, 9, 275, 3504, 14, 2416, 779, 1760, 63, 2703, 12, 2088, 63, 3083, 467, 990, 3073, 288, 340, 2088, 63, 2703 ]
[ 18521, 14, 10397, 14, 9228, 199, 199, 10397, 13, 6100, 11097, 367, 18169, 334, 14091, 12, 22242, 12, 5423, 4959, 10460, 14, 199, 199, 10924, 12252, 9296, 1133, 506, 1263, 1929, 370, 492, 642, 859, 5370, 14, 221, 2779, 199, 14117, 9987, 506, 8439, 4012, 314, 7809, 8218, 14, 10397, 14, 10397, 342, 199, 5592, 1083, 14, 199, 624, 199, 199, 3, 199, 3, 1898, 334, 67, 9, 12521, 12, 14790, 12, 13004, 12, 8353, 12, 11811, 12, 8315, 12, 10219, 12, 9079, 12, 8937, 12, 7129, 710, 8218, 2752, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 199, 3, 282, 1331, 402, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 199, 3, 298, 10337, 1288, 370, 7962, 315, 314, 2290, 1928, 10588, 12, 5893, 199, 3, 1928, 12305, 314, 4481, 370, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 199, 3, 11207, 12, 13473, 12, 436, 15, 269, 12743, 6866, 402, 314, 2290, 12, 436, 370, 199, 3, 11291, 12103, 370, 12676, 314, 2290, 365, 13985, 370, 886, 880, 12, 5420, 370, 199, 3, 314, 2569, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 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, 199, 3, 3826, 12, 7168, 1549, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 199, 3, 2990, 1634, 3169, 12, 3092, 2381, 437, 3115, 3104, 2401, 199, 3, 13229, 14, 1621, 4825, 6461, 7000, 2334, 10610, 1549, 5877, 8164, 6262, 199, 3, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 5603, 12, 7061, 1621, 1261, 9612, 199, 3, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 4442, 12, 5738, 1634, 1549, 1621, 11287, 199, 3, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 5010, 13198, 1621, 2334, 4141, 14, 199, 3, 199, 199, 363, 5792, 363, 275, 298, 2164, 15, 3908, 15, 18521, 15, 10397, 15, 9228, 14, 647, 959, 7582, 7129, 15, 2036, 15, 975, 6546, 26, 996, 26, 2167, 330, 271, 5902, 290, 2, 199, 199, 646, 7554, 199, 646, 747, 199, 646, 747, 14, 515, 199, 646, 3873, 199, 646, 984, 199, 646, 3504, 199, 199, 646, 8218, 14, 9562, 199, 504, 8218, 14, 10397, 492, 12540, 1173, 45, 16993, 199, 199, 2224, 637, 1130, 275, 469, 272, 499, 520, 12792, 12, 272, 4944, 520, 21572, 12, 199, 93, 199, 199, 318, 4772, 8, 1273, 304, 272, 298, 3765, 5218, 4539, 4110, 2, 272, 14457, 275, 22548, 272, 4539, 275, 5522, 4, 11716, 339, 1680, 275, 1680, 14, 1814, 8, 7001, 12, 14457, 11, 7001, 9, 272, 367, 286, 315, 4539, 26, 267, 1680, 275, 1680, 14, 1814, 8, 67, 12, 14457, 11, 67, 9, 339, 372, 14788, 435, 1680, 435, 14788, 199, 199, 318, 2146, 63, 2253, 8, 76, 12, 2589, 304, 272, 5672, 275, 747, 14, 2253, 360, 1987, 904, 8, 76, 430, 272, 340, 5672, 1253, 378, 3581, 26, 267, 372, 5672, 1204, 378, 88, 1257, 272, 372, 5672, 4331, 1695, 199, 199, 318, 2146, 63, 10212, 86, 321, 8, 76, 12, 2589, 304, 272, 5672, 275, 747, 14, 10212, 86, 321, 8, 736, 14, 48, 63, 12458, 12, 634, 59, 16, 467, 634, 12, 2589, 9, 272, 327, 747, 14, 10212, 86, 321, 342, 2529, 314, 3503, 4458, 1233, 12, 440, 314, 2644, 272, 327, 2138, 701, 747, 14, 2573, 3150, 342, 503, 747, 14, 2253, 1252, 272, 372, 5672, 199, 199, 318, 2146, 63, 11796, 8, 76, 12, 2589, 304, 5591, 4422, 275, 747, 14, 11796, 342, 272, 340, 440, 4422, 26, 267, 327, 12988, 2112, 14, 267, 4458, 637, 275, 12792, 267, 862, 26, 288, 747, 14, 1628, 86, 321, 8, 76, 59, 16, 467, 634, 12, 2589, 9, 267, 871, 6440, 12, 325, 26, 288, 4458, 637, 275, 4458, 637, 1130, 14, 362, 8, 69, 59, 16, 467, 325, 59, 16, 566, 288, 984, 14, 3083, 14, 952, 480, 21529, 26, 450, 83, 26, 450, 83, 60, 78, 2, 450, 334, 76, 59, 16, 467, 325, 59, 17, 2459, 267, 747, 423, 2224, 8, 2224, 637, 9, 272, 587, 26, 267, 327, 16396, 2112, 14, 267, 4422, 12, 5672, 275, 747, 14, 2573, 3150, 8, 3150, 12, 378, 9, 267, 340, 5672, 1253, 378, 3581, 26, 288, 372, 5672, 1204, 378, 88, 1257, 267, 372, 5672, 4331, 1695, 199, 199, 318, 485, 362, 63, 1813, 63, 1531, 8, 609, 12, 4772, 12, 2088, 12, 1249, 12, 2589, 304, 272, 308, 275, 283, 1987, 904, 8, 589, 9, 272, 340, 2589, 26, 267, 634, 275, 788, 1813, 297, 2475, 418, 435, 971, 288, 359, 3765, 8, 84, 59, 16, 566, 4786, 22078, 3765, 8, 84, 59, 17, 566, 367, 307, 315, 2589, 14, 1744, 5106, 435, 971, 288, 359, 609, 12, 2475, 67, 297, 4772, 8, 83, 1874, 267, 308, 275, 283, 1987, 904, 8, 76, 9, 272, 372, 308, 199, 199, 318, 2589, 63, 10212, 8, 609, 12, 4772, 12, 2088, 12, 1249, 12, 2589, 304, 272, 372, 2146, 63, 2253, 779, 63, 362, 63, 1813, 63, 1531, 8, 1033, 12, 4772, 12, 2088, 12, 1249, 12, 2589, 4360, 2589, 9, 199, 199, 318, 15187, 86, 321, 63, 10212, 8, 609, 12, 4772, 12, 2088, 12, 1249, 12, 2589, 304, 272, 372, 2146, 63, 10212, 86, 321, 779, 609, 12, 2475, 67, 297, 283, 1987, 904, 8, 589, 4360, 2589, 9, 199, 199, 318, 14926, 63, 10212, 8, 609, 12, 4772, 12, 2088, 12, 1249, 12, 2589, 304, 272, 372, 2146, 63, 11796, 779, 609, 12, 2475, 67, 297, 283, 1987, 904, 8, 589, 4360, 2589, 9, 199, 199, 318, 2112, 63, 1760, 63, 1199, 8, 1760, 63, 2703, 12, 2088, 63, 3083, 12, 3839, 12, 4635, 304, 272, 3839, 63, 11670, 275, 4635, 63, 11670, 275, 378, 272, 1830, 440, 334, 2703, 63, 11670, 436, 4635, 63, 11670, 304, 267, 862, 26, 288, 334, 73, 12, 79, 12, 69, 9, 275, 3504, 14, 2416, 779, 1760, 63, 2703, 12, 2088, 63, 3083, 467, 990, 3073, 288, 340, 2088, 63, 2703, 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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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
morsdatum/ArangoDB
3rdParty/V8/tools/testrunner/local/statusfile.py
16
4705
# Copyright 2012 the V8 project authors. 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. # These imports are required for the on-demand conversion from # old to new status file format. from os.path import exists from os.path import getmtime from . import old_statusfile # These outcomes can occur in a TestCase's outcomes list: SKIP = "SKIP" FAIL = "FAIL" PASS = "PASS" OKAY = "OKAY" TIMEOUT = "TIMEOUT" CRASH = "CRASH" SLOW = "SLOW" # These are just for the status files and are mapped below in DEFS: FAIL_OK = "FAIL_OK" PASS_OR_FAIL = "PASS_OR_FAIL" ALWAYS = "ALWAYS" KEYWORDS = {} for key in [SKIP, FAIL, PASS, OKAY, TIMEOUT, CRASH, SLOW, FAIL_OK, PASS_OR_FAIL, ALWAYS]: KEYWORDS[key] = key DEFS = {FAIL_OK: [FAIL, OKAY], PASS_OR_FAIL: [PASS, FAIL]} # Support arches, modes to be written as keywords instead of strings. VARIABLES = {ALWAYS: True} for var in ["debug", "release", "android_arm", "android_ia32", "arm", "ia32", "mipsel", "x64"]: VARIABLES[var] = var def DoSkip(outcomes): return SKIP in outcomes or SLOW in outcomes def IsFlaky(outcomes): return ((PASS in outcomes) and (FAIL in outcomes) and (not CRASH in outcomes) and (not OKAY in outcomes)) def IsFailOk(outcomes): return (FAIL in outcomes) and (OKAY in outcomes) def _AddOutcome(result, new): global DEFS if new in DEFS: mapped = DEFS[new] if type(mapped) == list: for m in mapped: _AddOutcome(result, m) elif type(mapped) == str: _AddOutcome(result, mapped) else: result.add(new) def _ParseOutcomeList(rule, outcomes, target_dict, variables): result = set([]) if type(outcomes) == str: outcomes = [outcomes] for item in outcomes: if type(item) == str: _AddOutcome(result, item) elif type(item) == list: if not eval(item[0], variables): continue for outcome in item[1:]: assert type(outcome) == str _AddOutcome(result, outcome) else: assert False if len(result) == 0: return if rule in target_dict: target_dict[rule] |= result else: target_dict[rule] = result def ReadStatusFile(path, variables): # As long as the old-format .status files are authoritative, just # create the converted version on demand and cache it to speed up # subsequent runs. if path.endswith(".status"): newpath = path + "2" if not exists(newpath) or getmtime(newpath) < getmtime(path): print "Converting status file." converted = old_statusfile.ConvertNotation(path).GetOutput() with open(newpath, 'w') as f: f.write(converted) path = newpath with open(path) as f: global KEYWORDS contents = eval(f.read(), KEYWORDS) rules = {} wildcards = {} variables.update(VARIABLES) for section in contents: assert type(section) == list assert len(section) == 2 if not eval(section[0], variables): continue section = section[1] assert type(section) == dict for rule in section: assert type(rule) == str if rule[-1] == '*': _ParseOutcomeList(rule, section[rule], wildcards, variables) else: _ParseOutcomeList(rule, section[rule], rules, variables) return rules, wildcards
apache-2.0
[ 3, 1898, 6029, 314, 812, 24, 2199, 11462, 14, 2900, 4481, 4644, 14, 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, 755, 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, 755, 4248, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 199, 3, 755, 6450, 315, 314, 3794, 436, 15, 269, 1163, 8418, 2741, 199, 3, 755, 543, 314, 4084, 14, 199, 3, 258, 627, 11443, 314, 536, 402, 4475, 3277, 14, 6590, 314, 1561, 402, 2399, 199, 3, 755, 8417, 1443, 506, 1202, 370, 10692, 503, 10016, 7585, 7131, 199, 3, 755, 687, 642, 2032, 1928, 2488, 6791, 5313, 4983, 14, 199, 3, 199, 3, 5749, 4141, 2281, 7049, 6515, 2334, 5877, 8164, 2401, 6483, 199, 3, 298, 1179, 2281, 2, 2401, 1821, 7168, 1549, 5292, 2990, 12, 6931, 12, 5400, 2845, 199, 3, 5471, 2296, 12, 2334, 5292, 2990, 1634, 3169, 2401, 3092, 2381, 199, 3, 437, 3115, 3104, 9315, 9706, 14, 1621, 4825, 6461, 7000, 2334, 5877, 199, 3, 11489, 1549, 6483, 6262, 7024, 2381, 1821, 8703, 12, 9168, 12, 9716, 12, 199, 3, 8820, 12, 9836, 12, 1549, 9110, 6736, 334, 6446, 12, 5400, 2845, 199, 3, 5471, 2296, 12, 9838, 1634, 9103, 9764, 1549, 9714, 27, 9102, 1634, 4815, 12, 199, 3, 7126, 12, 1549, 9206, 27, 1549, 9748, 9831, 9, 9802, 9817, 2401, 5258, 1821, 199, 3, 9815, 1634, 5603, 12, 7061, 1621, 7066, 12, 9644, 5603, 12, 1549, 7056, 199, 3, 334, 6446, 9254, 1549, 7334, 9, 7043, 1621, 1821, 9683, 5738, 1634, 2334, 4815, 199, 3, 1634, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 9726, 1634, 9712, 9784, 14, 421, 199, 3, 5723, 8925, 787, 1415, 367, 314, 641, 13, 24152, 8603, 687, 199, 3, 2269, 370, 892, 2004, 570, 1475, 14, 199, 504, 747, 14, 515, 492, 3495, 199, 504, 747, 14, 515, 492, 664, 8180, 199, 199, 504, 1275, 492, 2269, 63, 1205, 493, 421, 199, 3, 5723, 15955, 83, 883, 4781, 315, 282, 7640, 1159, 15955, 83, 769, 26, 199, 13525, 275, 298, 13525, 2, 199, 8784, 275, 298, 8784, 2, 199, 6909, 275, 298, 6909, 2, 199, 3593, 3448, 275, 298, 3593, 3448, 2, 199, 8899, 275, 298, 8899, 2, 199, 2944, 8100, 275, 298, 2944, 8100, 2, 199, 51, 5896, 275, 298, 51, 5896, 2, 199, 3, 5723, 787, 2951, 367, 314, 2004, 1584, 436, 787, 9994, 5084, 315, 28259, 26, 199, 8784, 63, 3593, 275, 298, 8784, 63, 3593, 2, 199, 6909, 63, 726, 63, 8784, 275, 298, 6909, 63, 726, 63, 8784, 2, 199, 199, 32509, 275, 298, 32509, 2, 199, 199, 32187, 275, 1052, 199, 509, 790, 315, 359, 13525, 12, 10341, 12, 21705, 12, 9949, 3448, 12, 29998, 12, 17101, 8100, 12, 428, 5896, 12, 10341, 63, 3593, 12, 288, 21705, 63, 726, 63, 8784, 12, 12112, 26194, 2189, 523, 9301, 19984, 59, 498, 61, 275, 790, 199, 199, 5638, 51, 275, 469, 8784, 63, 3593, 26, 359, 8784, 12, 9949, 3448, 467, 267, 21705, 63, 726, 63, 8784, 26, 359, 6909, 12, 10341, 9420, 199, 199, 3, 12502, 3819, 397, 12, 12404, 370, 506, 5313, 465, 7681, 3140, 402, 3326, 14, 199, 21161, 275, 469, 32509, 26, 715, 93, 199, 509, 2729, 315, 2097, 1757, 401, 298, 3221, 401, 298, 6238, 63, 5362, 401, 298, 6238, 63, 4674, 708, 401, 298, 5362, 401, 298, 4674, 708, 401, 288, 298, 20496, 5891, 401, 298, 88, 772, 6229, 523, 30098, 17041, 59, 1391, 61, 275, 2729, 421, 199, 318, 4226, 7738, 8, 17502, 83, 304, 523, 372, 27885, 315, 15955, 83, 503, 428, 5896, 315, 15955, 83, 421, 199, 318, 6596, 38, 416, 10562, 8, 17502, 83, 304, 523, 372, 3666, 6909, 315, 15955, 83, 9, 436, 334, 8784, 315, 15955, 83, 9, 436, 881, 334, 1397, 17101, 8100, 315, 15955, 83, 9, 436, 334, 1397, 9949, 3448, 315, 15955, 83, 430, 421, 199, 318, 6596, 4874, 11622, 8, 17502, 83, 304, 272, 372, 334, 8784, 315, 15955, 83, 9, 436, 334, 3593, 3448, 315, 15955, 83, 9, 421, 199, 318, 485, 1123, 2204, 4352, 8, 1099, 12, 892, 304, 523, 2288, 28259, 523, 340, 892, 315, 28259, 26, 272, 9994, 275, 28259, 59, 1222, 61, 272, 340, 730, 8, 11663, 9, 508, 769, 26, 489, 367, 333, 315, 9994, 26, 267, 485, 1123, 2204, 4352, 8, 1099, 12, 333, 9, 272, 916, 730, 8, 11663, 9, 508, 620, 26, 489, 485, 1123, 2204, 4352, 8, 1099, 12, 9994, 9, 523, 587, 26, 272, 754, 14, 525, 8, 1222, 9, 421, 199, 318, 485, 4003, 2204, 4352, 1296, 8, 2200, 12, 15955, 83, 12, 1347, 63, 807, 12, 2860, 304, 523, 754, 275, 663, 4157, 523, 340, 730, 8, 17502, 83, 9, 508, 620, 26, 2043, 15955, 83, 275, 359, 17502, 83, 61, 523, 367, 1242, 315, 15955, 83, 26, 272, 340, 730, 8, 1053, 9, 508, 620, 26, 489, 485, 1123, 2204, 4352, 8, 1099, 12, 1242, 9, 272, 916, 730, 8, 1053, 9, 508, 769, 26, 489, 340, 440, 3468, 8, 1053, 59, 16, 467, 2860, 304, 1980, 489, 367, 15955, 315, 1242, 59, 17, 10688, 267, 702, 730, 8, 17502, 9, 508, 620, 267, 485, 1123, 2204, 4352, 8, 1099, 12, 15955, 9, 272, 587, 26, 489, 702, 756, 523, 340, 822, 8, 1099, 9, 508, 378, 26, 372, 523, 340, 2332, 315, 1347, 63, 807, 26, 272, 1347, 63, 807, 59, 2200, 61, 8901, 754, 523, 587, 26, 272, 1347, 63, 807, 59, 2200, 61, 275, 754, 421, 199, 318, 5574, 3694, 1173, 8, 515, 12, 2860, 304, 523, 327, 3709, 1846, 465, 314, 2269, 13, 908, 1275, 1205, 1584, 787, 4132, 390, 1905, 12, 2951, 523, 327, 1218, 314, 6702, 1015, 641, 29237, 436, 2581, 652, 370, 8112, 1536, 523, 327, 13372, 7858, 14, 523, 340, 931, 14, 4130, 9520, 1205, 2349, 272, 30965, 275, 931 ]
[ 1898, 6029, 314, 812, 24, 2199, 11462, 14, 2900, 4481, 4644, 14, 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, 755, 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, 755, 4248, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 199, 3, 755, 6450, 315, 314, 3794, 436, 15, 269, 1163, 8418, 2741, 199, 3, 755, 543, 314, 4084, 14, 199, 3, 258, 627, 11443, 314, 536, 402, 4475, 3277, 14, 6590, 314, 1561, 402, 2399, 199, 3, 755, 8417, 1443, 506, 1202, 370, 10692, 503, 10016, 7585, 7131, 199, 3, 755, 687, 642, 2032, 1928, 2488, 6791, 5313, 4983, 14, 199, 3, 199, 3, 5749, 4141, 2281, 7049, 6515, 2334, 5877, 8164, 2401, 6483, 199, 3, 298, 1179, 2281, 2, 2401, 1821, 7168, 1549, 5292, 2990, 12, 6931, 12, 5400, 2845, 199, 3, 5471, 2296, 12, 2334, 5292, 2990, 1634, 3169, 2401, 3092, 2381, 199, 3, 437, 3115, 3104, 9315, 9706, 14, 1621, 4825, 6461, 7000, 2334, 5877, 199, 3, 11489, 1549, 6483, 6262, 7024, 2381, 1821, 8703, 12, 9168, 12, 9716, 12, 199, 3, 8820, 12, 9836, 12, 1549, 9110, 6736, 334, 6446, 12, 5400, 2845, 199, 3, 5471, 2296, 12, 9838, 1634, 9103, 9764, 1549, 9714, 27, 9102, 1634, 4815, 12, 199, 3, 7126, 12, 1549, 9206, 27, 1549, 9748, 9831, 9, 9802, 9817, 2401, 5258, 1821, 199, 3, 9815, 1634, 5603, 12, 7061, 1621, 7066, 12, 9644, 5603, 12, 1549, 7056, 199, 3, 334, 6446, 9254, 1549, 7334, 9, 7043, 1621, 1821, 9683, 5738, 1634, 2334, 4815, 199, 3, 1634, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 9726, 1634, 9712, 9784, 14, 421, 199, 3, 5723, 8925, 787, 1415, 367, 314, 641, 13, 24152, 8603, 687, 199, 3, 2269, 370, 892, 2004, 570, 1475, 14, 199, 504, 747, 14, 515, 492, 3495, 199, 504, 747, 14, 515, 492, 664, 8180, 199, 199, 504, 1275, 492, 2269, 63, 1205, 493, 421, 199, 3, 5723, 15955, 83, 883, 4781, 315, 282, 7640, 1159, 15955, 83, 769, 26, 199, 13525, 275, 298, 13525, 2, 199, 8784, 275, 298, 8784, 2, 199, 6909, 275, 298, 6909, 2, 199, 3593, 3448, 275, 298, 3593, 3448, 2, 199, 8899, 275, 298, 8899, 2, 199, 2944, 8100, 275, 298, 2944, 8100, 2, 199, 51, 5896, 275, 298, 51, 5896, 2, 199, 3, 5723, 787, 2951, 367, 314, 2004, 1584, 436, 787, 9994, 5084, 315, 28259, 26, 199, 8784, 63, 3593, 275, 298, 8784, 63, 3593, 2, 199, 6909, 63, 726, 63, 8784, 275, 298, 6909, 63, 726, 63, 8784, 2, 199, 199, 32509, 275, 298, 32509, 2, 199, 199, 32187, 275, 1052, 199, 509, 790, 315, 359, 13525, 12, 10341, 12, 21705, 12, 9949, 3448, 12, 29998, 12, 17101, 8100, 12, 428, 5896, 12, 10341, 63, 3593, 12, 288, 21705, 63, 726, 63, 8784, 12, 12112, 26194, 2189, 523, 9301, 19984, 59, 498, 61, 275, 790, 199, 199, 5638, 51, 275, 469, 8784, 63, 3593, 26, 359, 8784, 12, 9949, 3448, 467, 267, 21705, 63, 726, 63, 8784, 26, 359, 6909, 12, 10341, 9420, 199, 199, 3, 12502, 3819, 397, 12, 12404, 370, 506, 5313, 465, 7681, 3140, 402, 3326, 14, 199, 21161, 275, 469, 32509, 26, 715, 93, 199, 509, 2729, 315, 2097, 1757, 401, 298, 3221, 401, 298, 6238, 63, 5362, 401, 298, 6238, 63, 4674, 708, 401, 298, 5362, 401, 298, 4674, 708, 401, 288, 298, 20496, 5891, 401, 298, 88, 772, 6229, 523, 30098, 17041, 59, 1391, 61, 275, 2729, 421, 199, 318, 4226, 7738, 8, 17502, 83, 304, 523, 372, 27885, 315, 15955, 83, 503, 428, 5896, 315, 15955, 83, 421, 199, 318, 6596, 38, 416, 10562, 8, 17502, 83, 304, 523, 372, 3666, 6909, 315, 15955, 83, 9, 436, 334, 8784, 315, 15955, 83, 9, 436, 881, 334, 1397, 17101, 8100, 315, 15955, 83, 9, 436, 334, 1397, 9949, 3448, 315, 15955, 83, 430, 421, 199, 318, 6596, 4874, 11622, 8, 17502, 83, 304, 272, 372, 334, 8784, 315, 15955, 83, 9, 436, 334, 3593, 3448, 315, 15955, 83, 9, 421, 199, 318, 485, 1123, 2204, 4352, 8, 1099, 12, 892, 304, 523, 2288, 28259, 523, 340, 892, 315, 28259, 26, 272, 9994, 275, 28259, 59, 1222, 61, 272, 340, 730, 8, 11663, 9, 508, 769, 26, 489, 367, 333, 315, 9994, 26, 267, 485, 1123, 2204, 4352, 8, 1099, 12, 333, 9, 272, 916, 730, 8, 11663, 9, 508, 620, 26, 489, 485, 1123, 2204, 4352, 8, 1099, 12, 9994, 9, 523, 587, 26, 272, 754, 14, 525, 8, 1222, 9, 421, 199, 318, 485, 4003, 2204, 4352, 1296, 8, 2200, 12, 15955, 83, 12, 1347, 63, 807, 12, 2860, 304, 523, 754, 275, 663, 4157, 523, 340, 730, 8, 17502, 83, 9, 508, 620, 26, 2043, 15955, 83, 275, 359, 17502, 83, 61, 523, 367, 1242, 315, 15955, 83, 26, 272, 340, 730, 8, 1053, 9, 508, 620, 26, 489, 485, 1123, 2204, 4352, 8, 1099, 12, 1242, 9, 272, 916, 730, 8, 1053, 9, 508, 769, 26, 489, 340, 440, 3468, 8, 1053, 59, 16, 467, 2860, 304, 1980, 489, 367, 15955, 315, 1242, 59, 17, 10688, 267, 702, 730, 8, 17502, 9, 508, 620, 267, 485, 1123, 2204, 4352, 8, 1099, 12, 15955, 9, 272, 587, 26, 489, 702, 756, 523, 340, 822, 8, 1099, 9, 508, 378, 26, 372, 523, 340, 2332, 315, 1347, 63, 807, 26, 272, 1347, 63, 807, 59, 2200, 61, 8901, 754, 523, 587, 26, 272, 1347, 63, 807, 59, 2200, 61, 275, 754, 421, 199, 318, 5574, 3694, 1173, 8, 515, 12, 2860, 304, 523, 327, 3709, 1846, 465, 314, 2269, 13, 908, 1275, 1205, 1584, 787, 4132, 390, 1905, 12, 2951, 523, 327, 1218, 314, 6702, 1015, 641, 29237, 436, 2581, 652, 370, 8112, 1536, 523, 327, 13372, 7858, 14, 523, 340, 931, 14, 4130, 9520, 1205, 2349, 272, 30965, 275, 931, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
opencloudinfra/orchestrator
venv/Lib/site-packages/setuptools/command/bdist_rpm.py
1049
1508
import distutils.command.bdist_rpm as orig class bdist_rpm(orig.bdist_rpm): """ Override the default bdist_rpm behavior to do the following: 1. Run egg_info to ensure the name and version are properly calculated. 2. Always run 'install' using --single-version-externally-managed to disable eggs in RPM distributions. 3. Replace dash with underscore in the version numbers for better RPM compatibility. """ def run(self): # ensure distro name is up-to-date self.run_command('egg_info') orig.bdist_rpm.run(self) def _make_spec_file(self): version = self.distribution.get_version() rpmversion = version.replace('-', '_') spec = orig.bdist_rpm._make_spec_file(self) line23 = '%define version ' + version line24 = '%define version ' + rpmversion spec = [ line.replace( "Source0: %{name}-%{version}.tar", "Source0: %{name}-%{unmangled_version}.tar" ).replace( "setup.py install ", "setup.py install --single-version-externally-managed " ).replace( "%setup", "%setup -n %{name}-%{unmangled_version}" ).replace(line23, line24) for line in spec ] insert_loc = spec.index(line24) + 1 unmangled_version = "%define unmangled_version " + version spec.insert(insert_loc, unmangled_version) return spec
gpl-3.0
[ 646, 7065, 14, 1531, 14, 17403, 63, 14191, 465, 2306, 421, 199, 533, 26308, 63, 14191, 8, 2981, 14, 17403, 63, 14191, 304, 272, 408, 272, 11041, 314, 849, 26308, 63, 14191, 5953, 370, 886, 314, 2569, 26, 339, 413, 14, 3378, 11393, 63, 815, 370, 4868, 314, 536, 436, 1015, 787, 7684, 12950, 14, 272, 499, 14, 16763, 1255, 283, 3174, 7, 1808, 1553, 4780, 13, 1023, 13, 18587, 1183, 13, 11122, 370, 2126, 3507, 22151, 315, 820, 10793, 10208, 14, 272, 650, 14, 14402, 11847, 543, 18888, 315, 314, 1015, 5579, 367, 8034, 820, 10793, 2126, 7163, 14, 272, 408, 339, 347, 1255, 8, 277, 304, 267, 327, 4868, 20499, 536, 365, 1536, 13, 475, 13, 602, 267, 291, 14, 1065, 63, 1531, 360, 5799, 63, 815, 358, 398, 2306, 14, 17403, 63, 14191, 14, 1065, 8, 277, 9, 339, 347, 485, 1875, 63, 1650, 63, 493, 8, 277, 304, 267, 1015, 275, 291, 14, 4972, 14, 362, 63, 1023, 342, 267, 21980, 1023, 275, 1015, 14, 1814, 13858, 18962, 267, 3158, 275, 2306, 14, 17403, 63, 14191, 423, 1875, 63, 1650, 63, 493, 8, 277, 9, 267, 1004, 1789, 275, 1543, 4640, 1015, 283, 435, 1015, 267, 1004, 1194, 275, 1543, 4640, 1015, 283, 435, 21980, 1023, 267, 3158, 275, 359, 288, 1004, 14, 1814, 8, 355, 298, 2980, 16, 26, 450, 91, 354, 93, 3295, 91, 1023, 5565, 5369, 401, 355, 298, 2980, 16, 26, 450, 91, 354, 93, 3295, 91, 324, 77, 22183, 63, 1023, 5565, 5369, 2, 288, 7092, 1814, 8, 355, 298, 2758, 14, 647, 3907, 3872, 355, 298, 2758, 14, 647, 3907, 1553, 4780, 13, 1023, 13, 18587, 1183, 13, 11122, 298, 288, 7092, 1814, 8, 355, 2071, 2758, 401, 355, 2071, 2758, 446, 78, 450, 91, 354, 93, 3295, 91, 324, 77, 22183, 63, 1023, 7063, 288, 7092, 1814, 8, 604, 1789, 12, 1004, 1194, 9, 288, 367, 1004, 315, 3158, 267, 1622, 267, 5518, 63, 2102, 275, 3158, 14, 1080, 8, 604, 1194, 9, 435, 413, 267, 625, 77, 22183, 63, 1023, 275, 2071, 4640, 625, 77, 22183, 63, 1023, 298, 435, 1015, 267, 3158, 14, 3176, 8, 3176, 63, 2102, 12, 625, 77, 22183, 63, 1023, 9, 267, 372, 3158, 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 ]
[ 7065, 14, 1531, 14, 17403, 63, 14191, 465, 2306, 421, 199, 533, 26308, 63, 14191, 8, 2981, 14, 17403, 63, 14191, 304, 272, 408, 272, 11041, 314, 849, 26308, 63, 14191, 5953, 370, 886, 314, 2569, 26, 339, 413, 14, 3378, 11393, 63, 815, 370, 4868, 314, 536, 436, 1015, 787, 7684, 12950, 14, 272, 499, 14, 16763, 1255, 283, 3174, 7, 1808, 1553, 4780, 13, 1023, 13, 18587, 1183, 13, 11122, 370, 2126, 3507, 22151, 315, 820, 10793, 10208, 14, 272, 650, 14, 14402, 11847, 543, 18888, 315, 314, 1015, 5579, 367, 8034, 820, 10793, 2126, 7163, 14, 272, 408, 339, 347, 1255, 8, 277, 304, 267, 327, 4868, 20499, 536, 365, 1536, 13, 475, 13, 602, 267, 291, 14, 1065, 63, 1531, 360, 5799, 63, 815, 358, 398, 2306, 14, 17403, 63, 14191, 14, 1065, 8, 277, 9, 339, 347, 485, 1875, 63, 1650, 63, 493, 8, 277, 304, 267, 1015, 275, 291, 14, 4972, 14, 362, 63, 1023, 342, 267, 21980, 1023, 275, 1015, 14, 1814, 13858, 18962, 267, 3158, 275, 2306, 14, 17403, 63, 14191, 423, 1875, 63, 1650, 63, 493, 8, 277, 9, 267, 1004, 1789, 275, 1543, 4640, 1015, 283, 435, 1015, 267, 1004, 1194, 275, 1543, 4640, 1015, 283, 435, 21980, 1023, 267, 3158, 275, 359, 288, 1004, 14, 1814, 8, 355, 298, 2980, 16, 26, 450, 91, 354, 93, 3295, 91, 1023, 5565, 5369, 401, 355, 298, 2980, 16, 26, 450, 91, 354, 93, 3295, 91, 324, 77, 22183, 63, 1023, 5565, 5369, 2, 288, 7092, 1814, 8, 355, 298, 2758, 14, 647, 3907, 3872, 355, 298, 2758, 14, 647, 3907, 1553, 4780, 13, 1023, 13, 18587, 1183, 13, 11122, 298, 288, 7092, 1814, 8, 355, 2071, 2758, 401, 355, 2071, 2758, 446, 78, 450, 91, 354, 93, 3295, 91, 324, 77, 22183, 63, 1023, 7063, 288, 7092, 1814, 8, 604, 1789, 12, 1004, 1194, 9, 288, 367, 1004, 315, 3158, 267, 1622, 267, 5518, 63, 2102, 275, 3158, 14, 1080, 8, 604, 1194, 9, 435, 413, 267, 625, 77, 22183, 63, 1023, 275, 2071, 4640, 625, 77, 22183, 63, 1023, 298, 435, 1015, 267, 3158, 14, 3176, 8, 3176, 63, 2102, 12, 625, 77, 22183, 63, 1023, 9, 267, 372, 3158, 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, 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,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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 ]
jclc/discus-inferno
flaskenv/lib/python2.7/site-packages/pip/_vendor/requests/packages/chardet/cp949prober.py
2801
1782
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library 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. # # This library 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 this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .mbcharsetprober import MultiByteCharSetProber from .codingstatemachine import CodingStateMachine from .chardistribution import EUCKRDistributionAnalysis from .mbcssm import CP949SMModel class CP949Prober(MultiByteCharSetProber): def __init__(self): MultiByteCharSetProber.__init__(self) self._mCodingSM = CodingStateMachine(CP949SMModel) # NOTE: CP949 is a superset of EUC-KR, so the distribution should be # not different. self._mDistributionAnalyzer = EUCKRDistributionAnalysis() self.reset() def get_charset_name(self): return "CP949"
mit
[ 6565, 16427, 5113, 8068, 11945, 199, 3, 710, 12769, 5495, 365, 1303, 6956, 14, 1308, 1233, 14, 199, 3, 199, 3, 710, 6026, 9607, 402, 314, 12769, 5495, 365, 199, 3, 20433, 18686, 11098, 14, 199, 3, 20825, 2737, 701, 314, 6026, 9607, 787, 1898, 334, 35, 9, 19960, 199, 3, 314, 6026, 9607, 14, 2900, 5924, 5702, 14, 199, 3, 199, 3, 17636, 8, 83, 304, 199, 3, 257, 7173, 19641, 446, 1844, 370, 2018, 199, 3, 199, 3, 961, 3555, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 199, 3, 2811, 652, 1334, 314, 2895, 402, 314, 1664, 6401, 1696, 1684, 199, 3, 844, 465, 3267, 701, 314, 2868, 2290, 2752, 27, 1902, 199, 3, 1015, 499, 14, 17, 402, 314, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 961, 3555, 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, 1664, 199, 3, 6401, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 6401, 1696, 1684, 199, 3, 844, 3180, 543, 642, 3555, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 199, 3, 2752, 12, 3277, 2020, 8026, 11236, 1933, 12, 12066, 11844, 12, 8226, 12, 4828, 199, 3, 11315, 13, 10067, 221, 8217, 199, 19054, 7729, 5113, 8068, 21186, 199, 199, 504, 1275, 887, 6043, 19903, 492, 6879, 21312, 199, 504, 1275, 1523, 929, 6744, 492, 30539, 199, 504, 1275, 1560, 4972, 492, 26007, 27373, 24906, 199, 504, 1275, 887, 3919, 77, 492, 19701, 15674, 25335, 421, 199, 533, 19701, 15674, 8029, 8, 3947, 21312, 304, 272, 347, 636, 826, 721, 277, 304, 267, 6879, 21312, 855, 826, 721, 277, 9, 267, 291, 423, 29633, 275, 30539, 8, 2890, 15674, 25335, 9, 267, 327, 6944, 26, 19701, 15674, 365, 282, 1613, 409, 402, 662, 13371, 13, 23063, 12, 880, 314, 4084, 1077, 506, 267, 327, 755, 440, 3365, 14, 267, 291, 423, 77, 8580, 17606, 275, 26007, 27373, 24906, 342, 267, 291, 14, 3958, 342, 339, 347, 664, 63, 6043, 63, 354, 8, 277, 304, 267, 372, 298, 2890, 15674, 2, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 16427, 5113, 8068, 11945, 199, 3, 710, 12769, 5495, 365, 1303, 6956, 14, 1308, 1233, 14, 199, 3, 199, 3, 710, 6026, 9607, 402, 314, 12769, 5495, 365, 199, 3, 20433, 18686, 11098, 14, 199, 3, 20825, 2737, 701, 314, 6026, 9607, 787, 1898, 334, 35, 9, 19960, 199, 3, 314, 6026, 9607, 14, 2900, 5924, 5702, 14, 199, 3, 199, 3, 17636, 8, 83, 304, 199, 3, 257, 7173, 19641, 446, 1844, 370, 2018, 199, 3, 199, 3, 961, 3555, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 199, 3, 2811, 652, 1334, 314, 2895, 402, 314, 1664, 6401, 1696, 1684, 199, 3, 844, 465, 3267, 701, 314, 2868, 2290, 2752, 27, 1902, 199, 3, 1015, 499, 14, 17, 402, 314, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 961, 3555, 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, 1664, 199, 3, 6401, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 6401, 1696, 1684, 199, 3, 844, 3180, 543, 642, 3555, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 199, 3, 2752, 12, 3277, 2020, 8026, 11236, 1933, 12, 12066, 11844, 12, 8226, 12, 4828, 199, 3, 11315, 13, 10067, 221, 8217, 199, 19054, 7729, 5113, 8068, 21186, 199, 199, 504, 1275, 887, 6043, 19903, 492, 6879, 21312, 199, 504, 1275, 1523, 929, 6744, 492, 30539, 199, 504, 1275, 1560, 4972, 492, 26007, 27373, 24906, 199, 504, 1275, 887, 3919, 77, 492, 19701, 15674, 25335, 421, 199, 533, 19701, 15674, 8029, 8, 3947, 21312, 304, 272, 347, 636, 826, 721, 277, 304, 267, 6879, 21312, 855, 826, 721, 277, 9, 267, 291, 423, 29633, 275, 30539, 8, 2890, 15674, 25335, 9, 267, 327, 6944, 26, 19701, 15674, 365, 282, 1613, 409, 402, 662, 13371, 13, 23063, 12, 880, 314, 4084, 1077, 506, 267, 327, 755, 440, 3365, 14, 267, 291, 423, 77, 8580, 17606, 275, 26007, 27373, 24906, 342, 267, 291, 14, 3958, 342, 339, 347, 664, 63, 6043, 63, 354, 8, 277, 304, 267, 372, 298, 2890, 15674, 2, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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,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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 ]
Jaidan/jaidan-hab-home-assistant
tests/test_component_group.py
3
8147
""" tests.test_component_group ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tests the group compoments. """ # pylint: disable=protected-access,too-many-public-methods import unittest import logging import homeassistant as ha from homeassistant.const import STATE_ON, STATE_OFF, STATE_HOME, STATE_UNKNOWN import homeassistant.components.group as group def setUpModule(): # pylint: disable=invalid-name """ Setup to ignore group errors. """ logging.disable(logging.CRITICAL) class TestComponentsGroup(unittest.TestCase): """ Tests homeassistant.components.group module. """ def setUp(self): # pylint: disable=invalid-name """ Init needed objects. """ self.hass = ha.HomeAssistant() self.hass.states.set('light.Bowl', STATE_ON) self.hass.states.set('light.Ceiling', STATE_OFF) test_group = group.Group( self.hass, 'init_group', ['light.Bowl', 'light.Ceiling'], False) self.group_entity_id = test_group.entity_id def tearDown(self): # pylint: disable=invalid-name """ Stop down stuff we started. """ self.hass.stop() def test_setup_group_with_mixed_groupable_states(self): """ Try to setup a group with mixed groupable states """ self.hass.states.set('device_tracker.Paulus', STATE_HOME) group.setup_group( self.hass, 'person_and_light', ['light.Bowl', 'device_tracker.Paulus']) self.assertEqual( STATE_ON, self.hass.states.get( group.ENTITY_ID_FORMAT.format('person_and_light')).state) def test_setup_group_with_a_non_existing_state(self): """ Try to setup a group with a non existing state """ grp = group.setup_group( self.hass, 'light_and_nothing', ['light.Bowl', 'non.existing']) self.assertEqual(STATE_ON, grp.state.state) def test_setup_group_with_non_groupable_states(self): self.hass.states.set('cast.living_room', "Plex") self.hass.states.set('cast.bedroom', "Netflix") grp = group.setup_group( self.hass, 'chromecasts', ['cast.living_room', 'cast.bedroom']) self.assertEqual(STATE_UNKNOWN, grp.state.state) def test_setup_empty_group(self): """ Try to setup an empty group. """ grp = group.setup_group(self.hass, 'nothing', []) self.assertEqual(STATE_UNKNOWN, grp.state.state) def test_monitor_group(self): """ Test if the group keeps track of states. """ # Test if group setup in our init mode is ok self.assertIn(self.group_entity_id, self.hass.states.entity_ids()) group_state = self.hass.states.get(self.group_entity_id) self.assertEqual(STATE_ON, group_state.state) self.assertTrue(group_state.attributes[group.ATTR_AUTO]) def test_group_turns_off_if_all_off(self): """ Test if the group turns off if the last device that was on turns off. """ self.hass.states.set('light.Bowl', STATE_OFF) self.hass.pool.block_till_done() group_state = self.hass.states.get(self.group_entity_id) self.assertEqual(STATE_OFF, group_state.state) def test_group_turns_on_if_all_are_off_and_one_turns_on(self): """ Test if group turns on if all devices were turned off and one turns on. """ # Make sure all are off. self.hass.states.set('light.Bowl', STATE_OFF) self.hass.pool.block_till_done() # Turn one on self.hass.states.set('light.Ceiling', STATE_ON) self.hass.pool.block_till_done() group_state = self.hass.states.get(self.group_entity_id) self.assertEqual(STATE_ON, group_state.state) def test_is_on(self): """ Test is_on method. """ self.assertTrue(group.is_on(self.hass, self.group_entity_id)) self.hass.states.set('light.Bowl', STATE_OFF) self.hass.pool.block_till_done() self.assertFalse(group.is_on(self.hass, self.group_entity_id)) # Try on non existing state self.assertFalse(group.is_on(self.hass, 'non.existing')) def test_expand_entity_ids(self): """ Test expand_entity_ids method. """ self.assertEqual(sorted(['light.ceiling', 'light.bowl']), sorted(group.expand_entity_ids( self.hass, [self.group_entity_id]))) def test_expand_entity_ids_does_not_return_duplicates(self): """ Test that expand_entity_ids does not return duplicates. """ self.assertEqual( ['light.bowl', 'light.ceiling'], sorted(group.expand_entity_ids( self.hass, [self.group_entity_id, 'light.Ceiling']))) self.assertEqual( ['light.bowl', 'light.ceiling'], sorted(group.expand_entity_ids( self.hass, ['light.bowl', self.group_entity_id]))) def test_expand_entity_ids_ignores_non_strings(self): """ Test that non string elements in lists are ignored. """ self.assertEqual([], group.expand_entity_ids(self.hass, [5, True])) def test_get_entity_ids(self): """ Test get_entity_ids method. """ self.assertEqual( ['light.bowl', 'light.ceiling'], sorted(group.get_entity_ids(self.hass, self.group_entity_id))) def test_get_entity_ids_with_domain_filter(self): """ Test if get_entity_ids works with a domain_filter. """ self.hass.states.set('switch.AC', STATE_OFF) mixed_group = group.Group( self.hass, 'mixed_group', ['light.Bowl', 'switch.AC'], False) self.assertEqual( ['switch.ac'], group.get_entity_ids( self.hass, mixed_group.entity_id, domain_filter="switch")) def test_get_entity_ids_with_non_existing_group_name(self): """ Tests get_entity_ids with a non existing group. """ self.assertEqual([], group.get_entity_ids(self.hass, 'non_existing')) def test_get_entity_ids_with_non_group_state(self): """ Tests get_entity_ids with a non group state. """ self.assertEqual([], group.get_entity_ids(self.hass, 'switch.AC')) def test_group_being_init_before_first_tracked_state_is_set_to_on(self): """ Test if the group turns on if no states existed and now a state it is tracking is being added as ON. """ test_group = group.Group( self.hass, 'test group', ['light.not_there_1']) self.hass.states.set('light.not_there_1', STATE_ON) self.hass.pool.block_till_done() group_state = self.hass.states.get(test_group.entity_id) self.assertEqual(STATE_ON, group_state.state) def test_group_being_init_before_first_tracked_state_is_set_to_off(self): """ Test if the group turns off if no states existed and now a state it is tracking is being added as OFF. """ test_group = group.Group( self.hass, 'test group', ['light.not_there_1']) self.hass.states.set('light.not_there_1', STATE_OFF) self.hass.pool.block_till_done() group_state = self.hass.states.get(test_group.entity_id) self.assertEqual(STATE_OFF, group_state.state) def test_setup(self): """ Test setup method. """ self.assertTrue( group.setup( self.hass, { group.DOMAIN: { 'second_group': ','.join((self.group_entity_id, 'light.Bowl')) } })) group_state = self.hass.states.get( group.ENTITY_ID_FORMAT.format('second_group')) self.assertEqual(STATE_ON, group_state.state) self.assertFalse(group_state.attributes[group.ATTR_AUTO]) def test_groups_get_unique_names(self): """ Two groups with same name should both have a unique entity id. """ grp1 = group.Group(self.hass, 'Je suis Charlie') grp2 = group.Group(self.hass, 'Je suis Charlie') self.assertNotEqual(grp1.entity_id, grp2.entity_id)
mit
[ 624, 199, 2219, 14, 396, 63, 3173, 63, 923, 199, 9753, 22935, 199, 199, 2925, 314, 1572, 11395, 1470, 14, 199, 624, 199, 3, 4287, 26, 3507, 29, 6798, 13, 2732, 12, 7354, 13, 3479, 13, 3455, 13, 2474, 199, 646, 2882, 199, 646, 2050, 199, 199, 646, 8846, 465, 18251, 199, 504, 8846, 14, 1297, 492, 11377, 63, 615, 12, 11377, 63, 7517, 12, 11377, 63, 9524, 12, 11377, 63, 11588, 199, 646, 8846, 14, 4608, 14, 923, 465, 1572, 421, 199, 318, 3613, 2377, 837, 257, 327, 4287, 26, 3507, 29, 3197, 13, 354, 272, 408, 12439, 370, 3686, 1572, 2552, 14, 408, 272, 2050, 14, 5993, 8, 4806, 14, 21539, 9, 421, 199, 533, 1379, 22714, 2448, 8, 2796, 14, 1746, 304, 272, 408, 6496, 8846, 14, 4608, 14, 923, 859, 14, 408, 339, 347, 3613, 8, 277, 304, 221, 327, 4287, 26, 3507, 29, 3197, 13, 354, 267, 408, 21026, 4346, 2251, 14, 408, 267, 291, 14, 5387, 275, 18251, 14, 12054, 24486, 342, 398, 291, 14, 5387, 14, 4981, 14, 409, 360, 4040, 14, 34, 583, 76, 297, 11377, 63, 615, 9, 267, 291, 14, 5387, 14, 4981, 14, 409, 360, 4040, 14, 24417, 5662, 297, 11377, 63, 7517, 9, 267, 511, 63, 923, 275, 1572, 14, 2448, 8, 288, 291, 14, 5387, 12, 283, 826, 63, 923, 297, 788, 4040, 14, 34, 583, 76, 297, 283, 4040, 14, 24417, 5662, 995, 756, 9, 398, 291, 14, 923, 63, 4502, 63, 344, 275, 511, 63, 923, 14, 4502, 63, 344, 339, 347, 6766, 8, 277, 304, 221, 327, 4287, 26, 3507, 29, 3197, 13, 354, 267, 408, 8015, 3224, 8292, 781, 8239, 14, 408, 267, 291, 14, 5387, 14, 2379, 342, 339, 347, 511, 63, 2758, 63, 923, 63, 1045, 63, 10455, 63, 923, 461, 63, 4981, 8, 277, 304, 267, 408, 7649, 370, 3272, 282, 1572, 543, 13492, 1572, 461, 6363, 408, 267, 291, 14, 5387, 14, 4981, 14, 409, 360, 1782, 63, 8877, 14, 4232, 15909, 297, 11377, 63, 9524, 9, 267, 1572, 14, 2758, 63, 923, 8, 288, 291, 14, 5387, 12, 283, 5484, 63, 460, 63, 4040, 297, 288, 788, 4040, 14, 34, 583, 76, 297, 283, 1782, 63, 8877, 14, 4232, 15909, 1105, 398, 291, 14, 629, 8, 288, 11377, 63, 615, 12, 288, 291, 14, 5387, 14, 4981, 14, 362, 8, 355, 1572, 14, 13630, 63, 998, 63, 4807, 14, 908, 360, 5484, 63, 460, 63, 4040, 11103, 929, 9, 339, 347, 511, 63, 2758, 63, 923, 63, 1045, 63, 65, 63, 2865, 63, 5952, 63, 929, 8, 277, 304, 267, 408, 7649, 370, 3272, 282, 1572, 543, 282, 2222, 3411, 1174, 408, 267, 18598, 275, 1572, 14, 2758, 63, 923, 8, 288, 291, 14, 5387, 12, 283, 4040, 63, 460, 63, 16323, 297, 288, 788, 4040, 14, 34, 583, 76, 297, 283, 2865, 14, 5952, 1105, 398, 291, 14, 629, 8, 6689, 63, 615, 12, 18598, 14, 929, 14, 929, 9, 339, 347, 511, 63, 2758, 63, 923, 63, 1045, 63, 2865, 63, 923, 461, 63, 4981, 8, 277, 304, 267, 291, 14, 5387, 14, 4981, 14, 409, 360, 2931, 14, 317, 4007, 63, 11245, 297, 298, 48, 3113, 531, 267, 291, 14, 5387, 14, 4981, 14, 409, 360, 2931, 14, 6123, 11245, 297, 298, 2480, 70, 20528, 531, 398, 18598, 275, 1572, 14, 2758, 63, 923, 8, 288, 291, 14, 5387, 12, 283, 9887, 2931, 83, 297, 288, 788, 2931, 14, 317, 4007, 63, 11245, 297, 283, 2931, 14, 6123, 11245, 1105, 398, 291, 14, 629, 8, 6689, 63, 11588, 12, 18598, 14, 929, 14, 929, 9, 339, 347, 511, 63, 2758, 63, 1667, 63, 923, 8, 277, 304, 267, 408, 7649, 370, 3272, 376, 2701, 1572, 14, 408, 267, 18598, 275, 1572, 14, 2758, 63, 923, 8, 277, 14, 5387, 12, 283, 16323, 297, 3073, 398, 291, 14, 629, 8, 6689, 63, 11588, 12, 18598, 14, 929, 14, 929, 9, 339, 347, 511, 63, 7157, 63, 923, 8, 277, 304, 267, 408, 1379, 340, 314, 1572, 18578, 4426, 402, 6363, 14, 408, 398, 327, 1379, 340, 1572, 3272, 315, 4154, 4205, 818, 365, 4112, 267, 291, 14, 4080, 8, 277, 14, 923, 63, 4502, 63, 344, 12, 291, 14, 5387, 14, 4981, 14, 4502, 63, 1580, 1012, 398, 1572, 63, 929, 275, 291, 14, 5387, 14, 4981, 14, 362, 8, 277, 14, 923, 63, 4502, 63, 344, 9, 267, 291, 14, 629, 8, 6689, 63, 615, 12, 1572, 63, 929, 14, 929, 9, 267, 291, 14, 1815, 8, 923, 63, 929, 14, 2987, 59, 923, 14, 5280, 63, 13883, 566, 339, 347, 511, 63, 923, 63, 353, 83, 63, 1997, 63, 692, 63, 452, 63, 1997, 8, 277, 304, 267, 408, 267, 1379, 340, 314, 1572, 25449, 2331, 340, 314, 2061, 2243, 626, 1990, 641, 25449, 2331, 14, 267, 408, 267, 291, 14, 5387, 14, 4981, 14, 409, 360, 4040, 14, 34, 583, 76, 297, 11377, 63, 7517, 9, 398, 291, 14, 5387, 14, 2293, 14, 1457, 63, 12587, 63, 4456, 342, 398, 1572, 63, 929, 275, 291, 14, 5387, 14, 4981, 14, 362, 8, 277, 14, 923, 63, 4502, 63, 344, 9, 267, 291, 14, 629, 8, 6689, 63, 7517, 12, 1572, 63, 929, 14, 929, 9, 339, 347, 511, 63, 923, 63, 353, 83, 63, 265, 63, 692, 63, 452, 63, 1530, 63, 1997, 63, 460, 63, 368, 63, 353, 83, 63, 265, 8, 277, 304, 267, 408, 267, 1379, 340, 1572, 25449, 641, 340, 1006, 7256, 4898, 19136, 2331, 436, 1373, 25449, 641, 14, 267, 408, 267, 327, 4155, 3238, 1006, 787, 2331, 14, 267, 291, 14, 5387, 14, 4981, 14, 409, 360, 4040, 14, 34, 583, 76, 297, 11377, 63, 7517, 9, 267, 291, 14, 5387, 14, 2293, 14, 1457, 63, 12587, 63, 4456, 342, 398, 327, 16147, 1373, 641, 267, 291, 14, 5387, 14, 4981, 14, 409, 360, 4040, 14, 24417, 5662, 297, 11377, 63, 615, 9, 267, 291, 14, 5387, 14, 2293, 14, 1457, 63, 12587, 63, 4456, 342, 398, 1572, 63, 929, 275, 291, 14, 5387, 14, 4981, 14, 362, 8, 277, 14, 923, 63, 4502, 63, 344, 9, 267, 291, 14, 629 ]
[ 199, 2219, 14, 396, 63, 3173, 63, 923, 199, 9753, 22935, 199, 199, 2925, 314, 1572, 11395, 1470, 14, 199, 624, 199, 3, 4287, 26, 3507, 29, 6798, 13, 2732, 12, 7354, 13, 3479, 13, 3455, 13, 2474, 199, 646, 2882, 199, 646, 2050, 199, 199, 646, 8846, 465, 18251, 199, 504, 8846, 14, 1297, 492, 11377, 63, 615, 12, 11377, 63, 7517, 12, 11377, 63, 9524, 12, 11377, 63, 11588, 199, 646, 8846, 14, 4608, 14, 923, 465, 1572, 421, 199, 318, 3613, 2377, 837, 257, 327, 4287, 26, 3507, 29, 3197, 13, 354, 272, 408, 12439, 370, 3686, 1572, 2552, 14, 408, 272, 2050, 14, 5993, 8, 4806, 14, 21539, 9, 421, 199, 533, 1379, 22714, 2448, 8, 2796, 14, 1746, 304, 272, 408, 6496, 8846, 14, 4608, 14, 923, 859, 14, 408, 339, 347, 3613, 8, 277, 304, 221, 327, 4287, 26, 3507, 29, 3197, 13, 354, 267, 408, 21026, 4346, 2251, 14, 408, 267, 291, 14, 5387, 275, 18251, 14, 12054, 24486, 342, 398, 291, 14, 5387, 14, 4981, 14, 409, 360, 4040, 14, 34, 583, 76, 297, 11377, 63, 615, 9, 267, 291, 14, 5387, 14, 4981, 14, 409, 360, 4040, 14, 24417, 5662, 297, 11377, 63, 7517, 9, 267, 511, 63, 923, 275, 1572, 14, 2448, 8, 288, 291, 14, 5387, 12, 283, 826, 63, 923, 297, 788, 4040, 14, 34, 583, 76, 297, 283, 4040, 14, 24417, 5662, 995, 756, 9, 398, 291, 14, 923, 63, 4502, 63, 344, 275, 511, 63, 923, 14, 4502, 63, 344, 339, 347, 6766, 8, 277, 304, 221, 327, 4287, 26, 3507, 29, 3197, 13, 354, 267, 408, 8015, 3224, 8292, 781, 8239, 14, 408, 267, 291, 14, 5387, 14, 2379, 342, 339, 347, 511, 63, 2758, 63, 923, 63, 1045, 63, 10455, 63, 923, 461, 63, 4981, 8, 277, 304, 267, 408, 7649, 370, 3272, 282, 1572, 543, 13492, 1572, 461, 6363, 408, 267, 291, 14, 5387, 14, 4981, 14, 409, 360, 1782, 63, 8877, 14, 4232, 15909, 297, 11377, 63, 9524, 9, 267, 1572, 14, 2758, 63, 923, 8, 288, 291, 14, 5387, 12, 283, 5484, 63, 460, 63, 4040, 297, 288, 788, 4040, 14, 34, 583, 76, 297, 283, 1782, 63, 8877, 14, 4232, 15909, 1105, 398, 291, 14, 629, 8, 288, 11377, 63, 615, 12, 288, 291, 14, 5387, 14, 4981, 14, 362, 8, 355, 1572, 14, 13630, 63, 998, 63, 4807, 14, 908, 360, 5484, 63, 460, 63, 4040, 11103, 929, 9, 339, 347, 511, 63, 2758, 63, 923, 63, 1045, 63, 65, 63, 2865, 63, 5952, 63, 929, 8, 277, 304, 267, 408, 7649, 370, 3272, 282, 1572, 543, 282, 2222, 3411, 1174, 408, 267, 18598, 275, 1572, 14, 2758, 63, 923, 8, 288, 291, 14, 5387, 12, 283, 4040, 63, 460, 63, 16323, 297, 288, 788, 4040, 14, 34, 583, 76, 297, 283, 2865, 14, 5952, 1105, 398, 291, 14, 629, 8, 6689, 63, 615, 12, 18598, 14, 929, 14, 929, 9, 339, 347, 511, 63, 2758, 63, 923, 63, 1045, 63, 2865, 63, 923, 461, 63, 4981, 8, 277, 304, 267, 291, 14, 5387, 14, 4981, 14, 409, 360, 2931, 14, 317, 4007, 63, 11245, 297, 298, 48, 3113, 531, 267, 291, 14, 5387, 14, 4981, 14, 409, 360, 2931, 14, 6123, 11245, 297, 298, 2480, 70, 20528, 531, 398, 18598, 275, 1572, 14, 2758, 63, 923, 8, 288, 291, 14, 5387, 12, 283, 9887, 2931, 83, 297, 288, 788, 2931, 14, 317, 4007, 63, 11245, 297, 283, 2931, 14, 6123, 11245, 1105, 398, 291, 14, 629, 8, 6689, 63, 11588, 12, 18598, 14, 929, 14, 929, 9, 339, 347, 511, 63, 2758, 63, 1667, 63, 923, 8, 277, 304, 267, 408, 7649, 370, 3272, 376, 2701, 1572, 14, 408, 267, 18598, 275, 1572, 14, 2758, 63, 923, 8, 277, 14, 5387, 12, 283, 16323, 297, 3073, 398, 291, 14, 629, 8, 6689, 63, 11588, 12, 18598, 14, 929, 14, 929, 9, 339, 347, 511, 63, 7157, 63, 923, 8, 277, 304, 267, 408, 1379, 340, 314, 1572, 18578, 4426, 402, 6363, 14, 408, 398, 327, 1379, 340, 1572, 3272, 315, 4154, 4205, 818, 365, 4112, 267, 291, 14, 4080, 8, 277, 14, 923, 63, 4502, 63, 344, 12, 291, 14, 5387, 14, 4981, 14, 4502, 63, 1580, 1012, 398, 1572, 63, 929, 275, 291, 14, 5387, 14, 4981, 14, 362, 8, 277, 14, 923, 63, 4502, 63, 344, 9, 267, 291, 14, 629, 8, 6689, 63, 615, 12, 1572, 63, 929, 14, 929, 9, 267, 291, 14, 1815, 8, 923, 63, 929, 14, 2987, 59, 923, 14, 5280, 63, 13883, 566, 339, 347, 511, 63, 923, 63, 353, 83, 63, 1997, 63, 692, 63, 452, 63, 1997, 8, 277, 304, 267, 408, 267, 1379, 340, 314, 1572, 25449, 2331, 340, 314, 2061, 2243, 626, 1990, 641, 25449, 2331, 14, 267, 408, 267, 291, 14, 5387, 14, 4981, 14, 409, 360, 4040, 14, 34, 583, 76, 297, 11377, 63, 7517, 9, 398, 291, 14, 5387, 14, 2293, 14, 1457, 63, 12587, 63, 4456, 342, 398, 1572, 63, 929, 275, 291, 14, 5387, 14, 4981, 14, 362, 8, 277, 14, 923, 63, 4502, 63, 344, 9, 267, 291, 14, 629, 8, 6689, 63, 7517, 12, 1572, 63, 929, 14, 929, 9, 339, 347, 511, 63, 923, 63, 353, 83, 63, 265, 63, 692, 63, 452, 63, 1530, 63, 1997, 63, 460, 63, 368, 63, 353, 83, 63, 265, 8, 277, 304, 267, 408, 267, 1379, 340, 1572, 25449, 641, 340, 1006, 7256, 4898, 19136, 2331, 436, 1373, 25449, 641, 14, 267, 408, 267, 327, 4155, 3238, 1006, 787, 2331, 14, 267, 291, 14, 5387, 14, 4981, 14, 409, 360, 4040, 14, 34, 583, 76, 297, 11377, 63, 7517, 9, 267, 291, 14, 5387, 14, 2293, 14, 1457, 63, 12587, 63, 4456, 342, 398, 327, 16147, 1373, 641, 267, 291, 14, 5387, 14, 4981, 14, 409, 360, 4040, 14, 24417, 5662, 297, 11377, 63, 615, 9, 267, 291, 14, 5387, 14, 2293, 14, 1457, 63, 12587, 63, 4456, 342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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 ]
clarkperkins/stackdio
stackdio/api/cloud/migrations/0002_0_8_initial.py
2
3061
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ('stacks', '0001_0_8_initial'), ('cloud', '0001_0_8_initial'), ] replaces = [ ('cloud', '0001_initial'), ('cloud', '0002_initial'), ('cloud', '0004_v0_7_migrations'), ('cloud', '0005_v0_7b_migrations'), ('cloud', '0006_v0_7c_migrations'), ('cloud', '0007_v0_7d_migrations'), ('cloud', '0008_v0_7e_migrations'), ] operations = [ migrations.AddField( model_name='securitygroup', name='stack', field=models.ForeignKey(related_name='security_groups', to='stacks.Stack', null=True), ), migrations.AddField( model_name='cloudzone', name='region', field=models.ForeignKey(related_name='zones', to='cloud.CloudRegion'), ), migrations.AddField( model_name='cloudregion', name='provider', field=models.ForeignKey(verbose_name='Cloud Provider', to='cloud.CloudProvider'), ), migrations.AddField( model_name='cloudinstancesize', name='provider', field=models.ForeignKey(verbose_name='Cloud Provider', to='cloud.CloudProvider'), ), migrations.AddField( model_name='cloudimage', name='account', field=models.ForeignKey(related_name='images', to='cloud.CloudAccount'), ), migrations.AddField( model_name='cloudimage', name='default_instance_size', field=models.ForeignKey(verbose_name='Default Instance Size', to='cloud.CloudInstanceSize'), ), migrations.AddField( model_name='cloudaccount', name='provider', field=models.ForeignKey(verbose_name='Cloud Provider', to='cloud.CloudProvider'), ), migrations.AddField( model_name='cloudaccount', name='region', field=models.ForeignKey(verbose_name='Region', to='cloud.CloudRegion'), ), migrations.AlterUniqueTogether( name='snapshot', unique_together=set([('snapshot_id', 'account')]), ), migrations.AlterUniqueTogether( name='securitygroup', unique_together=set([('name', 'account')]), ), migrations.AlterUniqueTogether( name='cloudzone', unique_together=set([('title', 'region')]), ), migrations.AlterUniqueTogether( name='cloudregion', unique_together=set([('title', 'provider')]), ), migrations.AlterUniqueTogether( name='cloudimage', unique_together=set([('title', 'account')]), ), migrations.AlterUniqueTogether( name='cloudaccount', unique_together=set([('title', 'provider')]), ), ]
apache-2.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 1639, 14, 697, 492, 6180, 12, 1709, 421, 199, 533, 12090, 8, 7685, 14, 9816, 304, 339, 2536, 275, 715, 339, 5124, 275, 359, 267, 661, 21707, 297, 283, 4183, 63, 16, 63, 24, 63, 2747, 659, 267, 661, 4091, 297, 283, 4183, 63, 16, 63, 24, 63, 2747, 659, 272, 1622, 339, 19058, 275, 359, 267, 661, 4091, 297, 283, 4183, 63, 2747, 659, 267, 661, 4091, 297, 283, 9425, 63, 2747, 659, 267, 661, 4091, 297, 283, 16643, 63, 86, 16, 63, 23, 63, 7685, 659, 267, 661, 4091, 297, 283, 15646, 63, 86, 16, 63, 23, 66, 63, 7685, 659, 267, 661, 4091, 297, 283, 20965, 63, 86, 16, 63, 23, 67, 63, 7685, 659, 267, 661, 4091, 297, 283, 22530, 63, 86, 16, 63, 23, 68, 63, 7685, 659, 267, 661, 4091, 297, 283, 19141, 63, 86, 16, 63, 23, 69, 63, 7685, 659, 272, 1622, 339, 5331, 275, 359, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 4416, 923, 297, 288, 536, 534, 2340, 297, 288, 901, 29, 992, 14, 3190, 8, 2407, 63, 354, 534, 4416, 63, 2634, 297, 370, 534, 21707, 14, 4851, 297, 2973, 29, 549, 395, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 4091, 2619, 297, 288, 536, 534, 4551, 297, 288, 901, 29, 992, 14, 3190, 8, 2407, 63, 354, 534, 13325, 297, 370, 534, 4091, 14, 9089, 10708, 659, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 4091, 4551, 297, 288, 536, 534, 3780, 297, 288, 901, 29, 992, 14, 3190, 8, 3832, 63, 354, 534, 9089, 18489, 297, 370, 534, 4091, 14, 9089, 6663, 659, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 4091, 842, 890, 297, 288, 536, 534, 3780, 297, 288, 901, 29, 992, 14, 3190, 8, 3832, 63, 354, 534, 9089, 18489, 297, 370, 534, 4091, 14, 9089, 6663, 659, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 1251, 14525, 960, 297, 288, 536, 534, 2048, 297, 288, 901, 29, 992, 14, 3190, 8, 2407, 63, 354, 534, 4782, 297, 370, 534, 4091, 14, 9089, 6009, 659, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 1251, 14525, 960, 297, 288, 536, 534, 885, 63, 842, 63, 890, 297, 288, 901, 29, 992, 14, 3190, 8, 3832, 63, 354, 534, 2698, 10066, 14579, 297, 370, 534, 4091, 14, 9089, 3244, 2320, 659, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 4091, 2048, 297, 288, 536, 534, 3780, 297, 288, 901, 29, 992, 14, 3190, 8, 3832, 63, 354, 534, 9089, 18489, 297, 370, 534, 4091, 14, 9089, 6663, 659, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 4091, 2048, 297, 288, 536, 534, 4551, 297, 288, 901, 29, 992, 14, 3190, 8, 3832, 63, 354, 534, 10708, 297, 370, 534, 4091, 14, 9089, 10708, 659, 267, 2318, 267, 6180, 14, 14364, 11427, 1378, 4920, 8, 288, 536, 534, 4753, 297, 288, 3747, 63, 6314, 29, 409, 8318, 4753, 63, 344, 297, 283, 2048, 22864, 267, 2318, 267, 6180, 14, 14364, 11427, 1378, 4920, 8, 288, 536, 534, 4416, 923, 297, 288, 3747, 63, 6314, 29, 409, 8318, 354, 297, 283, 2048, 22864, 267, 2318, 267, 6180, 14, 14364, 11427, 1378, 4920, 8, 288, 536, 534, 4091, 2619, 297, 288, 3747, 63, 6314, 29, 409, 8318, 1213, 297, 283, 4551, 22864, 267, 2318, 267, 6180, 14, 14364, 11427, 1378, 4920, 8, 288, 536, 534, 4091, 4551, 297, 288, 3747, 63, 6314, 29, 409, 8318, 1213, 297, 283, 3780, 22864, 267, 2318, 267, 6180, 14, 14364, 11427, 1378, 4920, 8, 288, 536, 534, 1251, 14525, 960, 297, 288, 3747, 63, 6314, 29, 409, 8318, 1213, 297, 283, 2048, 22864, 267, 2318, 267, 6180, 14, 14364, 11427, 1378, 4920, 8, 288, 536, 534, 4091, 2048, 297, 288, 3747, 63, 6314, 29, 409, 8318, 1213, 297, 283, 3780, 22864, 267, 2318, 272, 1622, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 1639, 14, 697, 492, 6180, 12, 1709, 421, 199, 533, 12090, 8, 7685, 14, 9816, 304, 339, 2536, 275, 715, 339, 5124, 275, 359, 267, 661, 21707, 297, 283, 4183, 63, 16, 63, 24, 63, 2747, 659, 267, 661, 4091, 297, 283, 4183, 63, 16, 63, 24, 63, 2747, 659, 272, 1622, 339, 19058, 275, 359, 267, 661, 4091, 297, 283, 4183, 63, 2747, 659, 267, 661, 4091, 297, 283, 9425, 63, 2747, 659, 267, 661, 4091, 297, 283, 16643, 63, 86, 16, 63, 23, 63, 7685, 659, 267, 661, 4091, 297, 283, 15646, 63, 86, 16, 63, 23, 66, 63, 7685, 659, 267, 661, 4091, 297, 283, 20965, 63, 86, 16, 63, 23, 67, 63, 7685, 659, 267, 661, 4091, 297, 283, 22530, 63, 86, 16, 63, 23, 68, 63, 7685, 659, 267, 661, 4091, 297, 283, 19141, 63, 86, 16, 63, 23, 69, 63, 7685, 659, 272, 1622, 339, 5331, 275, 359, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 4416, 923, 297, 288, 536, 534, 2340, 297, 288, 901, 29, 992, 14, 3190, 8, 2407, 63, 354, 534, 4416, 63, 2634, 297, 370, 534, 21707, 14, 4851, 297, 2973, 29, 549, 395, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 4091, 2619, 297, 288, 536, 534, 4551, 297, 288, 901, 29, 992, 14, 3190, 8, 2407, 63, 354, 534, 13325, 297, 370, 534, 4091, 14, 9089, 10708, 659, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 4091, 4551, 297, 288, 536, 534, 3780, 297, 288, 901, 29, 992, 14, 3190, 8, 3832, 63, 354, 534, 9089, 18489, 297, 370, 534, 4091, 14, 9089, 6663, 659, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 4091, 842, 890, 297, 288, 536, 534, 3780, 297, 288, 901, 29, 992, 14, 3190, 8, 3832, 63, 354, 534, 9089, 18489, 297, 370, 534, 4091, 14, 9089, 6663, 659, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 1251, 14525, 960, 297, 288, 536, 534, 2048, 297, 288, 901, 29, 992, 14, 3190, 8, 2407, 63, 354, 534, 4782, 297, 370, 534, 4091, 14, 9089, 6009, 659, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 1251, 14525, 960, 297, 288, 536, 534, 885, 63, 842, 63, 890, 297, 288, 901, 29, 992, 14, 3190, 8, 3832, 63, 354, 534, 2698, 10066, 14579, 297, 370, 534, 4091, 14, 9089, 3244, 2320, 659, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 4091, 2048, 297, 288, 536, 534, 3780, 297, 288, 901, 29, 992, 14, 3190, 8, 3832, 63, 354, 534, 9089, 18489, 297, 370, 534, 4091, 14, 9089, 6663, 659, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 4091, 2048, 297, 288, 536, 534, 4551, 297, 288, 901, 29, 992, 14, 3190, 8, 3832, 63, 354, 534, 10708, 297, 370, 534, 4091, 14, 9089, 10708, 659, 267, 2318, 267, 6180, 14, 14364, 11427, 1378, 4920, 8, 288, 536, 534, 4753, 297, 288, 3747, 63, 6314, 29, 409, 8318, 4753, 63, 344, 297, 283, 2048, 22864, 267, 2318, 267, 6180, 14, 14364, 11427, 1378, 4920, 8, 288, 536, 534, 4416, 923, 297, 288, 3747, 63, 6314, 29, 409, 8318, 354, 297, 283, 2048, 22864, 267, 2318, 267, 6180, 14, 14364, 11427, 1378, 4920, 8, 288, 536, 534, 4091, 2619, 297, 288, 3747, 63, 6314, 29, 409, 8318, 1213, 297, 283, 4551, 22864, 267, 2318, 267, 6180, 14, 14364, 11427, 1378, 4920, 8, 288, 536, 534, 4091, 4551, 297, 288, 3747, 63, 6314, 29, 409, 8318, 1213, 297, 283, 3780, 22864, 267, 2318, 267, 6180, 14, 14364, 11427, 1378, 4920, 8, 288, 536, 534, 1251, 14525, 960, 297, 288, 3747, 63, 6314, 29, 409, 8318, 1213, 297, 283, 2048, 22864, 267, 2318, 267, 6180, 14, 14364, 11427, 1378, 4920, 8, 288, 536, 534, 4091, 2048, 297, 288, 3747, 63, 6314, 29, 409, 8318, 1213, 297, 283, 3780, 22864, 267, 2318, 272, 1622, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 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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 ]
Yen-Chung-En/w16b_test
static/Brython3.1.1-20150328-091302/Lib/browser/indexed_db.py
632
3008
class EventListener: def __init__(self, events=[]): self._events=events def append(self, event): self._events.append(event) def fire(self, e): for _event in self._events: _event(e) class IndexedDB: def __init__(self): if not __BRYTHON__.has_indexedDB: raise NotImplementedError("Your browser doesn't support indexedDB") return self._indexedDB=__BRYTHON__.indexedDB() self._db=None self._version=None def _onsuccess(self, event): self._db=event.target.result def open(self, name, onsuccess, version=1.0, onerror=None, onupgradeneeded=None): self._version=version _result=self._indexedDB.open(name, version) _success=EventListener([self._onsuccess, onsuccess]) _result.onsuccess=_success.fire _result.onupgradeneeded=onupgradeneeded #if onerror is None: def onerror(e): print("onerror: %s:%s" % (e.type, e.target.result)) def onblocked(e): print("blocked: %s:%s" % (e.type, e.result)) _result.onerror=onerror _result.onblocked=onblocked def transaction(self, entities, mode='read'): return Transaction(self._db.transaction(entities, mode)) class Transaction: def __init__(self, transaction): self._transaction=transaction def objectStore(self, name): return ObjectStore(self._transaction.objectStore(name)) class ObjectStore: def __init__(self, objectStore): self._objectStore=objectStore self._data=[] def clear(self, onsuccess=None, onerror=None): _result=self._objectStore.clear() if onsuccess is not None: _result.onsuccess=onsuccess if onerror is not None: _result.onerror=onerror def _helper(self, func, object, onsuccess=None, onerror=None): _result=func(object) if onsuccess is not None: _result.onsuccess=onsuccess if onerror is not None: _result.onerror=onerror def put(self, obj, key=None, onsuccess=None, onerror=None): _r = self._objectStore.put(obj, key) _r.onsuccess = onsuccess _r.onerror = onerror def add(self, obj, key, onsuccess=None, onerror=None): _r = self._objectStore.add(obj, key) _r.onsuccess = onsuccess _r.onerror = onerror #self._helper(self._objectStore.add, object, onsuccess, onerror) def delete(self, index, onsuccess=None, onerror=None): self._helper(self._objectStore.delete, index, onsuccess, onerror) def query(self, *args): self._data=[] def onsuccess(event): cursor=event.target.result if cursor is not None: self._data.append(cursor.value) getattr(cursor,"continue")() # cursor.continue() is illegal self._objectStore.openCursor(args).onsuccess=onsuccess def fetchall(self): yield self._data def get(self, key, onsuccess=None, onerror=None): self._helper(self._objectStore.get, key, onsuccess, onerror)
agpl-3.0
[ 533, 6763, 10464, 26, 523, 347, 636, 826, 721, 277, 12, 4474, 17894, 489, 291, 423, 4368, 29, 4368, 819, 347, 5666, 8, 277, 12, 1566, 304, 489, 291, 423, 4368, 14, 740, 8, 1430, 9, 819, 347, 8344, 8, 277, 12, 325, 304, 489, 367, 485, 1430, 315, 291, 423, 4368, 26, 881, 485, 1430, 8, 69, 9, 199, 199, 533, 26437, 2846, 26, 523, 347, 636, 826, 721, 277, 304, 489, 340, 440, 636, 34, 5782, 8472, 4343, 1989, 63, 16821, 2846, 26, 268, 746, 4279, 480, 14398, 7042, 3181, 1133, 2291, 15235, 2846, 531, 268, 372, 2541, 291, 423, 16821, 2846, 18971, 34, 5782, 8472, 4343, 16821, 2846, 342, 489, 291, 423, 697, 29, 403, 489, 291, 423, 1023, 29, 403, 819, 347, 485, 265, 3742, 8, 277, 12, 1566, 304, 489, 291, 423, 697, 29, 1430, 14, 1375, 14, 1099, 819, 347, 1551, 8, 277, 12, 536, 12, 641, 3742, 12, 1015, 29, 17, 14, 16, 12, 22852, 29, 403, 12, 221, 1779, 641, 9375, 11368, 29, 403, 304, 489, 291, 423, 1023, 29, 1023, 489, 485, 1099, 29, 277, 423, 16821, 2846, 14, 1490, 8, 354, 12, 1015, 9, 489, 485, 3742, 29, 2390, 10464, 779, 277, 423, 265, 3742, 12, 641, 3742, 566, 489, 485, 1099, 14, 265, 3742, 3699, 3742, 14, 8935, 489, 485, 1099, 14, 265, 9375, 11368, 29, 265, 9375, 11368, 2541, 327, 692, 22852, 365, 488, 26, 489, 347, 22852, 8, 69, 304, 881, 870, 480, 265, 705, 26, 450, 83, 2689, 83, 2, 450, 221, 334, 69, 14, 466, 12, 325, 14, 1375, 14, 1099, 430, 2541, 347, 641, 17726, 8, 69, 304, 881, 870, 480, 17726, 26, 450, 83, 2689, 83, 2, 450, 221, 334, 69, 14, 466, 12, 325, 14, 1099, 430, 2541, 485, 1099, 14, 265, 705, 29, 265, 705, 489, 485, 1099, 14, 265, 17726, 29, 265, 17726, 819, 347, 6008, 8, 277, 12, 9045, 12, 818, 534, 739, 735, 489, 372, 18244, 8, 277, 423, 697, 14, 5945, 8, 8327, 12, 818, 430, 199, 199, 533, 18244, 26, 819, 347, 636, 826, 721, 277, 12, 6008, 304, 489, 291, 423, 5945, 29, 5945, 819, 347, 909, 5502, 8, 277, 12, 536, 304, 489, 372, 6935, 5502, 8, 277, 423, 5945, 14, 785, 5502, 8, 354, 430, 199, 199, 533, 6935, 5502, 26, 819, 347, 636, 826, 721, 277, 12, 909, 5502, 304, 489, 291, 423, 785, 5502, 29, 785, 5502, 489, 291, 423, 576, 9811, 819, 347, 5436, 8, 277, 12, 641, 3742, 29, 403, 12, 22852, 29, 403, 304, 489, 485, 1099, 29, 277, 423, 785, 5502, 14, 3584, 342, 2541, 340, 641, 3742, 365, 440, 488, 26, 268, 485, 1099, 14, 265, 3742, 29, 265, 3742, 2541, 340, 22852, 365, 440, 488, 26, 268, 485, 1099, 14, 265, 705, 29, 265, 705, 819, 347, 485, 3676, 8, 277, 12, 2562, 12, 909, 12, 641, 3742, 29, 403, 12, 22852, 29, 403, 304, 489, 485, 1099, 29, 1532, 8, 785, 9, 2541, 340, 641, 3742, 365, 440, 488, 26, 268, 485, 1099, 14, 265, 3742, 29, 265, 3742, 2541, 340, 22852, 365, 440, 488, 26, 268, 485, 1099, 14, 265, 705, 29, 265, 705, 819, 347, 5324, 8, 277, 12, 1559, 12, 790, 29, 403, 12, 641, 3742, 29, 403, 12, 22852, 29, 403, 304, 489, 485, 82, 275, 291, 423, 785, 5502, 14, 524, 8, 1113, 12, 790, 9, 489, 485, 82, 14, 265, 3742, 275, 641, 3742, 489, 485, 82, 14, 265, 705, 275, 22852, 819, 347, 1050, 8, 277, 12, 1559, 12, 790, 12, 641, 3742, 29, 403, 12, 22852, 29, 403, 304, 489, 485, 82, 275, 291, 423, 785, 5502, 14, 525, 8, 1113, 12, 790, 9, 489, 485, 82, 14, 265, 3742, 275, 641, 3742, 489, 485, 82, 14, 265, 705, 275, 22852, 489, 327, 277, 423, 3676, 8, 277, 423, 785, 5502, 14, 525, 12, 909, 12, 641, 3742, 12, 22852, 9, 819, 347, 3145, 8, 277, 12, 1478, 12, 641, 3742, 29, 403, 12, 22852, 29, 403, 304, 15166, 291, 423, 3676, 8, 277, 423, 785, 5502, 14, 1807, 12, 1478, 12, 641, 3742, 12, 22852, 9, 489, 523, 347, 1827, 8, 277, 12, 627, 589, 304, 489, 291, 423, 576, 9811, 489, 347, 641, 3742, 8, 1430, 304, 881, 3920, 29, 1430, 14, 1375, 14, 1099, 881, 340, 3920, 365, 440, 488, 26, 1467, 291, 423, 576, 14, 740, 8, 3937, 14, 585, 9, 1467, 2519, 8, 3937, 4589, 6958, 531, 342, 327, 3920, 14, 6958, 342, 365, 20282, 2541, 291, 423, 785, 5502, 14, 1490, 8993, 8, 589, 680, 265, 3742, 29, 265, 3742, 819, 347, 5267, 452, 8, 277, 304, 489, 1995, 291, 423, 576, 819, 347, 664, 8, 277, 12, 790, 12, 641, 3742, 29, 403, 12, 22852, 29, 403, 304, 489, 291, 423, 3676, 8, 277, 423, 785, 5502, 14, 362, 12, 790, 12, 641, 3742, 12, 22852, 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 ]
[ 6763, 10464, 26, 523, 347, 636, 826, 721, 277, 12, 4474, 17894, 489, 291, 423, 4368, 29, 4368, 819, 347, 5666, 8, 277, 12, 1566, 304, 489, 291, 423, 4368, 14, 740, 8, 1430, 9, 819, 347, 8344, 8, 277, 12, 325, 304, 489, 367, 485, 1430, 315, 291, 423, 4368, 26, 881, 485, 1430, 8, 69, 9, 199, 199, 533, 26437, 2846, 26, 523, 347, 636, 826, 721, 277, 304, 489, 340, 440, 636, 34, 5782, 8472, 4343, 1989, 63, 16821, 2846, 26, 268, 746, 4279, 480, 14398, 7042, 3181, 1133, 2291, 15235, 2846, 531, 268, 372, 2541, 291, 423, 16821, 2846, 18971, 34, 5782, 8472, 4343, 16821, 2846, 342, 489, 291, 423, 697, 29, 403, 489, 291, 423, 1023, 29, 403, 819, 347, 485, 265, 3742, 8, 277, 12, 1566, 304, 489, 291, 423, 697, 29, 1430, 14, 1375, 14, 1099, 819, 347, 1551, 8, 277, 12, 536, 12, 641, 3742, 12, 1015, 29, 17, 14, 16, 12, 22852, 29, 403, 12, 221, 1779, 641, 9375, 11368, 29, 403, 304, 489, 291, 423, 1023, 29, 1023, 489, 485, 1099, 29, 277, 423, 16821, 2846, 14, 1490, 8, 354, 12, 1015, 9, 489, 485, 3742, 29, 2390, 10464, 779, 277, 423, 265, 3742, 12, 641, 3742, 566, 489, 485, 1099, 14, 265, 3742, 3699, 3742, 14, 8935, 489, 485, 1099, 14, 265, 9375, 11368, 29, 265, 9375, 11368, 2541, 327, 692, 22852, 365, 488, 26, 489, 347, 22852, 8, 69, 304, 881, 870, 480, 265, 705, 26, 450, 83, 2689, 83, 2, 450, 221, 334, 69, 14, 466, 12, 325, 14, 1375, 14, 1099, 430, 2541, 347, 641, 17726, 8, 69, 304, 881, 870, 480, 17726, 26, 450, 83, 2689, 83, 2, 450, 221, 334, 69, 14, 466, 12, 325, 14, 1099, 430, 2541, 485, 1099, 14, 265, 705, 29, 265, 705, 489, 485, 1099, 14, 265, 17726, 29, 265, 17726, 819, 347, 6008, 8, 277, 12, 9045, 12, 818, 534, 739, 735, 489, 372, 18244, 8, 277, 423, 697, 14, 5945, 8, 8327, 12, 818, 430, 199, 199, 533, 18244, 26, 819, 347, 636, 826, 721, 277, 12, 6008, 304, 489, 291, 423, 5945, 29, 5945, 819, 347, 909, 5502, 8, 277, 12, 536, 304, 489, 372, 6935, 5502, 8, 277, 423, 5945, 14, 785, 5502, 8, 354, 430, 199, 199, 533, 6935, 5502, 26, 819, 347, 636, 826, 721, 277, 12, 909, 5502, 304, 489, 291, 423, 785, 5502, 29, 785, 5502, 489, 291, 423, 576, 9811, 819, 347, 5436, 8, 277, 12, 641, 3742, 29, 403, 12, 22852, 29, 403, 304, 489, 485, 1099, 29, 277, 423, 785, 5502, 14, 3584, 342, 2541, 340, 641, 3742, 365, 440, 488, 26, 268, 485, 1099, 14, 265, 3742, 29, 265, 3742, 2541, 340, 22852, 365, 440, 488, 26, 268, 485, 1099, 14, 265, 705, 29, 265, 705, 819, 347, 485, 3676, 8, 277, 12, 2562, 12, 909, 12, 641, 3742, 29, 403, 12, 22852, 29, 403, 304, 489, 485, 1099, 29, 1532, 8, 785, 9, 2541, 340, 641, 3742, 365, 440, 488, 26, 268, 485, 1099, 14, 265, 3742, 29, 265, 3742, 2541, 340, 22852, 365, 440, 488, 26, 268, 485, 1099, 14, 265, 705, 29, 265, 705, 819, 347, 5324, 8, 277, 12, 1559, 12, 790, 29, 403, 12, 641, 3742, 29, 403, 12, 22852, 29, 403, 304, 489, 485, 82, 275, 291, 423, 785, 5502, 14, 524, 8, 1113, 12, 790, 9, 489, 485, 82, 14, 265, 3742, 275, 641, 3742, 489, 485, 82, 14, 265, 705, 275, 22852, 819, 347, 1050, 8, 277, 12, 1559, 12, 790, 12, 641, 3742, 29, 403, 12, 22852, 29, 403, 304, 489, 485, 82, 275, 291, 423, 785, 5502, 14, 525, 8, 1113, 12, 790, 9, 489, 485, 82, 14, 265, 3742, 275, 641, 3742, 489, 485, 82, 14, 265, 705, 275, 22852, 489, 327, 277, 423, 3676, 8, 277, 423, 785, 5502, 14, 525, 12, 909, 12, 641, 3742, 12, 22852, 9, 819, 347, 3145, 8, 277, 12, 1478, 12, 641, 3742, 29, 403, 12, 22852, 29, 403, 304, 15166, 291, 423, 3676, 8, 277, 423, 785, 5502, 14, 1807, 12, 1478, 12, 641, 3742, 12, 22852, 9, 489, 523, 347, 1827, 8, 277, 12, 627, 589, 304, 489, 291, 423, 576, 9811, 489, 347, 641, 3742, 8, 1430, 304, 881, 3920, 29, 1430, 14, 1375, 14, 1099, 881, 340, 3920, 365, 440, 488, 26, 1467, 291, 423, 576, 14, 740, 8, 3937, 14, 585, 9, 1467, 2519, 8, 3937, 4589, 6958, 531, 342, 327, 3920, 14, 6958, 342, 365, 20282, 2541, 291, 423, 785, 5502, 14, 1490, 8993, 8, 589, 680, 265, 3742, 29, 265, 3742, 819, 347, 5267, 452, 8, 277, 304, 489, 1995, 291, 423, 576, 819, 347, 664, 8, 277, 12, 790, 12, 641, 3742, 29, 403, 12, 22852, 29, 403, 304, 489, 291, 423, 3676, 8, 277, 423, 785, 5502, 14, 362, 12, 790, 12, 641, 3742, 12, 22852, 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,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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 ]
kpdyer/marionette
marionette_tg/dsl_tests.py
10
23296
import sys import unittest sys.path.append('.') import marionette_tg.dsl class Tests(unittest.TestCase): def test1(self): mar_format = """connection(tcp, 80): start downstream NULL 1.0 downstream upstream http_get 1.0 upstream end http_ok 1.0 action http_get: client fte.send("^regex\r\n\r\n$", 128) action http_ok: server fte.send("^regex\r\n\r\n\C*$", 128)""" parsed_format = marionette_tg.dsl.parse(mar_format) self.assertEquals(parsed_format.get_transport(), "tcp") self.assertEquals(parsed_format.get_port(), 80) self.assertEquals( parsed_format.get_transitions()[0].get_src(), "start") self.assertEquals( parsed_format.get_transitions()[0].get_dst(), "downstream") self.assertEquals( parsed_format.get_transitions()[0].get_action_block(), None) self.assertEquals( parsed_format.get_transitions()[0].get_probability(), float(1.0)) self.assertEquals( parsed_format.get_transitions()[1].get_src(), "downstream") self.assertEquals( parsed_format.get_transitions()[1].get_dst(), "upstream") self.assertEquals( parsed_format.get_transitions()[1].get_action_block(), "http_get") self.assertEquals( parsed_format.get_transitions()[1].get_probability(), float(1.0)) self.assertEquals( parsed_format.get_transitions()[2].get_src(), "upstream") self.assertEquals(parsed_format.get_transitions()[2].get_dst(), "end") self.assertEquals( parsed_format.get_transitions()[2].get_action_block(), "http_ok") self.assertEquals( parsed_format.get_transitions()[2].get_probability(), float(1.0)) self.assertEquals( parsed_format.get_action_blocks()[0].get_name(), "http_get") self.assertEquals( parsed_format.get_action_blocks()[0].get_party(), "client") self.assertEquals( parsed_format.get_action_blocks()[0].get_module(), "fte") self.assertEquals( parsed_format.get_action_blocks()[0].get_method(), "send") self.assertEquals( parsed_format.get_action_blocks()[0].get_args(), [ "^regex\r\n\r\n$", 128]) self.assertEquals( parsed_format.get_action_blocks()[1].get_name(), "http_ok") self.assertEquals( parsed_format.get_action_blocks()[1].get_party(), "server") self.assertEquals( parsed_format.get_action_blocks()[1].get_module(), "fte") self.assertEquals( parsed_format.get_action_blocks()[1].get_method(), "send") self.assertEquals( parsed_format.get_action_blocks()[1].get_args(), [ "^regex\r\n\r\n\C*$", 128]) def test2(self): mar_format = """connection(tcp, 80): start downstream NULL 1.0 downstream upstream http_get 1.0 upstream end http_ok 1.0 action http_get: client fte.send("^regex\r\n\r\n$", 128) action http_ok: server fte.send("^regex\r\n\r\n\C*$", 128) action http_put: client fte.send("^regex\r\n\r\n$", 128)""" parsed_format = marionette_tg.dsl.parse(mar_format) self.assertEquals(parsed_format.get_transport(), "tcp") self.assertEquals(parsed_format.get_port(), 80) self.assertEquals( parsed_format.get_transitions()[0].get_src(), "start") self.assertEquals( parsed_format.get_transitions()[0].get_dst(), "downstream") self.assertEquals( parsed_format.get_transitions()[0].get_action_block(), None) self.assertEquals( parsed_format.get_transitions()[0].get_probability(), float(1.0)) self.assertEquals( parsed_format.get_transitions()[1].get_src(), "downstream") self.assertEquals( parsed_format.get_transitions()[1].get_dst(), "upstream") self.assertEquals( parsed_format.get_transitions()[1].get_action_block(), "http_get") self.assertEquals( parsed_format.get_transitions()[1].get_probability(), float(1.0)) self.assertEquals( parsed_format.get_transitions()[2].get_src(), "upstream") self.assertEquals(parsed_format.get_transitions()[2].get_dst(), "end") self.assertEquals( parsed_format.get_transitions()[2].get_action_block(), "http_ok") self.assertEquals( parsed_format.get_transitions()[2].get_probability(), float(1.0)) self.assertEquals( parsed_format.get_action_blocks()[0].get_name(), "http_get") self.assertEquals( parsed_format.get_action_blocks()[0].get_party(), "client") self.assertEquals( parsed_format.get_action_blocks()[0].get_module(), "fte") self.assertEquals( parsed_format.get_action_blocks()[0].get_method(), "send") self.assertEquals( parsed_format.get_action_blocks()[0].get_args(), [ "^regex\r\n\r\n$", 128]) self.assertEquals( parsed_format.get_action_blocks()[1].get_name(), "http_ok") self.assertEquals( parsed_format.get_action_blocks()[1].get_party(), "server") self.assertEquals( parsed_format.get_action_blocks()[1].get_module(), "fte") self.assertEquals( parsed_format.get_action_blocks()[1].get_method(), "send") self.assertEquals( parsed_format.get_action_blocks()[1].get_args(), [ "^regex\r\n\r\n\C*$", 128]) self.assertEquals( parsed_format.get_action_blocks()[2].get_name(), "http_put") self.assertEquals( parsed_format.get_action_blocks()[2].get_party(), "client") self.assertEquals( parsed_format.get_action_blocks()[2].get_module(), "fte") self.assertEquals( parsed_format.get_action_blocks()[2].get_method(), "send") self.assertEquals( parsed_format.get_action_blocks()[2].get_args(), [ "^regex\r\n\r\n$", 128]) def test3(self): mar_format = """connection(tcp, 80): start downstream NULL 1.0 downstream upstream http_get 1.0 upstream end http_ok 1.0 action http_get: client fte.send("^regex\r\n\r\n$", 128) action http_ok: server fte.send("^regex\r\n\r\n\C*$", 128) action http_put: client fte.send("^regex\r\n\r\n$", 128) action http_notok: server fte.send("^regex\r\n\r\n\C*$", 128)""" parsed_format = marionette_tg.dsl.parse(mar_format) self.assertEquals(parsed_format.get_transport(), "tcp") self.assertEquals(parsed_format.get_port(), 80) self.assertEquals( parsed_format.get_transitions()[0].get_src(), "start") self.assertEquals( parsed_format.get_transitions()[0].get_dst(), "downstream") self.assertEquals( parsed_format.get_transitions()[0].get_action_block(), None) self.assertEquals( parsed_format.get_transitions()[0].get_probability(), float(1.0)) self.assertEquals( parsed_format.get_transitions()[1].get_src(), "downstream") self.assertEquals( parsed_format.get_transitions()[1].get_dst(), "upstream") self.assertEquals( parsed_format.get_transitions()[1].get_action_block(), "http_get") self.assertEquals( parsed_format.get_transitions()[1].get_probability(), float(1.0)) self.assertEquals( parsed_format.get_transitions()[2].get_src(), "upstream") self.assertEquals(parsed_format.get_transitions()[2].get_dst(), "end") self.assertEquals( parsed_format.get_transitions()[2].get_action_block(), "http_ok") self.assertEquals( parsed_format.get_transitions()[2].get_probability(), float(1.0)) self.assertEquals( parsed_format.get_action_blocks()[0].get_name(), "http_get") self.assertEquals( parsed_format.get_action_blocks()[0].get_party(), "client") self.assertEquals( parsed_format.get_action_blocks()[0].get_module(), "fte") self.assertEquals( parsed_format.get_action_blocks()[0].get_method(), "send") self.assertEquals( parsed_format.get_action_blocks()[0].get_args(), [ "^regex\r\n\r\n$", 128]) self.assertEquals( parsed_format.get_action_blocks()[1].get_name(), "http_ok") self.assertEquals( parsed_format.get_action_blocks()[1].get_party(), "server") self.assertEquals( parsed_format.get_action_blocks()[1].get_module(), "fte") self.assertEquals( parsed_format.get_action_blocks()[1].get_method(), "send") self.assertEquals( parsed_format.get_action_blocks()[1].get_args(), [ "^regex\r\n\r\n\C*$", 128]) self.assertEquals( parsed_format.get_action_blocks()[2].get_name(), "http_put") self.assertEquals( parsed_format.get_action_blocks()[2].get_party(), "client") self.assertEquals( parsed_format.get_action_blocks()[2].get_module(), "fte") self.assertEquals( parsed_format.get_action_blocks()[2].get_method(), "send") self.assertEquals( parsed_format.get_action_blocks()[2].get_args(), [ "^regex\r\n\r\n$", 128]) self.assertEquals( parsed_format.get_action_blocks()[3].get_name(), "http_notok") self.assertEquals( parsed_format.get_action_blocks()[3].get_party(), "server") self.assertEquals( parsed_format.get_action_blocks()[3].get_module(), "fte") self.assertEquals( parsed_format.get_action_blocks()[3].get_method(), "send") self.assertEquals( parsed_format.get_action_blocks()[3].get_args(), [ "^regex\r\n\r\n\C*$", 128]) def test4(self): mar_format = """connection(tcp, 8082): start handshake NULL 1.0 handshake upstream upstream_handshake 1.0 upstream downstream upstream_async 1.0 downstream upstream downstream_async 1.0 action upstream_handshake: client fte.send("^.*$", 128) action upstream_async: client fte.send_async("^.*$", 128) action downstream_async: server fte.send_async("^.*$", 128) """ parsed_format = marionette_tg.dsl.parse(mar_format) self.assertEquals(parsed_format.get_transport(), "tcp") self.assertEquals(parsed_format.get_port(), 8082) self.assertEquals( parsed_format.get_transitions()[0].get_src(), "start") self.assertEquals( parsed_format.get_transitions()[0].get_dst(), "handshake") self.assertEquals( parsed_format.get_transitions()[0].get_action_block(), None) self.assertEquals( parsed_format.get_transitions()[0].get_probability(), float(1.0)) self.assertEquals( parsed_format.get_transitions()[1].get_src(), "handshake") self.assertEquals( parsed_format.get_transitions()[1].get_dst(), "upstream") self.assertEquals( parsed_format.get_transitions()[1].get_action_block(), "upstream_handshake") self.assertEquals( parsed_format.get_transitions()[1].get_probability(), float(1.0)) self.assertEquals( parsed_format.get_transitions()[2].get_src(), "upstream") self.assertEquals( parsed_format.get_transitions()[2].get_dst(), "downstream") self.assertEquals( parsed_format.get_transitions()[2].get_action_block(), "upstream_async") self.assertEquals( parsed_format.get_transitions()[2].get_probability(), float(1.0)) self.assertEquals( parsed_format.get_transitions()[3].get_src(), "downstream") self.assertEquals( parsed_format.get_transitions()[3].get_dst(), "upstream") self.assertEquals( parsed_format.get_transitions()[3].get_action_block(), "downstream_async") self.assertEquals( parsed_format.get_transitions()[3].get_probability(), float(1.0)) self.assertEquals( parsed_format.get_action_blocks()[0].get_name(), "upstream_handshake") self.assertEquals( parsed_format.get_action_blocks()[0].get_party(), "client") self.assertEquals( parsed_format.get_action_blocks()[0].get_module(), "fte") self.assertEquals( parsed_format.get_action_blocks()[0].get_method(), "send") self.assertEquals( parsed_format.get_action_blocks()[0].get_args(), ["^.*$", 128]) self.assertEquals( parsed_format.get_action_blocks()[1].get_name(), "upstream_async") self.assertEquals( parsed_format.get_action_blocks()[1].get_party(), "client") self.assertEquals( parsed_format.get_action_blocks()[1].get_module(), "fte") self.assertEquals( parsed_format.get_action_blocks()[1].get_method(), "send_async") self.assertEquals( parsed_format.get_action_blocks()[1].get_args(), ["^.*$", 128]) self.assertEquals( parsed_format.get_action_blocks()[2].get_name(), "downstream_async") self.assertEquals( parsed_format.get_action_blocks()[2].get_party(), "server") self.assertEquals( parsed_format.get_action_blocks()[2].get_module(), "fte") self.assertEquals( parsed_format.get_action_blocks()[2].get_method(), "send_async") self.assertEquals( parsed_format.get_action_blocks()[2].get_args(), ["^.*$", 128]) def test5(self): mar_format = """connection(tcp, 80): start downstream NULL 1.0 downstream upstream http_get 1.0 upstream end http_ok 1.0 action http_get: client fte.send("^regex\r\n\r\n$") action http_ok: server fte.send("^regex\r\n\r\n\C*$")""" parsed_format = marionette_tg.dsl.parse(mar_format) self.assertEquals(parsed_format.get_transport(), "tcp") self.assertEquals(parsed_format.get_port(), 80) self.assertEquals( parsed_format.get_transitions()[0].get_src(), "start") self.assertEquals( parsed_format.get_transitions()[0].get_dst(), "downstream") self.assertEquals( parsed_format.get_transitions()[0].get_action_block(), None) self.assertEquals( parsed_format.get_transitions()[0].get_probability(), float(1.0)) self.assertEquals( parsed_format.get_transitions()[1].get_src(), "downstream") self.assertEquals( parsed_format.get_transitions()[1].get_dst(), "upstream") self.assertEquals( parsed_format.get_transitions()[1].get_action_block(), "http_get") self.assertEquals( parsed_format.get_transitions()[1].get_probability(), float(1.0)) self.assertEquals( parsed_format.get_transitions()[2].get_src(), "upstream") self.assertEquals(parsed_format.get_transitions()[2].get_dst(), "end") self.assertEquals( parsed_format.get_transitions()[2].get_action_block(), "http_ok") self.assertEquals( parsed_format.get_transitions()[2].get_probability(), float(1.0)) def test6(self): mar_format = """connection(tcp, 80): start do_nothing NULL 1.0 do_nothing end NULL 1.0 action http_get: client fte.send("^regex1\r\n\r\n$") server fte.recv("^regex2\r\n\r\n$")""" parsed_format = marionette_tg.dsl.parse(mar_format) self.assertEquals(parsed_format.get_transport(), "tcp") self.assertEquals(parsed_format.get_port(), 80) self.assertEquals( parsed_format.get_transitions()[0].get_src(), "start") self.assertEquals( parsed_format.get_transitions()[0].get_dst(), "do_nothing") self.assertEquals( parsed_format.get_transitions()[0].get_action_block(), None) self.assertEquals( parsed_format.get_transitions()[0].get_probability(), float(1.0)) self.assertEquals( parsed_format.get_transitions()[1].get_src(), "do_nothing") self.assertEquals(parsed_format.get_transitions()[1].get_dst(), "end") self.assertEquals( parsed_format.get_transitions()[1].get_action_block(), None) self.assertEquals( parsed_format.get_transitions()[1].get_probability(), float(1.0)) self.assertEquals( parsed_format.get_action_blocks()[0].get_name(), "http_get") self.assertEquals( parsed_format.get_action_blocks()[0].get_party(), "client") self.assertEquals( parsed_format.get_action_blocks()[0].get_module(), "fte") self.assertEquals( parsed_format.get_action_blocks()[0].get_method(), "send") self.assertEquals( parsed_format.get_action_blocks()[0].get_args(), ["^regex1\r\n\r\n$"]) self.assertEquals( parsed_format.get_action_blocks()[1].get_name(), "http_get") self.assertEquals( parsed_format.get_action_blocks()[1].get_party(), "server") self.assertEquals( parsed_format.get_action_blocks()[1].get_module(), "fte") self.assertEquals( parsed_format.get_action_blocks()[1].get_method(), "recv") self.assertEquals( parsed_format.get_action_blocks()[1].get_args(), ["^regex2\r\n\r\n$"]) def test7(self): mar_format = """connection(tcp, 80): start do_nothing NULL 1.0 do_nothing end NULL 1.0 start do_err NULL error do_err end NULL error action http_get: client fte.send("^regex1\r\n\r\n$")""" parsed_format = marionette_tg.dsl.parse(mar_format) self.assertEquals(parsed_format.get_transport(), "tcp") self.assertEquals(parsed_format.get_port(), 80) self.assertEquals( parsed_format.get_transitions()[0].get_src(), "start") self.assertEquals( parsed_format.get_transitions()[0].get_dst(), "do_nothing") self.assertEquals( parsed_format.get_transitions()[0].get_action_block(), None) self.assertEquals( parsed_format.get_transitions()[0].get_probability(), float(1.0)) self.assertEquals( parsed_format.get_transitions()[0].is_error_transition(), False) self.assertEquals( parsed_format.get_transitions()[1].get_src(), "do_nothing") self.assertEquals(parsed_format.get_transitions()[1].get_dst(), "end") self.assertEquals( parsed_format.get_transitions()[1].get_action_block(), None) self.assertEquals( parsed_format.get_transitions()[1].get_probability(), float(1.0)) self.assertEquals( parsed_format.get_transitions()[1].is_error_transition(), False) self.assertEquals( parsed_format.get_transitions()[2].get_src(), "start") self.assertEquals( parsed_format.get_transitions()[2].get_dst(), "do_err") self.assertEquals( parsed_format.get_transitions()[2].get_action_block(), None) self.assertEquals( parsed_format.get_transitions()[2].get_probability(), float(0)) self.assertEquals( parsed_format.get_transitions()[2].is_error_transition(), True) self.assertEquals( parsed_format.get_transitions()[3].get_src(), "do_err") self.assertEquals( parsed_format.get_transitions()[3].get_dst(), "end") self.assertEquals( parsed_format.get_transitions()[3].get_action_block(), None) self.assertEquals( parsed_format.get_transitions()[3].get_probability(), float(0)) self.assertEquals( parsed_format.get_transitions()[3].is_error_transition(), True) def test8(self): mar_format = """connection(tcp, 80): start do_nothing NULL 1.0 do_nothing end NULL 1.0 action http_get: client fte.send("^regex1\r\n\r\n$") server fte.recv("^regex2\r\n\r\n$") if regex_match_incoming("^regex2.*")""" parsed_format = marionette_tg.dsl.parse(mar_format) self.assertEquals( parsed_format.get_action_blocks()[0].get_name(), "http_get") self.assertEquals( parsed_format.get_action_blocks()[0].get_party(), "client") self.assertEquals( parsed_format.get_action_blocks()[0].get_module(), "fte") self.assertEquals( parsed_format.get_action_blocks()[0].get_method(), "send") self.assertEquals( parsed_format.get_action_blocks()[0].get_args(), ["^regex1\r\n\r\n$"]) self.assertEquals( parsed_format.get_action_blocks()[1].get_name(), "http_get") self.assertEquals( parsed_format.get_action_blocks()[1].get_party(), "server") self.assertEquals( parsed_format.get_action_blocks()[1].get_module(), "fte") self.assertEquals( parsed_format.get_action_blocks()[1].get_method(), "recv") self.assertEquals( parsed_format.get_action_blocks()[1].get_args(), ["^regex2\r\n\r\n$"]) self.assertEquals( parsed_format.get_action_blocks()[1].get_regex_match_incoming(),"^regex2.*") def test9(self): mar_format = """connection(udp, 80): start do_nothing NULL 1.0 do_nothing end NULL 1.0 action http_get: client fte.send("^regex1\r\n\r\n$")""" parsed_format = marionette_tg.dsl.parse(mar_format) self.assertEquals(parsed_format.get_transport(), "udp") def test_hex_input_strings(self): mar_files = marionette_tg.dsl.find_mar_files('client', 'test_hex_input_strings', '20150701') with open(mar_files[0]) as f: mar_format = f.read() parsed_format = marionette_tg.dsl.parse(mar_format) self.assertEquals(parsed_format.get_action_blocks()[0].get_name(), "null_puts") self.assertEquals(parsed_format.get_action_blocks()[0].get_party(), "client") self.assertEquals(parsed_format.get_action_blocks()[0].get_module(), "io") self.assertEquals(parsed_format.get_action_blocks()[0].get_method(), "puts") self.assertEquals(parsed_format.get_action_blocks()[0].get_args()[0], "\x41\x42\\backslash") if __name__ == "__main__": unittest.main()
apache-2.0
[ 646, 984, 199, 646, 2882, 199, 199, 1274, 14, 515, 14, 740, 7563, 199, 199, 646, 333, 759, 368, 14586, 63, 17699, 14, 795, 76, 421, 199, 533, 6496, 8, 2796, 14, 1746, 304, 339, 347, 511, 17, 8, 277, 304, 267, 7557, 63, 908, 275, 408, 2105, 8, 8815, 12, 5939, 304, 881, 1343, 420, 3224, 1745, 5962, 258, 413, 14, 16, 881, 3224, 1745, 18932, 257, 1455, 63, 362, 413, 14, 16, 881, 18932, 257, 1284, 263, 1455, 63, 745, 221, 413, 14, 16, 398, 1595, 1455, 63, 362, 26, 881, 1890, 289, 266, 14, 2254, 18523, 3821, 60, 82, 60, 78, 60, 82, 60, 78, 11918, 7960, 9, 398, 1595, 1455, 63, 745, 26, 881, 1654, 289, 266, 14, 2254, 18523, 3821, 60, 82, 60, 78, 60, 82, 60, 78, 60, 35, 10, 11918, 7960, 9471, 398, 4565, 63, 908, 275, 333, 759, 368, 14586, 63, 17699, 14, 795, 76, 14, 1122, 8, 4584, 63, 908, 9, 398, 291, 14, 2947, 8, 6751, 63, 908, 14, 362, 63, 5545, 1062, 298, 8815, 531, 267, 291, 14, 2947, 8, 6751, 63, 908, 14, 362, 63, 719, 1062, 5939, 9, 398, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 16, 1055, 362, 63, 2164, 1062, 298, 928, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 16, 1055, 362, 63, 5119, 1062, 298, 2110, 1745, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 16, 1055, 362, 63, 1287, 63, 1457, 1062, 488, 9, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 16, 1055, 362, 63, 17210, 1062, 2069, 8, 17, 14, 16, 430, 398, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 17, 1055, 362, 63, 2164, 1062, 298, 2110, 1745, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 17, 1055, 362, 63, 5119, 1062, 298, 20099, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 17, 1055, 362, 63, 1287, 63, 1457, 1062, 298, 1014, 63, 362, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 17, 1055, 362, 63, 17210, 1062, 2069, 8, 17, 14, 16, 430, 398, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 18, 1055, 362, 63, 2164, 1062, 298, 20099, 531, 267, 291, 14, 2947, 8, 6751, 63, 908, 14, 362, 63, 23062, 3430, 18, 1055, 362, 63, 5119, 1062, 298, 500, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 18, 1055, 362, 63, 1287, 63, 1457, 1062, 298, 1014, 63, 745, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 18, 1055, 362, 63, 17210, 1062, 2069, 8, 17, 14, 16, 430, 398, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 16, 1055, 362, 63, 354, 1062, 298, 1014, 63, 362, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 16, 1055, 362, 63, 7522, 1062, 298, 1258, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 16, 1055, 362, 63, 578, 1062, 298, 70, 266, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 16, 1055, 362, 63, 765, 1062, 298, 2254, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 16, 1055, 362, 63, 589, 1062, 359, 355, 18129, 3821, 60, 82, 60, 78, 60, 82, 60, 78, 11918, 7960, 566, 398, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 17, 1055, 362, 63, 354, 1062, 298, 1014, 63, 745, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 17, 1055, 362, 63, 7522, 1062, 298, 1000, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 17, 1055, 362, 63, 578, 1062, 298, 70, 266, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 17, 1055, 362, 63, 765, 1062, 298, 2254, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 17, 1055, 362, 63, 589, 1062, 359, 355, 18129, 3821, 60, 82, 60, 78, 60, 82, 60, 78, 60, 35, 10, 11918, 7960, 566, 339, 347, 511, 18, 8, 277, 304, 267, 7557, 63, 908, 275, 408, 2105, 8, 8815, 12, 5939, 304, 881, 1343, 420, 3224, 1745, 5962, 258, 413, 14, 16, 881, 3224, 1745, 18932, 257, 1455, 63, 362, 413, 14, 16, 881, 18932, 257, 1284, 263, 1455, 63, 745, 221, 413, 14, 16, 398, 1595, 1455, 63, 362, 26, 881, 1890, 289, 266, 14, 2254, 18523, 3821, 60, 82, 60, 78, 60, 82, 60, 78, 11918, 7960, 9, 398, 1595, 1455, 63, 745, 26, 881, 1654, 289, 266, 14, 2254, 18523, 3821, 60, 82, 60, 78, 60, 82, 60, 78, 60, 35, 10, 11918, 7960, 9, 398, 1595, 1455, 63, 524, 26, 881, 1890, 289, 266, 14, 2254, 18523, 3821, 60, 82, 60, 78, 60, 82, 60, 78, 11918, 7960, 9471, 398, 4565, 63, 908, 275, 333, 759, 368, 14586, 63, 17699, 14, 795, 76, 14, 1122, 8, 4584, 63, 908, 9, 398, 291, 14, 2947, 8, 6751, 63, 908, 14, 362, 63, 5545, 1062, 298, 8815, 531, 267, 291, 14, 2947, 8, 6751, 63, 908, 14, 362, 63, 719, 1062, 5939, 9, 398, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 16, 1055, 362, 63, 2164, 1062, 298, 928, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 16, 1055, 362, 63, 5119, 1062, 298, 2110, 1745, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 16, 1055, 362, 63, 1287, 63, 1457, 1062, 488, 9, 267, 291 ]
[ 984, 199, 646, 2882, 199, 199, 1274, 14, 515, 14, 740, 7563, 199, 199, 646, 333, 759, 368, 14586, 63, 17699, 14, 795, 76, 421, 199, 533, 6496, 8, 2796, 14, 1746, 304, 339, 347, 511, 17, 8, 277, 304, 267, 7557, 63, 908, 275, 408, 2105, 8, 8815, 12, 5939, 304, 881, 1343, 420, 3224, 1745, 5962, 258, 413, 14, 16, 881, 3224, 1745, 18932, 257, 1455, 63, 362, 413, 14, 16, 881, 18932, 257, 1284, 263, 1455, 63, 745, 221, 413, 14, 16, 398, 1595, 1455, 63, 362, 26, 881, 1890, 289, 266, 14, 2254, 18523, 3821, 60, 82, 60, 78, 60, 82, 60, 78, 11918, 7960, 9, 398, 1595, 1455, 63, 745, 26, 881, 1654, 289, 266, 14, 2254, 18523, 3821, 60, 82, 60, 78, 60, 82, 60, 78, 60, 35, 10, 11918, 7960, 9471, 398, 4565, 63, 908, 275, 333, 759, 368, 14586, 63, 17699, 14, 795, 76, 14, 1122, 8, 4584, 63, 908, 9, 398, 291, 14, 2947, 8, 6751, 63, 908, 14, 362, 63, 5545, 1062, 298, 8815, 531, 267, 291, 14, 2947, 8, 6751, 63, 908, 14, 362, 63, 719, 1062, 5939, 9, 398, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 16, 1055, 362, 63, 2164, 1062, 298, 928, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 16, 1055, 362, 63, 5119, 1062, 298, 2110, 1745, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 16, 1055, 362, 63, 1287, 63, 1457, 1062, 488, 9, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 16, 1055, 362, 63, 17210, 1062, 2069, 8, 17, 14, 16, 430, 398, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 17, 1055, 362, 63, 2164, 1062, 298, 2110, 1745, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 17, 1055, 362, 63, 5119, 1062, 298, 20099, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 17, 1055, 362, 63, 1287, 63, 1457, 1062, 298, 1014, 63, 362, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 17, 1055, 362, 63, 17210, 1062, 2069, 8, 17, 14, 16, 430, 398, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 18, 1055, 362, 63, 2164, 1062, 298, 20099, 531, 267, 291, 14, 2947, 8, 6751, 63, 908, 14, 362, 63, 23062, 3430, 18, 1055, 362, 63, 5119, 1062, 298, 500, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 18, 1055, 362, 63, 1287, 63, 1457, 1062, 298, 1014, 63, 745, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 18, 1055, 362, 63, 17210, 1062, 2069, 8, 17, 14, 16, 430, 398, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 16, 1055, 362, 63, 354, 1062, 298, 1014, 63, 362, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 16, 1055, 362, 63, 7522, 1062, 298, 1258, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 16, 1055, 362, 63, 578, 1062, 298, 70, 266, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 16, 1055, 362, 63, 765, 1062, 298, 2254, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 16, 1055, 362, 63, 589, 1062, 359, 355, 18129, 3821, 60, 82, 60, 78, 60, 82, 60, 78, 11918, 7960, 566, 398, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 17, 1055, 362, 63, 354, 1062, 298, 1014, 63, 745, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 17, 1055, 362, 63, 7522, 1062, 298, 1000, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 17, 1055, 362, 63, 578, 1062, 298, 70, 266, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 17, 1055, 362, 63, 765, 1062, 298, 2254, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 1287, 63, 4166, 3430, 17, 1055, 362, 63, 589, 1062, 359, 355, 18129, 3821, 60, 82, 60, 78, 60, 82, 60, 78, 60, 35, 10, 11918, 7960, 566, 339, 347, 511, 18, 8, 277, 304, 267, 7557, 63, 908, 275, 408, 2105, 8, 8815, 12, 5939, 304, 881, 1343, 420, 3224, 1745, 5962, 258, 413, 14, 16, 881, 3224, 1745, 18932, 257, 1455, 63, 362, 413, 14, 16, 881, 18932, 257, 1284, 263, 1455, 63, 745, 221, 413, 14, 16, 398, 1595, 1455, 63, 362, 26, 881, 1890, 289, 266, 14, 2254, 18523, 3821, 60, 82, 60, 78, 60, 82, 60, 78, 11918, 7960, 9, 398, 1595, 1455, 63, 745, 26, 881, 1654, 289, 266, 14, 2254, 18523, 3821, 60, 82, 60, 78, 60, 82, 60, 78, 60, 35, 10, 11918, 7960, 9, 398, 1595, 1455, 63, 524, 26, 881, 1890, 289, 266, 14, 2254, 18523, 3821, 60, 82, 60, 78, 60, 82, 60, 78, 11918, 7960, 9471, 398, 4565, 63, 908, 275, 333, 759, 368, 14586, 63, 17699, 14, 795, 76, 14, 1122, 8, 4584, 63, 908, 9, 398, 291, 14, 2947, 8, 6751, 63, 908, 14, 362, 63, 5545, 1062, 298, 8815, 531, 267, 291, 14, 2947, 8, 6751, 63, 908, 14, 362, 63, 719, 1062, 5939, 9, 398, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 16, 1055, 362, 63, 2164, 1062, 298, 928, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 16, 1055, 362, 63, 5119, 1062, 298, 2110, 1745, 531, 267, 291, 14, 2947, 8, 288, 4565, 63, 908, 14, 362, 63, 23062, 3430, 16, 1055, 362, 63, 1287, 63, 1457, 1062, 488, 9, 267, 291, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
ThePixelBro22/willienelsoncoin
contrib/pyminer/pyminer.py
766
6434
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import sys from multiprocessing import Process ERR_SLEEP = 15 MAX_NONCE = 1000000L settings = {} pp = pprint.PrettyPrinter(indent=4) class BitcoinRPC: OBJID = 1 def __init__(self, host, port, username, password): authpair = "%s:%s" % (username, password) self.authhdr = "Basic %s" % (base64.b64encode(authpair)) self.conn = httplib.HTTPConnection(host, port, False, 30) def rpc(self, method, params=None): self.OBJID += 1 obj = { 'version' : '1.1', 'method' : method, 'id' : self.OBJID } if params is None: obj['params'] = [] else: obj['params'] = params self.conn.request('POST', '/', json.dumps(obj), { 'Authorization' : self.authhdr, 'Content-type' : 'application/json' }) resp = self.conn.getresponse() if resp is None: print "JSON-RPC: no response" return None body = resp.read() resp_obj = json.loads(body) if resp_obj is None: print "JSON-RPC: cannot JSON-decode body" return None if 'error' in resp_obj and resp_obj['error'] != None: return resp_obj['error'] if 'result' not in resp_obj: print "JSON-RPC: no result in object" return None return resp_obj['result'] def getblockcount(self): return self.rpc('getblockcount') def getwork(self, data=None): return self.rpc('getwork', data) def uint32(x): return x & 0xffffffffL def bytereverse(x): return uint32(( ((x) << 24) | (((x) << 8) & 0x00ff0000) | (((x) >> 8) & 0x0000ff00) | ((x) >> 24) )) def bufreverse(in_buf): out_words = [] for i in range(0, len(in_buf), 4): word = struct.unpack('@I', in_buf[i:i+4])[0] out_words.append(struct.pack('@I', bytereverse(word))) return ''.join(out_words) def wordreverse(in_buf): out_words = [] for i in range(0, len(in_buf), 4): out_words.append(in_buf[i:i+4]) out_words.reverse() return ''.join(out_words) class Miner: def __init__(self, id): self.id = id self.max_nonce = MAX_NONCE def work(self, datastr, targetstr): # decode work data hex string to binary static_data = datastr.decode('hex') static_data = bufreverse(static_data) # the first 76b of 80b do not change blk_hdr = static_data[:76] # decode 256-bit target value targetbin = targetstr.decode('hex') targetbin = targetbin[::-1] # byte-swap and dword-swap targetbin_str = targetbin.encode('hex') target = long(targetbin_str, 16) # pre-hash first 76b of block header static_hash = hashlib.sha256() static_hash.update(blk_hdr) for nonce in xrange(self.max_nonce): # encode 32-bit nonce value nonce_bin = struct.pack("<I", nonce) # hash final 4b, the nonce value hash1_o = static_hash.copy() hash1_o.update(nonce_bin) hash1 = hash1_o.digest() # sha256 hash of sha256 hash hash_o = hashlib.sha256() hash_o.update(hash1) hash = hash_o.digest() # quick test for winning solution: high 32 bits zero? if hash[-4:] != '\0\0\0\0': continue # convert binary hash to 256-bit Python long hash = bufreverse(hash) hash = wordreverse(hash) hash_str = hash.encode('hex') l = long(hash_str, 16) # proof-of-work test: hash < target if l < target: print time.asctime(), "PROOF-OF-WORK found: %064x" % (l,) return (nonce + 1, nonce_bin) else: print time.asctime(), "PROOF-OF-WORK false positive %064x" % (l,) # return (nonce + 1, nonce_bin) return (nonce + 1, None) def submit_work(self, rpc, original_data, nonce_bin): nonce_bin = bufreverse(nonce_bin) nonce = nonce_bin.encode('hex') solution = original_data[:152] + nonce + original_data[160:256] param_arr = [ solution ] result = rpc.getwork(param_arr) print time.asctime(), "--> Upstream RPC result:", result def iterate(self, rpc): work = rpc.getwork() if work is None: time.sleep(ERR_SLEEP) return if 'data' not in work or 'target' not in work: time.sleep(ERR_SLEEP) return time_start = time.time() (hashes_done, nonce_bin) = self.work(work['data'], work['target']) time_end = time.time() time_diff = time_end - time_start self.max_nonce = long( (hashes_done * settings['scantime']) / time_diff) if self.max_nonce > 0xfffffffaL: self.max_nonce = 0xfffffffaL if settings['hashmeter']: print "HashMeter(%d): %d hashes, %.2f Khash/sec" % ( self.id, hashes_done, (hashes_done / 1000.0) / time_diff) if nonce_bin is not None: self.submit_work(rpc, work['data'], nonce_bin) def loop(self): rpc = BitcoinRPC(settings['host'], settings['port'], settings['rpcuser'], settings['rpcpass']) if rpc is None: return while True: self.iterate(rpc) def miner_thread(id): miner = Miner(id) miner.loop() if __name__ == '__main__': if len(sys.argv) != 2: print "Usage: pyminer.py CONFIG-FILE" sys.exit(1) f = open(sys.argv[1]) for line in f: # skip comment lines m = re.search('^\s*#', line) if m: continue # parse key=value lines m = re.search('^(\w+)\s*=\s*(\S.*)$', line) if m is None: continue settings[m.group(1)] = m.group(2) f.close() if 'host' not in settings: settings['host'] = '127.0.0.1' if 'port' not in settings: settings['port'] = 9332 if 'threads' not in settings: settings['threads'] = 1 if 'hashmeter' not in settings: settings['hashmeter'] = 0 if 'scantime' not in settings: settings['scantime'] = 30L if 'rpcuser' not in settings or 'rpcpass' not in settings: print "Missing username and/or password in cfg file" sys.exit(1) settings['port'] = int(settings['port']) settings['threads'] = int(settings['threads']) settings['hashmeter'] = int(settings['hashmeter']) settings['scantime'] = long(settings['scantime']) thr_list = [] for thr_id in range(settings['threads']): p = Process(target=miner_thread, args=(thr_id,)) p.start() thr_list.append(p) time.sleep(1) # stagger threads print settings['threads'], "mining threads started" print time.asctime(), "Miner Starts - %s:%s" % (settings['host'], settings['port']) try: for thr_proc in thr_list: thr_proc.join() except KeyboardInterrupt: pass print time.asctime(), "Miner Stops - %s:%s" % (settings['host'], settings['port'])
mit
[ 3381, 2647, 15, 1393, 15, 1548, 199, 3, 199, 3, 1898, 334, 67, 9, 7760, 710, 21158, 19782, 199, 3, 17484, 1334, 314, 10697, 15, 56, 845, 2032, 4190, 12, 1937, 314, 23073, 199, 3, 570, 9685, 503, 1455, 921, 1544, 14, 16374, 14, 1308, 15, 2383, 15, 1147, 13, 1682, 14, 8624, 14, 199, 3, 199, 199, 646, 900, 199, 646, 2022, 199, 646, 10933, 199, 646, 8337, 199, 646, 2702, 199, 646, 295, 199, 646, 1300, 772, 199, 646, 8809, 199, 646, 984, 199, 504, 12866, 492, 7132, 199, 199, 2666, 63, 51, 906, 6102, 275, 4114, 199, 4283, 63, 13887, 2089, 275, 19492, 44, 199, 199, 1751, 275, 1052, 199, 802, 275, 10933, 14, 27153, 14131, 8, 3724, 29, 20, 9, 199, 199, 533, 21158, 8171, 26, 199, 198, 15862, 998, 275, 413, 421, 198, 318, 636, 826, 721, 277, 12, 1591, 12, 1844, 12, 3434, 12, 2505, 304, 507, 198, 1178, 3852, 275, 2071, 83, 2689, 83, 2, 450, 334, 2473, 12, 2505, 9, 507, 198, 277, 14, 1178, 11244, 275, 298, 6845, 450, 83, 2, 450, 334, 1095, 772, 14, 66, 772, 2143, 8, 1178, 3852, 430, 507, 198, 277, 14, 1631, 275, 8809, 14, 19114, 8, 1102, 12, 1844, 12, 756, 12, 4233, 9, 199, 198, 318, 8985, 8, 277, 12, 1083, 12, 1862, 29, 403, 304, 507, 198, 277, 14, 15862, 998, 847, 413, 507, 198, 1113, 275, 469, 283, 1023, 7, 520, 283, 17, 14, 17, 297, 686, 198, 6704, 69, 594, 7, 520, 1083, 12, 686, 198, 7, 344, 7, 520, 291, 14, 15862, 998, 789, 507, 198, 692, 1862, 365, 488, 26, 686, 198, 1113, 459, 1162, 418, 275, 942, 507, 198, 2836, 26, 686, 198, 1113, 459, 1162, 418, 275, 1862, 507, 198, 277, 14, 1631, 14, 1069, 360, 4030, 297, 17220, 2022, 14, 4180, 8, 1113, 395, 686, 198, 91, 283, 11626, 7, 520, 291, 14, 1178, 11244, 12, 1585, 221, 283, 2714, 13, 466, 7, 520, 283, 3578, 15, 1001, 7, 3828, 2742, 198, 4518, 275, 291, 14, 1631, 14, 25006, 342, 507, 198, 692, 3085, 365, 488, 26, 686, 198, 1361, 298, 6243, 13, 8171, 26, 949, 1177, 2, 686, 198, 1107, 488, 2742, 198, 2030, 275, 3085, 14, 739, 342, 507, 198, 4518, 63, 1113, 275, 2022, 14, 3640, 8, 2030, 9, 507, 198, 692, 3085, 63, 1113, 365, 488, 26, 686, 198, 1361, 298, 6243, 13, 8171, 26, 3913, 4840, 13, 2708, 2396, 2, 686, 198, 1107, 488, 507, 198, 692, 283, 705, 7, 315, 3085, 63, 1113, 436, 3085, 63, 1113, 459, 705, 418, 1137, 488, 26, 686, 198, 1107, 3085, 63, 1113, 459, 705, 418, 507, 198, 692, 283, 1099, 7, 440, 315, 3085, 63, 1113, 26, 686, 198, 1361, 298, 6243, 13, 8171, 26, 949, 754, 315, 909, 2, 686, 198, 1107, 488, 2742, 198, 1107, 3085, 63, 1113, 459, 1099, 418, 199, 198, 318, 664, 1457, 835, 8, 277, 304, 507, 198, 1107, 291, 14, 4354, 360, 30710, 358, 199, 198, 318, 664, 800, 8, 277, 12, 666, 29, 403, 304, 507, 198, 1107, 291, 14, 4354, 360, 362, 800, 297, 666, 9, 199, 199, 318, 3152, 708, 8, 88, 304, 199, 198, 1107, 671, 1253, 378, 21870, 44, 199, 199, 318, 3696, 4471, 8, 88, 304, 199, 198, 1107, 3152, 708, 1332, 3666, 88, 9, 5213, 5504, 9, 1204, 20337, 88, 9, 5213, 1695, 9, 1253, 378, 88, 383, 556, 993, 9, 1204, 686, 198, 12925, 88, 9, 4331, 1695, 9, 1253, 378, 88, 993, 556, 383, 9, 1204, 3666, 88, 9, 4331, 5504, 9, 5082, 199, 199, 318, 4123, 4471, 8, 262, 63, 1436, 304, 199, 198, 548, 63, 3148, 275, 942, 199, 198, 509, 284, 315, 1425, 8, 16, 12, 822, 8, 262, 63, 1436, 395, 841, 304, 507, 198, 1027, 275, 2702, 14, 5301, 16591, 41, 297, 315, 63, 1436, 59, 73, 26, 73, 11, 20, 11057, 16, 61, 507, 198, 548, 63, 3148, 14, 740, 8, 1820, 14, 1389, 16591, 41, 297, 3696, 4471, 8, 1027, 1724, 199, 198, 1107, 6522, 904, 8, 548, 63, 3148, 9, 199, 199, 318, 4349, 4471, 8, 262, 63, 1436, 304, 199, 198, 548, 63, 3148, 275, 942, 199, 198, 509, 284, 315, 1425, 8, 16, 12, 822, 8, 262, 63, 1436, 395, 841, 304, 507, 198, 548, 63, 3148, 14, 740, 8, 262, 63, 1436, 59, 73, 26, 73, 11, 20, 566, 199, 198, 548, 63, 3148, 14, 4471, 342, 199, 198, 1107, 6522, 904, 8, 548, 63, 3148, 9, 199, 199, 533, 10195, 281, 26, 199, 198, 318, 636, 826, 721, 277, 12, 1305, 304, 507, 198, 277, 14, 344, 275, 1305, 507, 198, 277, 14, 988, 63, 10667, 275, 9141, 63, 13887, 2089, 421, 198, 318, 1736, 8, 277, 12, 666, 495, 12, 1347, 495, 304, 507, 198, 3, 4849, 1736, 666, 6318, 1059, 370, 3366, 507, 198, 1986, 63, 576, 275, 666, 495, 14, 2708, 360, 4097, 358, 507, 198, 1986, 63, 576, 275, 4123, 4471, 8, 1986, 63, 576, 9, 2742, 198, 3, 314, 1642, 14646, 66, 402, 5939, 66, 886, 440, 1570, 507, 198, 14023, 63, 11244, 275, 2955, 63, 576, 1491, 2114, 61, 2742, 198, 3, 4849, 7633, 13, 2075, 1347, 574, 507, 198, 1375, 1393, 275, 1347, 495, 14, 2708, 360, 4097, 358, 507, 198, 1375, 1393, 275, 1347, 1393, 14172, 17, 61, 198, 3, 3696, 13, 9286, 436, 366, 1027, 13, 9286, 507, 198, 1375, 1393, 63, 495, 275, 1347, 1393, 14, 2143, 360, 4097, 358, 507, 198, 1375, 275, 1846, 8, 1375, 1393, 63, 495, 12, 3193, 9, 2742, 198, 3, 876, 13, 2227, 1642, 14646, 66, 402, 1853, 1406, 507, 198, 1986, 63, 2227, 275, 8337, 14, 4835, 3912, 342, 507, 198, 1986, 63, 2227, 14, 873, 8, 14023, 63, 11244, 9, 2742, 198, 509, 13711, 315, 4945, 8, 277, 14, 988, 63, 10667, 304, 6319, 198, 3, 3752, 4337, 13, 2075, 13711, 574, 686, 198, 10667, 63, 1393, 275, 2702, 14, 1389, 6757, 41, 401, 13711, 9, 6319, 198, 3, 2631, 4242, 841, 66, 12, 314, 13711, 574, 686, 198, 2227, 17, 63, 79, 275, 2955, 63, 2227, 14, 1574, 342 ]
[ 2647, 15, 1393, 15, 1548, 199, 3, 199, 3, 1898, 334, 67, 9, 7760, 710, 21158, 19782, 199, 3, 17484, 1334, 314, 10697, 15, 56, 845, 2032, 4190, 12, 1937, 314, 23073, 199, 3, 570, 9685, 503, 1455, 921, 1544, 14, 16374, 14, 1308, 15, 2383, 15, 1147, 13, 1682, 14, 8624, 14, 199, 3, 199, 199, 646, 900, 199, 646, 2022, 199, 646, 10933, 199, 646, 8337, 199, 646, 2702, 199, 646, 295, 199, 646, 1300, 772, 199, 646, 8809, 199, 646, 984, 199, 504, 12866, 492, 7132, 199, 199, 2666, 63, 51, 906, 6102, 275, 4114, 199, 4283, 63, 13887, 2089, 275, 19492, 44, 199, 199, 1751, 275, 1052, 199, 802, 275, 10933, 14, 27153, 14131, 8, 3724, 29, 20, 9, 199, 199, 533, 21158, 8171, 26, 199, 198, 15862, 998, 275, 413, 421, 198, 318, 636, 826, 721, 277, 12, 1591, 12, 1844, 12, 3434, 12, 2505, 304, 507, 198, 1178, 3852, 275, 2071, 83, 2689, 83, 2, 450, 334, 2473, 12, 2505, 9, 507, 198, 277, 14, 1178, 11244, 275, 298, 6845, 450, 83, 2, 450, 334, 1095, 772, 14, 66, 772, 2143, 8, 1178, 3852, 430, 507, 198, 277, 14, 1631, 275, 8809, 14, 19114, 8, 1102, 12, 1844, 12, 756, 12, 4233, 9, 199, 198, 318, 8985, 8, 277, 12, 1083, 12, 1862, 29, 403, 304, 507, 198, 277, 14, 15862, 998, 847, 413, 507, 198, 1113, 275, 469, 283, 1023, 7, 520, 283, 17, 14, 17, 297, 686, 198, 6704, 69, 594, 7, 520, 1083, 12, 686, 198, 7, 344, 7, 520, 291, 14, 15862, 998, 789, 507, 198, 692, 1862, 365, 488, 26, 686, 198, 1113, 459, 1162, 418, 275, 942, 507, 198, 2836, 26, 686, 198, 1113, 459, 1162, 418, 275, 1862, 507, 198, 277, 14, 1631, 14, 1069, 360, 4030, 297, 17220, 2022, 14, 4180, 8, 1113, 395, 686, 198, 91, 283, 11626, 7, 520, 291, 14, 1178, 11244, 12, 1585, 221, 283, 2714, 13, 466, 7, 520, 283, 3578, 15, 1001, 7, 3828, 2742, 198, 4518, 275, 291, 14, 1631, 14, 25006, 342, 507, 198, 692, 3085, 365, 488, 26, 686, 198, 1361, 298, 6243, 13, 8171, 26, 949, 1177, 2, 686, 198, 1107, 488, 2742, 198, 2030, 275, 3085, 14, 739, 342, 507, 198, 4518, 63, 1113, 275, 2022, 14, 3640, 8, 2030, 9, 507, 198, 692, 3085, 63, 1113, 365, 488, 26, 686, 198, 1361, 298, 6243, 13, 8171, 26, 3913, 4840, 13, 2708, 2396, 2, 686, 198, 1107, 488, 507, 198, 692, 283, 705, 7, 315, 3085, 63, 1113, 436, 3085, 63, 1113, 459, 705, 418, 1137, 488, 26, 686, 198, 1107, 3085, 63, 1113, 459, 705, 418, 507, 198, 692, 283, 1099, 7, 440, 315, 3085, 63, 1113, 26, 686, 198, 1361, 298, 6243, 13, 8171, 26, 949, 754, 315, 909, 2, 686, 198, 1107, 488, 2742, 198, 1107, 3085, 63, 1113, 459, 1099, 418, 199, 198, 318, 664, 1457, 835, 8, 277, 304, 507, 198, 1107, 291, 14, 4354, 360, 30710, 358, 199, 198, 318, 664, 800, 8, 277, 12, 666, 29, 403, 304, 507, 198, 1107, 291, 14, 4354, 360, 362, 800, 297, 666, 9, 199, 199, 318, 3152, 708, 8, 88, 304, 199, 198, 1107, 671, 1253, 378, 21870, 44, 199, 199, 318, 3696, 4471, 8, 88, 304, 199, 198, 1107, 3152, 708, 1332, 3666, 88, 9, 5213, 5504, 9, 1204, 20337, 88, 9, 5213, 1695, 9, 1253, 378, 88, 383, 556, 993, 9, 1204, 686, 198, 12925, 88, 9, 4331, 1695, 9, 1253, 378, 88, 993, 556, 383, 9, 1204, 3666, 88, 9, 4331, 5504, 9, 5082, 199, 199, 318, 4123, 4471, 8, 262, 63, 1436, 304, 199, 198, 548, 63, 3148, 275, 942, 199, 198, 509, 284, 315, 1425, 8, 16, 12, 822, 8, 262, 63, 1436, 395, 841, 304, 507, 198, 1027, 275, 2702, 14, 5301, 16591, 41, 297, 315, 63, 1436, 59, 73, 26, 73, 11, 20, 11057, 16, 61, 507, 198, 548, 63, 3148, 14, 740, 8, 1820, 14, 1389, 16591, 41, 297, 3696, 4471, 8, 1027, 1724, 199, 198, 1107, 6522, 904, 8, 548, 63, 3148, 9, 199, 199, 318, 4349, 4471, 8, 262, 63, 1436, 304, 199, 198, 548, 63, 3148, 275, 942, 199, 198, 509, 284, 315, 1425, 8, 16, 12, 822, 8, 262, 63, 1436, 395, 841, 304, 507, 198, 548, 63, 3148, 14, 740, 8, 262, 63, 1436, 59, 73, 26, 73, 11, 20, 566, 199, 198, 548, 63, 3148, 14, 4471, 342, 199, 198, 1107, 6522, 904, 8, 548, 63, 3148, 9, 199, 199, 533, 10195, 281, 26, 199, 198, 318, 636, 826, 721, 277, 12, 1305, 304, 507, 198, 277, 14, 344, 275, 1305, 507, 198, 277, 14, 988, 63, 10667, 275, 9141, 63, 13887, 2089, 421, 198, 318, 1736, 8, 277, 12, 666, 495, 12, 1347, 495, 304, 507, 198, 3, 4849, 1736, 666, 6318, 1059, 370, 3366, 507, 198, 1986, 63, 576, 275, 666, 495, 14, 2708, 360, 4097, 358, 507, 198, 1986, 63, 576, 275, 4123, 4471, 8, 1986, 63, 576, 9, 2742, 198, 3, 314, 1642, 14646, 66, 402, 5939, 66, 886, 440, 1570, 507, 198, 14023, 63, 11244, 275, 2955, 63, 576, 1491, 2114, 61, 2742, 198, 3, 4849, 7633, 13, 2075, 1347, 574, 507, 198, 1375, 1393, 275, 1347, 495, 14, 2708, 360, 4097, 358, 507, 198, 1375, 1393, 275, 1347, 1393, 14172, 17, 61, 198, 3, 3696, 13, 9286, 436, 366, 1027, 13, 9286, 507, 198, 1375, 1393, 63, 495, 275, 1347, 1393, 14, 2143, 360, 4097, 358, 507, 198, 1375, 275, 1846, 8, 1375, 1393, 63, 495, 12, 3193, 9, 2742, 198, 3, 876, 13, 2227, 1642, 14646, 66, 402, 1853, 1406, 507, 198, 1986, 63, 2227, 275, 8337, 14, 4835, 3912, 342, 507, 198, 1986, 63, 2227, 14, 873, 8, 14023, 63, 11244, 9, 2742, 198, 509, 13711, 315, 4945, 8, 277, 14, 988, 63, 10667, 304, 6319, 198, 3, 3752, 4337, 13, 2075, 13711, 574, 686, 198, 10667, 63, 1393, 275, 2702, 14, 1389, 6757, 41, 401, 13711, 9, 6319, 198, 3, 2631, 4242, 841, 66, 12, 314, 13711, 574, 686, 198, 2227, 17, 63, 79, 275, 2955, 63, 2227, 14, 1574, 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, 1, 1, 1 ]
israeleriston/scientific-week
backend/venv/lib/python3.5/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py
360
11622
from __future__ import absolute_import import errno import warnings import hmac from binascii import hexlify, unhexlify from hashlib import md5, sha1, sha256 from ..exceptions import SSLError, InsecurePlatformWarning, SNIMissingWarning SSLContext = None HAS_SNI = False create_default_context = None IS_PYOPENSSL = False # Maps the length of a digest to a possible hash function producing this digest HASHFUNC_MAP = { 32: md5, 40: sha1, 64: sha256, } def _const_compare_digest_backport(a, b): """ Compare two digests of equal length in constant time. The digests must be of type str/bytes. Returns True if the digests match, and False otherwise. """ result = abs(len(a) - len(b)) for l, r in zip(bytearray(a), bytearray(b)): result |= l ^ r return result == 0 _const_compare_digest = getattr(hmac, 'compare_digest', _const_compare_digest_backport) try: # Test for SSL features import ssl from ssl import wrap_socket, CERT_NONE, PROTOCOL_SSLv23 from ssl import HAS_SNI # Has SNI? except ImportError: pass try: from ssl import OP_NO_SSLv2, OP_NO_SSLv3, OP_NO_COMPRESSION except ImportError: OP_NO_SSLv2, OP_NO_SSLv3 = 0x1000000, 0x2000000 OP_NO_COMPRESSION = 0x20000 # A secure default. # Sources for more information on TLS ciphers: # # - https://wiki.mozilla.org/Security/Server_Side_TLS # - https://www.ssllabs.com/projects/best-practices/index.html # - https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/ # # The general intent is: # - Prefer cipher suites that offer perfect forward secrecy (DHE/ECDHE), # - prefer ECDHE over DHE for better performance, # - prefer any AES-GCM over any AES-CBC for better performance and security, # - use 3DES as fallback which is secure but slow, # - disable NULL authentication, MD5 MACs and DSS for security reasons. DEFAULT_CIPHERS = ( 'ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+HIGH:' 'DH+HIGH:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+HIGH:RSA+3DES:!aNULL:' '!eNULL:!MD5' ) try: from ssl import SSLContext # Modern SSL? except ImportError: import sys class SSLContext(object): # Platform-specific: Python 2 & 3.1 supports_set_ciphers = ((2, 7) <= sys.version_info < (3,) or (3, 2) <= sys.version_info) def __init__(self, protocol_version): self.protocol = protocol_version # Use default values from a real SSLContext self.check_hostname = False self.verify_mode = ssl.CERT_NONE self.ca_certs = None self.options = 0 self.certfile = None self.keyfile = None self.ciphers = None def load_cert_chain(self, certfile, keyfile): self.certfile = certfile self.keyfile = keyfile def load_verify_locations(self, cafile=None, capath=None): self.ca_certs = cafile if capath is not None: raise SSLError("CA directories not supported in older Pythons") def set_ciphers(self, cipher_suite): if not self.supports_set_ciphers: raise TypeError( 'Your version of Python does not support setting ' 'a custom cipher suite. Please upgrade to Python ' '2.7, 3.2, or later if you need this functionality.' ) self.ciphers = cipher_suite def wrap_socket(self, socket, server_hostname=None, server_side=False): warnings.warn( 'A true SSLContext object is not available. This prevents ' 'urllib3 from configuring SSL appropriately and may cause ' 'certain SSL connections to fail. You can upgrade to a newer ' 'version of Python to solve this. For more information, see ' 'https://urllib3.readthedocs.io/en/latest/security.html' '#insecureplatformwarning.', InsecurePlatformWarning ) kwargs = { 'keyfile': self.keyfile, 'certfile': self.certfile, 'ca_certs': self.ca_certs, 'cert_reqs': self.verify_mode, 'ssl_version': self.protocol, 'server_side': server_side, } if self.supports_set_ciphers: # Platform-specific: Python 2.7+ return wrap_socket(socket, ciphers=self.ciphers, **kwargs) else: # Platform-specific: Python 2.6 return wrap_socket(socket, **kwargs) def assert_fingerprint(cert, fingerprint): """ Checks if given fingerprint matches the supplied certificate. :param cert: Certificate as bytes object. :param fingerprint: Fingerprint as string of hexdigits, can be interspersed by colons. """ fingerprint = fingerprint.replace(':', '').lower() digest_length = len(fingerprint) hashfunc = HASHFUNC_MAP.get(digest_length) if not hashfunc: raise SSLError( 'Fingerprint of invalid length: {0}'.format(fingerprint)) # We need encode() here for py32; works on py2 and p33. fingerprint_bytes = unhexlify(fingerprint.encode()) cert_digest = hashfunc(cert).digest() if not _const_compare_digest(cert_digest, fingerprint_bytes): raise SSLError('Fingerprints did not match. Expected "{0}", got "{1}".' .format(fingerprint, hexlify(cert_digest))) def resolve_cert_reqs(candidate): """ Resolves the argument to a numeric constant, which can be passed to the wrap_socket function/method from the ssl module. Defaults to :data:`ssl.CERT_NONE`. If given a string it is assumed to be the name of the constant in the :mod:`ssl` module or its abbrevation. (So you can specify `REQUIRED` instead of `CERT_REQUIRED`. If it's neither `None` nor a string we assume it is already the numeric constant which can directly be passed to wrap_socket. """ if candidate is None: return CERT_NONE if isinstance(candidate, str): res = getattr(ssl, candidate, None) if res is None: res = getattr(ssl, 'CERT_' + candidate) return res return candidate def resolve_ssl_version(candidate): """ like resolve_cert_reqs """ if candidate is None: return PROTOCOL_SSLv23 if isinstance(candidate, str): res = getattr(ssl, candidate, None) if res is None: res = getattr(ssl, 'PROTOCOL_' + candidate) return res return candidate def create_urllib3_context(ssl_version=None, cert_reqs=None, options=None, ciphers=None): """All arguments have the same meaning as ``ssl_wrap_socket``. By default, this function does a lot of the same work that ``ssl.create_default_context`` does on Python 3.4+. It: - Disables SSLv2, SSLv3, and compression - Sets a restricted set of server ciphers If you wish to enable SSLv3, you can do:: from urllib3.util import ssl_ context = ssl_.create_urllib3_context() context.options &= ~ssl_.OP_NO_SSLv3 You can do the same to enable compression (substituting ``COMPRESSION`` for ``SSLv3`` in the last line above). :param ssl_version: The desired protocol version to use. This will default to PROTOCOL_SSLv23 which will negotiate the highest protocol that both the server and your installation of OpenSSL support. :param cert_reqs: Whether to require the certificate verification. This defaults to ``ssl.CERT_REQUIRED``. :param options: Specific OpenSSL options. These default to ``ssl.OP_NO_SSLv2``, ``ssl.OP_NO_SSLv3``, ``ssl.OP_NO_COMPRESSION``. :param ciphers: Which cipher suites to allow the server to select. :returns: Constructed SSLContext object with specified options :rtype: SSLContext """ context = SSLContext(ssl_version or ssl.PROTOCOL_SSLv23) # Setting the default here, as we may have no ssl module on import cert_reqs = ssl.CERT_REQUIRED if cert_reqs is None else cert_reqs if options is None: options = 0 # SSLv2 is easily broken and is considered harmful and dangerous options |= OP_NO_SSLv2 # SSLv3 has several problems and is now dangerous options |= OP_NO_SSLv3 # Disable compression to prevent CRIME attacks for OpenSSL 1.0+ # (issue #309) options |= OP_NO_COMPRESSION context.options |= options if getattr(context, 'supports_set_ciphers', True): # Platform-specific: Python 2.6 context.set_ciphers(ciphers or DEFAULT_CIPHERS) context.verify_mode = cert_reqs if getattr(context, 'check_hostname', None) is not None: # Platform-specific: Python 3.2 # We do our own verification, including fingerprints and alternative # hostnames. So disable it here context.check_hostname = False return context def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None, ca_certs=None, server_hostname=None, ssl_version=None, ciphers=None, ssl_context=None, ca_cert_dir=None): """ All arguments except for server_hostname, ssl_context, and ca_cert_dir have the same meaning as they do when using :func:`ssl.wrap_socket`. :param server_hostname: When SNI is supported, the expected hostname of the certificate :param ssl_context: A pre-made :class:`SSLContext` object. If none is provided, one will be created using :func:`create_urllib3_context`. :param ciphers: A string of ciphers we wish the client to support. This is not supported on Python 2.6 as the ssl module does not support it. :param ca_cert_dir: A directory containing CA certificates in multiple separate files, as supported by OpenSSL's -CApath flag or the capath argument to SSLContext.load_verify_locations(). """ context = ssl_context if context is None: context = create_urllib3_context(ssl_version, cert_reqs, ciphers=ciphers) if ca_certs or ca_cert_dir: try: context.load_verify_locations(ca_certs, ca_cert_dir) except IOError as e: # Platform-specific: Python 2.6, 2.7, 3.2 raise SSLError(e) # Py33 raises FileNotFoundError which subclasses OSError # These are not equivalent unless we check the errno attribute except OSError as e: # Platform-specific: Python 3.3 and beyond if e.errno == errno.ENOENT: raise SSLError(e) raise if certfile: context.load_cert_chain(certfile, keyfile) if HAS_SNI: # Platform-specific: OpenSSL with enabled SNI return context.wrap_socket(sock, server_hostname=server_hostname) warnings.warn( 'An HTTPS request has been made, but the SNI (Subject Name ' 'Indication) extension to TLS is not available on this platform. ' 'This may cause the server to present an incorrect TLS ' 'certificate, which can cause validation failures. You can upgrade to ' 'a newer version of Python to solve this. For more information, see ' 'https://urllib3.readthedocs.io/en/latest/security.html' '#snimissingwarning.', SNIMissingWarning ) return context.wrap_socket(sock)
mit
[ 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 646, 7554, 199, 646, 3598, 199, 646, 20330, 199, 199, 504, 14755, 492, 6318, 8209, 12, 625, 20677, 199, 504, 8337, 492, 6128, 21, 12, 7793, 17, 12, 7793, 3912, 199, 199, 504, 2508, 3924, 492, 7799, 547, 12, 1010, 7817, 10397, 3849, 12, 428, 46, 1469, 374, 1044, 3849, 421, 199, 5413, 2998, 275, 488, 199, 13533, 63, 8199, 41, 275, 756, 199, 981, 63, 885, 63, 1100, 275, 488, 199, 1311, 63, 4521, 9935, 5413, 275, 756, 199, 199, 3, 23673, 314, 2582, 402, 282, 10017, 370, 282, 3962, 2631, 805, 27955, 642, 10017, 199, 14395, 19587, 63, 5443, 275, 469, 272, 4337, 26, 6128, 21, 12, 272, 6335, 26, 7793, 17, 12, 272, 5049, 26, 7793, 3912, 12, 199, 93, 421, 199, 318, 485, 1297, 63, 5785, 63, 5671, 63, 894, 719, 8, 65, 12, 330, 304, 272, 408, 272, 18955, 2877, 10017, 83, 402, 4472, 2582, 315, 4413, 900, 14, 339, 710, 10017, 83, 1471, 506, 402, 730, 620, 15, 2394, 14, 272, 1803, 715, 340, 314, 10017, 83, 1336, 12, 436, 756, 4257, 14, 272, 408, 272, 754, 275, 2853, 8, 552, 8, 65, 9, 446, 822, 8, 66, 430, 272, 367, 634, 12, 519, 315, 3482, 8, 20108, 8, 65, 395, 11640, 8, 66, 2298, 267, 754, 8901, 634, 7167, 519, 272, 372, 754, 508, 378, 421, 199, 63, 1297, 63, 5785, 63, 5671, 275, 2519, 8, 18537, 12, 283, 5785, 63, 5671, 297, 1816, 485, 1297, 63, 5785, 63, 5671, 63, 894, 719, 9, 421, 199, 893, 26, 221, 327, 1379, 367, 7799, 4534, 272, 492, 6149, 272, 687, 6149, 492, 4816, 63, 3450, 12, 28313, 63, 9185, 12, 3611, 2566, 3978, 63, 21082, 1789, 272, 687, 6149, 492, 7509, 63, 8199, 41, 221, 327, 13481, 428, 16730, 31, 199, 2590, 3545, 26, 272, 986, 421, 199, 893, 26, 272, 687, 6149, 492, 9827, 63, 2826, 63, 21082, 18, 12, 9827, 63, 2826, 63, 21082, 19, 12, 9827, 63, 2826, 63, 30193, 199, 2590, 3545, 26, 272, 9827, 63, 2826, 63, 21082, 18, 12, 9827, 63, 2826, 63, 21082, 19, 275, 378, 88, 22589, 12, 378, 88, 18, 3273, 272, 9827, 63, 2826, 63, 30193, 275, 378, 88, 27140, 199, 199, 3, 437, 11153, 849, 14, 199, 3, 5800, 83, 367, 1655, 2556, 641, 12213, 30377, 26, 199, 3, 199, 3, 446, 4178, 921, 6797, 14, 12102, 14, 1308, 15, 7676, 15, 3120, 63, 15414, 63, 10224, 199, 3, 446, 4178, 921, 1544, 14, 385, 914, 2101, 14, 957, 15, 6776, 15, 7010, 13, 80, 6457, 7724, 15, 1080, 14, 1360, 199, 3, 446, 4178, 921, 3577, 685, 75, 14, 278, 15, 19813, 15, 8210, 848, 316, 13, 12695, 13, 2520, 13, 5871, 13, 4266, 13, 27426, 15, 199, 3, 199, 3, 710, 8605, 21020, 365, 26, 199, 3, 446, 510, 21928, 10830, 24203, 626, 19793, 23668, 7568, 542, 1353, 1480, 334, 23520, 15, 4220, 23520, 395, 199, 3, 446, 16602, 662, 7695, 1645, 1806, 577, 1645, 367, 8034, 10238, 12, 199, 3, 446, 16602, 1263, 19093, 13, 29009, 1806, 1263, 19093, 13, 18255, 367, 8034, 10238, 436, 6391, 12, 199, 3, 446, 675, 650, 4448, 465, 9567, 1314, 365, 11153, 1325, 11999, 12, 199, 3, 446, 3507, 5962, 6299, 12, 15830, 21, 13347, 83, 436, 577, 2300, 367, 6391, 14872, 14, 199, 3472, 63, 35, 1772, 31700, 275, 334, 272, 283, 4220, 13860, 11, 14494, 29009, 26, 13860, 11, 14494, 29009, 26, 4220, 13860, 11, 14494, 3912, 26, 13860, 11, 14494, 3912, 26, 4220, 13860, 11, 14494, 3933, 26, 13860, 11, 14494, 26, 4220, 13860, 11, 17624, 4881, 272, 283, 13860, 11, 17624, 26, 4220, 13860, 11, 19, 4448, 26, 13860, 11, 19, 4448, 26, 12115, 11, 14494, 29009, 26, 12115, 11, 14494, 26, 12115, 11, 17624, 26, 12115, 11, 19, 4448, 26, 1, 65, 8084, 4881, 272, 14597, 69, 8084, 26, 1, 5127, 21, 7, 199, 9, 199, 199, 893, 26, 272, 687, 6149, 492, 7799, 2998, 221, 327, 4900, 11641, 7799, 31, 199, 2590, 3545, 26, 272, 492, 984, 339, 1021, 7799, 2998, 8, 785, 304, 221, 327, 16078, 13, 6100, 26, 2018, 499, 1253, 650, 14, 17, 267, 5171, 63, 409, 63, 27426, 275, 3666, 18, 12, 1520, 9, 2695, 984, 14, 1023, 63, 815, 665, 334, 19, 4258, 503, 1816, 334, 19, 12, 499, 9, 2695, 984, 14, 1023, 63, 815, 9, 398, 347, 636, 826, 721, 277, 12, 4113, 63, 1023, 304, 288, 291, 14, 3922, 275, 4113, 63, 1023, 288, 327, 3645, 849, 1338, 687, 282, 3363, 7799, 2998, 288, 291, 14, 1074, 63, 4269, 275, 756, 288, 291, 14, 4712, 63, 632, 275, 6149, 14, 11163, 63, 9185, 288, 291, 14, 696, 63, 8356, 275, 488, 288, 291, 14, 1419, 275, 378, 288, 291, 14, 28340, 275, 488, 288, 291, 14, 21856, 275, 488, 288, 291, 14, 27426, 275, 488, 398, 347, 2248, 63, 4736, 63, 4429, 8, 277, 12, 27660, 12, 25776, 304, 288, 291, 14, 28340, 275, 27660, 288, 291, 14, 21856, 275, 25776, 398, 347, 2248, 63, 4712, 63, 8022, 8, 277, 12, 1704, 493, 29, 403, 12, 1704, 515, 29, 403, 304, 288, 291, 14, 696, 63, 8356, 275, 1704, 493, 953, 340, 1704, 515, 365, 440, 488, 26, 355, 746, 7799, 547, 480, 3263, 6602, 440, 3748, 315, 12731, 2018, 83, 531, 398, 347, 663, 63, 27426, 8, 277, 12, 10830, 63, 5768, 304, 288, 340, 440, 291, 14, 9823, 63, 409, 63, 27426, 26, 355, 746, 3146, 8, 490, 283, 14398, 1015, 402, 2018, 1630, 440, 2291, 4260, 283, 490, 283, 65, 3537, 10830, 5241, 14, 7754, 10754, 370, 2018, 283, 490, 283, 18, 14, 23, 12, 650, 14, 18, 12, 503, 2945, 340, 1265, 1929, 642, 9330, 3530, 355, 776, 288, 291, 14, 27426, 275, 10830, 63, 5768, 398, 347, 4816, 63, 3450, 8, 277, 12, 2838, 12, 1654, 63, 4269, 29, 403, 12, 1654, 63, 2441, 29, 797, 304, 288, 3598, 14, 4050, 8, 355, 283, 33, 2549, 7799, 2998, 909, 365, 440, 2808, 14, 961, 21925, 283, 355, 283, 4078, 19, 687, 1101, 4039, 7799, 22497, 436, 1443, 7675, 283, 355 ]
[ 636, 2443, 363, 492, 3679, 63, 646, 199, 646, 7554, 199, 646, 3598, 199, 646, 20330, 199, 199, 504, 14755, 492, 6318, 8209, 12, 625, 20677, 199, 504, 8337, 492, 6128, 21, 12, 7793, 17, 12, 7793, 3912, 199, 199, 504, 2508, 3924, 492, 7799, 547, 12, 1010, 7817, 10397, 3849, 12, 428, 46, 1469, 374, 1044, 3849, 421, 199, 5413, 2998, 275, 488, 199, 13533, 63, 8199, 41, 275, 756, 199, 981, 63, 885, 63, 1100, 275, 488, 199, 1311, 63, 4521, 9935, 5413, 275, 756, 199, 199, 3, 23673, 314, 2582, 402, 282, 10017, 370, 282, 3962, 2631, 805, 27955, 642, 10017, 199, 14395, 19587, 63, 5443, 275, 469, 272, 4337, 26, 6128, 21, 12, 272, 6335, 26, 7793, 17, 12, 272, 5049, 26, 7793, 3912, 12, 199, 93, 421, 199, 318, 485, 1297, 63, 5785, 63, 5671, 63, 894, 719, 8, 65, 12, 330, 304, 272, 408, 272, 18955, 2877, 10017, 83, 402, 4472, 2582, 315, 4413, 900, 14, 339, 710, 10017, 83, 1471, 506, 402, 730, 620, 15, 2394, 14, 272, 1803, 715, 340, 314, 10017, 83, 1336, 12, 436, 756, 4257, 14, 272, 408, 272, 754, 275, 2853, 8, 552, 8, 65, 9, 446, 822, 8, 66, 430, 272, 367, 634, 12, 519, 315, 3482, 8, 20108, 8, 65, 395, 11640, 8, 66, 2298, 267, 754, 8901, 634, 7167, 519, 272, 372, 754, 508, 378, 421, 199, 63, 1297, 63, 5785, 63, 5671, 275, 2519, 8, 18537, 12, 283, 5785, 63, 5671, 297, 1816, 485, 1297, 63, 5785, 63, 5671, 63, 894, 719, 9, 421, 199, 893, 26, 221, 327, 1379, 367, 7799, 4534, 272, 492, 6149, 272, 687, 6149, 492, 4816, 63, 3450, 12, 28313, 63, 9185, 12, 3611, 2566, 3978, 63, 21082, 1789, 272, 687, 6149, 492, 7509, 63, 8199, 41, 221, 327, 13481, 428, 16730, 31, 199, 2590, 3545, 26, 272, 986, 421, 199, 893, 26, 272, 687, 6149, 492, 9827, 63, 2826, 63, 21082, 18, 12, 9827, 63, 2826, 63, 21082, 19, 12, 9827, 63, 2826, 63, 30193, 199, 2590, 3545, 26, 272, 9827, 63, 2826, 63, 21082, 18, 12, 9827, 63, 2826, 63, 21082, 19, 275, 378, 88, 22589, 12, 378, 88, 18, 3273, 272, 9827, 63, 2826, 63, 30193, 275, 378, 88, 27140, 199, 199, 3, 437, 11153, 849, 14, 199, 3, 5800, 83, 367, 1655, 2556, 641, 12213, 30377, 26, 199, 3, 199, 3, 446, 4178, 921, 6797, 14, 12102, 14, 1308, 15, 7676, 15, 3120, 63, 15414, 63, 10224, 199, 3, 446, 4178, 921, 1544, 14, 385, 914, 2101, 14, 957, 15, 6776, 15, 7010, 13, 80, 6457, 7724, 15, 1080, 14, 1360, 199, 3, 446, 4178, 921, 3577, 685, 75, 14, 278, 15, 19813, 15, 8210, 848, 316, 13, 12695, 13, 2520, 13, 5871, 13, 4266, 13, 27426, 15, 199, 3, 199, 3, 710, 8605, 21020, 365, 26, 199, 3, 446, 510, 21928, 10830, 24203, 626, 19793, 23668, 7568, 542, 1353, 1480, 334, 23520, 15, 4220, 23520, 395, 199, 3, 446, 16602, 662, 7695, 1645, 1806, 577, 1645, 367, 8034, 10238, 12, 199, 3, 446, 16602, 1263, 19093, 13, 29009, 1806, 1263, 19093, 13, 18255, 367, 8034, 10238, 436, 6391, 12, 199, 3, 446, 675, 650, 4448, 465, 9567, 1314, 365, 11153, 1325, 11999, 12, 199, 3, 446, 3507, 5962, 6299, 12, 15830, 21, 13347, 83, 436, 577, 2300, 367, 6391, 14872, 14, 199, 3472, 63, 35, 1772, 31700, 275, 334, 272, 283, 4220, 13860, 11, 14494, 29009, 26, 13860, 11, 14494, 29009, 26, 4220, 13860, 11, 14494, 3912, 26, 13860, 11, 14494, 3912, 26, 4220, 13860, 11, 14494, 3933, 26, 13860, 11, 14494, 26, 4220, 13860, 11, 17624, 4881, 272, 283, 13860, 11, 17624, 26, 4220, 13860, 11, 19, 4448, 26, 13860, 11, 19, 4448, 26, 12115, 11, 14494, 29009, 26, 12115, 11, 14494, 26, 12115, 11, 17624, 26, 12115, 11, 19, 4448, 26, 1, 65, 8084, 4881, 272, 14597, 69, 8084, 26, 1, 5127, 21, 7, 199, 9, 199, 199, 893, 26, 272, 687, 6149, 492, 7799, 2998, 221, 327, 4900, 11641, 7799, 31, 199, 2590, 3545, 26, 272, 492, 984, 339, 1021, 7799, 2998, 8, 785, 304, 221, 327, 16078, 13, 6100, 26, 2018, 499, 1253, 650, 14, 17, 267, 5171, 63, 409, 63, 27426, 275, 3666, 18, 12, 1520, 9, 2695, 984, 14, 1023, 63, 815, 665, 334, 19, 4258, 503, 1816, 334, 19, 12, 499, 9, 2695, 984, 14, 1023, 63, 815, 9, 398, 347, 636, 826, 721, 277, 12, 4113, 63, 1023, 304, 288, 291, 14, 3922, 275, 4113, 63, 1023, 288, 327, 3645, 849, 1338, 687, 282, 3363, 7799, 2998, 288, 291, 14, 1074, 63, 4269, 275, 756, 288, 291, 14, 4712, 63, 632, 275, 6149, 14, 11163, 63, 9185, 288, 291, 14, 696, 63, 8356, 275, 488, 288, 291, 14, 1419, 275, 378, 288, 291, 14, 28340, 275, 488, 288, 291, 14, 21856, 275, 488, 288, 291, 14, 27426, 275, 488, 398, 347, 2248, 63, 4736, 63, 4429, 8, 277, 12, 27660, 12, 25776, 304, 288, 291, 14, 28340, 275, 27660, 288, 291, 14, 21856, 275, 25776, 398, 347, 2248, 63, 4712, 63, 8022, 8, 277, 12, 1704, 493, 29, 403, 12, 1704, 515, 29, 403, 304, 288, 291, 14, 696, 63, 8356, 275, 1704, 493, 953, 340, 1704, 515, 365, 440, 488, 26, 355, 746, 7799, 547, 480, 3263, 6602, 440, 3748, 315, 12731, 2018, 83, 531, 398, 347, 663, 63, 27426, 8, 277, 12, 10830, 63, 5768, 304, 288, 340, 440, 291, 14, 9823, 63, 409, 63, 27426, 26, 355, 746, 3146, 8, 490, 283, 14398, 1015, 402, 2018, 1630, 440, 2291, 4260, 283, 490, 283, 65, 3537, 10830, 5241, 14, 7754, 10754, 370, 2018, 283, 490, 283, 18, 14, 23, 12, 650, 14, 18, 12, 503, 2945, 340, 1265, 1929, 642, 9330, 3530, 355, 776, 288, 291, 14, 27426, 275, 10830, 63, 5768, 398, 347, 4816, 63, 3450, 8, 277, 12, 2838, 12, 1654, 63, 4269, 29, 403, 12, 1654, 63, 2441, 29, 797, 304, 288, 3598, 14, 4050, 8, 355, 283, 33, 2549, 7799, 2998, 909, 365, 440, 2808, 14, 961, 21925, 283, 355, 283, 4078, 19, 687, 1101, 4039, 7799, 22497, 436, 1443, 7675, 283, 355, 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,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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 ]
UltrosBot/Ultros-examples
example_clj/plugins/example_clj/__init__.py
1
1893
""" This is an example plugin to give you an idea of how to use Clojure in your plugins, should you wish to. We don't really expect anyone to use this, but we've included it to show that it's actually possible. If you like Lisps, take a look at Clojure and also ClojurePy, which is what we're using here. """ __author__ = 'Gareth Coles' import types import cljplugin # Import main so the lib adds its import handler from clojure.lang import ifn from system import plugin class ClojurePlugin(plugin.PluginObject): """ Example Clojure plugin """ def __init__(self): super(ClojurePlugin, self).__init__() self.clj_plugin = cljplugin def setup(self): # Now run the actual setup function self.wrapper(self.clj_plugin.setup)() def __getattribute__(self, item): # This is so that you can have a clojure file that behaves like the # actual plugin. try: # Check whether we defined our own attribute on this class # noinspection PyCallByClass return object.__getattribute__(self, item) except AttributeError: # If not, use the one on the clojure plugin x = getattr(self.clj_plugin, item) # Python function or Clojure function if isinstance(x, types.FunctionType) or isinstance(x, ifn.IFn): # See below for why we do this. return self.wrapper(x) return x # This is used for interop because clojure files are modules, not # classes, and so need to be wrapped to have access to self. # # Use this when you create any functions in Clojure files that need to be # passed elsewhere - for example, event and command handlers. def wrapper(self, func): def inner(*args, **kwargs): return func(self, *args, **kwargs) return inner
artistic-2.0
[ 624, 199, 2765, 365, 376, 2893, 3589, 370, 8120, 1265, 376, 16819, 402, 4212, 370, 675, 5980, 74, 608, 315, 2195, 199, 5265, 12, 1077, 1265, 13809, 370, 14, 199, 199, 6004, 2793, 1133, 7710, 4282, 29165, 370, 675, 642, 12, 1325, 781, 9064, 5120, 652, 370, 2498, 626, 199, 390, 1159, 5965, 3962, 14, 982, 1265, 2839, 491, 374, 1190, 12, 5452, 282, 3648, 737, 5980, 74, 608, 436, 2597, 199, 3337, 74, 608, 2713, 12, 1314, 365, 4052, 781, 3984, 1808, 2348, 14, 199, 624, 199, 199, 363, 2502, 363, 275, 283, 39, 1530, 273, 1849, 2978, 7, 199, 199, 646, 2943, 199, 199, 646, 824, 74, 2718, 199, 3, 3161, 2446, 880, 314, 1973, 9584, 2399, 492, 3016, 199, 504, 2463, 74, 608, 14, 4159, 492, 340, 78, 199, 199, 504, 2656, 492, 3589, 421, 199, 533, 5980, 74, 608, 5061, 8, 2718, 14, 5061, 1692, 304, 272, 408, 272, 5679, 5980, 74, 608, 3589, 272, 408, 339, 347, 636, 826, 721, 277, 304, 267, 1613, 8, 3337, 74, 608, 5061, 12, 291, 2843, 826, 4533, 398, 291, 14, 429, 74, 63, 2718, 275, 824, 74, 2718, 339, 347, 3272, 8, 277, 304, 267, 327, 7356, 1255, 314, 3503, 3272, 805, 267, 291, 14, 5029, 8, 277, 14, 429, 74, 63, 2718, 14, 2758, 16315, 339, 347, 636, 18480, 721, 277, 12, 1242, 304, 267, 327, 961, 365, 880, 626, 1265, 883, 1172, 282, 2463, 74, 608, 570, 626, 25113, 2839, 314, 267, 327, 3503, 3589, 14, 267, 862, 26, 288, 327, 2670, 3775, 781, 3247, 4154, 5705, 2225, 641, 642, 1021, 288, 327, 30870, 1611, 2176, 2175, 2543, 288, 372, 909, 855, 18480, 721, 277, 12, 1242, 9, 267, 871, 4281, 26, 288, 327, 982, 440, 12, 675, 314, 1373, 641, 314, 2463, 74, 608, 3589, 288, 671, 275, 2519, 8, 277, 14, 429, 74, 63, 2718, 12, 1242, 9, 953, 327, 2018, 805, 503, 5980, 74, 608, 805, 288, 340, 1228, 8, 88, 12, 2943, 14, 26371, 9, 503, 1228, 8, 88, 12, 340, 78, 14, 4656, 78, 304, 355, 327, 1666, 5084, 367, 10842, 781, 886, 642, 14, 355, 372, 291, 14, 5029, 8, 88, 9, 953, 372, 671, 339, 327, 961, 365, 1202, 367, 4661, 2675, 2952, 2463, 74, 608, 1584, 787, 4621, 12, 440, 272, 327, 3992, 12, 436, 880, 1929, 370, 506, 8072, 370, 1172, 2879, 370, 291, 14, 272, 327, 272, 327, 3645, 642, 1380, 1265, 1218, 1263, 3423, 315, 5980, 74, 608, 1584, 626, 1929, 370, 506, 272, 327, 3032, 25320, 446, 367, 2893, 12, 1566, 436, 1414, 8297, 14, 339, 347, 4975, 8, 277, 12, 2562, 304, 267, 347, 6506, 2031, 589, 12, 1011, 958, 304, 288, 372, 2562, 8, 277, 12, 627, 589, 12, 1011, 958, 9, 267, 372, 6506, 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 ]
[ 199, 2765, 365, 376, 2893, 3589, 370, 8120, 1265, 376, 16819, 402, 4212, 370, 675, 5980, 74, 608, 315, 2195, 199, 5265, 12, 1077, 1265, 13809, 370, 14, 199, 199, 6004, 2793, 1133, 7710, 4282, 29165, 370, 675, 642, 12, 1325, 781, 9064, 5120, 652, 370, 2498, 626, 199, 390, 1159, 5965, 3962, 14, 982, 1265, 2839, 491, 374, 1190, 12, 5452, 282, 3648, 737, 5980, 74, 608, 436, 2597, 199, 3337, 74, 608, 2713, 12, 1314, 365, 4052, 781, 3984, 1808, 2348, 14, 199, 624, 199, 199, 363, 2502, 363, 275, 283, 39, 1530, 273, 1849, 2978, 7, 199, 199, 646, 2943, 199, 199, 646, 824, 74, 2718, 199, 3, 3161, 2446, 880, 314, 1973, 9584, 2399, 492, 3016, 199, 504, 2463, 74, 608, 14, 4159, 492, 340, 78, 199, 199, 504, 2656, 492, 3589, 421, 199, 533, 5980, 74, 608, 5061, 8, 2718, 14, 5061, 1692, 304, 272, 408, 272, 5679, 5980, 74, 608, 3589, 272, 408, 339, 347, 636, 826, 721, 277, 304, 267, 1613, 8, 3337, 74, 608, 5061, 12, 291, 2843, 826, 4533, 398, 291, 14, 429, 74, 63, 2718, 275, 824, 74, 2718, 339, 347, 3272, 8, 277, 304, 267, 327, 7356, 1255, 314, 3503, 3272, 805, 267, 291, 14, 5029, 8, 277, 14, 429, 74, 63, 2718, 14, 2758, 16315, 339, 347, 636, 18480, 721, 277, 12, 1242, 304, 267, 327, 961, 365, 880, 626, 1265, 883, 1172, 282, 2463, 74, 608, 570, 626, 25113, 2839, 314, 267, 327, 3503, 3589, 14, 267, 862, 26, 288, 327, 2670, 3775, 781, 3247, 4154, 5705, 2225, 641, 642, 1021, 288, 327, 30870, 1611, 2176, 2175, 2543, 288, 372, 909, 855, 18480, 721, 277, 12, 1242, 9, 267, 871, 4281, 26, 288, 327, 982, 440, 12, 675, 314, 1373, 641, 314, 2463, 74, 608, 3589, 288, 671, 275, 2519, 8, 277, 14, 429, 74, 63, 2718, 12, 1242, 9, 953, 327, 2018, 805, 503, 5980, 74, 608, 805, 288, 340, 1228, 8, 88, 12, 2943, 14, 26371, 9, 503, 1228, 8, 88, 12, 340, 78, 14, 4656, 78, 304, 355, 327, 1666, 5084, 367, 10842, 781, 886, 642, 14, 355, 372, 291, 14, 5029, 8, 88, 9, 953, 372, 671, 339, 327, 961, 365, 1202, 367, 4661, 2675, 2952, 2463, 74, 608, 1584, 787, 4621, 12, 440, 272, 327, 3992, 12, 436, 880, 1929, 370, 506, 8072, 370, 1172, 2879, 370, 291, 14, 272, 327, 272, 327, 3645, 642, 1380, 1265, 1218, 1263, 3423, 315, 5980, 74, 608, 1584, 626, 1929, 370, 506, 272, 327, 3032, 25320, 446, 367, 2893, 12, 1566, 436, 1414, 8297, 14, 339, 347, 4975, 8, 277, 12, 2562, 304, 267, 347, 6506, 2031, 589, 12, 1011, 958, 304, 288, 372, 2562, 8, 277, 12, 627, 589, 12, 1011, 958, 9, 267, 372, 6506, 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, 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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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 ]
spmjc/plugin.video.freplay
resources/lib/channels/tf12.py
1
4906
#-*- coding: utf-8 -*- from resources.lib import utils import base64 import hashlib import json import urllib import urllib2 import urlparse from resources.lib import globalvar title=['TF1','NT1','HD1','TMC','XTRA'] img=['tf1','nt1','hd1','tmc','xtra'] readyForUse=True #urlCatalog='http://api.mytf1.tf1.fr/mobile/init?device=ios-tablet' urlCatalog='http://api.mytf1.tf1.fr/mobile/2/init?device=ios-tablet' def list_shows(channel,param): shows=[] filePath=utils.downloadCatalog(urlCatalog,'tf1.json',False,{}) filPrgm=open(filePath).read() jsonParser = json.loads(filPrgm) uniqueItem = dict() if param=='none': for prgm in jsonParser['programs'] : if channel in prgm['channels']: if prgm['category'] not in uniqueItem: shows.append( [channel,prgm['categorySlug'], prgm['category'].encode('utf-8'),'','folder'] ) uniqueItem[prgm['category']] = prgm['category'] else: for prgm in jsonParser['programs'] : if channel in prgm['channels']: if prgm['categorySlug']==param: shows.append( [channel,prgm['id'], prgm['title'].encode('utf-8'),'','shows'] ) return shows def list_videos(channel, id): videos=[] filePath=utils.downloadCatalog(urlCatalog,'tf1.json',False,{}) filPrgm=open(filePath).read() jsonParser = json.loads(filPrgm) for vid in jsonParser['videos'] : if vid['programId'] ==id: if globalvar.ADDON.getSetting(channel + 'Bonus')=='true' or vid['videoType']['type']=='replay' or vid['videoType']['type']=='video': title=vid['title'].encode('utf-8') plot, duration = '', '' if 'summary' in vid : plot=vid['summary'].encode('utf-8') if 'length' in vid :duration=vid['length']/60 infoLabels = { "Title": title,"Plot":plot,"Duration": duration} videos.append( [channel, vid['streamId'], title, '',infoLabels,'play'] ) return videos def getVideoURLSimple(channel,id): VideoURL= 'http://wat.tv/get/ipad/' + id if globalvar.ADDON.getSetting('tf1ForceHD')=='true' and isHD(VideoURL) : VideoURL += '?bwmin=2000000' return VideoURL def isHD(VideoURL) : m3u8 = utils.get_webcontent(VideoURL) if '1280x720' in m3u8 : return True else : return False def getVideoURL(channel, media_id): """Returns the URL to use to read the given video.""" def get_timestamp(): """Returns the current server timestamp.""" servertime = urllib2.urlopen('http://www.wat.tv/servertime').read() timestamp = servertime.split(u"""|""")[0].encode('utf-8') return int(timestamp) def get_auth_key(app_name, media_id, timestamp): """Return the AuthKey to use to get the Video URL.""" secret = base64.b64decode('VzNtMCMxbUZJ') string = '%s-%s-%s-%s-%d' % (media_id, secret, app_name, secret, timestamp) #auth_key = hashlib.md5(bytearray(string)).hexdigest() + '/' + str(timestamp) auth_key = hashlib.md5(string).hexdigest() + '/' + str(timestamp) return auth_key user_agent = 'myTF1/60010000.15040209 CFNetwork/609 Darwin/13.0.0' app_name = 'sdk/Iphone/1.0' method = 'getUrl' timestamp = get_timestamp() version = '1.4.32' auth_key = get_auth_key(app_name, media_id, timestamp) hosting_application_name = 'com.tf1.applitf1' hosting_application_version = '60010000.15040209' req = urllib2.Request('http://api.wat.tv/services/Delivery') req.add_header('User-Agent', user_agent) req.add_data( ('appName=%s&method=%s&mediaId=%s&authKey=%s&version=%s' '&hostingApplicationName=%s&hostingApplicationVersion=%s') % (app_name, method, media_id, auth_key, version, hosting_application_name, hosting_application_version)) print 'Loading ' + req.get_full_url() + ' ' + req.get_data() data = json.loads(urllib2.urlopen(req).read()) print 'Response: ' + repr(data) if int(data['code']) != 200: # Something is not working, fall back to the simple url scheme. return 'http://wat.tv/get/ipad/' + media_id + '.m3u8' m3u8_url = data['message'] if globalvar.ADDON.getSetting('tf1ForceHD') == 'true': scheme, netloc, path, query_string, fragment = urlparse.urlsplit(m3u8_url) query_params = urlparse.parse_qs(query_string) query_params.pop('bwmax', None) new_query_string = urllib.urlencode(query_params, doseq=True) m3u8_url = urlparse.urlunsplit((scheme, netloc, path, new_query_string, fragment)) # The URL returned by '/services/Delivery' will return a 302 and this seems # to confuse the media player. So we first follow and 302 chain and return # the final real address. req = urllib2.Request(m3u8_url) req.add_header('User-Agent', user_agent) print 'Loading ' + req.get_full_url() response = urllib2.urlopen(req) return response.url + '|User-Agent=' + urllib2.quote(user_agent)
gpl-2.0
[ 3, 13, 1837, 2803, 26, 2774, 13, 24, 1882, 258, 199, 504, 5944, 14, 773, 492, 3778, 199, 646, 1300, 772, 199, 646, 8337, 199, 646, 2022, 199, 646, 4011, 199, 646, 4011, 18, 199, 646, 7097, 199, 504, 5944, 14, 773, 492, 2288, 1391, 199, 199, 1213, 2968, 6145, 17, 1673, 12460, 17, 1673, 14903, 17, 1673, 52, 7608, 1673, 56, 13954, 418, 199, 4060, 2968, 3249, 17, 1673, 343, 17, 1673, 7952, 17, 1673, 84, 5466, 1673, 400, 345, 418, 199, 2179, 1858, 6119, 29, 549, 3698, 199, 199, 3, 633, 17161, 534, 1014, 921, 1246, 14, 1662, 3249, 17, 14, 3249, 17, 14, 4391, 15, 11375, 15, 826, 31, 1782, 29, 9207, 13, 23126, 7, 199, 633, 17161, 534, 1014, 921, 1246, 14, 1662, 3249, 17, 14, 3249, 17, 14, 4391, 15, 11375, 15, 18, 15, 826, 31, 1782, 29, 9207, 13, 23126, 7, 199, 199, 318, 769, 63, 23866, 8, 2775, 12, 635, 304, 257, 523, 13703, 9811, 12244, 570, 2042, 29, 1208, 14, 4249, 17161, 8, 633, 17161, 2584, 3249, 17, 14, 1001, 297, 797, 12, 91, 1552, 16421, 1794, 9779, 13844, 29, 1490, 8, 27501, 680, 739, 342, 523, 2022, 2842, 258, 275, 2022, 14, 3640, 8, 1289, 9779, 13844, 9, 16421, 3747, 2081, 275, 1211, 342, 257, 12244, 340, 1215, 6803, 3592, 356, 272, 367, 5448, 13844, 315, 2022, 2842, 459, 28464, 418, 520, 489, 340, 3623, 315, 5448, 13844, 459, 6324, 2565, 267, 340, 5448, 13844, 459, 3710, 418, 440, 315, 3747, 2081, 26, 23664, 13703, 14, 740, 8, 359, 2775, 12, 2700, 13844, 459, 3710, 15554, 995, 5448, 13844, 459, 3710, 2278, 2143, 360, 1624, 13, 24, 659, 7, 1673, 3741, 418, 776, 881, 3747, 2081, 59, 2700, 13844, 459, 3710, 6538, 275, 5448, 13844, 459, 3710, 418, 523, 587, 26, 272, 367, 5448, 13844, 315, 2022, 2842, 459, 28464, 418, 520, 15166, 340, 3623, 315, 5448, 13844, 459, 6324, 2565, 267, 340, 5448, 13844, 459, 3710, 15554, 418, 389, 635, 26, 23664, 13703, 14, 740, 8, 359, 2775, 12, 2700, 13844, 459, 344, 995, 5448, 13844, 459, 1213, 2278, 2143, 360, 1624, 13, 24, 659, 7, 1673, 23866, 418, 776, 523, 372, 13703, 2043, 199, 318, 769, 63, 11418, 8, 2775, 12, 1305, 304, 523, 22010, 9811, 12244, 570, 2042, 29, 1208, 14, 4249, 17161, 8, 633, 17161, 2584, 3249, 17, 14, 1001, 297, 797, 12, 91, 1552, 16421, 1794, 9779, 13844, 29, 1490, 8, 27501, 680, 739, 342, 523, 2022, 2842, 258, 275, 2022, 14, 3640, 8, 1289, 9779, 13844, 9, 221, 12244, 367, 27767, 315, 2022, 2842, 459, 11418, 418, 520, 272, 340, 27767, 459, 6815, 1304, 418, 508, 344, 26, 489, 340, 2288, 1391, 14, 9732, 615, 14, 30008, 8, 2775, 435, 283, 34, 265, 527, 358, 6803, 2052, 7, 503, 27767, 459, 3722, 804, 2545, 466, 418, 6803, 19540, 7, 503, 27767, 459, 3722, 804, 2545, 466, 418, 6803, 3722, 356, 267, 2538, 29, 5017, 459, 1213, 2278, 2143, 360, 1624, 13, 24, 358, 3515, 267, 5137, 12, 7373, 275, 3260, 2125, 267, 340, 283, 4705, 7, 315, 27767, 520, 5137, 29, 5017, 459, 4705, 2278, 2143, 360, 1624, 13, 24, 358, 263, 267, 340, 283, 1267, 7, 315, 27767, 221, 520, 5553, 29, 5017, 459, 1267, 28178, 2259, 4960, 2256, 14016, 275, 469, 298, 6888, 582, 2538, 4589, 10711, 582, 2798, 4589, 13283, 582, 7373, 93, 267, 22010, 14, 740, 8, 359, 2775, 12, 27767, 459, 1745, 1304, 995, 2538, 12, 3260, 815, 14016, 2584, 2802, 418, 776, 1779, 523, 372, 22010, 3698, 2043, 199, 318, 664, 9166, 2632, 3184, 8, 2775, 12, 344, 304, 523, 15709, 2632, 29, 283, 1014, 921, 87, 292, 14, 6993, 15, 362, 15, 711, 350, 4805, 435, 1305, 523, 340, 2288, 1391, 14, 9732, 615, 14, 30008, 360, 3249, 17, 13606, 14903, 358, 6803, 2052, 7, 436, 365, 14903, 8, 9166, 2632, 9, 520, 272, 15709, 2632, 847, 8720, 12415, 827, 29, 18, 3273, 7, 523, 372, 15709, 2632, 523, 199, 318, 365, 14903, 8, 9166, 2632, 9, 520, 523, 333, 19, 85, 24, 275, 3778, 14, 362, 63, 2520, 1317, 8, 9166, 2632, 9, 523, 340, 283, 713, 1257, 88, 18386, 7, 315, 333, 19, 85, 24, 520, 372, 715, 523, 587, 8295, 520, 372, 756, 221, 2043, 199, 318, 664, 9166, 2632, 8, 2775, 12, 5898, 63, 344, 304, 523, 408, 3407, 314, 2851, 370, 675, 370, 1586, 314, 1627, 3991, 1041, 523, 347, 664, 63, 3954, 837, 272, 408, 3407, 314, 1453, 1654, 4913, 1041, 272, 1654, 521, 275, 4011, 18, 14, 10890, 360, 1014, 921, 1544, 14, 87, 292, 14, 6993, 15, 1000, 521, 1959, 739, 342, 272, 4913, 275, 1654, 521, 14, 1294, 8, 85, 624, 92, 6141, 59, 16, 1055, 2143, 360, 1624, 13, 24, 358, 272, 372, 1109, 8, 3954, 9, 819, 347, 664, 63, 1178, 63, 498, 8, 571, 63, 354, 12, 5898, 63, 344, 12, 4913, 304, 272, 408, 1767, 314, 3590, 1197, 370, 675, 370, 664, 314, 15709, 2851, 1041, 272, 7565, 275, 1300, 772, 14, 66, 772, 2708, 360, 54, 90, 5959, 7608, 45, 1774, 31957, 42, 358, 272, 1059, 275, 1543, 83, 3295, 83, 3295, 83, 3295, 83, 3295, 68, 7, 450, 334, 4603, 63, 344, 12, 7565, 12, 1145, 63, 354, 12, 7565, 12, 4913, 9, 272, 327, 1178, 63, 498, 275, 8337, 14, 1064, 21, 8, 20108, 8, 875, 4992, 11453, 342, 435, 7324, 435, 620, 8, 3954, 9, 272, 1790, 63, 498, 275, 8337, 14, 1064, 21, 8, 875, 680, 11453, 342, 435, 7324, 435, 620, 8, 3954, 9, 272, 372, 1790, 63, 498, 819, 922, 63, 4054, 275, 283, 1662, 6145, 17, 15, 22, 4587, 993, 14, 1046, 966, 996, 1643, 6035, 4491, 15, 14520, 577, 22822, 15, 969, 14, 16, 14, 16, 7, 523, 1145, 63, 354, 275, 283, 9277, 15, 41, 9339, 15, 17, 14, 16, 7, 523, 1083, 275, 283, 362, 6417, 7, 523, 4913, 275, 664, 63, 3954, 342, 523, 1015, 275, 283, 17, 14, 20, 14, 708, 7, 523, 1790, 63, 498, 275, 664, 63, 1178, 63, 498, 8, 571, 63, 354, 12, 5898, 63, 344, 12, 4913, 9, 523, 1591, 316 ]
[ 13, 1837, 2803, 26, 2774, 13, 24, 1882, 258, 199, 504, 5944, 14, 773, 492, 3778, 199, 646, 1300, 772, 199, 646, 8337, 199, 646, 2022, 199, 646, 4011, 199, 646, 4011, 18, 199, 646, 7097, 199, 504, 5944, 14, 773, 492, 2288, 1391, 199, 199, 1213, 2968, 6145, 17, 1673, 12460, 17, 1673, 14903, 17, 1673, 52, 7608, 1673, 56, 13954, 418, 199, 4060, 2968, 3249, 17, 1673, 343, 17, 1673, 7952, 17, 1673, 84, 5466, 1673, 400, 345, 418, 199, 2179, 1858, 6119, 29, 549, 3698, 199, 199, 3, 633, 17161, 534, 1014, 921, 1246, 14, 1662, 3249, 17, 14, 3249, 17, 14, 4391, 15, 11375, 15, 826, 31, 1782, 29, 9207, 13, 23126, 7, 199, 633, 17161, 534, 1014, 921, 1246, 14, 1662, 3249, 17, 14, 3249, 17, 14, 4391, 15, 11375, 15, 18, 15, 826, 31, 1782, 29, 9207, 13, 23126, 7, 199, 199, 318, 769, 63, 23866, 8, 2775, 12, 635, 304, 257, 523, 13703, 9811, 12244, 570, 2042, 29, 1208, 14, 4249, 17161, 8, 633, 17161, 2584, 3249, 17, 14, 1001, 297, 797, 12, 91, 1552, 16421, 1794, 9779, 13844, 29, 1490, 8, 27501, 680, 739, 342, 523, 2022, 2842, 258, 275, 2022, 14, 3640, 8, 1289, 9779, 13844, 9, 16421, 3747, 2081, 275, 1211, 342, 257, 12244, 340, 1215, 6803, 3592, 356, 272, 367, 5448, 13844, 315, 2022, 2842, 459, 28464, 418, 520, 489, 340, 3623, 315, 5448, 13844, 459, 6324, 2565, 267, 340, 5448, 13844, 459, 3710, 418, 440, 315, 3747, 2081, 26, 23664, 13703, 14, 740, 8, 359, 2775, 12, 2700, 13844, 459, 3710, 15554, 995, 5448, 13844, 459, 3710, 2278, 2143, 360, 1624, 13, 24, 659, 7, 1673, 3741, 418, 776, 881, 3747, 2081, 59, 2700, 13844, 459, 3710, 6538, 275, 5448, 13844, 459, 3710, 418, 523, 587, 26, 272, 367, 5448, 13844, 315, 2022, 2842, 459, 28464, 418, 520, 15166, 340, 3623, 315, 5448, 13844, 459, 6324, 2565, 267, 340, 5448, 13844, 459, 3710, 15554, 418, 389, 635, 26, 23664, 13703, 14, 740, 8, 359, 2775, 12, 2700, 13844, 459, 344, 995, 5448, 13844, 459, 1213, 2278, 2143, 360, 1624, 13, 24, 659, 7, 1673, 23866, 418, 776, 523, 372, 13703, 2043, 199, 318, 769, 63, 11418, 8, 2775, 12, 1305, 304, 523, 22010, 9811, 12244, 570, 2042, 29, 1208, 14, 4249, 17161, 8, 633, 17161, 2584, 3249, 17, 14, 1001, 297, 797, 12, 91, 1552, 16421, 1794, 9779, 13844, 29, 1490, 8, 27501, 680, 739, 342, 523, 2022, 2842, 258, 275, 2022, 14, 3640, 8, 1289, 9779, 13844, 9, 221, 12244, 367, 27767, 315, 2022, 2842, 459, 11418, 418, 520, 272, 340, 27767, 459, 6815, 1304, 418, 508, 344, 26, 489, 340, 2288, 1391, 14, 9732, 615, 14, 30008, 8, 2775, 435, 283, 34, 265, 527, 358, 6803, 2052, 7, 503, 27767, 459, 3722, 804, 2545, 466, 418, 6803, 19540, 7, 503, 27767, 459, 3722, 804, 2545, 466, 418, 6803, 3722, 356, 267, 2538, 29, 5017, 459, 1213, 2278, 2143, 360, 1624, 13, 24, 358, 3515, 267, 5137, 12, 7373, 275, 3260, 2125, 267, 340, 283, 4705, 7, 315, 27767, 520, 5137, 29, 5017, 459, 4705, 2278, 2143, 360, 1624, 13, 24, 358, 263, 267, 340, 283, 1267, 7, 315, 27767, 221, 520, 5553, 29, 5017, 459, 1267, 28178, 2259, 4960, 2256, 14016, 275, 469, 298, 6888, 582, 2538, 4589, 10711, 582, 2798, 4589, 13283, 582, 7373, 93, 267, 22010, 14, 740, 8, 359, 2775, 12, 27767, 459, 1745, 1304, 995, 2538, 12, 3260, 815, 14016, 2584, 2802, 418, 776, 1779, 523, 372, 22010, 3698, 2043, 199, 318, 664, 9166, 2632, 3184, 8, 2775, 12, 344, 304, 523, 15709, 2632, 29, 283, 1014, 921, 87, 292, 14, 6993, 15, 362, 15, 711, 350, 4805, 435, 1305, 523, 340, 2288, 1391, 14, 9732, 615, 14, 30008, 360, 3249, 17, 13606, 14903, 358, 6803, 2052, 7, 436, 365, 14903, 8, 9166, 2632, 9, 520, 272, 15709, 2632, 847, 8720, 12415, 827, 29, 18, 3273, 7, 523, 372, 15709, 2632, 523, 199, 318, 365, 14903, 8, 9166, 2632, 9, 520, 523, 333, 19, 85, 24, 275, 3778, 14, 362, 63, 2520, 1317, 8, 9166, 2632, 9, 523, 340, 283, 713, 1257, 88, 18386, 7, 315, 333, 19, 85, 24, 520, 372, 715, 523, 587, 8295, 520, 372, 756, 221, 2043, 199, 318, 664, 9166, 2632, 8, 2775, 12, 5898, 63, 344, 304, 523, 408, 3407, 314, 2851, 370, 675, 370, 1586, 314, 1627, 3991, 1041, 523, 347, 664, 63, 3954, 837, 272, 408, 3407, 314, 1453, 1654, 4913, 1041, 272, 1654, 521, 275, 4011, 18, 14, 10890, 360, 1014, 921, 1544, 14, 87, 292, 14, 6993, 15, 1000, 521, 1959, 739, 342, 272, 4913, 275, 1654, 521, 14, 1294, 8, 85, 624, 92, 6141, 59, 16, 1055, 2143, 360, 1624, 13, 24, 358, 272, 372, 1109, 8, 3954, 9, 819, 347, 664, 63, 1178, 63, 498, 8, 571, 63, 354, 12, 5898, 63, 344, 12, 4913, 304, 272, 408, 1767, 314, 3590, 1197, 370, 675, 370, 664, 314, 15709, 2851, 1041, 272, 7565, 275, 1300, 772, 14, 66, 772, 2708, 360, 54, 90, 5959, 7608, 45, 1774, 31957, 42, 358, 272, 1059, 275, 1543, 83, 3295, 83, 3295, 83, 3295, 83, 3295, 68, 7, 450, 334, 4603, 63, 344, 12, 7565, 12, 1145, 63, 354, 12, 7565, 12, 4913, 9, 272, 327, 1178, 63, 498, 275, 8337, 14, 1064, 21, 8, 20108, 8, 875, 4992, 11453, 342, 435, 7324, 435, 620, 8, 3954, 9, 272, 1790, 63, 498, 275, 8337, 14, 1064, 21, 8, 875, 680, 11453, 342, 435, 7324, 435, 620, 8, 3954, 9, 272, 372, 1790, 63, 498, 819, 922, 63, 4054, 275, 283, 1662, 6145, 17, 15, 22, 4587, 993, 14, 1046, 966, 996, 1643, 6035, 4491, 15, 14520, 577, 22822, 15, 969, 14, 16, 14, 16, 7, 523, 1145, 63, 354, 275, 283, 9277, 15, 41, 9339, 15, 17, 14, 16, 7, 523, 1083, 275, 283, 362, 6417, 7, 523, 4913, 275, 664, 63, 3954, 342, 523, 1015, 275, 283, 17, 14, 20, 14, 708, 7, 523, 1790, 63, 498, 275, 664, 63, 1178, 63, 498, 8, 571, 63, 354, 12, 5898, 63, 344, 12, 4913, 9, 523, 1591, 316, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
provaleks/o8
addons/payment_ogone/controllers/main.py
389
1179
# -*- coding: utf-8 -*- import logging import pprint import werkzeug from openerp import http, SUPERUSER_ID from openerp.http import request _logger = logging.getLogger(__name__) class OgoneController(http.Controller): _accept_url = '/payment/ogone/test/accept' _decline_url = '/payment/ogone/test/decline' _exception_url = '/payment/ogone/test/exception' _cancel_url = '/payment/ogone/test/cancel' @http.route([ '/payment/ogone/accept', '/payment/ogone/test/accept', '/payment/ogone/decline', '/payment/ogone/test/decline', '/payment/ogone/exception', '/payment/ogone/test/exception', '/payment/ogone/cancel', '/payment/ogone/test/cancel', ], type='http', auth='none') def ogone_form_feedback(self, **post): """ Ogone contacts using GET, at least for accept """ _logger.info('Ogone: entering form_feedback with post data %s', pprint.pformat(post)) # debug cr, uid, context = request.cr, SUPERUSER_ID, request.context request.registry['payment.transaction'].form_feedback(cr, uid, post, 'ogone', context=context) return werkzeug.utils.redirect(post.pop('return_url', '/'))
agpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 646, 2050, 199, 646, 10933, 199, 646, 10380, 199, 199, 504, 5166, 492, 1455, 12, 12824, 63, 998, 199, 504, 5166, 14, 1014, 492, 1056, 199, 199, 63, 2921, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 533, 593, 32227, 7506, 8, 1014, 14, 7506, 304, 272, 485, 5694, 63, 633, 275, 1994, 7948, 15, 29163, 15, 396, 15, 5694, 7, 272, 485, 9427, 1132, 63, 633, 275, 1994, 7948, 15, 29163, 15, 396, 15, 9427, 1132, 7, 272, 485, 1971, 63, 633, 275, 1994, 7948, 15, 29163, 15, 396, 15, 1971, 7, 272, 485, 6406, 63, 633, 275, 1994, 7948, 15, 29163, 15, 396, 15, 6406, 7, 339, 768, 1014, 14, 4449, 779, 267, 1994, 7948, 15, 29163, 15, 5694, 297, 1994, 7948, 15, 29163, 15, 396, 15, 5694, 297, 267, 1994, 7948, 15, 29163, 15, 9427, 1132, 297, 1994, 7948, 15, 29163, 15, 396, 15, 9427, 1132, 297, 267, 1994, 7948, 15, 29163, 15, 1971, 297, 1994, 7948, 15, 29163, 15, 396, 15, 1971, 297, 267, 1994, 7948, 15, 29163, 15, 6406, 297, 1994, 7948, 15, 29163, 15, 396, 15, 6406, 297, 272, 2156, 730, 534, 1014, 297, 1790, 534, 3592, 358, 272, 347, 312, 32227, 63, 964, 63, 13485, 8, 277, 12, 1011, 1932, 304, 267, 408, 593, 32227, 27989, 1808, 9576, 12, 737, 5210, 367, 4729, 408, 267, 485, 2921, 14, 815, 360, 47, 32227, 26, 9509, 316, 1824, 63, 13485, 543, 2963, 666, 450, 83, 297, 10933, 14, 24225, 8, 1932, 430, 221, 327, 3105, 267, 2467, 12, 1747, 12, 1067, 275, 1056, 14, 1556, 12, 12824, 63, 998, 12, 1056, 14, 1100, 267, 1056, 14, 5189, 459, 7948, 14, 5945, 2278, 964, 63, 13485, 8, 1556, 12, 1747, 12, 2963, 12, 283, 29163, 297, 1067, 29, 1100, 9, 267, 372, 10380, 14, 1208, 14, 4876, 8, 1932, 14, 1935, 360, 1107, 63, 633, 297, 1994, 1333, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 646, 2050, 199, 646, 10933, 199, 646, 10380, 199, 199, 504, 5166, 492, 1455, 12, 12824, 63, 998, 199, 504, 5166, 14, 1014, 492, 1056, 199, 199, 63, 2921, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 533, 593, 32227, 7506, 8, 1014, 14, 7506, 304, 272, 485, 5694, 63, 633, 275, 1994, 7948, 15, 29163, 15, 396, 15, 5694, 7, 272, 485, 9427, 1132, 63, 633, 275, 1994, 7948, 15, 29163, 15, 396, 15, 9427, 1132, 7, 272, 485, 1971, 63, 633, 275, 1994, 7948, 15, 29163, 15, 396, 15, 1971, 7, 272, 485, 6406, 63, 633, 275, 1994, 7948, 15, 29163, 15, 396, 15, 6406, 7, 339, 768, 1014, 14, 4449, 779, 267, 1994, 7948, 15, 29163, 15, 5694, 297, 1994, 7948, 15, 29163, 15, 396, 15, 5694, 297, 267, 1994, 7948, 15, 29163, 15, 9427, 1132, 297, 1994, 7948, 15, 29163, 15, 396, 15, 9427, 1132, 297, 267, 1994, 7948, 15, 29163, 15, 1971, 297, 1994, 7948, 15, 29163, 15, 396, 15, 1971, 297, 267, 1994, 7948, 15, 29163, 15, 6406, 297, 1994, 7948, 15, 29163, 15, 396, 15, 6406, 297, 272, 2156, 730, 534, 1014, 297, 1790, 534, 3592, 358, 272, 347, 312, 32227, 63, 964, 63, 13485, 8, 277, 12, 1011, 1932, 304, 267, 408, 593, 32227, 27989, 1808, 9576, 12, 737, 5210, 367, 4729, 408, 267, 485, 2921, 14, 815, 360, 47, 32227, 26, 9509, 316, 1824, 63, 13485, 543, 2963, 666, 450, 83, 297, 10933, 14, 24225, 8, 1932, 430, 221, 327, 3105, 267, 2467, 12, 1747, 12, 1067, 275, 1056, 14, 1556, 12, 12824, 63, 998, 12, 1056, 14, 1100, 267, 1056, 14, 5189, 459, 7948, 14, 5945, 2278, 964, 63, 13485, 8, 1556, 12, 1747, 12, 2963, 12, 283, 29163, 297, 1067, 29, 1100, 9, 267, 372, 10380, 14, 1208, 14, 4876, 8, 1932, 14, 1935, 360, 1107, 63, 633, 297, 1994, 1333, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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,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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 ]
nielsvanoch/django
django/conf/locale/sv/formats.py
197
1569
# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # from __future__ import unicode_literals # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j F Y' TIME_FORMAT = 'H:i' DATETIME_FORMAT = 'j F Y H:i' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j F' SHORT_DATE_FORMAT = 'Y-m-d' SHORT_DATETIME_FORMAT = 'Y-m-d H:i' FIRST_DAY_OF_WEEK = 1 # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # Kept ISO formats as they are in first position DATE_INPUT_FORMATS = ( '%Y-%m-%d', # '2006-10-25' '%m/%d/%Y', # '10/25/2006' '%m/%d/%y', # '10/25/06' ) DATETIME_INPUT_FORMATS = ( '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59' '%Y-%m-%d %H:%M:%S.%f', # '2006-10-25 14:30:59.000200' '%Y-%m-%d %H:%M', # '2006-10-25 14:30' '%Y-%m-%d', # '2006-10-25' '%m/%d/%Y %H:%M:%S', # '10/25/2006 14:30:59' '%m/%d/%Y %H:%M:%S.%f', # '10/25/2006 14:30:59.000200' '%m/%d/%Y %H:%M', # '10/25/2006 14:30' '%m/%d/%Y', # '10/25/2006' '%m/%d/%y %H:%M:%S', # '10/25/06 14:30:59' '%m/%d/%y %H:%M:%S.%f', # '10/25/06 14:30:59.000200' '%m/%d/%y %H:%M', # '10/25/06 14:30' '%m/%d/%y', # '10/25/06' ) DECIMAL_SEPARATOR = ',' THOUSAND_SEPARATOR = '\xa0' # non-breaking space NUMBER_GROUPING = 3
bsd-3-clause
[ 3, 1882, 2644, 26, 2774, 13, 24, 1882, 199, 3, 961, 570, 365, 1854, 1334, 314, 2011, 4190, 465, 314, 5634, 2559, 14, 199, 3, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 3, 710, 20841, 4807, 3326, 675, 314, 5634, 1434, 1475, 6302, 12, 199, 3, 1937, 1455, 921, 4757, 14, 14013, 14, 957, 15, 287, 15, 2374, 15, 1121, 15, 5876, 15, 10372, 12645, 602, 199, 5390, 63, 4807, 275, 283, 74, 481, 1488, 7, 199, 4961, 63, 4807, 275, 283, 40, 26, 73, 7, 199, 12488, 63, 4807, 275, 283, 74, 481, 1488, 869, 26, 73, 7, 199, 19216, 63, 16413, 63, 4807, 275, 283, 38, 1488, 7, 199, 16413, 63, 11655, 63, 4807, 275, 283, 74, 481, 7, 199, 13003, 63, 5390, 63, 4807, 275, 283, 57, 13, 77, 13, 68, 7, 199, 13003, 63, 12488, 63, 4807, 275, 283, 57, 13, 77, 13, 68, 869, 26, 73, 7, 199, 12903, 63, 11655, 63, 3359, 63, 24929, 275, 413, 199, 199, 3, 710, 20841, 7321, 63, 14019, 3326, 675, 314, 2018, 14053, 1475, 6302, 12, 199, 3, 1937, 1455, 921, 4757, 14, 1548, 14, 1308, 15, 4342, 15, 2083, 14, 1360, 3, 6205, 13, 9866, 13, 17537, 199, 3, 25645, 541, 9055, 6752, 465, 2985, 787, 315, 1642, 3421, 199, 5390, 63, 7321, 63, 14019, 275, 334, 272, 1543, 57, 3295, 77, 3295, 68, 297, 4519, 327, 283, 7968, 13, 709, 13, 821, 7, 272, 1543, 77, 3149, 68, 3149, 57, 297, 4519, 327, 283, 709, 15, 821, 15, 7968, 7, 272, 1543, 77, 3149, 68, 3149, 89, 297, 4519, 327, 283, 709, 15, 821, 15, 1690, 7, 199, 9, 199, 12488, 63, 7321, 63, 14019, 275, 334, 272, 1543, 57, 3295, 77, 3295, 68, 450, 40, 2689, 45, 2689, 51, 297, 258, 327, 283, 7968, 13, 709, 13, 821, 4329, 26, 1216, 26, 1427, 7, 272, 1543, 57, 3295, 77, 3295, 68, 450, 40, 2689, 45, 2689, 51, 4111, 70, 297, 221, 327, 283, 7968, 13, 709, 13, 821, 4329, 26, 1216, 26, 1427, 14, 25080, 7, 272, 1543, 57, 3295, 77, 3295, 68, 450, 40, 2689, 45, 297, 263, 327, 283, 7968, 13, 709, 13, 821, 4329, 26, 1216, 7, 272, 1543, 57, 3295, 77, 3295, 68, 297, 4519, 327, 283, 7968, 13, 709, 13, 821, 7, 272, 1543, 77, 3149, 68, 3149, 57, 450, 40, 2689, 45, 2689, 51, 297, 258, 327, 283, 709, 15, 821, 15, 7968, 4329, 26, 1216, 26, 1427, 7, 272, 1543, 77, 3149, 68, 3149, 57, 450, 40, 2689, 45, 2689, 51, 4111, 70, 297, 221, 327, 283, 709, 15, 821, 15, 7968, 4329, 26, 1216, 26, 1427, 14, 25080, 7, 272, 1543, 77, 3149, 68, 3149, 57, 450, 40, 2689, 45, 297, 263, 327, 283, 709, 15, 821, 15, 7968, 4329, 26, 1216, 7, 272, 1543, 77, 3149, 68, 3149, 57, 297, 4519, 327, 283, 709, 15, 821, 15, 7968, 7, 272, 1543, 77, 3149, 68, 3149, 89, 450, 40, 2689, 45, 2689, 51, 297, 258, 327, 283, 709, 15, 821, 15, 1690, 4329, 26, 1216, 26, 1427, 7, 272, 1543, 77, 3149, 68, 3149, 89, 450, 40, 2689, 45, 2689, 51, 4111, 70, 297, 221, 327, 283, 709, 15, 821, 15, 1690, 4329, 26, 1216, 26, 1427, 14, 25080, 7, 272, 1543, 77, 3149, 68, 3149, 89, 450, 40, 2689, 45, 297, 263, 327, 283, 709, 15, 821, 15, 1690, 4329, 26, 1216, 7, 272, 1543, 77, 3149, 68, 3149, 89, 297, 4519, 327, 283, 709, 15, 821, 15, 1690, 7, 199, 9, 199, 23925, 63, 15828, 275, 13647, 199, 28714, 63, 15828, 275, 1557, 1800, 16, 7, 221, 327, 2222, 13, 4785, 316, 4601, 199, 9190, 63, 7823, 1206, 275, 650, 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 ]
[ 1882, 2644, 26, 2774, 13, 24, 1882, 199, 3, 961, 570, 365, 1854, 1334, 314, 2011, 4190, 465, 314, 5634, 2559, 14, 199, 3, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 3, 710, 20841, 4807, 3326, 675, 314, 5634, 1434, 1475, 6302, 12, 199, 3, 1937, 1455, 921, 4757, 14, 14013, 14, 957, 15, 287, 15, 2374, 15, 1121, 15, 5876, 15, 10372, 12645, 602, 199, 5390, 63, 4807, 275, 283, 74, 481, 1488, 7, 199, 4961, 63, 4807, 275, 283, 40, 26, 73, 7, 199, 12488, 63, 4807, 275, 283, 74, 481, 1488, 869, 26, 73, 7, 199, 19216, 63, 16413, 63, 4807, 275, 283, 38, 1488, 7, 199, 16413, 63, 11655, 63, 4807, 275, 283, 74, 481, 7, 199, 13003, 63, 5390, 63, 4807, 275, 283, 57, 13, 77, 13, 68, 7, 199, 13003, 63, 12488, 63, 4807, 275, 283, 57, 13, 77, 13, 68, 869, 26, 73, 7, 199, 12903, 63, 11655, 63, 3359, 63, 24929, 275, 413, 199, 199, 3, 710, 20841, 7321, 63, 14019, 3326, 675, 314, 2018, 14053, 1475, 6302, 12, 199, 3, 1937, 1455, 921, 4757, 14, 1548, 14, 1308, 15, 4342, 15, 2083, 14, 1360, 3, 6205, 13, 9866, 13, 17537, 199, 3, 25645, 541, 9055, 6752, 465, 2985, 787, 315, 1642, 3421, 199, 5390, 63, 7321, 63, 14019, 275, 334, 272, 1543, 57, 3295, 77, 3295, 68, 297, 4519, 327, 283, 7968, 13, 709, 13, 821, 7, 272, 1543, 77, 3149, 68, 3149, 57, 297, 4519, 327, 283, 709, 15, 821, 15, 7968, 7, 272, 1543, 77, 3149, 68, 3149, 89, 297, 4519, 327, 283, 709, 15, 821, 15, 1690, 7, 199, 9, 199, 12488, 63, 7321, 63, 14019, 275, 334, 272, 1543, 57, 3295, 77, 3295, 68, 450, 40, 2689, 45, 2689, 51, 297, 258, 327, 283, 7968, 13, 709, 13, 821, 4329, 26, 1216, 26, 1427, 7, 272, 1543, 57, 3295, 77, 3295, 68, 450, 40, 2689, 45, 2689, 51, 4111, 70, 297, 221, 327, 283, 7968, 13, 709, 13, 821, 4329, 26, 1216, 26, 1427, 14, 25080, 7, 272, 1543, 57, 3295, 77, 3295, 68, 450, 40, 2689, 45, 297, 263, 327, 283, 7968, 13, 709, 13, 821, 4329, 26, 1216, 7, 272, 1543, 57, 3295, 77, 3295, 68, 297, 4519, 327, 283, 7968, 13, 709, 13, 821, 7, 272, 1543, 77, 3149, 68, 3149, 57, 450, 40, 2689, 45, 2689, 51, 297, 258, 327, 283, 709, 15, 821, 15, 7968, 4329, 26, 1216, 26, 1427, 7, 272, 1543, 77, 3149, 68, 3149, 57, 450, 40, 2689, 45, 2689, 51, 4111, 70, 297, 221, 327, 283, 709, 15, 821, 15, 7968, 4329, 26, 1216, 26, 1427, 14, 25080, 7, 272, 1543, 77, 3149, 68, 3149, 57, 450, 40, 2689, 45, 297, 263, 327, 283, 709, 15, 821, 15, 7968, 4329, 26, 1216, 7, 272, 1543, 77, 3149, 68, 3149, 57, 297, 4519, 327, 283, 709, 15, 821, 15, 7968, 7, 272, 1543, 77, 3149, 68, 3149, 89, 450, 40, 2689, 45, 2689, 51, 297, 258, 327, 283, 709, 15, 821, 15, 1690, 4329, 26, 1216, 26, 1427, 7, 272, 1543, 77, 3149, 68, 3149, 89, 450, 40, 2689, 45, 2689, 51, 4111, 70, 297, 221, 327, 283, 709, 15, 821, 15, 1690, 4329, 26, 1216, 26, 1427, 14, 25080, 7, 272, 1543, 77, 3149, 68, 3149, 89, 450, 40, 2689, 45, 297, 263, 327, 283, 709, 15, 821, 15, 1690, 4329, 26, 1216, 7, 272, 1543, 77, 3149, 68, 3149, 89, 297, 4519, 327, 283, 709, 15, 821, 15, 1690, 7, 199, 9, 199, 23925, 63, 15828, 275, 13647, 199, 28714, 63, 15828, 275, 1557, 1800, 16, 7, 221, 327, 2222, 13, 4785, 316, 4601, 199, 9190, 63, 7823, 1206, 275, 650, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
ehudmagal/robotqcapp
boto/ec2/autoscale/policy.py
24
5549
# Copyright (c) 2009-2010 Reza Lotun http://reza.lotun.name/ # Copyright (c) 2011 Jann Kleen # # 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.resultset import ResultSet from boto.ec2.elb.listelement import ListElement class Alarm(object): def __init__(self, connection=None): self.connection = connection self.name = None self.alarm_arn = None def __repr__(self): return 'Alarm:%s' % self.name def startElement(self, name, attrs, connection): return None def endElement(self, name, value, connection): if name == 'AlarmName': self.name = value elif name == 'AlarmARN': self.alarm_arn = value else: setattr(self, name, value) class AdjustmentType(object): def __init__(self, connection=None): self.connection = connection self.adjustment_types = ListElement([]) def __repr__(self): return 'AdjustmentType:%s' % self.adjustment_types def startElement(self, name, attrs, connection): if name == 'AdjustmentType': return self.adjustment_types def endElement(self, name, value, connection): return class MetricCollectionTypes(object): class BaseType(object): arg = '' def __init__(self, connection): self.connection = connection self.val = None def __repr__(self): return '%s:%s' % (self.arg, self.val) def startElement(self, name, attrs, connection): return def endElement(self, name, value, connection): if name == self.arg: self.val = value class Metric(BaseType): arg = 'Metric' class Granularity(BaseType): arg = 'Granularity' def __init__(self, connection=None): self.connection = connection self.metrics = [] self.granularities = [] def __repr__(self): return 'MetricCollectionTypes:<%s, %s>' % (self.metrics, self.granularities) def startElement(self, name, attrs, connection): if name == 'Granularities': self.granularities = ResultSet([('member', self.Granularity)]) return self.granularities elif name == 'Metrics': self.metrics = ResultSet([('member', self.Metric)]) return self.metrics def endElement(self, name, value, connection): return class ScalingPolicy(object): def __init__(self, connection=None, **kwargs): """ Scaling Policy :type name: str :param name: Name of scaling policy. :type adjustment_type: str :param adjustment_type: Specifies the type of adjustment. Valid values are `ChangeInCapacity`, `ExactCapacity` and `PercentChangeInCapacity`. :type as_name: str or int :param as_name: Name or ARN of the Auto Scaling Group. :type scaling_adjustment: int :param scaling_adjustment: Value of adjustment (type specified in `adjustment_type`). :type cooldown: int :param cooldown: Time (in seconds) before Alarm related Scaling Activities can start after the previous Scaling Activity ends. """ self.name = kwargs.get('name', None) self.adjustment_type = kwargs.get('adjustment_type', None) self.as_name = kwargs.get('as_name', None) self.scaling_adjustment = kwargs.get('scaling_adjustment', None) self.cooldown = kwargs.get('cooldown', None) self.connection = connection def __repr__(self): return 'ScalingPolicy(%s group:%s adjustment:%s)' % (self.name, self.as_name, self.adjustment_type) def startElement(self, name, attrs, connection): if name == 'Alarms': self.alarms = ResultSet([('member', Alarm)]) return self.alarms def endElement(self, name, value, connection): if name == 'PolicyName': self.name = value elif name == 'AutoScalingGroupName': self.as_name = value elif name == 'PolicyARN': self.policy_arn = value elif name == 'ScalingAdjustment': self.scaling_adjustment = int(value) elif name == 'Cooldown': self.cooldown = int(value) elif name == 'AdjustmentType': self.adjustment_type = value def delete(self): return self.connection.delete_policy(self.name, self.as_name)
bsd-3-clause
[ 3, 1898, 334, 67, 9, 8937, 13, 6542, 799, 8076, 491, 357, 324, 1455, 921, 264, 8076, 14, 1653, 324, 14, 354, 15, 199, 3, 1898, 334, 67, 9, 7760, 1603, 1189, 1804, 274, 287, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 199, 3, 1331, 402, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 199, 3, 298, 10337, 1288, 370, 7962, 315, 314, 2290, 1928, 10588, 12, 5893, 199, 3, 1928, 12305, 314, 4481, 370, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 2153, 13, 199, 3, 28420, 12, 13473, 12, 436, 15, 269, 12743, 6866, 402, 314, 2290, 12, 436, 370, 11291, 199, 3, 12103, 370, 12676, 314, 2290, 365, 13985, 370, 886, 880, 12, 5420, 370, 314, 1699, 13, 199, 3, 28486, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 199, 3, 315, 1006, 6866, 503, 13393, 12468, 402, 314, 2290, 14, 199, 3, 199, 3, 2334, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 7168, 199, 3, 1549, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 28471, 13, 199, 3, 28463, 12, 3092, 2381, 437, 3115, 3104, 2401, 13229, 14, 1621, 4825, 6461, 199, 3, 7000, 2334, 17632, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 5603, 12, 199, 3, 7061, 1621, 1261, 9612, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 4442, 12, 199, 3, 5738, 1634, 1549, 1621, 11287, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 5010, 13198, 199, 3, 1621, 2334, 4141, 14, 199, 199, 504, 6055, 14, 1099, 409, 492, 30751, 199, 504, 6055, 14, 825, 18, 14, 17778, 14, 317, 1597, 968, 492, 3820, 2162, 199, 199, 533, 4580, 5362, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 1950, 29, 403, 304, 267, 291, 14, 2105, 275, 1950, 267, 291, 14, 354, 275, 488, 267, 291, 14, 14160, 63, 1060, 275, 488, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 283, 30655, 2689, 83, 7, 450, 291, 14, 354, 339, 347, 26325, 8, 277, 12, 536, 12, 3290, 12, 1950, 304, 267, 372, 488, 339, 347, 28920, 8, 277, 12, 536, 12, 574, 12, 1950, 304, 267, 340, 536, 508, 283, 30655, 985, 356, 288, 291, 14, 354, 275, 574, 267, 916, 536, 508, 283, 30655, 26513, 356, 288, 291, 14, 14160, 63, 1060, 275, 574, 267, 587, 26, 288, 5371, 8, 277, 12, 536, 12, 574, 9, 421, 199, 533, 26412, 434, 804, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 1950, 29, 403, 304, 267, 291, 14, 2105, 275, 1950, 267, 291, 14, 21806, 63, 1313, 275, 3820, 2162, 4157, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 283, 17977, 434, 804, 2689, 83, 7, 450, 291, 14, 21806, 63, 1313, 339, 347, 26325, 8, 277, 12, 536, 12, 3290, 12, 1950, 304, 267, 340, 536, 508, 283, 17977, 434, 804, 356, 288, 372, 291, 14, 21806, 63, 1313, 339, 347, 28920, 8, 277, 12, 536, 12, 574, 12, 1950, 304, 267, 372, 421, 199, 533, 22465, 7768, 4100, 8, 785, 304, 272, 1021, 3523, 804, 8, 785, 304, 267, 1680, 275, 2125, 267, 347, 636, 826, 721, 277, 12, 1950, 304, 288, 291, 14, 2105, 275, 1950, 288, 291, 14, 637, 275, 488, 267, 347, 636, 2722, 721, 277, 304, 288, 372, 1543, 83, 2689, 83, 7, 450, 334, 277, 14, 1273, 12, 291, 14, 637, 9, 267, 347, 26325, 8, 277, 12, 536, 12, 3290, 12, 1950, 304, 288, 372, 267, 347, 28920, 8, 277, 12, 536, 12, 574, 12, 1950, 304, 288, 340, 536, 508, 291, 14, 1273, 26, 355, 291, 14, 637, 275, 574, 272, 1021, 22465, 8, 1563, 804, 304, 267, 1680, 275, 283, 11119, 7, 272, 1021, 598, 1312, 22504, 8, 1563, 804, 304, 267, 1680, 275, 283, 39, 1312, 22504, 7, 339, 347, 636, 826, 721, 277, 12, 1950, 29, 403, 304, 267, 291, 14, 2105, 275, 1950, 267, 291, 14, 6759, 275, 942, 267, 291, 14, 26655, 348, 27894, 275, 942, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 283, 11119, 7768, 4100, 16875, 5, 83, 12, 450, 83, 3524, 450, 334, 277, 14, 6759, 12, 291, 14, 26655, 348, 27894, 9, 339, 347, 26325, 8, 277, 12, 536, 12, 3290, 12, 1950, 304, 267, 340, 536, 508, 283, 39, 1312, 348, 27894, 356, 288, 291, 14, 26655, 348, 27894, 275, 30751, 8318, 1114, 297, 291, 14, 39, 1312, 22504, 3948, 288, 372, 291, 14, 26655, 348, 27894, 267, 916, 536, 508, 283, 17213, 356, 288, 291, 14, 6759, 275, 30751, 8318, 1114, 297, 291, 14, 11119, 3948, 288, 372, 291, 14, 6759, 339, 347, 28920, 8, 277, 12, 536, 12, 574, 12, 1950, 304, 267, 372, 421, 199, 533, 17619, 316, 4845, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 1950, 29, 403, 12, 1011, 958, 304, 267, 408, 267, 17619, 316, 18141, 398, 520, 466, 536, 26, 620, 267, 520, 635, 536, 26, 2812, 402, 13690, 4592, 14, 398, 520, 466, 27999, 63, 466, 26, 620, 267, 520, 635, 27999, 63, 466, 26, 11015, 314, 730, 402, 27999, 14, 4821, 1338, 787, 658, 4001, 607, 22688, 3559, 658, 29751, 22688, 64, 436, 658, 17931, 4001, 607, 22688, 2313, 398, 520, 466, 465, 63, 354, 26, 620, 503, 1109, 267, 520, 635, 465, 63, 354, 26, 2812, 503, 4160, 46, 402, 314, 9195, 17619, 316, 5611, 14, 398, 520, 466, 13690, 63, 21806, 26, 1109, 267, 520, 635, 13690, 63, 21806, 26, 1594, 402, 27999, 334, 466, 2013, 315, 658, 21806, 63, 466, 14963, 398, 520, 466, 512, 27898, 26, 1109, 267, 520, 635, 512, 27898, 26, 4703, 334, 262, 4696, 9, 2544, 4580, 5362, 4048, 17619, 316, 4473, 15805, 883, 1343, 2410, 314, 4136, 17619, 316, 21885, 11187, 14, 398, 408, 267, 291, 14, 354, 275, 2074, 14, 362, 360, 354, 297, 488, 9, 267, 291, 14, 21806, 63, 466, 275, 2074, 14, 362, 360, 21806, 63, 466, 297, 488, 9, 267, 291, 14, 305, 63, 354, 275, 2074, 14, 362, 360, 305, 63, 354 ]
[ 1898, 334, 67, 9, 8937, 13, 6542, 799, 8076, 491, 357, 324, 1455, 921, 264, 8076, 14, 1653, 324, 14, 354, 15, 199, 3, 1898, 334, 67, 9, 7760, 1603, 1189, 1804, 274, 287, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 199, 3, 1331, 402, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 199, 3, 298, 10337, 1288, 370, 7962, 315, 314, 2290, 1928, 10588, 12, 5893, 199, 3, 1928, 12305, 314, 4481, 370, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 2153, 13, 199, 3, 28420, 12, 13473, 12, 436, 15, 269, 12743, 6866, 402, 314, 2290, 12, 436, 370, 11291, 199, 3, 12103, 370, 12676, 314, 2290, 365, 13985, 370, 886, 880, 12, 5420, 370, 314, 1699, 13, 199, 3, 28486, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 199, 3, 315, 1006, 6866, 503, 13393, 12468, 402, 314, 2290, 14, 199, 3, 199, 3, 2334, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 7168, 199, 3, 1549, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 28471, 13, 199, 3, 28463, 12, 3092, 2381, 437, 3115, 3104, 2401, 13229, 14, 1621, 4825, 6461, 199, 3, 7000, 2334, 17632, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 5603, 12, 199, 3, 7061, 1621, 1261, 9612, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 4442, 12, 199, 3, 5738, 1634, 1549, 1621, 11287, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 5010, 13198, 199, 3, 1621, 2334, 4141, 14, 199, 199, 504, 6055, 14, 1099, 409, 492, 30751, 199, 504, 6055, 14, 825, 18, 14, 17778, 14, 317, 1597, 968, 492, 3820, 2162, 199, 199, 533, 4580, 5362, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 1950, 29, 403, 304, 267, 291, 14, 2105, 275, 1950, 267, 291, 14, 354, 275, 488, 267, 291, 14, 14160, 63, 1060, 275, 488, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 283, 30655, 2689, 83, 7, 450, 291, 14, 354, 339, 347, 26325, 8, 277, 12, 536, 12, 3290, 12, 1950, 304, 267, 372, 488, 339, 347, 28920, 8, 277, 12, 536, 12, 574, 12, 1950, 304, 267, 340, 536, 508, 283, 30655, 985, 356, 288, 291, 14, 354, 275, 574, 267, 916, 536, 508, 283, 30655, 26513, 356, 288, 291, 14, 14160, 63, 1060, 275, 574, 267, 587, 26, 288, 5371, 8, 277, 12, 536, 12, 574, 9, 421, 199, 533, 26412, 434, 804, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 1950, 29, 403, 304, 267, 291, 14, 2105, 275, 1950, 267, 291, 14, 21806, 63, 1313, 275, 3820, 2162, 4157, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 283, 17977, 434, 804, 2689, 83, 7, 450, 291, 14, 21806, 63, 1313, 339, 347, 26325, 8, 277, 12, 536, 12, 3290, 12, 1950, 304, 267, 340, 536, 508, 283, 17977, 434, 804, 356, 288, 372, 291, 14, 21806, 63, 1313, 339, 347, 28920, 8, 277, 12, 536, 12, 574, 12, 1950, 304, 267, 372, 421, 199, 533, 22465, 7768, 4100, 8, 785, 304, 272, 1021, 3523, 804, 8, 785, 304, 267, 1680, 275, 2125, 267, 347, 636, 826, 721, 277, 12, 1950, 304, 288, 291, 14, 2105, 275, 1950, 288, 291, 14, 637, 275, 488, 267, 347, 636, 2722, 721, 277, 304, 288, 372, 1543, 83, 2689, 83, 7, 450, 334, 277, 14, 1273, 12, 291, 14, 637, 9, 267, 347, 26325, 8, 277, 12, 536, 12, 3290, 12, 1950, 304, 288, 372, 267, 347, 28920, 8, 277, 12, 536, 12, 574, 12, 1950, 304, 288, 340, 536, 508, 291, 14, 1273, 26, 355, 291, 14, 637, 275, 574, 272, 1021, 22465, 8, 1563, 804, 304, 267, 1680, 275, 283, 11119, 7, 272, 1021, 598, 1312, 22504, 8, 1563, 804, 304, 267, 1680, 275, 283, 39, 1312, 22504, 7, 339, 347, 636, 826, 721, 277, 12, 1950, 29, 403, 304, 267, 291, 14, 2105, 275, 1950, 267, 291, 14, 6759, 275, 942, 267, 291, 14, 26655, 348, 27894, 275, 942, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 283, 11119, 7768, 4100, 16875, 5, 83, 12, 450, 83, 3524, 450, 334, 277, 14, 6759, 12, 291, 14, 26655, 348, 27894, 9, 339, 347, 26325, 8, 277, 12, 536, 12, 3290, 12, 1950, 304, 267, 340, 536, 508, 283, 39, 1312, 348, 27894, 356, 288, 291, 14, 26655, 348, 27894, 275, 30751, 8318, 1114, 297, 291, 14, 39, 1312, 22504, 3948, 288, 372, 291, 14, 26655, 348, 27894, 267, 916, 536, 508, 283, 17213, 356, 288, 291, 14, 6759, 275, 30751, 8318, 1114, 297, 291, 14, 11119, 3948, 288, 372, 291, 14, 6759, 339, 347, 28920, 8, 277, 12, 536, 12, 574, 12, 1950, 304, 267, 372, 421, 199, 533, 17619, 316, 4845, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 1950, 29, 403, 12, 1011, 958, 304, 267, 408, 267, 17619, 316, 18141, 398, 520, 466, 536, 26, 620, 267, 520, 635, 536, 26, 2812, 402, 13690, 4592, 14, 398, 520, 466, 27999, 63, 466, 26, 620, 267, 520, 635, 27999, 63, 466, 26, 11015, 314, 730, 402, 27999, 14, 4821, 1338, 787, 658, 4001, 607, 22688, 3559, 658, 29751, 22688, 64, 436, 658, 17931, 4001, 607, 22688, 2313, 398, 520, 466, 465, 63, 354, 26, 620, 503, 1109, 267, 520, 635, 465, 63, 354, 26, 2812, 503, 4160, 46, 402, 314, 9195, 17619, 316, 5611, 14, 398, 520, 466, 13690, 63, 21806, 26, 1109, 267, 520, 635, 13690, 63, 21806, 26, 1594, 402, 27999, 334, 466, 2013, 315, 658, 21806, 63, 466, 14963, 398, 520, 466, 512, 27898, 26, 1109, 267, 520, 635, 512, 27898, 26, 4703, 334, 262, 4696, 9, 2544, 4580, 5362, 4048, 17619, 316, 4473, 15805, 883, 1343, 2410, 314, 4136, 17619, 316, 21885, 11187, 14, 398, 408, 267, 291, 14, 354, 275, 2074, 14, 362, 360, 354, 297, 488, 9, 267, 291, 14, 21806, 63, 466, 275, 2074, 14, 362, 360, 21806, 63, 466, 297, 488, 9, 267, 291, 14, 305, 63, 354, 275, 2074, 14, 362, 360, 305, 63, 354, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
saurabh6790/medsynaptic-lib
conf/conf.py
33
1034
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals # app configuration # database config db_name = '%(db_name)s' db_password = '%(db_password)s' # user attachments stored in files_path = 'public/files' public_path = 'public' # max file attachment size (default 1MB) max_file_size = 1000000 # max email size in bytes max_email_size = 0 # total pop session timeout in seconds pop_timeout = 0 # generate schema (.txt files) developer_mode = 0 # clear cache on refresh auto_cache_clear = 0 # email logs to admin (beta) admin_email_notification = 0 # user timezone user_timezone = 'Asia/Calcutta' # dump backups here backup_path = 'public/backups' # outgoing mail settings mail_server = None mail_login = None mail_password = None mail_port = None use_ssl = None auto_email_id = None # logging settings log_file_name = 'logs/error_log.txt' debug_log_dbs = [] log_level = 'logging.INFO' log_file_size = 5000 log_file_backup_count = 5
mit
[ 3, 1898, 334, 67, 9, 6171, 12, 6001, 8144, 19215, 29053, 14, 12126, 14, 436, 23212, 199, 3, 10697, 844, 14, 1666, 4190, 14, 2424, 199, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 3, 1145, 2897, 199, 199, 3, 3050, 1101, 199, 697, 63, 354, 275, 9487, 697, 63, 354, 9, 83, 7, 199, 697, 63, 2060, 275, 9487, 697, 63, 2060, 9, 83, 7, 199, 199, 3, 922, 18912, 5489, 315, 199, 1725, 63, 515, 275, 283, 3455, 15, 1725, 7, 199, 3455, 63, 515, 275, 283, 3455, 7, 199, 199, 3, 1390, 570, 12193, 1568, 334, 885, 413, 4567, 9, 199, 988, 63, 493, 63, 890, 275, 19492, 199, 199, 3, 1390, 3031, 1568, 315, 2783, 199, 988, 63, 2123, 63, 890, 275, 378, 199, 199, 3, 3141, 4560, 2351, 2653, 315, 4696, 199, 1935, 63, 2593, 275, 378, 199, 199, 3, 3550, 4177, 17048, 2424, 1584, 9, 199, 11071, 63, 632, 275, 378, 199, 199, 3, 5436, 2581, 641, 9236, 199, 2495, 63, 1637, 63, 3584, 275, 378, 199, 199, 3, 3031, 9610, 370, 4628, 334, 5683, 9, 199, 2113, 63, 2123, 63, 6761, 275, 378, 199, 199, 3, 922, 7137, 199, 751, 63, 7145, 275, 283, 13878, 15, 6584, 5919, 502, 7, 199, 199, 3, 5461, 6902, 83, 2348, 199, 5751, 63, 515, 275, 283, 3455, 15, 27376, 7, 199, 199, 3, 21507, 6016, 2202, 199, 1198, 63, 1000, 275, 488, 199, 1198, 63, 2886, 275, 488, 199, 1198, 63, 2060, 275, 488, 199, 1198, 63, 719, 275, 488, 199, 1180, 63, 4266, 275, 488, 199, 2495, 63, 2123, 63, 344, 275, 488, 199, 199, 3, 2050, 2202, 199, 793, 63, 493, 63, 354, 275, 283, 7270, 15, 705, 63, 793, 14, 2424, 7, 199, 1757, 63, 793, 63, 30764, 275, 942, 199, 793, 63, 1896, 275, 283, 4806, 14, 4531, 7, 199, 793, 63, 493, 63, 890, 275, 22369, 199, 793, 63, 493, 63, 5751, 63, 835, 275, 959, 421, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1898, 334, 67, 9, 6171, 12, 6001, 8144, 19215, 29053, 14, 12126, 14, 436, 23212, 199, 3, 10697, 844, 14, 1666, 4190, 14, 2424, 199, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 3, 1145, 2897, 199, 199, 3, 3050, 1101, 199, 697, 63, 354, 275, 9487, 697, 63, 354, 9, 83, 7, 199, 697, 63, 2060, 275, 9487, 697, 63, 2060, 9, 83, 7, 199, 199, 3, 922, 18912, 5489, 315, 199, 1725, 63, 515, 275, 283, 3455, 15, 1725, 7, 199, 3455, 63, 515, 275, 283, 3455, 7, 199, 199, 3, 1390, 570, 12193, 1568, 334, 885, 413, 4567, 9, 199, 988, 63, 493, 63, 890, 275, 19492, 199, 199, 3, 1390, 3031, 1568, 315, 2783, 199, 988, 63, 2123, 63, 890, 275, 378, 199, 199, 3, 3141, 4560, 2351, 2653, 315, 4696, 199, 1935, 63, 2593, 275, 378, 199, 199, 3, 3550, 4177, 17048, 2424, 1584, 9, 199, 11071, 63, 632, 275, 378, 199, 199, 3, 5436, 2581, 641, 9236, 199, 2495, 63, 1637, 63, 3584, 275, 378, 199, 199, 3, 3031, 9610, 370, 4628, 334, 5683, 9, 199, 2113, 63, 2123, 63, 6761, 275, 378, 199, 199, 3, 922, 7137, 199, 751, 63, 7145, 275, 283, 13878, 15, 6584, 5919, 502, 7, 199, 199, 3, 5461, 6902, 83, 2348, 199, 5751, 63, 515, 275, 283, 3455, 15, 27376, 7, 199, 199, 3, 21507, 6016, 2202, 199, 1198, 63, 1000, 275, 488, 199, 1198, 63, 2886, 275, 488, 199, 1198, 63, 2060, 275, 488, 199, 1198, 63, 719, 275, 488, 199, 1180, 63, 4266, 275, 488, 199, 2495, 63, 2123, 63, 344, 275, 488, 199, 199, 3, 2050, 2202, 199, 793, 63, 493, 63, 354, 275, 283, 7270, 15, 705, 63, 793, 14, 2424, 7, 199, 1757, 63, 793, 63, 30764, 275, 942, 199, 793, 63, 1896, 275, 283, 4806, 14, 4531, 7, 199, 793, 63, 493, 63, 890, 275, 22369, 199, 793, 63, 493, 63, 5751, 63, 835, 275, 959, 421, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
xifle/home-assistant
homeassistant/components/binary_sensor/envisalink.py
12
2697
""" Support for Envisalink zone states- represented as binary sensors. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/binary_sensor.envisalink/ """ import logging from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.envisalink import (EVL_CONTROLLER, ZONE_SCHEMA, CONF_ZONENAME, CONF_ZONETYPE, EnvisalinkDevice, SIGNAL_ZONE_UPDATE) from homeassistant.const import ATTR_LAST_TRIP_TIME DEPENDENCIES = ['envisalink'] _LOGGER = logging.getLogger(__name__) def setup_platform(hass, config, add_devices_callback, discovery_info=None): """Setup Envisalink binary sensor devices.""" _configured_zones = discovery_info['zones'] for zone_num in _configured_zones: _device_config_data = ZONE_SCHEMA(_configured_zones[zone_num]) _device = EnvisalinkBinarySensor( zone_num, _device_config_data[CONF_ZONENAME], _device_config_data[CONF_ZONETYPE], EVL_CONTROLLER.alarm_state['zone'][zone_num], EVL_CONTROLLER) add_devices_callback([_device]) class EnvisalinkBinarySensor(EnvisalinkDevice, BinarySensorDevice): """Representation of an Envisalink binary sensor.""" def __init__(self, zone_number, zone_name, zone_type, info, controller): """Initialize the binary_sensor.""" from pydispatch import dispatcher self._zone_type = zone_type self._zone_number = zone_number _LOGGER.debug('Setting up zone: ' + zone_name) EnvisalinkDevice.__init__(self, zone_name, info, controller) dispatcher.connect(self._update_callback, signal=SIGNAL_ZONE_UPDATE, sender=dispatcher.Any) @property def device_state_attributes(self): """Return the state attributes.""" attr = {} attr[ATTR_LAST_TRIP_TIME] = self._info['last_fault'] return attr @property def is_on(self): """Return true if sensor is on.""" return self._info['status']['open'] @property def sensor_class(self): """Return the class of this sensor, from SENSOR_CLASSES.""" return self._zone_type def _update_callback(self, zone): """Update the zone's state, if needed.""" if zone is None or int(zone) == self._zone_number: self.hass.async_add_job(self.update_ha_state)
mit
[ 624, 199, 11532, 367, 3447, 5068, 279, 2292, 5718, 6363, 13, 11159, 465, 3366, 19678, 14, 199, 199, 1858, 1655, 2436, 3595, 642, 4298, 12, 8749, 10618, 370, 314, 3794, 737, 199, 2859, 921, 4219, 13, 7310, 14, 2308, 15, 4608, 15, 3008, 63, 8956, 14, 1813, 28235, 2292, 15, 199, 624, 199, 646, 2050, 199, 504, 8846, 14, 4608, 14, 3008, 63, 8956, 492, 14161, 10160, 2510, 199, 504, 8846, 14, 4608, 14, 1813, 28235, 2292, 492, 334, 18015, 44, 63, 5801, 14881, 540, 12, 1740, 3107, 4817, 63, 10926, 12, 1740, 6392, 63, 58, 615, 11536, 12, 1740, 6392, 63, 58, 615, 17509, 12, 1740, 3447, 5068, 279, 2292, 2510, 12, 1740, 24360, 63, 15353, 63, 10383, 9, 199, 504, 8846, 14, 1297, 492, 10762, 63, 16901, 63, 1766, 1772, 63, 4961, 199, 199, 25743, 9415, 2563, 275, 788, 1813, 28235, 2292, 418, 199, 63, 10186, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 318, 3272, 63, 3246, 8, 5387, 12, 1101, 12, 1050, 63, 6410, 63, 3058, 12, 13172, 63, 815, 29, 403, 304, 272, 408, 8555, 3447, 5068, 279, 2292, 3366, 8778, 7256, 1041, 272, 485, 11786, 63, 13325, 275, 13172, 63, 815, 459, 13325, 418, 272, 367, 5718, 63, 1507, 315, 485, 11786, 63, 13325, 26, 267, 485, 1782, 63, 888, 63, 576, 275, 3107, 4817, 63, 10926, 1547, 11786, 63, 13325, 59, 2619, 63, 1507, 566, 267, 485, 1782, 275, 3447, 5068, 279, 2292, 6636, 10160, 8, 288, 5718, 63, 1507, 12, 288, 485, 1782, 63, 888, 63, 576, 59, 3103, 63, 58, 615, 11536, 467, 288, 485, 1782, 63, 888, 63, 576, 59, 3103, 63, 58, 615, 17509, 467, 288, 30069, 44, 63, 5801, 14881, 540, 14, 14160, 63, 929, 459, 2619, 3488, 2619, 63, 1507, 467, 288, 30069, 44, 63, 5801, 14881, 540, 9, 267, 1050, 63, 6410, 63, 3058, 779, 63, 1782, 566, 421, 199, 533, 3447, 5068, 279, 2292, 6636, 10160, 8, 1327, 5068, 279, 2292, 2510, 12, 14161, 10160, 2510, 304, 272, 408, 20609, 402, 376, 3447, 5068, 279, 2292, 3366, 8778, 1041, 339, 347, 636, 826, 721, 277, 12, 5718, 63, 1955, 12, 5718, 63, 354, 12, 5718, 63, 466, 12, 2256, 12, 7614, 304, 267, 408, 9345, 314, 3366, 63, 8956, 1041, 267, 687, 1134, 6052, 492, 17475, 267, 291, 423, 2619, 63, 466, 275, 5718, 63, 466, 267, 291, 423, 2619, 63, 1955, 275, 5718, 63, 1955, 398, 485, 10186, 14, 1757, 360, 7776, 1536, 5718, 26, 283, 435, 5718, 63, 354, 9, 267, 3447, 5068, 279, 2292, 2510, 855, 826, 721, 277, 12, 5718, 63, 354, 12, 2256, 12, 7614, 9, 267, 17475, 14, 2242, 8, 277, 423, 873, 63, 3058, 12, 2574, 4673, 29, 16496, 63, 15353, 63, 10383, 12, 2574, 8904, 29, 14913, 14, 9874, 9, 339, 768, 1829, 272, 347, 2243, 63, 929, 63, 2987, 8, 277, 304, 267, 408, 1767, 314, 1174, 3004, 1041, 267, 1921, 275, 1052, 267, 1921, 59, 5280, 63, 16901, 63, 1766, 1772, 63, 4961, 61, 275, 291, 423, 815, 459, 2019, 63, 1879, 418, 267, 372, 1921, 339, 768, 1829, 272, 347, 365, 63, 265, 8, 277, 304, 267, 408, 1767, 2549, 340, 8778, 365, 641, 1041, 267, 372, 291, 423, 815, 459, 1205, 2545, 1490, 418, 339, 768, 1829, 272, 347, 8778, 63, 533, 8, 277, 304, 267, 408, 1767, 314, 1021, 402, 642, 8778, 12, 687, 428, 17850, 63, 13748, 1041, 267, 372, 291, 423, 2619, 63, 466, 339, 347, 485, 873, 63, 3058, 8, 277, 12, 5718, 304, 267, 408, 4152, 314, 5718, 1159, 1174, 12, 340, 4346, 1041, 267, 340, 5718, 365, 488, 503, 1109, 8, 2619, 9, 508, 291, 423, 2619, 63, 1955, 26, 288, 291, 14, 5387, 14, 4146, 63, 525, 63, 2423, 8, 277, 14, 873, 63, 2411, 63, 929, 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 ]
[ 199, 11532, 367, 3447, 5068, 279, 2292, 5718, 6363, 13, 11159, 465, 3366, 19678, 14, 199, 199, 1858, 1655, 2436, 3595, 642, 4298, 12, 8749, 10618, 370, 314, 3794, 737, 199, 2859, 921, 4219, 13, 7310, 14, 2308, 15, 4608, 15, 3008, 63, 8956, 14, 1813, 28235, 2292, 15, 199, 624, 199, 646, 2050, 199, 504, 8846, 14, 4608, 14, 3008, 63, 8956, 492, 14161, 10160, 2510, 199, 504, 8846, 14, 4608, 14, 1813, 28235, 2292, 492, 334, 18015, 44, 63, 5801, 14881, 540, 12, 1740, 3107, 4817, 63, 10926, 12, 1740, 6392, 63, 58, 615, 11536, 12, 1740, 6392, 63, 58, 615, 17509, 12, 1740, 3447, 5068, 279, 2292, 2510, 12, 1740, 24360, 63, 15353, 63, 10383, 9, 199, 504, 8846, 14, 1297, 492, 10762, 63, 16901, 63, 1766, 1772, 63, 4961, 199, 199, 25743, 9415, 2563, 275, 788, 1813, 28235, 2292, 418, 199, 63, 10186, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 318, 3272, 63, 3246, 8, 5387, 12, 1101, 12, 1050, 63, 6410, 63, 3058, 12, 13172, 63, 815, 29, 403, 304, 272, 408, 8555, 3447, 5068, 279, 2292, 3366, 8778, 7256, 1041, 272, 485, 11786, 63, 13325, 275, 13172, 63, 815, 459, 13325, 418, 272, 367, 5718, 63, 1507, 315, 485, 11786, 63, 13325, 26, 267, 485, 1782, 63, 888, 63, 576, 275, 3107, 4817, 63, 10926, 1547, 11786, 63, 13325, 59, 2619, 63, 1507, 566, 267, 485, 1782, 275, 3447, 5068, 279, 2292, 6636, 10160, 8, 288, 5718, 63, 1507, 12, 288, 485, 1782, 63, 888, 63, 576, 59, 3103, 63, 58, 615, 11536, 467, 288, 485, 1782, 63, 888, 63, 576, 59, 3103, 63, 58, 615, 17509, 467, 288, 30069, 44, 63, 5801, 14881, 540, 14, 14160, 63, 929, 459, 2619, 3488, 2619, 63, 1507, 467, 288, 30069, 44, 63, 5801, 14881, 540, 9, 267, 1050, 63, 6410, 63, 3058, 779, 63, 1782, 566, 421, 199, 533, 3447, 5068, 279, 2292, 6636, 10160, 8, 1327, 5068, 279, 2292, 2510, 12, 14161, 10160, 2510, 304, 272, 408, 20609, 402, 376, 3447, 5068, 279, 2292, 3366, 8778, 1041, 339, 347, 636, 826, 721, 277, 12, 5718, 63, 1955, 12, 5718, 63, 354, 12, 5718, 63, 466, 12, 2256, 12, 7614, 304, 267, 408, 9345, 314, 3366, 63, 8956, 1041, 267, 687, 1134, 6052, 492, 17475, 267, 291, 423, 2619, 63, 466, 275, 5718, 63, 466, 267, 291, 423, 2619, 63, 1955, 275, 5718, 63, 1955, 398, 485, 10186, 14, 1757, 360, 7776, 1536, 5718, 26, 283, 435, 5718, 63, 354, 9, 267, 3447, 5068, 279, 2292, 2510, 855, 826, 721, 277, 12, 5718, 63, 354, 12, 2256, 12, 7614, 9, 267, 17475, 14, 2242, 8, 277, 423, 873, 63, 3058, 12, 2574, 4673, 29, 16496, 63, 15353, 63, 10383, 12, 2574, 8904, 29, 14913, 14, 9874, 9, 339, 768, 1829, 272, 347, 2243, 63, 929, 63, 2987, 8, 277, 304, 267, 408, 1767, 314, 1174, 3004, 1041, 267, 1921, 275, 1052, 267, 1921, 59, 5280, 63, 16901, 63, 1766, 1772, 63, 4961, 61, 275, 291, 423, 815, 459, 2019, 63, 1879, 418, 267, 372, 1921, 339, 768, 1829, 272, 347, 365, 63, 265, 8, 277, 304, 267, 408, 1767, 2549, 340, 8778, 365, 641, 1041, 267, 372, 291, 423, 815, 459, 1205, 2545, 1490, 418, 339, 768, 1829, 272, 347, 8778, 63, 533, 8, 277, 304, 267, 408, 1767, 314, 1021, 402, 642, 8778, 12, 687, 428, 17850, 63, 13748, 1041, 267, 372, 291, 423, 2619, 63, 466, 339, 347, 485, 873, 63, 3058, 8, 277, 12, 5718, 304, 267, 408, 4152, 314, 5718, 1159, 1174, 12, 340, 4346, 1041, 267, 340, 5718, 365, 488, 503, 1109, 8, 2619, 9, 508, 291, 423, 2619, 63, 1955, 26, 288, 291, 14, 5387, 14, 4146, 63, 525, 63, 2423, 8, 277, 14, 873, 63, 2411, 63, 929, 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, 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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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 ]
40423106/2016fallcadp_ag4
local_publishconf.py
188
1674
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals # This file is only used if you use `make publish` or # explicitly specify it as your config file. import os import sys sys.path.append(os.curdir) from pelicanconf import * # 因為 publishconf.py 在 pelicanconf.py 之後, 因此若兩處有相同變數的設定, 將以較後讀入的 publishconf.py 中的設定為主. # 請注意, 為了在近端讓 Tipue search 傳回的搜尋結果連結正確, 必須使用 ./ SITEURL = './' # 此設定用於近端靜態網頁查驗, 因此使用相對 URL RELATIVE_URLS = True # 為了要讓 local 與 gh-pages 上都能夠使用 Tipue search, 可能要採用不同的 theme THEME = 'theme/pelican-bootstrap3_local' #BOOTSTRAP_THEME = 'readable' #BOOTSTRAP_THEME = 'readable-old' BOOTSTRAP_THEME = 'united' #PYGMENTS_STYLE = 'paraiso-drak' #PYGMENTS_STYLE = 'fruity' # 為了同時兼容 render_math, 必須放棄 fruity PYGMENTS_STYLE = 'monokai' FEED_ALL_ATOM = 'feeds/all.atom.xml' CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml' DELETE_OUTPUT_DIRECTORY = True # Following items are often useful when publishing #DISQUS_SITENAME = "kmolab" #GOOGLE_ANALYTICS = "" # 設定網誌以 md 檔案建立的 file system date 為準, 無需自行設定 DEFAULT_DATE = 'fs' # 近端的 code hightlight MD_EXTENSIONS = ['fenced_code', 'extra', 'codehilite(linenums=True)'] # 若要依照日期存檔呼叫 #ARTICLE_URL = 'posts/{date:%Y}/{date:%m}/{date:%d}/{slug}/index.html' #ARTICLE_SAVE_AS = 'posts/{date:%Y}/{date:%m}/{date:%d}/{slug}/index.html' PAGE_URL = 'pages/{slug}/' PAGE_SAVE_AS = 'pages/{slug}/index.html' SHOW_ARTICLE_AUTHOR = True
agpl-3.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 327, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 3, 961, 570, 365, 1454, 1202, 340, 1265, 675, 658, 1875, 2780, 64, 503, 199, 3, 7662, 4165, 652, 465, 2195, 1101, 570, 14, 199, 199, 646, 747, 199, 646, 984, 199, 1274, 14, 515, 14, 740, 8, 736, 14, 15594, 9, 199, 504, 4837, 28091, 2190, 492, 627, 199, 199, 3, 7094, 250, 255, 24889, 2780, 2190, 14, 647, 7094, 251, 102, 4837, 28091, 2190, 14, 647, 221, 17837, 234, 19073, 235, 12, 7094, 250, 255, 17627, 98, 165, 234, 99, 8379, 103, 165, 248, 244, 20916, 15545, 117, 28956, 14082, 233, 24814, 8106, 20278, 256, 20766, 12, 7094, 109, 230, 23681, 25624, 226, 19073, 235, 14082, 223, 18236, 8106, 2780, 2190, 14, 647, 221, 17088, 8106, 20278, 256, 20766, 24889, 4344, 120, 14, 199, 199, 3, 9065, 105, 234, 20021, 102, 163, 227, 238, 12, 9112, 18760, 30998, 21448, 13201, 240, 21341, 108, 14082, 242, 377, 711, 310, 2754, 7094, 225, 112, 22234, 8106, 163, 239, 251, 15348, 234, 23767, 239, 19349, 251, 14333, 97, 23767, 239, 17627, 97, 164, 96, 119, 12, 7094, 124, 228, 166, 255, 231, 30026, 16605, 199, 7917, 2632, 275, 1987, 4805, 199, 3, 8853, 256, 98, 20278, 256, 20766, 11428, 10310, 121, 13201, 240, 21341, 108, 26398, 251, 163, 228, 234, 164, 115, 111, 166, 8774, 21788, 166, 103, 246, 12, 7094, 250, 255, 17627, 98, 30026, 15545, 117, 15348, 236, 2851, 199, 13604, 14277, 63, 31582, 275, 715, 199, 3, 9112, 18760, 30998, 22274, 14082, 242, 2257, 9065, 231, 230, 23310, 13, 5856, 221, 22661, 166, 25315, 28371, 11546, 255, 30026, 377, 711, 310, 2754, 12, 221, 25521, 28371, 22274, 17797, 95, 11428, 19594, 28956, 8106, 8879, 199, 18061, 3635, 275, 283, 7915, 15, 321, 28091, 13, 11146, 19, 63, 1832, 7, 199, 3, 22679, 3027, 1282, 63, 18061, 3635, 275, 283, 11875, 7, 199, 3, 22679, 3027, 1282, 63, 18061, 3635, 275, 283, 11875, 13, 1753, 7, 199, 22679, 3027, 1282, 63, 18061, 3635, 275, 283, 5411, 471, 7, 199, 3, 4521, 39, 20967, 63, 18466, 275, 283, 12227, 4595, 13, 28385, 75, 7, 199, 3, 4521, 39, 20967, 63, 18466, 275, 283, 4391, 24180, 7, 199, 3, 9112, 18760, 30998, 28956, 163, 248, 225, 8379, 121, 10270, 118, 3795, 63, 3442, 12, 7094, 124, 228, 166, 255, 231, 17130, 123, 163, 97, 227, 289, 6558, 1209, 199, 4521, 39, 20967, 63, 18466, 275, 283, 2106, 745, 5789, 7, 199, 199, 18068, 63, 1761, 63, 22479, 275, 283, 11522, 15, 452, 14, 4188, 14, 1652, 7, 199, 22690, 63, 18068, 63, 22479, 275, 283, 11522, 3149, 83, 14, 4188, 14, 1652, 7, 199, 199, 7014, 63, 8414, 63, 16436, 275, 715, 199, 199, 3, 21876, 316, 2974, 787, 14115, 2997, 1380, 2780, 316, 199, 199, 3, 6178, 49, 1668, 63, 51, 649, 11536, 275, 298, 14595, 393, 371, 2, 199, 3, 24243, 63, 31158, 28267, 21174, 275, 3087, 199, 199, 3, 9065, 102, 256, 20766, 164, 115, 111, 165, 104, 235, 23681, 6128, 8853, 104, 243, 31333, 231, 29427, 119, 21341, 234, 8106, 570, 2656, 1434, 9112, 18760, 163, 119, 245, 12, 9112, 227, 95, 166, 251, 223, 27345, 104, 12609, 20278, 256, 20766, 199, 3472, 63, 5390, 275, 283, 2319, 7, 199, 199, 3, 9065, 124, 240, 21341, 108, 8106, 1233, 394, 1070, 4040, 199, 5127, 63, 18451, 275, 788, 28306, 68, 63, 600, 297, 283, 2911, 297, 283, 600, 72, 1638, 266, 8, 19466, 83, 29, 549, 9, 418, 199, 199, 3, 9065, 234, 99, 22274, 25439, 252, 164, 228, 101, 31502, 29846, 163, 104, 243, 19580, 121, 6075, 105, 199, 3, 2294, 948, 906, 63, 2632, 275, 283, 18084, 5321, 602, 2689, 57, 16152, 602, 2689, 77, 16152, 602, 2689, 68, 16152, 5464, 5995, 1080, 14, 1360, 7, 199, 3, 2294, 948, 906, 63, 19318, 63, 1179, 275, 283, 18084, 5321, 602, 2689, 57, 16152, 602, 2689, 77, 16152, 602, 2689, 68, 16152, 5464, 5995, 1080, 14, 1360, 7, 199, 12898, 63, 2632, 275, 283, 5856, 5321, 5464, 93, 4805, 199, 12898, 63, 19318, 63, 1179, 275, 283, 5856, 5321, 5464, 5995, 1080, 14, 1360, 7, 199, 19085, 63, 2294, 948, 906, 63, 27938, 275, 715, 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 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 327, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 3, 961, 570, 365, 1454, 1202, 340, 1265, 675, 658, 1875, 2780, 64, 503, 199, 3, 7662, 4165, 652, 465, 2195, 1101, 570, 14, 199, 199, 646, 747, 199, 646, 984, 199, 1274, 14, 515, 14, 740, 8, 736, 14, 15594, 9, 199, 504, 4837, 28091, 2190, 492, 627, 199, 199, 3, 7094, 250, 255, 24889, 2780, 2190, 14, 647, 7094, 251, 102, 4837, 28091, 2190, 14, 647, 221, 17837, 234, 19073, 235, 12, 7094, 250, 255, 17627, 98, 165, 234, 99, 8379, 103, 165, 248, 244, 20916, 15545, 117, 28956, 14082, 233, 24814, 8106, 20278, 256, 20766, 12, 7094, 109, 230, 23681, 25624, 226, 19073, 235, 14082, 223, 18236, 8106, 2780, 2190, 14, 647, 221, 17088, 8106, 20278, 256, 20766, 24889, 4344, 120, 14, 199, 199, 3, 9065, 105, 234, 20021, 102, 163, 227, 238, 12, 9112, 18760, 30998, 21448, 13201, 240, 21341, 108, 14082, 242, 377, 711, 310, 2754, 7094, 225, 112, 22234, 8106, 163, 239, 251, 15348, 234, 23767, 239, 19349, 251, 14333, 97, 23767, 239, 17627, 97, 164, 96, 119, 12, 7094, 124, 228, 166, 255, 231, 30026, 16605, 199, 7917, 2632, 275, 1987, 4805, 199, 3, 8853, 256, 98, 20278, 256, 20766, 11428, 10310, 121, 13201, 240, 21341, 108, 26398, 251, 163, 228, 234, 164, 115, 111, 166, 8774, 21788, 166, 103, 246, 12, 7094, 250, 255, 17627, 98, 30026, 15545, 117, 15348, 236, 2851, 199, 13604, 14277, 63, 31582, 275, 715, 199, 3, 9112, 18760, 30998, 22274, 14082, 242, 2257, 9065, 231, 230, 23310, 13, 5856, 221, 22661, 166, 25315, 28371, 11546, 255, 30026, 377, 711, 310, 2754, 12, 221, 25521, 28371, 22274, 17797, 95, 11428, 19594, 28956, 8106, 8879, 199, 18061, 3635, 275, 283, 7915, 15, 321, 28091, 13, 11146, 19, 63, 1832, 7, 199, 3, 22679, 3027, 1282, 63, 18061, 3635, 275, 283, 11875, 7, 199, 3, 22679, 3027, 1282, 63, 18061, 3635, 275, 283, 11875, 13, 1753, 7, 199, 22679, 3027, 1282, 63, 18061, 3635, 275, 283, 5411, 471, 7, 199, 3, 4521, 39, 20967, 63, 18466, 275, 283, 12227, 4595, 13, 28385, 75, 7, 199, 3, 4521, 39, 20967, 63, 18466, 275, 283, 4391, 24180, 7, 199, 3, 9112, 18760, 30998, 28956, 163, 248, 225, 8379, 121, 10270, 118, 3795, 63, 3442, 12, 7094, 124, 228, 166, 255, 231, 17130, 123, 163, 97, 227, 289, 6558, 1209, 199, 4521, 39, 20967, 63, 18466, 275, 283, 2106, 745, 5789, 7, 199, 199, 18068, 63, 1761, 63, 22479, 275, 283, 11522, 15, 452, 14, 4188, 14, 1652, 7, 199, 22690, 63, 18068, 63, 22479, 275, 283, 11522, 3149, 83, 14, 4188, 14, 1652, 7, 199, 199, 7014, 63, 8414, 63, 16436, 275, 715, 199, 199, 3, 21876, 316, 2974, 787, 14115, 2997, 1380, 2780, 316, 199, 199, 3, 6178, 49, 1668, 63, 51, 649, 11536, 275, 298, 14595, 393, 371, 2, 199, 3, 24243, 63, 31158, 28267, 21174, 275, 3087, 199, 199, 3, 9065, 102, 256, 20766, 164, 115, 111, 165, 104, 235, 23681, 6128, 8853, 104, 243, 31333, 231, 29427, 119, 21341, 234, 8106, 570, 2656, 1434, 9112, 18760, 163, 119, 245, 12, 9112, 227, 95, 166, 251, 223, 27345, 104, 12609, 20278, 256, 20766, 199, 3472, 63, 5390, 275, 283, 2319, 7, 199, 199, 3, 9065, 124, 240, 21341, 108, 8106, 1233, 394, 1070, 4040, 199, 5127, 63, 18451, 275, 788, 28306, 68, 63, 600, 297, 283, 2911, 297, 283, 600, 72, 1638, 266, 8, 19466, 83, 29, 549, 9, 418, 199, 199, 3, 9065, 234, 99, 22274, 25439, 252, 164, 228, 101, 31502, 29846, 163, 104, 243, 19580, 121, 6075, 105, 199, 3, 2294, 948, 906, 63, 2632, 275, 283, 18084, 5321, 602, 2689, 57, 16152, 602, 2689, 77, 16152, 602, 2689, 68, 16152, 5464, 5995, 1080, 14, 1360, 7, 199, 3, 2294, 948, 906, 63, 19318, 63, 1179, 275, 283, 18084, 5321, 602, 2689, 57, 16152, 602, 2689, 77, 16152, 602, 2689, 68, 16152, 5464, 5995, 1080, 14, 1360, 7, 199, 12898, 63, 2632, 275, 283, 5856, 5321, 5464, 93, 4805, 199, 12898, 63, 19318, 63, 1179, 275, 283, 5856, 5321, 5464, 5995, 1080, 14, 1360, 7, 199, 19085, 63, 2294, 948, 906, 63, 27938, 275, 715, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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 ]
jobbrIO/docs
conf.py
1
10123
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Jobbr documentation build configuration file, created by # sphinx-quickstart on Fri Nov 4 19:20:28 2016. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. # 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. # # import os # import sys # sys.path.insert(0, os.path.abspath('.')) # -- Custom Additions def setup(app): app.add_stylesheet('css/custom.css') # may also be an URL # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. # # needs_sphinx = '1.0' # 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.todo', #] # Add any paths that contain templates here, relative to this directory. # templates_path = ['_templates'] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # source_suffix = ['.rst', '.md'] # source_suffix = '.rst' from recommonmark.parser import CommonMarkParser source_parsers = { '.md': CommonMarkParser, } # The encoding of source files. # # source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = 'Jobbr .NET JobServer' copyright = u'2017 Zühlke Engineering AG' author = u'Michael Schnyder, Oliver Zürcher & Contributors' # 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 = '1.0' # The full version, including alpha/beta/rc tags. # release = '1.0-alpha' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. # language = None # 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. # This patterns also effect to html_static_path and html_extra_path exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'README.md'] # 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 = 'sphinx' # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. # keep_warnings = False # If true, `todo` and `todoList` produce output, else they produce nothing. # todo_include_todos = True # -- 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 = 'sphinx_rtd_theme' # 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 = [] # The name for this set of Sphinx documents. # "<project> v<release> documentation" by default. # # html_title = 'Doc' # 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 (relative to this directory) to use as a 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'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. # # html_extra_path = [] # If not None, a 'Last updated on:' timestamp is inserted at every page # bottom, using the given strftime format. # The empty string is equivalent to '%b %d, %Y'. # # html_last_updated_fmt = None # 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. # # 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 = False # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. # # html_show_sphinx = False # 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 = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). # html_file_suffix = None # Language to be used for generating the HTML full-text search index. # Sphinx supports the following languages: # 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja' # 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr', 'zh' # # html_search_language = 'en' # A dictionary with options for the search language support, empty by default. # 'ja' uses this config value. # 'zh' user can custom change `jieba` dictionary path. # # html_search_options = {'type': 'default'} # The name of a javascript file (relative to the configuration directory) that # implements a search results scorer. If empty, the default will be used. # # html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. # htmlhelp_basename = 'Jobbrdoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # # 'preamble': '', # Latex figure (float) alignment # # 'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). # latex_documents = [ # (master_doc, 'Jobbr.tex', 'Jobbr Documentation', # 'Michael Schnyder, Oliver Zürcher', 'manual'), # ] # The name of an image file (relative to this directory) to place at the top of # the title page. # # latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. # # latex_use_parts = False # If true, show page references after internal links. # # latex_show_pagerefs = False # If true, show URL addresses after external links. # # latex_show_urls = False # Documents to append as an appendix to all manuals. # # latex_appendices = [] # It false, will not define \strong, \code, itleref, \crossref ... but only # \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added # packages. # # latex_keep_old_macro_names = True # If false, no module index is generated. # # latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). # man_pages = [ # (master_doc, 'jobbrdoc', 'Jobbr Documentation', # [author], 1) #] # If true, show URL addresses after external links. # # man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) # texinfo_documents = [ # (master_doc, 'JobbrDoc', 'JobbrDoc', # author, 'JobbrDoc', 'One line description of project.', # 'Miscellaneous'), # ] # Documents to append as an appendix to all manuals. # # texinfo_appendices = [] # If false, no module index is generated. # # texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. # # texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. # # texinfo_no_detailmenu = False
mit
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 19, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 7135, 2501, 82, 3794, 1900, 2897, 570, 12, 2737, 701, 199, 3, 15882, 13, 28957, 641, 31712, 3091, 86, 221, 841, 5851, 26, 1165, 26, 1651, 7800, 14, 199, 3, 199, 3, 961, 570, 365, 22711, 342, 68, 543, 314, 1453, 2082, 663, 370, 2399, 199, 3, 3035, 2935, 14, 199, 3, 199, 3, 3390, 626, 440, 1006, 3962, 2897, 1338, 787, 3451, 315, 642, 199, 3, 18392, 570, 14, 199, 3, 199, 3, 2900, 2897, 1338, 1172, 282, 849, 27, 1338, 626, 787, 21804, 734, 199, 3, 14062, 370, 2498, 314, 849, 14, 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, 3, 199, 3, 492, 747, 199, 3, 492, 984, 199, 3, 984, 14, 515, 14, 3176, 8, 16, 12, 747, 14, 515, 14, 4832, 24535, 421, 199, 3, 1553, 8388, 4431, 3138, 199, 199, 318, 3272, 8, 571, 304, 272, 1145, 14, 525, 63, 15479, 360, 3919, 15, 4229, 14, 3919, 358, 221, 327, 1443, 2597, 506, 376, 2851, 199, 199, 3, 1553, 1696, 2897, 9527, 199, 199, 3, 982, 2195, 3794, 4839, 282, 13460, 10229, 1015, 12, 1174, 652, 2348, 14, 199, 3, 199, 3, 4839, 63, 8008, 275, 283, 17, 14, 16, 7, 199, 199, 3, 2654, 1263, 10229, 3329, 859, 1561, 2348, 12, 465, 3326, 14, 9322, 883, 506, 199, 3, 5478, 17262, 543, 10229, 334, 4579, 283, 8008, 14, 832, 24915, 503, 2195, 3537, 199, 3, 7869, 14, 199, 3, 5478, 275, 359, 199, 3, 259, 283, 8008, 14, 832, 14, 11396, 297, 199, 3, 61, 199, 199, 3, 2654, 1263, 3792, 626, 1395, 7009, 2348, 12, 3847, 370, 642, 2082, 14, 199, 3, 7009, 63, 515, 275, 4044, 5876, 418, 199, 199, 3, 710, 4739, 8, 397, 9, 402, 1350, 6203, 14, 199, 3, 2047, 883, 4165, 3663, 4739, 465, 282, 769, 402, 1059, 26, 199, 3, 199, 1365, 63, 4511, 275, 18953, 8332, 297, 1987, 1064, 418, 199, 3, 1350, 63, 4511, 275, 1987, 8332, 7, 199, 199, 504, 295, 2330, 1657, 14, 2087, 492, 13964, 6470, 2842, 199, 199, 1365, 63, 11531, 275, 469, 199, 198, 1370, 1064, 356, 13964, 6470, 2842, 12, 199, 93, 199, 199, 3, 710, 2644, 402, 1350, 1584, 14, 199, 3, 199, 3, 1350, 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, 283, 5691, 2501, 82, 1275, 7278, 15057, 3120, 7, 199, 7307, 275, 399, 7, 10680, 3107, 17709, 15544, 415, 12580, 15663, 26787, 7, 199, 2502, 275, 399, 7, 45, 11781, 22985, 9745, 424, 12, 593, 317, 422, 3107, 17709, 82, 7641, 1253, 23212, 7, 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, 3, 1015, 275, 283, 17, 14, 16, 7, 199, 3, 710, 2615, 1015, 12, 5893, 5131, 15, 5683, 15, 1195, 3762, 14, 199, 3, 4683, 275, 283, 17, 14, 16, 13, 4468, 7, 199, 199, 3, 710, 2637, 367, 1564, 18392, 701, 10229, 14, 21751, 370, 3794, 199, 3, 367, 282, 769, 402, 3748, 10815, 14, 199, 3, 199, 3, 961, 365, 2597, 1202, 340, 1265, 886, 1564, 7761, 4799, 9796, 6230, 18238, 14, 199, 3, 24612, 1265, 663, 298, 3671, 2, 687, 314, 1414, 1004, 367, 3520, 5560, 14, 199, 3, 2637, 275, 488, 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, 199, 3, 11168, 275, 2125, 199, 3, 199, 3, 19524, 12, 11168, 63, 5045, 365, 1202, 465, 314, 1475, 367, 282, 14053, 1240, 14, 199, 3, 199, 3, 11168, 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, 3, 961, 7970, 2597, 7763, 370, 3517, 63, 1986, 63, 515, 436, 3517, 63, 2911, 63, 515, 199, 5473, 63, 7435, 275, 4044, 1506, 297, 283, 2719, 23135, 14, 697, 297, 1987, 3177, 63, 5502, 297, 283, 18195, 14, 1064, 418, 199, 199, 3, 710, 20883, 849, 4719, 334, 2972, 367, 642, 9189, 26, 658, 505, 10522, 370, 675, 367, 1006, 199, 3, 8247, 14, 199, 3, 199, 3, 849, 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, 3, 199, 3, 1050, 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, 199, 3, 1050, 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, 199, 3, 2498, 63, 8149, 275, 756, 199, 199, 3, 710, 536, 402, 314, 14493, 334, 7093, 22437, 9, 3449, 370, 675, 14, 199, 3, 13277, 63, 2487, 275, 283, 8008, 7, 199, 199, 3, 437, 769, 402, 5525, 13158, 367, 859, 1478, 13351, 14, 199, 3, 3413, 1080, 63, 2330, 63, 1861, 275, 942, 199, 199, 3, 982, 2549, 12, 4215, 3598, 465, 298, 2253, 1245, 2, 26603, 315, 314, 6137, 8247, 14, 199, 3, 4215, 63, 5451, 275, 756, 199, 199, 3, 982, 2549 ]
[ 2647, 15, 1393, 15, 1813, 2366, 19, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 7135, 2501, 82, 3794, 1900, 2897, 570, 12, 2737, 701, 199, 3, 15882, 13, 28957, 641, 31712, 3091, 86, 221, 841, 5851, 26, 1165, 26, 1651, 7800, 14, 199, 3, 199, 3, 961, 570, 365, 22711, 342, 68, 543, 314, 1453, 2082, 663, 370, 2399, 199, 3, 3035, 2935, 14, 199, 3, 199, 3, 3390, 626, 440, 1006, 3962, 2897, 1338, 787, 3451, 315, 642, 199, 3, 18392, 570, 14, 199, 3, 199, 3, 2900, 2897, 1338, 1172, 282, 849, 27, 1338, 626, 787, 21804, 734, 199, 3, 14062, 370, 2498, 314, 849, 14, 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, 3, 199, 3, 492, 747, 199, 3, 492, 984, 199, 3, 984, 14, 515, 14, 3176, 8, 16, 12, 747, 14, 515, 14, 4832, 24535, 421, 199, 3, 1553, 8388, 4431, 3138, 199, 199, 318, 3272, 8, 571, 304, 272, 1145, 14, 525, 63, 15479, 360, 3919, 15, 4229, 14, 3919, 358, 221, 327, 1443, 2597, 506, 376, 2851, 199, 199, 3, 1553, 1696, 2897, 9527, 199, 199, 3, 982, 2195, 3794, 4839, 282, 13460, 10229, 1015, 12, 1174, 652, 2348, 14, 199, 3, 199, 3, 4839, 63, 8008, 275, 283, 17, 14, 16, 7, 199, 199, 3, 2654, 1263, 10229, 3329, 859, 1561, 2348, 12, 465, 3326, 14, 9322, 883, 506, 199, 3, 5478, 17262, 543, 10229, 334, 4579, 283, 8008, 14, 832, 24915, 503, 2195, 3537, 199, 3, 7869, 14, 199, 3, 5478, 275, 359, 199, 3, 259, 283, 8008, 14, 832, 14, 11396, 297, 199, 3, 61, 199, 199, 3, 2654, 1263, 3792, 626, 1395, 7009, 2348, 12, 3847, 370, 642, 2082, 14, 199, 3, 7009, 63, 515, 275, 4044, 5876, 418, 199, 199, 3, 710, 4739, 8, 397, 9, 402, 1350, 6203, 14, 199, 3, 2047, 883, 4165, 3663, 4739, 465, 282, 769, 402, 1059, 26, 199, 3, 199, 1365, 63, 4511, 275, 18953, 8332, 297, 1987, 1064, 418, 199, 3, 1350, 63, 4511, 275, 1987, 8332, 7, 199, 199, 504, 295, 2330, 1657, 14, 2087, 492, 13964, 6470, 2842, 199, 199, 1365, 63, 11531, 275, 469, 199, 198, 1370, 1064, 356, 13964, 6470, 2842, 12, 199, 93, 199, 199, 3, 710, 2644, 402, 1350, 1584, 14, 199, 3, 199, 3, 1350, 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, 283, 5691, 2501, 82, 1275, 7278, 15057, 3120, 7, 199, 7307, 275, 399, 7, 10680, 3107, 17709, 15544, 415, 12580, 15663, 26787, 7, 199, 2502, 275, 399, 7, 45, 11781, 22985, 9745, 424, 12, 593, 317, 422, 3107, 17709, 82, 7641, 1253, 23212, 7, 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, 3, 1015, 275, 283, 17, 14, 16, 7, 199, 3, 710, 2615, 1015, 12, 5893, 5131, 15, 5683, 15, 1195, 3762, 14, 199, 3, 4683, 275, 283, 17, 14, 16, 13, 4468, 7, 199, 199, 3, 710, 2637, 367, 1564, 18392, 701, 10229, 14, 21751, 370, 3794, 199, 3, 367, 282, 769, 402, 3748, 10815, 14, 199, 3, 199, 3, 961, 365, 2597, 1202, 340, 1265, 886, 1564, 7761, 4799, 9796, 6230, 18238, 14, 199, 3, 24612, 1265, 663, 298, 3671, 2, 687, 314, 1414, 1004, 367, 3520, 5560, 14, 199, 3, 2637, 275, 488, 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, 199, 3, 11168, 275, 2125, 199, 3, 199, 3, 19524, 12, 11168, 63, 5045, 365, 1202, 465, 314, 1475, 367, 282, 14053, 1240, 14, 199, 3, 199, 3, 11168, 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, 3, 961, 7970, 2597, 7763, 370, 3517, 63, 1986, 63, 515, 436, 3517, 63, 2911, 63, 515, 199, 5473, 63, 7435, 275, 4044, 1506, 297, 283, 2719, 23135, 14, 697, 297, 1987, 3177, 63, 5502, 297, 283, 18195, 14, 1064, 418, 199, 199, 3, 710, 20883, 849, 4719, 334, 2972, 367, 642, 9189, 26, 658, 505, 10522, 370, 675, 367, 1006, 199, 3, 8247, 14, 199, 3, 199, 3, 849, 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, 3, 199, 3, 1050, 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, 199, 3, 1050, 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, 199, 3, 2498, 63, 8149, 275, 756, 199, 199, 3, 710, 536, 402, 314, 14493, 334, 7093, 22437, 9, 3449, 370, 675, 14, 199, 3, 13277, 63, 2487, 275, 283, 8008, 7, 199, 199, 3, 437, 769, 402, 5525, 13158, 367, 859, 1478, 13351, 14, 199, 3, 3413, 1080, 63, 2330, 63, 1861, 275, 942, 199, 199, 3, 982, 2549, 12, 4215, 3598, 465, 298, 2253, 1245, 2, 26603, 315, 314, 6137, 8247, 14, 199, 3, 4215, 63, 5451, 275, 756, 199, 199, 3, 982, 2549, 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 ]
sambev/ircbot
scrapers/cafescraper.py
1
1407
def scrapeCafe(): """ Scrape the EastBay Cafe's site for the current lunch menu """ from bs4 import BeautifulSoup import requests # Get the page contents and make a soup object from it page = requests.get('http://www.eastbaycafe.com/menu.php') the_html = BeautifulSoup(page.text) mapping = { 'Steam \'n Turren': 'steam', 'Flavor & Fire': 'flavor', 'Main Event': 'mainevent', 'Field Of Greens': 'fieldofgreens', 'The Grillery': 'dailygrill', } menu = { 'item_max_width': 0, 'station_max_width': 0, 'stations': {} } main_div = the_html.find_all('div', 'menu_content')[0] # For each mapping, find the Menu Item # thanks to iffycan for the more elegant approach for k,v in mapping.items(): try: li = main_div.find_all('li', v)[0]; menu_item = li.find_all('em')[0].get_text() prices = li.find_all('strong') if v == 'steam': price = "%s Cup / %s Bowl" % (prices[0].get_text().lstrip('/ '), prices[1].get_text().lstrip('/ ')) else: price = prices[0].get_text().lstrip('/ ') menu['item_max_width'] = max(menu['item_max_width'], len(menu_item)) menu['station_max_width'] = max(menu['station_max_width'], len(k)) menu['stations'][k] = { 'item': menu_item, 'price': price } except: menu['stations'][k] = None pass return menu
mit
[ 318, 10328, 321, 3630, 771, 837, 199, 198, 624, 199, 198, 7181, 345, 321, 314, 662, 1810, 29115, 445, 6504, 1159, 4770, 367, 314, 1453, 634, 4689, 6269, 199, 198, 624, 199, 198, 504, 9922, 20, 492, 17132, 199, 198, 646, 4145, 421, 198, 3, 2372, 314, 2034, 4072, 436, 1852, 282, 9108, 909, 687, 652, 199, 198, 1606, 275, 4145, 14, 362, 360, 1014, 921, 1544, 14, 14346, 19558, 696, 771, 14, 957, 15, 4470, 14, 8624, 358, 199, 198, 1589, 63, 1360, 275, 17132, 8, 1606, 14, 505, 9, 421, 198, 4745, 275, 469, 6722, 283, 51, 5969, 8891, 78, 377, 300, 828, 356, 283, 1597, 455, 297, 6722, 283, 16739, 1253, 15967, 356, 283, 6081, 297, 6722, 283, 6756, 6763, 356, 283, 973, 1430, 297, 6722, 283, 792, 24545, 32585, 83, 356, 283, 698, 1618, 7731, 83, 297, 6722, 283, 1918, 598, 10363, 274, 651, 356, 283, 18621, 7928, 914, 297, 199, 198, 93, 421, 198, 4470, 275, 469, 507, 198, 7, 1053, 63, 988, 63, 2063, 356, 378, 12, 507, 198, 1159, 84, 425, 63, 988, 63, 2063, 356, 378, 12, 507, 198, 1159, 84, 1298, 356, 1052, 199, 198, 93, 199, 198, 973, 63, 3015, 275, 314, 63, 1360, 14, 1623, 63, 452, 360, 3015, 297, 283, 4470, 63, 1317, 5832, 16, 61, 421, 198, 3, 2104, 1924, 4412, 12, 2342, 314, 18281, 7020, 199, 198, 3, 2419, 6080, 370, 340, 1399, 2425, 367, 314, 1655, 325, 4170, 867, 18140, 199, 198, 509, 1022, 12, 86, 315, 4412, 14, 1744, 837, 6722, 862, 26, 507, 258, 198, 317, 275, 2446, 63, 3015, 14, 1623, 63, 452, 360, 317, 297, 373, 2788, 16, 11566, 507, 258, 198, 4470, 63, 1053, 275, 1212, 14, 1623, 63, 452, 360, 5633, 5832, 16, 1055, 362, 63, 505, 342, 268, 198, 32434, 275, 1212, 14, 1623, 63, 452, 360, 9370, 358, 507, 263, 340, 373, 508, 283, 1597, 455, 356, 507, 260, 198, 4777, 275, 2071, 83, 445, 384, 1182, 450, 83, 699, 583, 76, 2, 450, 334, 32434, 59, 16, 1055, 362, 63, 505, 1252, 10124, 2336, 17748, 1979, 823, 59, 17, 1055, 362, 63, 505, 1252, 10124, 2336, 20005, 507, 263, 587, 26, 507, 260, 198, 4777, 275, 1979, 823, 59, 16, 1055, 362, 63, 505, 1252, 10124, 2336, 5320, 507, 263, 6269, 459, 1053, 63, 988, 63, 2063, 418, 275, 1390, 8, 4470, 459, 1053, 63, 988, 63, 2063, 995, 822, 8, 4470, 63, 1053, 430, 507, 263, 6269, 459, 10600, 63, 988, 63, 2063, 418, 275, 1390, 8, 4470, 459, 10600, 63, 988, 63, 2063, 995, 822, 8, 75, 430, 507, 263, 6269, 459, 270, 1298, 3488, 75, 61, 275, 469, 507, 260, 198, 7, 1053, 356, 6269, 63, 1053, 12, 507, 260, 198, 7, 4777, 356, 8033, 507, 263, 789, 6722, 871, 26, 507, 258, 198, 4470, 459, 270, 1298, 3488, 75, 61, 275, 488, 507, 263, 986, 421, 198, 1107, 6269, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 10328, 321, 3630, 771, 837, 199, 198, 624, 199, 198, 7181, 345, 321, 314, 662, 1810, 29115, 445, 6504, 1159, 4770, 367, 314, 1453, 634, 4689, 6269, 199, 198, 624, 199, 198, 504, 9922, 20, 492, 17132, 199, 198, 646, 4145, 421, 198, 3, 2372, 314, 2034, 4072, 436, 1852, 282, 9108, 909, 687, 652, 199, 198, 1606, 275, 4145, 14, 362, 360, 1014, 921, 1544, 14, 14346, 19558, 696, 771, 14, 957, 15, 4470, 14, 8624, 358, 199, 198, 1589, 63, 1360, 275, 17132, 8, 1606, 14, 505, 9, 421, 198, 4745, 275, 469, 6722, 283, 51, 5969, 8891, 78, 377, 300, 828, 356, 283, 1597, 455, 297, 6722, 283, 16739, 1253, 15967, 356, 283, 6081, 297, 6722, 283, 6756, 6763, 356, 283, 973, 1430, 297, 6722, 283, 792, 24545, 32585, 83, 356, 283, 698, 1618, 7731, 83, 297, 6722, 283, 1918, 598, 10363, 274, 651, 356, 283, 18621, 7928, 914, 297, 199, 198, 93, 421, 198, 4470, 275, 469, 507, 198, 7, 1053, 63, 988, 63, 2063, 356, 378, 12, 507, 198, 1159, 84, 425, 63, 988, 63, 2063, 356, 378, 12, 507, 198, 1159, 84, 1298, 356, 1052, 199, 198, 93, 199, 198, 973, 63, 3015, 275, 314, 63, 1360, 14, 1623, 63, 452, 360, 3015, 297, 283, 4470, 63, 1317, 5832, 16, 61, 421, 198, 3, 2104, 1924, 4412, 12, 2342, 314, 18281, 7020, 199, 198, 3, 2419, 6080, 370, 340, 1399, 2425, 367, 314, 1655, 325, 4170, 867, 18140, 199, 198, 509, 1022, 12, 86, 315, 4412, 14, 1744, 837, 6722, 862, 26, 507, 258, 198, 317, 275, 2446, 63, 3015, 14, 1623, 63, 452, 360, 317, 297, 373, 2788, 16, 11566, 507, 258, 198, 4470, 63, 1053, 275, 1212, 14, 1623, 63, 452, 360, 5633, 5832, 16, 1055, 362, 63, 505, 342, 268, 198, 32434, 275, 1212, 14, 1623, 63, 452, 360, 9370, 358, 507, 263, 340, 373, 508, 283, 1597, 455, 356, 507, 260, 198, 4777, 275, 2071, 83, 445, 384, 1182, 450, 83, 699, 583, 76, 2, 450, 334, 32434, 59, 16, 1055, 362, 63, 505, 1252, 10124, 2336, 17748, 1979, 823, 59, 17, 1055, 362, 63, 505, 1252, 10124, 2336, 20005, 507, 263, 587, 26, 507, 260, 198, 4777, 275, 1979, 823, 59, 16, 1055, 362, 63, 505, 1252, 10124, 2336, 5320, 507, 263, 6269, 459, 1053, 63, 988, 63, 2063, 418, 275, 1390, 8, 4470, 459, 1053, 63, 988, 63, 2063, 995, 822, 8, 4470, 63, 1053, 430, 507, 263, 6269, 459, 10600, 63, 988, 63, 2063, 418, 275, 1390, 8, 4470, 459, 10600, 63, 988, 63, 2063, 995, 822, 8, 75, 430, 507, 263, 6269, 459, 270, 1298, 3488, 75, 61, 275, 469, 507, 260, 198, 7, 1053, 356, 6269, 63, 1053, 12, 507, 260, 198, 7, 4777, 356, 8033, 507, 263, 789, 6722, 871, 26, 507, 258, 198, 4470, 459, 270, 1298, 3488, 75, 61, 275, 488, 507, 263, 986, 421, 198, 1107, 6269, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 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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 ]
ellipsis14/dolfin
test/unit/python/nls/test_PETScSNES_solver.py
2
4907
#!/usr/bin/env py.test """Unit test for the SNES nonlinear solver""" # Copyright (C) 2012 Patrick E. Farrell # # This file is part of DOLFIN. # # DOLFIN is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # DOLFIN 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 DOLFIN. If not, see <http://www.gnu.org/licenses/>. # # First added: 2012-10-17 # Last changed: 2013-11-22 from __future__ import print_function """Solve the Yamabe PDE which arises in the differential geometry of general relativity. http://arxiv.org/abs/1107.0360. The Yamabe equation is highly nonlinear and supports many solutions. However, only one of these is of physical relevance -- the positive solution. This unit test demonstrates the capability of the SNES solver to accept bounds on the resulting solution. The plain Newton method converges to an unphysical negative solution, while the SNES solution with {sign: nonnegative} converges to the physical positive solution. An alternative interface to SNESVI allows the user to set explicitly more complex bounds as GenericVectors or Function. """ from dolfin import * import pytest import os from dolfin_utils.test import * parameter_degree = set_parameters_fixture("form_compiler.quadrature_degree", \ [5]) parameter_backend = set_parameters_fixture("linear_algebra_backend", ["PETSc"]) @fixture def mesh(datadir): return Mesh(os.path.join(datadir, "doughnut.xml.gz")) @fixture def V(mesh): return FunctionSpace(mesh, "CG", 1) @fixture def bcs(V): return [DirichletBC(V, 1.0, "on_boundary")] @fixture def u(V): u = Function(V) u.interpolate(Constant(-1000.0)) return u @fixture def v(V): return TestFunction(V) @fixture def F(u, v, mesh): x = SpatialCoordinate(mesh) r = sqrt(x[0]**2 + x[1]**2) rho = 1.0/r**3 return (8*inner(grad(u), grad(v))*dx + rho * inner(u**5, v)*dx \ + (-1.0/8.0)*inner(u, v)*dx) @fixture def J(V, u, F): du = TrialFunction(V) return derivative(F, u, du) @fixture def lb(V): return Function(interpolate(Constant(0.), V)) @fixture def ub(V): return Function(interpolate(Constant(100.), V)) @fixture def newton_solver_parameters(): return{"nonlinear_solver": "newton", "newton_solver": {"linear_solver": "lu", "maximum_iterations": 100, "report": False}} @fixture def snes_solver_parameters_sign(): return {"nonlinear_solver": "snes", "snes_solver": {"linear_solver": "lu", "maximum_iterations": 100, "sign": "nonnegative", "report": True}} @fixture def snes_solver_parameters_bounds(): return {"nonlinear_solver": "snes", "snes_solver": {"linear_solver": "lu", "maximum_iterations": 100, "sign": "default", "report": True}} @skip_if_not_PETSc def test_snes_solver(F, bcs, u, snes_solver_parameters_sign, parameter_degree,\ parameter_backend): u.interpolate(Constant(-1000.0)) solve(F == 0, u, bcs, solver_parameters=snes_solver_parameters_sign) assert u.vector().min() >= 0 @skip_if_not_PETSc def test_newton_solver(F, u, bcs, newton_solver_parameters, parameter_degree,\ parameter_backend): u.interpolate(Constant(-1000.0)) solve(F == 0, u, bcs, solver_parameters=newton_solver_parameters) assert u.vector().min() < 0 @skip_if_not_PETSc def test_snes_solver_bound_functions(F, u, bcs, J, \ snes_solver_parameters_bounds, lb, ub, parameter_degree, \ parameter_backend): u.interpolate(Constant(-1000.0)) problem = NonlinearVariationalProblem(F, u, bcs, J) solver = NonlinearVariationalSolver(problem) solver.parameters.update(snes_solver_parameters_bounds) solver.solve(lb, ub) assert u.vector().min() >= 0 @skip_if_not_PETSc def test_snes_solver_bound_vectors(F, u, bcs, J, snes_solver_parameters_bounds, lb, ub, parameter_degree, \ parameter_backend): u.interpolate(Constant(-1000.0)) problem = NonlinearVariationalProblem(F, u, bcs, J) solver = NonlinearVariationalSolver(problem) solver.parameters.update(snes_solver_parameters_bounds) solver.solve(lb.vector(), ub.vector()) assert u.vector().min() >= 0
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1813, 1134, 14, 396, 199, 199, 624, 5072, 511, 367, 314, 428, 46, 654, 2222, 6676, 10196, 624, 199, 199, 3, 1898, 334, 35, 9, 6029, 510, 292, 27091, 662, 14, 481, 285, 264, 914, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 28701, 17383, 14, 199, 3, 199, 3, 28701, 17383, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 6401, 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, 28701, 17383, 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, 6401, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 6401, 1696, 1684, 844, 199, 3, 3180, 543, 28701, 17383, 14, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 3, 7758, 3483, 26, 221, 6029, 13, 709, 13, 1196, 199, 3, 15237, 2896, 26, 6171, 13, 845, 13, 1081, 199, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 624, 51, 3344, 314, 1488, 455, 7570, 510, 1093, 1314, 14554, 874, 315, 314, 31605, 3400, 402, 199, 10706, 13773, 4191, 14, 1455, 921, 27290, 14, 1308, 15, 2101, 15, 6019, 23, 14, 16, 11197, 14, 199, 199, 1918, 1488, 455, 7570, 18649, 365, 4721, 590, 2222, 6676, 436, 5171, 5002, 199, 27313, 14, 9738, 12, 1454, 1373, 402, 3520, 365, 402, 14095, 295, 28791, 1553, 314, 199, 8965, 8744, 14, 199, 199, 2765, 4137, 511, 23789, 31216, 314, 19854, 402, 314, 428, 46, 654, 10196, 370, 199, 5694, 10461, 641, 314, 9183, 8744, 14, 710, 8971, 7053, 1860, 1083, 199, 6435, 3389, 370, 376, 625, 15020, 6946, 8744, 12, 1830, 314, 428, 46, 654, 8744, 199, 1045, 469, 1037, 26, 2222, 7371, 93, 3818, 3389, 370, 314, 14095, 7317, 8744, 14, 199, 199, 2493, 13943, 3217, 370, 428, 46, 654, 17655, 6127, 314, 922, 370, 663, 7662, 199, 6878, 6114, 10461, 465, 8307, 31465, 503, 6801, 14, 199, 624, 199, 199, 504, 886, 276, 262, 492, 627, 199, 646, 4613, 199, 646, 747, 199, 199, 504, 886, 276, 262, 63, 1208, 14, 396, 492, 627, 199, 199, 5329, 63, 10956, 275, 663, 63, 3214, 63, 5997, 480, 964, 63, 5772, 14, 14567, 30985, 63, 10956, 401, 971, 5101, 359, 21, 566, 199, 5329, 63, 4620, 275, 663, 63, 3214, 63, 5997, 480, 6676, 63, 279, 19355, 63, 4620, 401, 2097, 48, 775, 7181, 3135, 199, 199, 32, 5997, 199, 318, 9364, 8, 18259, 304, 272, 372, 603, 10613, 8, 736, 14, 515, 14, 904, 8, 18259, 12, 298, 68, 4937, 78, 337, 14, 1652, 14, 6838, 2237, 199, 199, 32, 5997, 199, 318, 812, 8, 6480, 304, 272, 372, 6801, 7643, 8, 6480, 12, 298, 4064, 401, 413, 9, 199, 199, 32, 5997, 199, 318, 330, 1259, 8, 54, 304, 272, 372, 359, 1341, 19683, 6265, 8, 54, 12, 413, 14, 16, 12, 298, 265, 63, 9891, 11323, 199, 199, 32, 5997, 199, 318, 399, 8, 54, 304, 272, 399, 275, 6801, 8, 54, 9, 272, 399, 14, 21294, 8, 9737, 2801, 5279, 14, 16, 430, 272, 372, 399, 199, 199, 32, 5997, 199, 318, 373, 8, 54, 304, 272, 372, 1379, 3481, 8, 54, 9, 199, 199, 32, 5997, 199, 318, 481, 8, 85, 12, 373, 12, 9364, 304, 272, 671, 275, 13423, 18017, 8, 6480, 9, 272, 519, 275, 7452, 8, 88, 59, 16, 24186, 18, 435, 671, 59, 17, 24186, 18, 9, 272, 17908, 275, 413, 14, 16, 15, 82, 538, 19, 339, 372, 334, 24, 10, 5216, 8, 6017, 8, 85, 395, 7659, 8, 86, 19198, 8373, 435, 17908, 627, 6506, 8, 85, 538, 21, 12, 373, 3342, 8373, 971, 288, 435, 5868, 17, 14, 16, 15, 24, 14, 16, 3342, 5216, 8, 85, 12, 373, 3342, 8373, 9, 199, 199, 32, 5997, 199, 318, 1603, 8, 54, 12, 399, 12, 481, 304, 272, 15776, 275, 377, 1383, 3481, 8, 54, 9, 272, 372, 18883, 8, 38, 12, 399, 12, 15776, 9, 199, 199, 32, 5997, 199, 318, 11104, 8, 54, 304, 272, 372, 6801, 8, 21294, 8, 9737, 8, 16, 15631, 812, 430, 199, 199, 32, 5997, 199, 318, 23730, 8, 54, 304, 272, 372, 6801, 8, 21294, 8, 9737, 8, 1960, 15631, 812, 430, 199, 199, 32, 5997, 199, 318, 892, 1860, 63, 11263, 63, 3214, 837, 272, 372, 6641, 2865, 6676, 63, 11263, 582, 298, 1222, 1860, 401, 288, 298, 1222, 1860, 63, 11263, 582, 2420, 6676, 63, 11263, 582, 298, 10836, 401, 288, 298, 11555, 63, 13570, 582, 2948, 12, 288, 298, 3070, 582, 756, 4863, 199, 199, 32, 5997, 199, 318, 6895, 397, 63, 11263, 63, 3214, 63, 1037, 837, 272, 372, 2420, 2865, 6676, 63, 11263, 582, 298, 5167, 397, 401, 288, 298, 5167, 397, 63, 11263, 582, 2420, 6676, 63, 11263, 582, 298, 10836, 401, 288, 298, 11555, 63, 13570, 582, 2948, 12, 288, 298, 1037, 582, 298, 2865, 7371, 401, 288, 298, 3070, 582, 715, 4863, 199, 199, 32, 5997, 199, 318, 6895, 397, 63, 11263, 63, 3214, 63, 9632, 837, 272, 372, 2420, 2865, 6676, 63, 11263, 582, 298, 5167, 397, 401, 288, 298, 5167, 397, 63, 11263, 582, 2420, 6676, 63, 11263, 582, 298, 10836, 401, 288, 298, 11555, 63, 13570, 582, 2948, 12, 288, 298, 1037, 582, 298, 885, 401, 288, 298, 3070, 582, 715, 4863, 199, 199, 32, 2759, 63, 692, 63, 1397, 63, 48, 775, 7181, 199, 318, 511, 63, 5167, 397, 63, 11263, 8, 38, 12, 330, 1259, 12, 399, 12, 6895, 397, 63, 11263, 63, 3214, 63, 1037, 12, 2725, 63, 10956, 4202, 2151, 2725, 63, 4620, 304, 272, 399, 14, 21294, 8, 9737, 2801, 5279, 14, 16, 430, 272, 14241, 8, 38, 508, 378 ]
[ 2647, 15, 1393, 15, 1813, 1134, 14, 396, 199, 199, 624, 5072, 511, 367, 314, 428, 46, 654, 2222, 6676, 10196, 624, 199, 199, 3, 1898, 334, 35, 9, 6029, 510, 292, 27091, 662, 14, 481, 285, 264, 914, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 28701, 17383, 14, 199, 3, 199, 3, 28701, 17383, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 6401, 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, 28701, 17383, 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, 6401, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 6401, 1696, 1684, 844, 199, 3, 3180, 543, 28701, 17383, 14, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 3, 7758, 3483, 26, 221, 6029, 13, 709, 13, 1196, 199, 3, 15237, 2896, 26, 6171, 13, 845, 13, 1081, 199, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 624, 51, 3344, 314, 1488, 455, 7570, 510, 1093, 1314, 14554, 874, 315, 314, 31605, 3400, 402, 199, 10706, 13773, 4191, 14, 1455, 921, 27290, 14, 1308, 15, 2101, 15, 6019, 23, 14, 16, 11197, 14, 199, 199, 1918, 1488, 455, 7570, 18649, 365, 4721, 590, 2222, 6676, 436, 5171, 5002, 199, 27313, 14, 9738, 12, 1454, 1373, 402, 3520, 365, 402, 14095, 295, 28791, 1553, 314, 199, 8965, 8744, 14, 199, 199, 2765, 4137, 511, 23789, 31216, 314, 19854, 402, 314, 428, 46, 654, 10196, 370, 199, 5694, 10461, 641, 314, 9183, 8744, 14, 710, 8971, 7053, 1860, 1083, 199, 6435, 3389, 370, 376, 625, 15020, 6946, 8744, 12, 1830, 314, 428, 46, 654, 8744, 199, 1045, 469, 1037, 26, 2222, 7371, 93, 3818, 3389, 370, 314, 14095, 7317, 8744, 14, 199, 199, 2493, 13943, 3217, 370, 428, 46, 654, 17655, 6127, 314, 922, 370, 663, 7662, 199, 6878, 6114, 10461, 465, 8307, 31465, 503, 6801, 14, 199, 624, 199, 199, 504, 886, 276, 262, 492, 627, 199, 646, 4613, 199, 646, 747, 199, 199, 504, 886, 276, 262, 63, 1208, 14, 396, 492, 627, 199, 199, 5329, 63, 10956, 275, 663, 63, 3214, 63, 5997, 480, 964, 63, 5772, 14, 14567, 30985, 63, 10956, 401, 971, 5101, 359, 21, 566, 199, 5329, 63, 4620, 275, 663, 63, 3214, 63, 5997, 480, 6676, 63, 279, 19355, 63, 4620, 401, 2097, 48, 775, 7181, 3135, 199, 199, 32, 5997, 199, 318, 9364, 8, 18259, 304, 272, 372, 603, 10613, 8, 736, 14, 515, 14, 904, 8, 18259, 12, 298, 68, 4937, 78, 337, 14, 1652, 14, 6838, 2237, 199, 199, 32, 5997, 199, 318, 812, 8, 6480, 304, 272, 372, 6801, 7643, 8, 6480, 12, 298, 4064, 401, 413, 9, 199, 199, 32, 5997, 199, 318, 330, 1259, 8, 54, 304, 272, 372, 359, 1341, 19683, 6265, 8, 54, 12, 413, 14, 16, 12, 298, 265, 63, 9891, 11323, 199, 199, 32, 5997, 199, 318, 399, 8, 54, 304, 272, 399, 275, 6801, 8, 54, 9, 272, 399, 14, 21294, 8, 9737, 2801, 5279, 14, 16, 430, 272, 372, 399, 199, 199, 32, 5997, 199, 318, 373, 8, 54, 304, 272, 372, 1379, 3481, 8, 54, 9, 199, 199, 32, 5997, 199, 318, 481, 8, 85, 12, 373, 12, 9364, 304, 272, 671, 275, 13423, 18017, 8, 6480, 9, 272, 519, 275, 7452, 8, 88, 59, 16, 24186, 18, 435, 671, 59, 17, 24186, 18, 9, 272, 17908, 275, 413, 14, 16, 15, 82, 538, 19, 339, 372, 334, 24, 10, 5216, 8, 6017, 8, 85, 395, 7659, 8, 86, 19198, 8373, 435, 17908, 627, 6506, 8, 85, 538, 21, 12, 373, 3342, 8373, 971, 288, 435, 5868, 17, 14, 16, 15, 24, 14, 16, 3342, 5216, 8, 85, 12, 373, 3342, 8373, 9, 199, 199, 32, 5997, 199, 318, 1603, 8, 54, 12, 399, 12, 481, 304, 272, 15776, 275, 377, 1383, 3481, 8, 54, 9, 272, 372, 18883, 8, 38, 12, 399, 12, 15776, 9, 199, 199, 32, 5997, 199, 318, 11104, 8, 54, 304, 272, 372, 6801, 8, 21294, 8, 9737, 8, 16, 15631, 812, 430, 199, 199, 32, 5997, 199, 318, 23730, 8, 54, 304, 272, 372, 6801, 8, 21294, 8, 9737, 8, 1960, 15631, 812, 430, 199, 199, 32, 5997, 199, 318, 892, 1860, 63, 11263, 63, 3214, 837, 272, 372, 6641, 2865, 6676, 63, 11263, 582, 298, 1222, 1860, 401, 288, 298, 1222, 1860, 63, 11263, 582, 2420, 6676, 63, 11263, 582, 298, 10836, 401, 288, 298, 11555, 63, 13570, 582, 2948, 12, 288, 298, 3070, 582, 756, 4863, 199, 199, 32, 5997, 199, 318, 6895, 397, 63, 11263, 63, 3214, 63, 1037, 837, 272, 372, 2420, 2865, 6676, 63, 11263, 582, 298, 5167, 397, 401, 288, 298, 5167, 397, 63, 11263, 582, 2420, 6676, 63, 11263, 582, 298, 10836, 401, 288, 298, 11555, 63, 13570, 582, 2948, 12, 288, 298, 1037, 582, 298, 2865, 7371, 401, 288, 298, 3070, 582, 715, 4863, 199, 199, 32, 5997, 199, 318, 6895, 397, 63, 11263, 63, 3214, 63, 9632, 837, 272, 372, 2420, 2865, 6676, 63, 11263, 582, 298, 5167, 397, 401, 288, 298, 5167, 397, 63, 11263, 582, 2420, 6676, 63, 11263, 582, 298, 10836, 401, 288, 298, 11555, 63, 13570, 582, 2948, 12, 288, 298, 1037, 582, 298, 885, 401, 288, 298, 3070, 582, 715, 4863, 199, 199, 32, 2759, 63, 692, 63, 1397, 63, 48, 775, 7181, 199, 318, 511, 63, 5167, 397, 63, 11263, 8, 38, 12, 330, 1259, 12, 399, 12, 6895, 397, 63, 11263, 63, 3214, 63, 1037, 12, 2725, 63, 10956, 4202, 2151, 2725, 63, 4620, 304, 272, 399, 14, 21294, 8, 9737, 2801, 5279, 14, 16, 430, 272, 14241, 8, 38, 508, 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,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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 ]
luogangyi/Ceilometer-oVirt
build/lib/ceilometer/dispatcher/redis_database.py
2
8223
# # Copyright 2013 IBM Corp # # Author: Tong Li <litong01@us.ibm.com> # # 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.utils import timeutils from oslo.config import cfg from ceilometer import dispatcher from ceilometer.openstack.common.gettextutils import _ from ceilometer.openstack.common import log from ceilometer.publisher import utils as publisher_utils from ceilometer import storage from ceilometer.utils import SetJSONEncoder import json import redis LOG = log.getLogger(__name__) STORAGE_OPTS = [ cfg.IntOpt('redis_port', default=6379, help="The port used by redis, default 6379 "), cfg.IntOpt('redis_db', default=0, help="The db used by redis, default 0"), cfg.StrOpt('redis_host', default=None, help='The host of redis database'), cfg.StrOpt('redis_password', default=None, help='The password redis use'), ] cfg.CONF.register_opts(STORAGE_OPTS, group='redis_database') class RedisDispatcher(dispatcher.Base): """Dispatcher class for recording metering data into database. The dispatcher class which records each meter into a database configured in ceilometer configuration file. To enable this dispatcher, the following section needs to be present in ceilometer.conf file dispatchers = database """ def __init__(self, conf): super(RedisDispatcher, self).__init__(conf) self.storage_conn = storage.get_connection_from_config(conf) self.instance_map = {} self.host_map = {} print redis.__file__ #self.redis_conn = redis.Redis(host='192.168.39.16', # port=6379, db=0, password='foobared') self.redis_conn = redis.Redis(host=conf.redis_database.redis_host, port=conf.redis_database.redis_port, db=conf.redis_database.redis_db, password=conf.redis_database.redis_password) def record_metering_data(self, data): # We may have receive only one counter on the wire if not isinstance(data, list): data = [data] for meter in data: LOG.debug(_( 'metering data %(counter_name)s ' 'for %(resource_id)s @ %(timestamp)s: %(counter_volume)s') % ({'counter_name': meter['counter_name'], 'resource_id': meter['resource_id'], 'timestamp': meter.get('timestamp', 'NO TIMESTAMP'), 'counter_volume': meter['counter_volume']})) if publisher_utils.verify_signature( meter, self.conf.publisher.metering_secret): try: # Convert the timestamp to a datetime instance. # Storage engines are responsible for converting # that value to something they can store. if meter.get('timestamp'): ts = timeutils.parse_isotime(meter['timestamp']) #meter['timestamp'] = timeutils.normalize_time(ts) if meter.get('resource_metadata'): resource_metadata = meter['resource_metadata'] if resource_metadata.get('instance_id'): instance_uuid = resource_metadata['instance_id'] meter_name = meter['counter_name'] resource_id = meter['resource_id'] meter_map = self.instance_map.get(instance_uuid) if meter_map is None: meter_map = {} self.instance_map[instance_uuid] = meter_map resource_set = meter_map.get(meter_name) if resource_set is None: resource_set = set() meter_map[meter_name] = resource_set resource_set.add(resource_id) meter_map_json = json.dumps(meter_map, cls=SetJSONEncoder) print meter_map_json self.redis_conn.set("metermeta-"+instance_uuid, meter_map_json) counter_map = {} counter_map['counter_name'] = meter['counter_name'] counter_map['counter_unit'] = meter['counter_unit'] counter_map['counter_type'] = meter['counter_type'] counter_map['counter_volume'] = meter['counter_volume'] counter_map['timestamp'] = meter['timestamp'] counter_map_json = json.dumps(counter_map) print counter_map_json self.redis_conn.set(meter_name+'-'+resource_id, counter_map_json) print "%s instance: %s, meter_name: %s, volume: %s" %\ (meter['timestamp'], resource_metadata['instance_id'], meter['counter_name'], meter['counter_volume']) elif resource_metadata.get('hostname'): hostname = resource_metadata['hostname'] meter_name = meter['counter_name'] resource_id = meter['resource_id'] meter_map = self.host_map.get(hostname) if meter_map is None: meter_map = {} self.host_map[hostname] = meter_map resource_set = meter_map.get(meter_name) if resource_set is None: resource_set = set() meter_map[meter_name] = resource_set resource_set.add(resource_id) meter_map_json = json.dumps(meter_map, cls=SetJSONEncoder) print meter_map_json self.redis_conn.set("metermeta-"+hostname, meter_map_json) counter_map = {} counter_map['counter_name'] = meter['counter_name'] counter_map['counter_unit'] = meter['counter_unit'] counter_map['counter_type'] = meter['counter_type'] counter_map['counter_volume'] = meter['counter_volume'] counter_map['timestamp'] = meter['timestamp'] counter_map_json = json.dumps(counter_map) print counter_map_json self.redis_conn.set(meter_name+'-'+resource_id, counter_map_json) print "%s hostname: %s, meter_name: %s, volume: %s" % \ (meter['timestamp'], resource_metadata['hostname'], meter['counter_name'], meter['counter_volume']) except Exception as err: LOG.exception(_('Failed to record metering data: %s'), err) else: LOG.warning(_( 'message signature invalid, discarding message: %r'), meter) def record_events(self, events): if not isinstance(events, list): events = [events] return self.storage_conn.record_events(events)
apache-2.0
[ 3, 199, 3, 1898, 6171, 26202, 22304, 199, 3, 199, 3, 6529, 26, 377, 951, 24157, 665, 1051, 951, 614, 32, 527, 14, 19870, 14, 957, 30, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 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, 2428, 199, 3, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 1334, 314, 844, 14, 199, 504, 11258, 14, 1208, 492, 23011, 199, 504, 11258, 14, 888, 492, 4810, 199, 199, 504, 10142, 25617, 492, 17475, 199, 504, 10142, 25617, 14, 8512, 14, 2330, 14, 5152, 1208, 492, 485, 199, 504, 10142, 25617, 14, 8512, 14, 2330, 492, 943, 199, 504, 10142, 25617, 14, 12789, 492, 3778, 465, 19704, 63, 1208, 199, 504, 10142, 25617, 492, 4887, 199, 504, 10142, 25617, 14, 1208, 492, 2494, 23069, 199, 199, 646, 2022, 199, 646, 16967, 199, 199, 4947, 275, 943, 14, 5572, 3460, 354, 3368, 199, 199, 17467, 63, 25636, 275, 359, 272, 4810, 14, 3241, 9985, 360, 15369, 63, 719, 297, 2049, 849, 29, 22, 12015, 12, 2049, 1720, 628, 1918, 1844, 1202, 701, 16967, 12, 849, 1227, 12015, 26261, 272, 4810, 14, 3241, 9985, 360, 15369, 63, 697, 297, 2049, 849, 29, 16, 12, 2049, 1720, 628, 1918, 1592, 1202, 701, 16967, 12, 849, 378, 1288, 272, 4810, 14, 19340, 360, 15369, 63, 1102, 297, 2049, 849, 29, 403, 12, 2049, 1720, 534, 1918, 1591, 402, 16967, 3050, 659, 272, 4810, 14, 19340, 360, 15369, 63, 2060, 297, 2049, 849, 29, 403, 12, 2049, 1720, 534, 1918, 2505, 16967, 675, 659, 199, 61, 199, 199, 4128, 14, 3103, 14, 2683, 63, 3291, 8, 17467, 63, 25636, 12, 1572, 534, 15369, 63, 4659, 358, 199, 199, 533, 25496, 15461, 8, 14913, 14, 1563, 304, 272, 408, 15461, 1021, 367, 20952, 21247, 316, 666, 1901, 3050, 14, 339, 710, 17475, 1021, 1314, 5767, 1924, 21247, 1901, 282, 3050, 7526, 272, 315, 10142, 25617, 2897, 570, 14, 339, 4005, 4756, 642, 17475, 12, 314, 2569, 3420, 4839, 370, 506, 3451, 315, 272, 10142, 25617, 14, 2190, 570, 339, 7634, 1192, 275, 3050, 272, 408, 272, 347, 636, 826, 721, 277, 12, 3743, 304, 267, 1613, 8, 29605, 15461, 12, 291, 2843, 826, 721, 2190, 9, 267, 291, 14, 3494, 63, 1631, 275, 4887, 14, 362, 63, 2105, 63, 504, 63, 888, 8, 2190, 9, 267, 291, 14, 842, 63, 1130, 275, 1052, 267, 291, 14, 1102, 63, 1130, 275, 1052, 267, 870, 16967, 855, 493, 363, 267, 327, 277, 14, 15369, 63, 1631, 275, 16967, 14, 29605, 8, 1102, 534, 5756, 14, 6568, 14, 1355, 14, 975, 297, 267, 327, 19242, 1844, 29, 22, 12015, 12, 1592, 29, 16, 12, 2505, 534, 1421, 2470, 581, 358, 267, 291, 14, 15369, 63, 1631, 275, 16967, 14, 29605, 8, 1102, 29, 2190, 14, 15369, 63, 4659, 14, 15369, 63, 1102, 12, 4228, 1844, 29, 2190, 14, 15369, 63, 4659, 14, 15369, 63, 719, 12, 4228, 1592, 29, 2190, 14, 15369, 63, 4659, 14, 15369, 63, 697, 12, 4228, 2505, 29, 2190, 14, 15369, 63, 4659, 14, 15369, 63, 2060, 9, 339, 347, 2777, 63, 26754, 63, 576, 8, 277, 12, 666, 304, 267, 327, 2136, 1443, 1172, 9128, 1454, 1373, 7055, 641, 314, 11799, 267, 340, 440, 1228, 8, 576, 12, 769, 304, 288, 666, 275, 359, 576, 61, 398, 367, 21247, 315, 666, 26, 288, 5051, 14, 1757, 27594, 355, 283, 26754, 666, 2818, 5337, 63, 354, 9, 83, 283, 355, 283, 509, 2818, 1927, 63, 344, 9, 83, 768, 2818, 3954, 9, 83, 26, 2818, 5337, 63, 2405, 9, 83, 358, 355, 450, 26227, 5337, 63, 354, 356, 21247, 459, 5337, 63, 354, 995, 490, 283, 1927, 63, 344, 356, 21247, 459, 1927, 63, 344, 995, 490, 283, 3954, 356, 21247, 14, 362, 360, 3954, 297, 283, 2826, 32745, 659, 490, 283, 5337, 63, 2405, 356, 21247, 459, 5337, 63, 2405, 12074, 430, 288, 340, 19704, 63, 1208, 14, 4712, 63, 5233, 8, 490, 21247, 12, 490, 291, 14, 2190, 14, 12789, 14, 26754, 63, 4731, 304, 355, 862, 26, 490, 327, 7905, 314, 4913, 370, 282, 2197, 1256, 14, 490, 327, 10533, 28156, 787, 17845, 367, 13806, 490, 327, 626, 574, 370, 6020, 2985, 883, 3877, 14, 490, 340, 21247, 14, 362, 360, 3954, 735, 717, 6714, 275, 23011, 14, 1122, 63, 4595, 521, 8, 10011, 459, 3954, 1105, 717, 327, 10011, 459, 3954, 418, 275, 23011, 14, 7721, 63, 521, 8, 1086, 9, 4951, 340, 21247, 14, 362, 360, 1927, 63, 2343, 735, 717, 2073, 63, 2343, 275, 21247, 459, 1927, 63, 2343, 418, 717, 340, 2073, 63, 2343, 14, 362, 360, 842, 63, 344, 735, 1169, 1256, 63, 2580, 275, 2073, 63, 2343, 459, 842, 63, 344, 418, 1169, 21247, 63, 354, 275, 21247, 459, 5337, 63, 354, 418, 1169, 2073, 63, 344, 275, 21247, 459, 1927, 63, 344, 418, 18008, 21247, 63, 1130, 275, 291, 14, 842, 63, 1130, 14, 362, 8, 842, 63, 2580, 9, 1169, 340, 21247, 63, 1130, 365, 488, 26, 1816, 21247, 63, 1130, 275, 1052, 1816, 291, 14, 842, 63, 1130, 59, 842, 63, 2580, 61, 275, 21247, 63, 1130, 18008, 2073, 63, 409, 275, 21247, 63, 1130, 14, 362, 8, 10011, 63, 354, 9, 1169, 340, 2073, 63, 409, 365, 488, 26, 1816, 2073, 63, 409, 275, 663, 342, 1816, 21247, 63, 1130, 59, 10011, 63, 354, 61, 275, 2073, 63, 409, 1169, 2073, 63, 409, 14, 525, 8, 1927, 63, 344, 9, 18008, 21247, 63, 1130, 63, 1001, 275, 2022, 14, 4180, 8, 10011, 63, 1130, 12, 843, 29, 1084, 23069, 9, 1169 ]
[ 199, 3, 1898, 6171, 26202, 22304, 199, 3, 199, 3, 6529, 26, 377, 951, 24157, 665, 1051, 951, 614, 32, 527, 14, 19870, 14, 957, 30, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 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, 2428, 199, 3, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 1334, 314, 844, 14, 199, 504, 11258, 14, 1208, 492, 23011, 199, 504, 11258, 14, 888, 492, 4810, 199, 199, 504, 10142, 25617, 492, 17475, 199, 504, 10142, 25617, 14, 8512, 14, 2330, 14, 5152, 1208, 492, 485, 199, 504, 10142, 25617, 14, 8512, 14, 2330, 492, 943, 199, 504, 10142, 25617, 14, 12789, 492, 3778, 465, 19704, 63, 1208, 199, 504, 10142, 25617, 492, 4887, 199, 504, 10142, 25617, 14, 1208, 492, 2494, 23069, 199, 199, 646, 2022, 199, 646, 16967, 199, 199, 4947, 275, 943, 14, 5572, 3460, 354, 3368, 199, 199, 17467, 63, 25636, 275, 359, 272, 4810, 14, 3241, 9985, 360, 15369, 63, 719, 297, 2049, 849, 29, 22, 12015, 12, 2049, 1720, 628, 1918, 1844, 1202, 701, 16967, 12, 849, 1227, 12015, 26261, 272, 4810, 14, 3241, 9985, 360, 15369, 63, 697, 297, 2049, 849, 29, 16, 12, 2049, 1720, 628, 1918, 1592, 1202, 701, 16967, 12, 849, 378, 1288, 272, 4810, 14, 19340, 360, 15369, 63, 1102, 297, 2049, 849, 29, 403, 12, 2049, 1720, 534, 1918, 1591, 402, 16967, 3050, 659, 272, 4810, 14, 19340, 360, 15369, 63, 2060, 297, 2049, 849, 29, 403, 12, 2049, 1720, 534, 1918, 2505, 16967, 675, 659, 199, 61, 199, 199, 4128, 14, 3103, 14, 2683, 63, 3291, 8, 17467, 63, 25636, 12, 1572, 534, 15369, 63, 4659, 358, 199, 199, 533, 25496, 15461, 8, 14913, 14, 1563, 304, 272, 408, 15461, 1021, 367, 20952, 21247, 316, 666, 1901, 3050, 14, 339, 710, 17475, 1021, 1314, 5767, 1924, 21247, 1901, 282, 3050, 7526, 272, 315, 10142, 25617, 2897, 570, 14, 339, 4005, 4756, 642, 17475, 12, 314, 2569, 3420, 4839, 370, 506, 3451, 315, 272, 10142, 25617, 14, 2190, 570, 339, 7634, 1192, 275, 3050, 272, 408, 272, 347, 636, 826, 721, 277, 12, 3743, 304, 267, 1613, 8, 29605, 15461, 12, 291, 2843, 826, 721, 2190, 9, 267, 291, 14, 3494, 63, 1631, 275, 4887, 14, 362, 63, 2105, 63, 504, 63, 888, 8, 2190, 9, 267, 291, 14, 842, 63, 1130, 275, 1052, 267, 291, 14, 1102, 63, 1130, 275, 1052, 267, 870, 16967, 855, 493, 363, 267, 327, 277, 14, 15369, 63, 1631, 275, 16967, 14, 29605, 8, 1102, 534, 5756, 14, 6568, 14, 1355, 14, 975, 297, 267, 327, 19242, 1844, 29, 22, 12015, 12, 1592, 29, 16, 12, 2505, 534, 1421, 2470, 581, 358, 267, 291, 14, 15369, 63, 1631, 275, 16967, 14, 29605, 8, 1102, 29, 2190, 14, 15369, 63, 4659, 14, 15369, 63, 1102, 12, 4228, 1844, 29, 2190, 14, 15369, 63, 4659, 14, 15369, 63, 719, 12, 4228, 1592, 29, 2190, 14, 15369, 63, 4659, 14, 15369, 63, 697, 12, 4228, 2505, 29, 2190, 14, 15369, 63, 4659, 14, 15369, 63, 2060, 9, 339, 347, 2777, 63, 26754, 63, 576, 8, 277, 12, 666, 304, 267, 327, 2136, 1443, 1172, 9128, 1454, 1373, 7055, 641, 314, 11799, 267, 340, 440, 1228, 8, 576, 12, 769, 304, 288, 666, 275, 359, 576, 61, 398, 367, 21247, 315, 666, 26, 288, 5051, 14, 1757, 27594, 355, 283, 26754, 666, 2818, 5337, 63, 354, 9, 83, 283, 355, 283, 509, 2818, 1927, 63, 344, 9, 83, 768, 2818, 3954, 9, 83, 26, 2818, 5337, 63, 2405, 9, 83, 358, 355, 450, 26227, 5337, 63, 354, 356, 21247, 459, 5337, 63, 354, 995, 490, 283, 1927, 63, 344, 356, 21247, 459, 1927, 63, 344, 995, 490, 283, 3954, 356, 21247, 14, 362, 360, 3954, 297, 283, 2826, 32745, 659, 490, 283, 5337, 63, 2405, 356, 21247, 459, 5337, 63, 2405, 12074, 430, 288, 340, 19704, 63, 1208, 14, 4712, 63, 5233, 8, 490, 21247, 12, 490, 291, 14, 2190, 14, 12789, 14, 26754, 63, 4731, 304, 355, 862, 26, 490, 327, 7905, 314, 4913, 370, 282, 2197, 1256, 14, 490, 327, 10533, 28156, 787, 17845, 367, 13806, 490, 327, 626, 574, 370, 6020, 2985, 883, 3877, 14, 490, 340, 21247, 14, 362, 360, 3954, 735, 717, 6714, 275, 23011, 14, 1122, 63, 4595, 521, 8, 10011, 459, 3954, 1105, 717, 327, 10011, 459, 3954, 418, 275, 23011, 14, 7721, 63, 521, 8, 1086, 9, 4951, 340, 21247, 14, 362, 360, 1927, 63, 2343, 735, 717, 2073, 63, 2343, 275, 21247, 459, 1927, 63, 2343, 418, 717, 340, 2073, 63, 2343, 14, 362, 360, 842, 63, 344, 735, 1169, 1256, 63, 2580, 275, 2073, 63, 2343, 459, 842, 63, 344, 418, 1169, 21247, 63, 354, 275, 21247, 459, 5337, 63, 354, 418, 1169, 2073, 63, 344, 275, 21247, 459, 1927, 63, 344, 418, 18008, 21247, 63, 1130, 275, 291, 14, 842, 63, 1130, 14, 362, 8, 842, 63, 2580, 9, 1169, 340, 21247, 63, 1130, 365, 488, 26, 1816, 21247, 63, 1130, 275, 1052, 1816, 291, 14, 842, 63, 1130, 59, 842, 63, 2580, 61, 275, 21247, 63, 1130, 18008, 2073, 63, 409, 275, 21247, 63, 1130, 14, 362, 8, 10011, 63, 354, 9, 1169, 340, 2073, 63, 409, 365, 488, 26, 1816, 2073, 63, 409, 275, 663, 342, 1816, 21247, 63, 1130, 59, 10011, 63, 354, 61, 275, 2073, 63, 409, 1169, 2073, 63, 409, 14, 525, 8, 1927, 63, 344, 9, 18008, 21247, 63, 1130, 63, 1001, 275, 2022, 14, 4180, 8, 10011, 63, 1130, 12, 843, 29, 1084, 23069, 9, 1169, 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, 1 ]
amolkahat/pandas
pandas/util/_validators.py
4
13052
""" Module that contains many useful utilities for validating data or function arguments """ import warnings from pandas.core.dtypes.common import is_bool def _check_arg_length(fname, args, max_fname_arg_count, compat_args): """ Checks whether 'args' has length of at most 'compat_args'. Raises a TypeError if that is not the case, similar to in Python when a function is called with too many arguments. """ if max_fname_arg_count < 0: raise ValueError("'max_fname_arg_count' must be non-negative") if len(args) > len(compat_args): max_arg_count = len(compat_args) + max_fname_arg_count actual_arg_count = len(args) + max_fname_arg_count argument = 'argument' if max_arg_count == 1 else 'arguments' raise TypeError( "{fname}() takes at most {max_arg} {argument} " "({given_arg} given)".format( fname=fname, max_arg=max_arg_count, argument=argument, given_arg=actual_arg_count)) def _check_for_default_values(fname, arg_val_dict, compat_args): """ Check that the keys in `arg_val_dict` are mapped to their default values as specified in `compat_args`. Note that this function is to be called only when it has been checked that arg_val_dict.keys() is a subset of compat_args """ for key in arg_val_dict: # try checking equality directly with '=' operator, # as comparison may have been overridden for the left # hand object try: v1 = arg_val_dict[key] v2 = compat_args[key] # check for None-ness otherwise we could end up # comparing a numpy array vs None if (v1 is not None and v2 is None) or \ (v1 is None and v2 is not None): match = False else: match = (v1 == v2) if not is_bool(match): raise ValueError("'match' is not a boolean") # could not compare them directly, so try comparison # using the 'is' operator except ValueError: match = (arg_val_dict[key] is compat_args[key]) if not match: raise ValueError(("the '{arg}' parameter is not " "supported in the pandas " "implementation of {fname}()". format(fname=fname, arg=key))) def validate_args(fname, args, max_fname_arg_count, compat_args): """ Checks whether the length of the `*args` argument passed into a function has at most `len(compat_args)` arguments and whether or not all of these elements in `args` are set to their default values. fname: str The name of the function being passed the `*args` parameter args: tuple The `*args` parameter passed into a function max_fname_arg_count: int The maximum number of arguments that the function `fname` can accept, excluding those in `args`. Used for displaying appropriate error messages. Must be non-negative. compat_args: OrderedDict A ordered dictionary of keys and their associated default values. In order to accommodate buggy behaviour in some versions of `numpy`, where a signature displayed keyword arguments but then passed those arguments **positionally** internally when calling downstream implementations, an ordered dictionary ensures that the original order of the keyword arguments is enforced. Note that if there is only one key, a generic dict can be passed in as well. Raises ------ TypeError if `args` contains more values than there are `compat_args` ValueError if `args` contains values that do not correspond to those of the default values specified in `compat_args` """ _check_arg_length(fname, args, max_fname_arg_count, compat_args) # We do this so that we can provide a more informative # error message about the parameters that we are not # supporting in the pandas implementation of 'fname' kwargs = dict(zip(compat_args, args)) _check_for_default_values(fname, kwargs, compat_args) def _check_for_invalid_keys(fname, kwargs, compat_args): """ Checks whether 'kwargs' contains any keys that are not in 'compat_args' and raises a TypeError if there is one. """ # set(dict) --> set of the dictionary's keys diff = set(kwargs) - set(compat_args) if diff: bad_arg = list(diff)[0] raise TypeError(("{fname}() got an unexpected " "keyword argument '{arg}'". format(fname=fname, arg=bad_arg))) def validate_kwargs(fname, kwargs, compat_args): """ Checks whether parameters passed to the **kwargs argument in a function `fname` are valid parameters as specified in `*compat_args` and whether or not they are set to their default values. Parameters ---------- fname: str The name of the function being passed the `**kwargs` parameter kwargs: dict The `**kwargs` parameter passed into `fname` compat_args: dict A dictionary of keys that `kwargs` is allowed to have and their associated default values Raises ------ TypeError if `kwargs` contains keys not in `compat_args` ValueError if `kwargs` contains keys in `compat_args` that do not map to the default values specified in `compat_args` """ kwds = kwargs.copy() _check_for_invalid_keys(fname, kwargs, compat_args) _check_for_default_values(fname, kwds, compat_args) def validate_args_and_kwargs(fname, args, kwargs, max_fname_arg_count, compat_args): """ Checks whether parameters passed to the *args and **kwargs argument in a function `fname` are valid parameters as specified in `*compat_args` and whether or not they are set to their default values. Parameters ---------- fname: str The name of the function being passed the `**kwargs` parameter args: tuple The `*args` parameter passed into a function kwargs: dict The `**kwargs` parameter passed into `fname` max_fname_arg_count: int The minimum number of arguments that the function `fname` requires, excluding those in `args`. Used for displaying appropriate error messages. Must be non-negative. compat_args: OrderedDict A ordered dictionary of keys that `kwargs` is allowed to have and their associated default values. Note that if there is only one key, a generic dict can be passed in as well. Raises ------ TypeError if `args` contains more values than there are `compat_args` OR `kwargs` contains keys not in `compat_args` ValueError if `args` contains values not at the default value (`None`) `kwargs` contains keys in `compat_args` that do not map to the default value as specified in `compat_args` See Also -------- validate_args : purely args validation validate_kwargs : purely kwargs validation """ # Check that the total number of arguments passed in (i.e. # args and kwargs) does not exceed the length of compat_args _check_arg_length(fname, args + tuple(kwargs.values()), max_fname_arg_count, compat_args) # Check there is no overlap with the positional and keyword # arguments, similar to what is done in actual Python functions args_dict = dict(zip(compat_args, args)) for key in args_dict: if key in kwargs: raise TypeError("{fname}() got multiple values for keyword " "argument '{arg}'".format(fname=fname, arg=key)) kwargs.update(args_dict) validate_kwargs(fname, kwargs, compat_args) def validate_bool_kwarg(value, arg_name): """ Ensures that argument passed in arg_name is of type bool. """ if not (is_bool(value) or value is None): raise ValueError('For argument "{arg}" expected type bool, received ' 'type {typ}.'.format(arg=arg_name, typ=type(value).__name__)) return value def validate_axis_style_args(data, args, kwargs, arg_name, method_name): """Argument handler for mixed index, columns / axis functions In an attempt to handle both `.method(index, columns)`, and `.method(arg, axis=.)`, we have to do some bad things to argument parsing. This translates all arguments to `{index=., columns=.}` style. Parameters ---------- data : DataFrame or Panel arg : tuple All positional arguments from the user kwargs : dict All keyword arguments from the user arg_name, method_name : str Used for better error messages Returns ------- kwargs : dict A dictionary of keyword arguments. Doesn't modify ``kwargs`` inplace, so update them with the return value here. Examples -------- >>> df._validate_axis_style_args((str.upper,), {'columns': id}, ... 'mapper', 'rename') {'columns': <function id>, 'index': <method 'upper' of 'str' objects>} This emits a warning >>> df._validate_axis_style_args((str.upper, id), {}, ... 'mapper', 'rename') {'columns': <function id>, 'index': <method 'upper' of 'str' objects>} """ # TODO(PY3): Change to keyword-only args and remove all this out = {} # Goal: fill 'out' with index/columns-style arguments # like out = {'index': foo, 'columns': bar} # Start by validating for consistency if 'axis' in kwargs and any(x in kwargs for x in data._AXIS_NUMBERS): msg = "Cannot specify both 'axis' and any of 'index' or 'columns'." raise TypeError(msg) # First fill with explicit values provided by the user... if arg_name in kwargs: if args: msg = ("{} got multiple values for argument " "'{}'".format(method_name, arg_name)) raise TypeError(msg) axis = data._get_axis_name(kwargs.get('axis', 0)) out[axis] = kwargs[arg_name] # More user-provided arguments, now from kwargs for k, v in kwargs.items(): try: ax = data._get_axis_name(k) except ValueError: pass else: out[ax] = v # All user-provided kwargs have been handled now. # Now we supplement with positional arguments, emitting warnings # when there's ambiguity and raising when there's conflicts if len(args) == 0: pass # It's up to the function to decide if this is valid elif len(args) == 1: axis = data._get_axis_name(kwargs.get('axis', 0)) out[axis] = args[0] elif len(args) == 2: if 'axis' in kwargs: # Unambiguously wrong msg = ("Cannot specify both 'axis' and any of 'index' " "or 'columns'") raise TypeError(msg) msg = ("Interpreting call\n\t'.{method_name}(a, b)' as " "\n\t'.{method_name}(index=a, columns=b)'.\nUse named " "arguments to remove any ambiguity. In the future, using " "positional arguments for 'index' or 'columns' will raise " " a 'TypeError'.") warnings.warn(msg.format(method_name=method_name,), FutureWarning, stacklevel=4) out[data._AXIS_NAMES[0]] = args[0] out[data._AXIS_NAMES[1]] = args[1] else: msg = "Cannot specify all of '{}', 'index', 'columns'." raise TypeError(msg.format(arg_name)) return out def validate_fillna_kwargs(value, method, validate_scalar_dict_value=True): """Validate the keyword arguments to 'fillna'. This checks that exactly one of 'value' and 'method' is specified. If 'method' is specified, this validates that it's a valid method. Parameters ---------- value, method : object The 'value' and 'method' keyword arguments for 'fillna'. validate_scalar_dict_value : bool, default True Whether to validate that 'value' is a scalar or dict. Specifically, validate that it is not a list or tuple. Returns ------- value, method : object """ from pandas.core.missing import clean_fill_method if value is None and method is None: raise ValueError("Must specify a fill 'value' or 'method'.") elif value is None and method is not None: method = clean_fill_method(method) elif value is not None and method is None: if validate_scalar_dict_value and isinstance(value, (list, tuple)): raise TypeError('"value" parameter must be a scalar or dict, but ' 'you passed a "{0}"'.format(type(value).__name__)) elif value is not None and method is not None: raise ValueError("Cannot specify both 'value' and 'method'.") return value, method
bsd-3-clause
[ 624, 199, 2377, 626, 3509, 5002, 2997, 15841, 199, 509, 1686, 1958, 666, 503, 805, 2368, 199, 624, 199, 646, 3598, 199, 199, 504, 10634, 14, 1018, 14, 5717, 14, 2330, 492, 365, 63, 2245, 421, 199, 318, 485, 1074, 63, 1273, 63, 1267, 8, 5252, 12, 1249, 12, 1390, 63, 5252, 63, 1273, 63, 835, 12, 8434, 63, 589, 304, 272, 408, 272, 13813, 3775, 283, 589, 7, 965, 2582, 402, 737, 4750, 283, 5819, 63, 589, 1370, 6218, 272, 282, 3146, 340, 626, 365, 440, 314, 1930, 12, 8545, 370, 315, 2018, 1380, 282, 272, 805, 365, 2797, 543, 4634, 5002, 2368, 14, 339, 408, 272, 340, 1390, 63, 5252, 63, 1273, 63, 835, 665, 378, 26, 267, 746, 1722, 15587, 988, 63, 5252, 63, 1273, 63, 835, 7, 1471, 506, 2222, 13, 7371, 531, 339, 340, 822, 8, 589, 9, 690, 822, 8, 5819, 63, 589, 304, 267, 1390, 63, 1273, 63, 835, 275, 822, 8, 5819, 63, 589, 9, 435, 1390, 63, 5252, 63, 1273, 63, 835, 267, 3503, 63, 1273, 63, 835, 275, 822, 8, 589, 9, 435, 1390, 63, 5252, 63, 1273, 63, 835, 267, 1423, 275, 283, 2094, 7, 340, 1390, 63, 1273, 63, 835, 508, 413, 587, 283, 4958, 7, 398, 746, 3146, 8, 288, 5310, 5252, 93, 342, 6181, 737, 4750, 469, 988, 63, 1273, 93, 469, 2094, 93, 298, 288, 298, 2561, 11809, 63, 1273, 93, 1627, 30351, 908, 8, 355, 6748, 29, 5252, 12, 1390, 63, 1273, 29, 988, 63, 1273, 63, 835, 12, 355, 1423, 29, 2094, 12, 1627, 63, 1273, 29, 6514, 63, 1273, 63, 835, 430, 421, 199, 318, 485, 1074, 63, 509, 63, 885, 63, 1459, 8, 5252, 12, 1680, 63, 637, 63, 807, 12, 8434, 63, 589, 304, 272, 408, 272, 2670, 626, 314, 2883, 315, 658, 1273, 63, 637, 63, 807, 64, 787, 9994, 370, 3932, 272, 849, 1338, 465, 2013, 315, 658, 5819, 63, 589, 2313, 339, 3390, 626, 642, 805, 365, 370, 506, 2797, 1454, 1380, 652, 965, 2757, 272, 7923, 626, 1680, 63, 637, 63, 807, 14, 1612, 342, 365, 282, 10026, 402, 8434, 63, 589, 339, 408, 272, 367, 790, 315, 1680, 63, 637, 63, 807, 26, 267, 327, 862, 7907, 16612, 5370, 543, 14051, 4182, 12, 267, 327, 465, 9132, 1443, 1172, 2757, 10087, 367, 314, 3602, 267, 327, 4926, 909, 267, 862, 26, 288, 373, 17, 275, 1680, 63, 637, 63, 807, 59, 498, 61, 288, 373, 18, 275, 8434, 63, 589, 59, 498, 61, 953, 327, 1104, 367, 488, 13, 4171, 4257, 781, 4293, 1284, 1536, 288, 327, 20234, 282, 2680, 1625, 8118, 488, 288, 340, 334, 86, 17, 365, 440, 488, 436, 373, 18, 365, 488, 9, 503, 971, 2049, 334, 86, 17, 365, 488, 436, 373, 18, 365, 440, 488, 304, 355, 1336, 275, 756, 288, 587, 26, 355, 1336, 275, 334, 86, 17, 508, 373, 18, 9, 953, 340, 440, 365, 63, 2245, 8, 1431, 304, 355, 746, 1722, 15587, 1431, 7, 365, 440, 282, 5046, 531, 398, 327, 4293, 440, 6540, 3062, 5370, 12, 880, 862, 9132, 267, 327, 1808, 314, 283, 374, 7, 4182, 267, 871, 1722, 26, 288, 1336, 275, 334, 1273, 63, 637, 63, 807, 59, 498, 61, 365, 8434, 63, 589, 59, 498, 566, 398, 340, 440, 1336, 26, 288, 746, 1722, 9313, 1589, 5041, 1273, 6834, 2725, 365, 440, 298, 2892, 298, 4946, 315, 314, 10634, 298, 2892, 298, 12236, 402, 469, 5252, 93, 342, 1674, 2892, 1475, 8, 5252, 29, 5252, 12, 1680, 29, 498, 1724, 421, 199, 318, 4107, 63, 589, 8, 5252, 12, 1249, 12, 1390, 63, 5252, 63, 1273, 63, 835, 12, 8434, 63, 589, 304, 272, 408, 272, 13813, 3775, 314, 2582, 402, 314, 658, 10, 589, 64, 1423, 3032, 1901, 282, 805, 272, 965, 737, 4750, 658, 552, 8, 5819, 63, 589, 12544, 2368, 436, 3775, 503, 440, 1006, 402, 3520, 272, 4008, 315, 658, 589, 64, 787, 663, 370, 3932, 849, 1338, 14, 339, 6748, 26, 620, 267, 710, 536, 402, 314, 805, 3769, 3032, 314, 658, 10, 589, 64, 2725, 339, 1249, 26, 2008, 267, 710, 658, 10, 589, 64, 2725, 3032, 1901, 282, 805, 339, 1390, 63, 5252, 63, 1273, 63, 835, 26, 1109, 267, 710, 5696, 1329, 402, 2368, 626, 314, 805, 658, 5252, 64, 267, 883, 4729, 12, 28529, 5204, 315, 658, 589, 2313, 8051, 367, 20589, 267, 5827, 1125, 3788, 14, 9498, 506, 2222, 13, 7371, 14, 339, 8434, 63, 589, 26, 8773, 267, 437, 7741, 2600, 402, 2883, 436, 3932, 4568, 849, 1338, 14, 267, 1010, 1865, 370, 1066, 1404, 364, 323, 1032, 26435, 13942, 315, 2005, 5459, 402, 658, 4714, 3559, 267, 2382, 282, 4955, 9080, 4252, 2368, 1325, 2066, 3032, 5204, 267, 2368, 1011, 3124, 1183, 538, 14448, 1380, 6358, 3224, 1745, 267, 12591, 12, 376, 7741, 2600, 15620, 626, 314, 3379, 267, 1865, 402, 314, 4252, 2368, 365, 30163, 14, 3390, 626, 340, 2337, 365, 267, 1454, 1373, 790, 12, 282, 7809, 1211, 883, 506, 3032, 315, 465, 5521, 14, 339, 6218, 272, 21397, 272, 3146, 340, 658, 589, 64, 3509, 1655, 1338, 2419, 2337, 787, 658, 5819, 63, 589, 64, 272, 1722, 340, 658, 589, 64, 3509, 1338, 626, 886, 440, 17118, 370, 5204, 272, 402, 314, 849, 1338, 2013, 315, 658, 5819, 63, 589, 64, 339, 408, 272, 485, 1074, 63, 1273, 63, 1267, 8, 5252, 12, 1249, 12, 1390, 63, 5252, 63, 1273, 63, 835, 12, 8434, 63, 589, 9, 339, 327, 2136, 886, 642, 880, 626, 781, 883, 5647, 282, 1655, 315, 20889, 272, 327, 1125, 1245, 3595, 314, 2633, 626, 781, 787, 440, 272, 327, 21038, 315, 314, 10634, 4514, 402, 283, 5252, 7, 272, 2074, 275, 1211, 8, 3065, 8, 5819, 63, 589, 12, 1249, 430, 272, 485, 1074, 63, 509, 63, 885, 63, 1459, 8, 5252, 12, 2074, 12, 8434, 63, 589, 9, 421, 199, 318, 485, 1074, 63, 509, 63, 3197, 63, 1612, 8, 5252, 12, 2074, 12, 8434, 63, 589, 304, 272, 408, 272, 13813, 3775, 283, 958, 7, 3509, 1263, 2883, 626, 787, 440, 272, 315, 283, 5819, 63, 589, 7, 436, 6534, 282, 3146 ]
[ 199, 2377, 626, 3509, 5002, 2997, 15841, 199, 509, 1686, 1958, 666, 503, 805, 2368, 199, 624, 199, 646, 3598, 199, 199, 504, 10634, 14, 1018, 14, 5717, 14, 2330, 492, 365, 63, 2245, 421, 199, 318, 485, 1074, 63, 1273, 63, 1267, 8, 5252, 12, 1249, 12, 1390, 63, 5252, 63, 1273, 63, 835, 12, 8434, 63, 589, 304, 272, 408, 272, 13813, 3775, 283, 589, 7, 965, 2582, 402, 737, 4750, 283, 5819, 63, 589, 1370, 6218, 272, 282, 3146, 340, 626, 365, 440, 314, 1930, 12, 8545, 370, 315, 2018, 1380, 282, 272, 805, 365, 2797, 543, 4634, 5002, 2368, 14, 339, 408, 272, 340, 1390, 63, 5252, 63, 1273, 63, 835, 665, 378, 26, 267, 746, 1722, 15587, 988, 63, 5252, 63, 1273, 63, 835, 7, 1471, 506, 2222, 13, 7371, 531, 339, 340, 822, 8, 589, 9, 690, 822, 8, 5819, 63, 589, 304, 267, 1390, 63, 1273, 63, 835, 275, 822, 8, 5819, 63, 589, 9, 435, 1390, 63, 5252, 63, 1273, 63, 835, 267, 3503, 63, 1273, 63, 835, 275, 822, 8, 589, 9, 435, 1390, 63, 5252, 63, 1273, 63, 835, 267, 1423, 275, 283, 2094, 7, 340, 1390, 63, 1273, 63, 835, 508, 413, 587, 283, 4958, 7, 398, 746, 3146, 8, 288, 5310, 5252, 93, 342, 6181, 737, 4750, 469, 988, 63, 1273, 93, 469, 2094, 93, 298, 288, 298, 2561, 11809, 63, 1273, 93, 1627, 30351, 908, 8, 355, 6748, 29, 5252, 12, 1390, 63, 1273, 29, 988, 63, 1273, 63, 835, 12, 355, 1423, 29, 2094, 12, 1627, 63, 1273, 29, 6514, 63, 1273, 63, 835, 430, 421, 199, 318, 485, 1074, 63, 509, 63, 885, 63, 1459, 8, 5252, 12, 1680, 63, 637, 63, 807, 12, 8434, 63, 589, 304, 272, 408, 272, 2670, 626, 314, 2883, 315, 658, 1273, 63, 637, 63, 807, 64, 787, 9994, 370, 3932, 272, 849, 1338, 465, 2013, 315, 658, 5819, 63, 589, 2313, 339, 3390, 626, 642, 805, 365, 370, 506, 2797, 1454, 1380, 652, 965, 2757, 272, 7923, 626, 1680, 63, 637, 63, 807, 14, 1612, 342, 365, 282, 10026, 402, 8434, 63, 589, 339, 408, 272, 367, 790, 315, 1680, 63, 637, 63, 807, 26, 267, 327, 862, 7907, 16612, 5370, 543, 14051, 4182, 12, 267, 327, 465, 9132, 1443, 1172, 2757, 10087, 367, 314, 3602, 267, 327, 4926, 909, 267, 862, 26, 288, 373, 17, 275, 1680, 63, 637, 63, 807, 59, 498, 61, 288, 373, 18, 275, 8434, 63, 589, 59, 498, 61, 953, 327, 1104, 367, 488, 13, 4171, 4257, 781, 4293, 1284, 1536, 288, 327, 20234, 282, 2680, 1625, 8118, 488, 288, 340, 334, 86, 17, 365, 440, 488, 436, 373, 18, 365, 488, 9, 503, 971, 2049, 334, 86, 17, 365, 488, 436, 373, 18, 365, 440, 488, 304, 355, 1336, 275, 756, 288, 587, 26, 355, 1336, 275, 334, 86, 17, 508, 373, 18, 9, 953, 340, 440, 365, 63, 2245, 8, 1431, 304, 355, 746, 1722, 15587, 1431, 7, 365, 440, 282, 5046, 531, 398, 327, 4293, 440, 6540, 3062, 5370, 12, 880, 862, 9132, 267, 327, 1808, 314, 283, 374, 7, 4182, 267, 871, 1722, 26, 288, 1336, 275, 334, 1273, 63, 637, 63, 807, 59, 498, 61, 365, 8434, 63, 589, 59, 498, 566, 398, 340, 440, 1336, 26, 288, 746, 1722, 9313, 1589, 5041, 1273, 6834, 2725, 365, 440, 298, 2892, 298, 4946, 315, 314, 10634, 298, 2892, 298, 12236, 402, 469, 5252, 93, 342, 1674, 2892, 1475, 8, 5252, 29, 5252, 12, 1680, 29, 498, 1724, 421, 199, 318, 4107, 63, 589, 8, 5252, 12, 1249, 12, 1390, 63, 5252, 63, 1273, 63, 835, 12, 8434, 63, 589, 304, 272, 408, 272, 13813, 3775, 314, 2582, 402, 314, 658, 10, 589, 64, 1423, 3032, 1901, 282, 805, 272, 965, 737, 4750, 658, 552, 8, 5819, 63, 589, 12544, 2368, 436, 3775, 503, 440, 1006, 402, 3520, 272, 4008, 315, 658, 589, 64, 787, 663, 370, 3932, 849, 1338, 14, 339, 6748, 26, 620, 267, 710, 536, 402, 314, 805, 3769, 3032, 314, 658, 10, 589, 64, 2725, 339, 1249, 26, 2008, 267, 710, 658, 10, 589, 64, 2725, 3032, 1901, 282, 805, 339, 1390, 63, 5252, 63, 1273, 63, 835, 26, 1109, 267, 710, 5696, 1329, 402, 2368, 626, 314, 805, 658, 5252, 64, 267, 883, 4729, 12, 28529, 5204, 315, 658, 589, 2313, 8051, 367, 20589, 267, 5827, 1125, 3788, 14, 9498, 506, 2222, 13, 7371, 14, 339, 8434, 63, 589, 26, 8773, 267, 437, 7741, 2600, 402, 2883, 436, 3932, 4568, 849, 1338, 14, 267, 1010, 1865, 370, 1066, 1404, 364, 323, 1032, 26435, 13942, 315, 2005, 5459, 402, 658, 4714, 3559, 267, 2382, 282, 4955, 9080, 4252, 2368, 1325, 2066, 3032, 5204, 267, 2368, 1011, 3124, 1183, 538, 14448, 1380, 6358, 3224, 1745, 267, 12591, 12, 376, 7741, 2600, 15620, 626, 314, 3379, 267, 1865, 402, 314, 4252, 2368, 365, 30163, 14, 3390, 626, 340, 2337, 365, 267, 1454, 1373, 790, 12, 282, 7809, 1211, 883, 506, 3032, 315, 465, 5521, 14, 339, 6218, 272, 21397, 272, 3146, 340, 658, 589, 64, 3509, 1655, 1338, 2419, 2337, 787, 658, 5819, 63, 589, 64, 272, 1722, 340, 658, 589, 64, 3509, 1338, 626, 886, 440, 17118, 370, 5204, 272, 402, 314, 849, 1338, 2013, 315, 658, 5819, 63, 589, 64, 339, 408, 272, 485, 1074, 63, 1273, 63, 1267, 8, 5252, 12, 1249, 12, 1390, 63, 5252, 63, 1273, 63, 835, 12, 8434, 63, 589, 9, 339, 327, 2136, 886, 642, 880, 626, 781, 883, 5647, 282, 1655, 315, 20889, 272, 327, 1125, 1245, 3595, 314, 2633, 626, 781, 787, 440, 272, 327, 21038, 315, 314, 10634, 4514, 402, 283, 5252, 7, 272, 2074, 275, 1211, 8, 3065, 8, 5819, 63, 589, 12, 1249, 430, 272, 485, 1074, 63, 509, 63, 885, 63, 1459, 8, 5252, 12, 2074, 12, 8434, 63, 589, 9, 421, 199, 318, 485, 1074, 63, 509, 63, 3197, 63, 1612, 8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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 ]
tersmitten/ansible
test/units/modules/network/f5/test_bigip_device_group_member.py
16
2967
# -*- coding: utf-8 -*- # # Copyright (c) 2017 F5 Networks Inc. # GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import json import pytest import sys if sys.version_info < (2, 7): pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7") from ansible.module_utils.basic import AnsibleModule try: from library.modules.bigip_device_group_member import Parameters from library.modules.bigip_device_group_member import ModuleManager from library.modules.bigip_device_group_member import ArgumentSpec # In Ansible 2.8, Ansible changed import paths. from test.units.compat import unittest from test.units.compat.mock import Mock from test.units.compat.mock import patch from test.units.modules.utils import set_module_args except ImportError: from ansible.modules.network.f5.bigip_device_group_member import Parameters from ansible.modules.network.f5.bigip_device_group_member import ModuleManager from ansible.modules.network.f5.bigip_device_group_member import ArgumentSpec # Ansible 2.8 imports from units.compat import unittest from units.compat.mock import Mock from units.compat.mock import patch from units.modules.utils import set_module_args fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} def load_fixture(name): path = os.path.join(fixture_path, name) if path in fixture_data: return fixture_data[path] with open(path) as f: data = f.read() try: data = json.loads(data) except Exception: pass fixture_data[path] = data return data class TestParameters(unittest.TestCase): def test_module_parameters(self): args = dict( name='bigip1', device_group='dg1' ) p = Parameters(params=args) assert p.name == 'bigip1' assert p.device_group == 'dg1' class TestManager(unittest.TestCase): def setUp(self): self.spec = ArgumentSpec() def test_create(self, *args): set_module_args( dict( name="bigip1", device_group="dg1", state="present", provider=dict( server='localhost', password='password', user='admin' ) ) ) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode ) mm = ModuleManager(module=module) # Override methods to force specific logic in the module to happen mm.create_on_device = Mock(return_value=True) mm.exists = Mock(return_value=False) results = mm.exec_module() assert results['changed'] is True
gpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 1898, 334, 67, 9, 9708, 481, 21, 17138, 3277, 14, 199, 3, 1664, 1696, 1684, 844, 373, 19, 14, 16, 334, 3239, 9685, 503, 4178, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 15, 11692, 13, 19, 14, 16, 14, 2424, 9, 199, 199, 504, 636, 2443, 363, 492, 334, 6116, 63, 646, 12, 4629, 12, 870, 63, 1593, 9, 199, 363, 6577, 363, 275, 730, 199, 199, 646, 747, 199, 646, 2022, 199, 646, 4613, 199, 646, 984, 199, 199, 692, 984, 14, 1023, 63, 815, 665, 334, 18, 12, 1520, 304, 272, 4613, 1657, 275, 4613, 14, 1657, 14, 2759, 480, 38, 21, 2622, 4621, 4409, 2018, 2356, 499, 14, 23, 531, 199, 199, 504, 3242, 14, 578, 63, 1208, 14, 4316, 492, 6953, 199, 199, 893, 26, 272, 687, 3555, 14, 3112, 14, 17833, 63, 1782, 63, 923, 63, 1114, 492, 3897, 272, 687, 3555, 14, 3112, 14, 17833, 63, 1782, 63, 923, 63, 1114, 492, 24118, 272, 687, 3555, 14, 3112, 14, 17833, 63, 1782, 63, 923, 63, 1114, 492, 28405, 339, 327, 1010, 2622, 499, 14, 24, 12, 2622, 2896, 492, 3792, 14, 272, 687, 511, 14, 5260, 14, 5819, 492, 2882, 272, 687, 511, 14, 5260, 14, 5819, 14, 1805, 492, 4420, 272, 687, 511, 14, 5260, 14, 5819, 14, 1805, 492, 3371, 339, 687, 511, 14, 5260, 14, 3112, 14, 1208, 492, 663, 63, 578, 63, 589, 199, 2590, 3545, 26, 272, 687, 3242, 14, 3112, 14, 1200, 14, 70, 21, 14, 17833, 63, 1782, 63, 923, 63, 1114, 492, 3897, 272, 687, 3242, 14, 3112, 14, 1200, 14, 70, 21, 14, 17833, 63, 1782, 63, 923, 63, 1114, 492, 24118, 272, 687, 3242, 14, 3112, 14, 1200, 14, 70, 21, 14, 17833, 63, 1782, 63, 923, 63, 1114, 492, 28405, 339, 327, 2622, 499, 14, 24, 8925, 272, 687, 6204, 14, 5819, 492, 2882, 272, 687, 6204, 14, 5819, 14, 1805, 492, 4420, 272, 687, 6204, 14, 5819, 14, 1805, 492, 3371, 339, 687, 6204, 14, 3112, 14, 1208, 492, 663, 63, 578, 63, 589, 421, 199, 5997, 63, 515, 275, 747, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 283, 8769, 358, 199, 5997, 63, 576, 275, 1052, 421, 199, 318, 2248, 63, 5997, 8, 354, 304, 272, 931, 275, 747, 14, 515, 14, 904, 8, 5997, 63, 515, 12, 536, 9, 339, 340, 931, 315, 10949, 63, 576, 26, 267, 372, 10949, 63, 576, 59, 515, 61, 339, 543, 1551, 8, 515, 9, 465, 289, 26, 267, 666, 275, 289, 14, 739, 342, 339, 862, 26, 267, 666, 275, 2022, 14, 3640, 8, 576, 9, 272, 871, 2186, 26, 267, 986, 339, 10949, 63, 576, 59, 515, 61, 275, 666, 272, 372, 666, 421, 199, 533, 1379, 5976, 8, 2796, 14, 1746, 304, 272, 347, 511, 63, 578, 63, 3214, 8, 277, 304, 267, 1249, 275, 1211, 8, 288, 536, 534, 17833, 17, 297, 288, 2243, 63, 923, 534, 13279, 17, 7, 267, 776, 398, 299, 275, 3897, 8, 1162, 29, 589, 9, 267, 702, 299, 14, 354, 508, 283, 17833, 17, 7, 267, 702, 299, 14, 1782, 63, 923, 508, 283, 13279, 17, 7, 421, 199, 533, 1379, 2988, 8, 2796, 14, 1746, 304, 272, 347, 3613, 8, 277, 304, 267, 291, 14, 1650, 275, 28405, 342, 339, 347, 511, 63, 981, 8, 277, 12, 627, 589, 304, 267, 663, 63, 578, 63, 589, 8, 288, 1211, 8, 355, 536, 628, 17833, 17, 401, 355, 2243, 63, 923, 628, 13279, 17, 401, 355, 1174, 628, 1881, 401, 355, 5022, 29, 807, 8, 490, 1654, 534, 5967, 297, 490, 2505, 534, 2060, 297, 490, 922, 534, 2113, 7, 355, 776, 288, 776, 267, 776, 398, 859, 275, 6953, 8, 288, 1423, 63, 1650, 29, 277, 14, 1650, 14, 2094, 63, 1650, 12, 288, 5171, 63, 1074, 63, 632, 29, 277, 14, 1650, 14, 9823, 63, 1074, 63, 632, 267, 776, 267, 8562, 275, 24118, 8, 578, 29, 578, 9, 398, 327, 11041, 3102, 370, 3542, 2488, 9661, 315, 314, 859, 370, 5992, 267, 8562, 14, 981, 63, 265, 63, 1782, 275, 4420, 8, 1107, 63, 585, 29, 549, 9, 267, 8562, 14, 2444, 275, 4420, 8, 1107, 63, 585, 29, 797, 9, 398, 2058, 275, 8562, 14, 1628, 63, 578, 342, 267, 702, 2058, 459, 2489, 418, 365, 715, 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 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 1898, 334, 67, 9, 9708, 481, 21, 17138, 3277, 14, 199, 3, 1664, 1696, 1684, 844, 373, 19, 14, 16, 334, 3239, 9685, 503, 4178, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 15, 11692, 13, 19, 14, 16, 14, 2424, 9, 199, 199, 504, 636, 2443, 363, 492, 334, 6116, 63, 646, 12, 4629, 12, 870, 63, 1593, 9, 199, 363, 6577, 363, 275, 730, 199, 199, 646, 747, 199, 646, 2022, 199, 646, 4613, 199, 646, 984, 199, 199, 692, 984, 14, 1023, 63, 815, 665, 334, 18, 12, 1520, 304, 272, 4613, 1657, 275, 4613, 14, 1657, 14, 2759, 480, 38, 21, 2622, 4621, 4409, 2018, 2356, 499, 14, 23, 531, 199, 199, 504, 3242, 14, 578, 63, 1208, 14, 4316, 492, 6953, 199, 199, 893, 26, 272, 687, 3555, 14, 3112, 14, 17833, 63, 1782, 63, 923, 63, 1114, 492, 3897, 272, 687, 3555, 14, 3112, 14, 17833, 63, 1782, 63, 923, 63, 1114, 492, 24118, 272, 687, 3555, 14, 3112, 14, 17833, 63, 1782, 63, 923, 63, 1114, 492, 28405, 339, 327, 1010, 2622, 499, 14, 24, 12, 2622, 2896, 492, 3792, 14, 272, 687, 511, 14, 5260, 14, 5819, 492, 2882, 272, 687, 511, 14, 5260, 14, 5819, 14, 1805, 492, 4420, 272, 687, 511, 14, 5260, 14, 5819, 14, 1805, 492, 3371, 339, 687, 511, 14, 5260, 14, 3112, 14, 1208, 492, 663, 63, 578, 63, 589, 199, 2590, 3545, 26, 272, 687, 3242, 14, 3112, 14, 1200, 14, 70, 21, 14, 17833, 63, 1782, 63, 923, 63, 1114, 492, 3897, 272, 687, 3242, 14, 3112, 14, 1200, 14, 70, 21, 14, 17833, 63, 1782, 63, 923, 63, 1114, 492, 24118, 272, 687, 3242, 14, 3112, 14, 1200, 14, 70, 21, 14, 17833, 63, 1782, 63, 923, 63, 1114, 492, 28405, 339, 327, 2622, 499, 14, 24, 8925, 272, 687, 6204, 14, 5819, 492, 2882, 272, 687, 6204, 14, 5819, 14, 1805, 492, 4420, 272, 687, 6204, 14, 5819, 14, 1805, 492, 3371, 339, 687, 6204, 14, 3112, 14, 1208, 492, 663, 63, 578, 63, 589, 421, 199, 5997, 63, 515, 275, 747, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 283, 8769, 358, 199, 5997, 63, 576, 275, 1052, 421, 199, 318, 2248, 63, 5997, 8, 354, 304, 272, 931, 275, 747, 14, 515, 14, 904, 8, 5997, 63, 515, 12, 536, 9, 339, 340, 931, 315, 10949, 63, 576, 26, 267, 372, 10949, 63, 576, 59, 515, 61, 339, 543, 1551, 8, 515, 9, 465, 289, 26, 267, 666, 275, 289, 14, 739, 342, 339, 862, 26, 267, 666, 275, 2022, 14, 3640, 8, 576, 9, 272, 871, 2186, 26, 267, 986, 339, 10949, 63, 576, 59, 515, 61, 275, 666, 272, 372, 666, 421, 199, 533, 1379, 5976, 8, 2796, 14, 1746, 304, 272, 347, 511, 63, 578, 63, 3214, 8, 277, 304, 267, 1249, 275, 1211, 8, 288, 536, 534, 17833, 17, 297, 288, 2243, 63, 923, 534, 13279, 17, 7, 267, 776, 398, 299, 275, 3897, 8, 1162, 29, 589, 9, 267, 702, 299, 14, 354, 508, 283, 17833, 17, 7, 267, 702, 299, 14, 1782, 63, 923, 508, 283, 13279, 17, 7, 421, 199, 533, 1379, 2988, 8, 2796, 14, 1746, 304, 272, 347, 3613, 8, 277, 304, 267, 291, 14, 1650, 275, 28405, 342, 339, 347, 511, 63, 981, 8, 277, 12, 627, 589, 304, 267, 663, 63, 578, 63, 589, 8, 288, 1211, 8, 355, 536, 628, 17833, 17, 401, 355, 2243, 63, 923, 628, 13279, 17, 401, 355, 1174, 628, 1881, 401, 355, 5022, 29, 807, 8, 490, 1654, 534, 5967, 297, 490, 2505, 534, 2060, 297, 490, 922, 534, 2113, 7, 355, 776, 288, 776, 267, 776, 398, 859, 275, 6953, 8, 288, 1423, 63, 1650, 29, 277, 14, 1650, 14, 2094, 63, 1650, 12, 288, 5171, 63, 1074, 63, 632, 29, 277, 14, 1650, 14, 9823, 63, 1074, 63, 632, 267, 776, 267, 8562, 275, 24118, 8, 578, 29, 578, 9, 398, 327, 11041, 3102, 370, 3542, 2488, 9661, 315, 314, 859, 370, 5992, 267, 8562, 14, 981, 63, 265, 63, 1782, 275, 4420, 8, 1107, 63, 585, 29, 549, 9, 267, 8562, 14, 2444, 275, 4420, 8, 1107, 63, 585, 29, 797, 9, 398, 2058, 275, 8562, 14, 1628, 63, 578, 342, 267, 702, 2058, 459, 2489, 418, 365, 715, 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,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
CallaJun/hackprince
indico/matplotlib/gridspec.py
10
15668
""" :mod:`~matplotlib.gridspec` is a module which specifies the location of the subplot in the figure. ``GridSpec`` specifies the geometry of the grid that a subplot will be placed. The number of rows and number of columns of the grid need to be set. Optionally, the subplot layout parameters (e.g., left, right, etc.) can be tuned. ``SubplotSpec`` specifies the location of the subplot in the given *GridSpec*. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import six from six.moves import zip import matplotlib rcParams = matplotlib.rcParams import matplotlib.transforms as mtransforms import numpy as np import warnings class GridSpecBase(object): """ A base class of GridSpec that specifies the geometry of the grid that a subplot will be placed. """ def __init__(self, nrows, ncols, height_ratios=None, width_ratios=None): """ The number of rows and number of columns of the grid need to be set. Optionally, the ratio of heights and widths of rows and columns can be specified. """ #self.figure = figure self._nrows , self._ncols = nrows, ncols self.set_height_ratios(height_ratios) self.set_width_ratios(width_ratios) def get_geometry(self): 'get the geometry of the grid, e.g., 2,3' return self._nrows, self._ncols def get_subplot_params(self, fig=None): pass def new_subplotspec(self, loc, rowspan=1, colspan=1): """ create and return a SuplotSpec instance. """ loc1, loc2 = loc subplotspec = self[loc1:loc1+rowspan, loc2:loc2+colspan] return subplotspec def set_width_ratios(self, width_ratios): self._col_width_ratios = width_ratios def get_width_ratios(self): return self._col_width_ratios def set_height_ratios(self, height_ratios): self._row_height_ratios = height_ratios def get_height_ratios(self): return self._row_height_ratios def get_grid_positions(self, fig): """ return lists of bottom and top position of rows, left and right positions of columns. """ nrows, ncols = self.get_geometry() subplot_params = self.get_subplot_params(fig) left = subplot_params.left right = subplot_params.right bottom = subplot_params.bottom top = subplot_params.top wspace = subplot_params.wspace hspace = subplot_params.hspace totWidth = right-left totHeight = top-bottom # calculate accumulated heights of columns cellH = totHeight/(nrows + hspace*(nrows-1)) sepH = hspace*cellH if self._row_height_ratios is not None: netHeight = cellH * nrows tr = float(sum(self._row_height_ratios)) cellHeights = [netHeight*r/tr for r in self._row_height_ratios] else: cellHeights = [cellH] * nrows sepHeights = [0] + ([sepH] * (nrows-1)) cellHs = np.add.accumulate(np.ravel(list(zip(sepHeights, cellHeights)))) # calculate accumulated widths of rows cellW = totWidth/(ncols + wspace*(ncols-1)) sepW = wspace*cellW if self._col_width_ratios is not None: netWidth = cellW * ncols tr = float(sum(self._col_width_ratios)) cellWidths = [netWidth*r/tr for r in self._col_width_ratios] else: cellWidths = [cellW] * ncols sepWidths = [0] + ([sepW] * (ncols-1)) cellWs = np.add.accumulate(np.ravel(list(zip(sepWidths, cellWidths)))) figTops = [top - cellHs[2*rowNum] for rowNum in range(nrows)] figBottoms = [top - cellHs[2*rowNum+1] for rowNum in range(nrows)] figLefts = [left + cellWs[2*colNum] for colNum in range(ncols)] figRights = [left + cellWs[2*colNum+1] for colNum in range(ncols)] return figBottoms, figTops, figLefts, figRights def __getitem__(self, key): """ create and return a SuplotSpec instance. """ nrows, ncols = self.get_geometry() total = nrows*ncols if isinstance(key, tuple): try: k1, k2 = key except ValueError: raise ValueError("unrecognized subplot spec") if isinstance(k1, slice): row1, row2, _ = k1.indices(nrows) else: if k1 < 0: k1 += nrows if k1 >= nrows or k1 < 0 : raise IndexError("index out of range") row1, row2 = k1, k1+1 if isinstance(k2, slice): col1, col2, _ = k2.indices(ncols) else: if k2 < 0: k2 += ncols if k2 >= ncols or k2 < 0 : raise IndexError("index out of range") col1, col2 = k2, k2+1 num1 = row1*ncols + col1 num2 = (row2-1)*ncols + (col2-1) # single key else: if isinstance(key, slice): num1, num2, _ = key.indices(total) num2 -= 1 else: if key < 0: key += total if key >= total or key < 0 : raise IndexError("index out of range") num1, num2 = key, None return SubplotSpec(self, num1, num2) class GridSpec(GridSpecBase): """ A class that specifies the geometry of the grid that a subplot will be placed. The location of grid is determined by similar way as the SubplotParams. """ def __init__(self, nrows, ncols, left=None, bottom=None, right=None, top=None, wspace=None, hspace=None, width_ratios=None, height_ratios=None): """ The number of rows and number of columns of the grid need to be set. Optionally, the subplot layout parameters (e.g., left, right, etc.) can be tuned. """ #self.figure = figure self.left=left self.bottom=bottom self.right=right self.top=top self.wspace=wspace self.hspace=hspace GridSpecBase.__init__(self, nrows, ncols, width_ratios=width_ratios, height_ratios=height_ratios) #self.set_width_ratios(width_ratios) #self.set_height_ratios(height_ratios) _AllowedKeys = ["left", "bottom", "right", "top", "wspace", "hspace"] def update(self, **kwargs): """ Update the current values. If any kwarg is None, default to the current value, if set, otherwise to rc. """ for k, v in six.iteritems(kwargs): if k in self._AllowedKeys: setattr(self, k, v) else: raise AttributeError("%s is unknown keyword" % (k,)) from matplotlib import _pylab_helpers from matplotlib.axes import SubplotBase for figmanager in six.itervalues(_pylab_helpers.Gcf.figs): for ax in figmanager.canvas.figure.axes: # copied from Figure.subplots_adjust if not isinstance(ax, SubplotBase): # Check if sharing a subplots axis if ax._sharex is not None and isinstance(ax._sharex, SubplotBase): if ax._sharex.get_subplotspec().get_gridspec() == self: ax._sharex.update_params() ax.set_position(ax._sharex.figbox) elif ax._sharey is not None and isinstance(ax._sharey,SubplotBase): if ax._sharey.get_subplotspec().get_gridspec() == self: ax._sharey.update_params() ax.set_position(ax._sharey.figbox) else: ss = ax.get_subplotspec().get_topmost_subplotspec() if ss.get_gridspec() == self: ax.update_params() ax.set_position(ax.figbox) def get_subplot_params(self, fig=None): """ return a dictionary of subplot layout parameters. The default parameters are from rcParams unless a figure attribute is set. """ from matplotlib.figure import SubplotParams import copy if fig is None: kw = dict([(k, rcParams["figure.subplot."+k]) \ for k in self._AllowedKeys]) subplotpars = SubplotParams(**kw) else: subplotpars = copy.copy(fig.subplotpars) update_kw = dict([(k, getattr(self, k)) for k in self._AllowedKeys]) subplotpars.update(**update_kw) return subplotpars def locally_modified_subplot_params(self): return [k for k in self._AllowedKeys if getattr(self, k)] def tight_layout(self, fig, renderer=None, pad=1.08, h_pad=None, w_pad=None, rect=None): """ Adjust subplot parameters to give specified padding. Parameters: pad : float padding between the figure edge and the edges of subplots, as a fraction of the font-size. h_pad, w_pad : float padding (height/width) between edges of adjacent subplots. Defaults to `pad_inches`. rect : if rect is given, it is interpreted as a rectangle (left, bottom, right, top) in the normalized figure coordinate that the whole subplots area (including labels) will fit into. Default is (0, 0, 1, 1). """ from .tight_layout import (get_subplotspec_list, get_tight_layout_figure, get_renderer) subplotspec_list = get_subplotspec_list(fig.axes, grid_spec=self) if None in subplotspec_list: warnings.warn("This figure includes Axes that are not " "compatible with tight_layout, so its " "results might be incorrect.") if renderer is None: renderer = get_renderer(fig) kwargs = get_tight_layout_figure(fig, fig.axes, subplotspec_list, renderer, pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect, ) self.update(**kwargs) class GridSpecFromSubplotSpec(GridSpecBase): """ GridSpec whose subplot layout parameters are inherited from the location specified by a given SubplotSpec. """ def __init__(self, nrows, ncols, subplot_spec, wspace=None, hspace=None, height_ratios=None, width_ratios=None): """ The number of rows and number of columns of the grid need to be set. An instance of SubplotSpec is also needed to be set from which the layout parameters will be inherited. The wspace and hspace of the layout can be optionally specified or the default values (from the figure or rcParams) will be used. """ self._wspace=wspace self._hspace=hspace self._subplot_spec = subplot_spec GridSpecBase.__init__(self, nrows, ncols, width_ratios=width_ratios, height_ratios=height_ratios) def get_subplot_params(self, fig=None): """ return a dictionary of subplot layout parameters. """ if fig is None: hspace = rcParams["figure.subplot.hspace"] wspace = rcParams["figure.subplot.wspace"] else: hspace = fig.subplotpars.hspace wspace = fig.subplotpars.wspace if self._hspace is not None: hspace = self._hspace if self._wspace is not None: wspace = self._wspace figbox = self._subplot_spec.get_position(fig, return_all=False) left, bottom, right, top = figbox.extents from matplotlib.figure import SubplotParams sp = SubplotParams(left=left, right=right, bottom=bottom, top=top, wspace=wspace, hspace=hspace) return sp def get_topmost_subplotspec(self): 'get the topmost SubplotSpec instance associated with the subplot' return self._subplot_spec.get_topmost_subplotspec() class SubplotSpec(object): """ specifies the location of the subplot in the given *GridSpec*. """ def __init__(self, gridspec, num1, num2=None): """ The subplot will occupy the num1-th cell of the given gridspec. If num2 is provided, the subplot will span between num1-th cell and num2-th cell. The index stars from 0. """ rows, cols = gridspec.get_geometry() total = rows*cols self._gridspec = gridspec self.num1 = num1 self.num2 = num2 def get_gridspec(self): return self._gridspec def get_geometry(self): """ get the subplot geometry, e.g., 2,2,3. Unlike SuplorParams, index is 0-based """ rows, cols = self.get_gridspec().get_geometry() return rows, cols, self.num1, self.num2 def get_position(self, fig, return_all=False): """ update the subplot position from fig.subplotpars """ gridspec = self.get_gridspec() nrows, ncols = gridspec.get_geometry() figBottoms, figTops, figLefts, figRights = \ gridspec.get_grid_positions(fig) rowNum, colNum = divmod(self.num1, ncols) figBottom = figBottoms[rowNum] figTop = figTops[rowNum] figLeft = figLefts[colNum] figRight = figRights[colNum] if self.num2 is not None: rowNum2, colNum2 = divmod(self.num2, ncols) figBottom2 = figBottoms[rowNum2] figTop2 = figTops[rowNum2] figLeft2 = figLefts[colNum2] figRight2 = figRights[colNum2] figBottom = min(figBottom, figBottom2) figLeft = min(figLeft, figLeft2) figTop = max(figTop, figTop2) figRight = max(figRight, figRight2) figbox = mtransforms.Bbox.from_extents(figLeft, figBottom, figRight, figTop) if return_all: return figbox, rowNum, colNum, nrows, ncols else: return figbox def get_topmost_subplotspec(self): 'get the topmost SubplotSpec instance associated with the subplot' gridspec = self.get_gridspec() if hasattr(gridspec, "get_topmost_subplotspec"): return gridspec.get_topmost_subplotspec() else: return self def __eq__(self, other): # check to make sure other has the attributes # we need to do the comparison if not (hasattr(other, '_gridspec') and hasattr(other, 'num1') and hasattr(other, 'num2')): return False return all((self._gridspec == other._gridspec, self.num1 == other.num1, self.num2 == other.num2)) def __hash__(self): return (hash(self._gridspec) ^ hash(self.num1) ^ hash(self.num2))
lgpl-3.0
[ 624, 199, 26, 1494, 6054, 16440, 14, 7928, 795, 733, 64, 365, 282, 859, 1314, 9314, 314, 2909, 199, 1618, 314, 1007, 2798, 315, 314, 9658, 14, 339, 1124, 7900, 5307, 1040, 267, 9314, 314, 3400, 402, 314, 6068, 626, 282, 1007, 2798, 911, 506, 267, 15090, 14, 710, 1329, 402, 4730, 436, 1329, 402, 4362, 402, 314, 6068, 267, 1929, 370, 506, 663, 14, 22383, 12, 314, 1007, 2798, 7054, 2633, 267, 334, 69, 14, 71, 2020, 3602, 12, 2451, 12, 5423, 4959, 883, 506, 15486, 379, 14, 339, 1124, 2610, 2798, 5307, 1040, 267, 9314, 314, 2909, 402, 314, 1007, 2798, 315, 314, 1627, 627, 7900, 5307, 4856, 421, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 334, 6116, 63, 646, 12, 4629, 12, 870, 63, 1593, 12, 717, 2649, 63, 5955, 9, 199, 199, 646, 3816, 199, 504, 3816, 14, 4912, 492, 3482, 199, 199, 646, 8027, 199, 1195, 6007, 275, 8027, 14, 1195, 6007, 199, 199, 646, 8027, 14, 15133, 465, 333, 15133, 199, 199, 646, 2680, 465, 980, 199, 646, 3598, 199, 199, 533, 16386, 5307, 1563, 8, 785, 304, 272, 408, 272, 437, 1300, 1021, 402, 16386, 5307, 626, 9314, 314, 3400, 402, 314, 6068, 272, 626, 282, 1007, 2798, 911, 506, 15090, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 30497, 12, 302, 4574, 12, 326, 4569, 63, 345, 9636, 29, 403, 12, 3462, 63, 345, 9636, 29, 403, 304, 267, 408, 267, 710, 1329, 402, 4730, 436, 1329, 402, 4362, 402, 314, 6068, 1929, 370, 267, 506, 663, 14, 22383, 12, 314, 10463, 402, 946, 2492, 436, 28186, 402, 4730, 436, 267, 4362, 883, 506, 2013, 14, 267, 408, 267, 327, 277, 14, 8941, 275, 9658, 267, 291, 423, 24590, 2360, 291, 423, 78, 4574, 275, 30497, 12, 302, 4574, 398, 291, 14, 409, 63, 3333, 63, 345, 9636, 8, 3333, 63, 345, 9636, 9, 267, 291, 14, 409, 63, 2063, 63, 345, 9636, 8, 2063, 63, 345, 9636, 9, 339, 347, 664, 63, 7660, 8, 277, 304, 267, 283, 362, 314, 3400, 402, 314, 6068, 12, 325, 14, 71, 2020, 499, 12, 19, 7, 267, 372, 291, 423, 24590, 12, 291, 423, 78, 4574, 339, 347, 664, 63, 13334, 63, 1162, 8, 277, 12, 6085, 29, 403, 304, 267, 986, 339, 347, 892, 63, 21430, 733, 8, 277, 12, 4355, 12, 1962, 3751, 29, 17, 12, 26384, 29, 17, 304, 267, 408, 267, 1218, 436, 372, 282, 6820, 1653, 5307, 1256, 14, 267, 408, 267, 4355, 17, 12, 4355, 18, 275, 4355, 267, 1007, 13701, 733, 275, 291, 59, 2102, 17, 26, 2102, 17, 11, 1143, 3751, 12, 4355, 18, 26, 2102, 18, 11, 4574, 10384, 61, 267, 372, 1007, 13701, 733, 2378, 347, 663, 63, 2063, 63, 345, 9636, 8, 277, 12, 3462, 63, 345, 9636, 304, 267, 291, 423, 761, 63, 2063, 63, 345, 9636, 275, 3462, 63, 345, 9636, 339, 347, 664, 63, 2063, 63, 345, 9636, 8, 277, 304, 267, 372, 291, 423, 761, 63, 2063, 63, 345, 9636, 339, 347, 663, 63, 3333, 63, 345, 9636, 8, 277, 12, 4569, 63, 345, 9636, 304, 267, 291, 423, 1143, 63, 3333, 63, 345, 9636, 275, 4569, 63, 345, 9636, 339, 347, 664, 63, 3333, 63, 345, 9636, 8, 277, 304, 267, 372, 291, 423, 1143, 63, 3333, 63, 345, 9636, 2378, 347, 664, 63, 3825, 63, 12658, 8, 277, 12, 6085, 304, 267, 408, 267, 372, 5548, 402, 9048, 436, 2746, 3421, 402, 4730, 12, 3602, 436, 267, 2451, 12266, 402, 4362, 14, 267, 408, 267, 30497, 12, 302, 4574, 275, 291, 14, 362, 63, 7660, 342, 398, 1007, 2798, 63, 1162, 275, 291, 14, 362, 63, 13334, 63, 1162, 8, 592, 9, 267, 3602, 275, 1007, 2798, 63, 1162, 14, 3039, 267, 2451, 275, 1007, 2798, 63, 1162, 14, 1019, 267, 9048, 275, 1007, 2798, 63, 1162, 14, 8305, 267, 2746, 275, 1007, 2798, 63, 1162, 14, 2119, 267, 336, 2638, 275, 1007, 2798, 63, 1162, 14, 87, 2638, 267, 394, 2638, 275, 1007, 2798, 63, 1162, 14, 72, 2638, 267, 12657, 6216, 275, 2451, 13, 3039, 267, 12657, 8436, 275, 2746, 13, 8305, 398, 327, 8671, 29845, 946, 2492, 402, 4362, 267, 4917, 40, 275, 12657, 8436, 7985, 24590, 435, 394, 2638, 5830, 24590, 13, 17, 430, 267, 7375, 40, 275, 394, 2638, 10, 3890, 40, 398, 340, 291, 423, 1143, 63, 3333, 63, 345, 9636, 365, 440, 488, 26, 288, 1851, 8436, 275, 4917, 40, 627, 30497, 288, 5651, 275, 2069, 8, 1838, 8, 277, 423, 1143, 63, 3333, 63, 345, 9636, 430, 288, 4917, 1966, 2492, 275, 359, 846, 8436, 10, 82, 15, 454, 367, 519, 315, 291, 423, 1143, 63, 3333, 63, 345, 9636, 61, 267, 587, 26, 288, 4917, 1966, 2492, 275, 359, 3890, 40, 61, 627, 30497, 398, 7375, 1966, 2492, 275, 359, 16, 61, 435, 7287, 4127, 40, 61, 627, 334, 24590, 13, 17, 430, 267, 4917, 40, 83, 275, 980, 14, 525, 14, 13223, 5434, 8, 1590, 14, 11186, 8, 513, 8, 3065, 8, 4127, 1966, 2492, 12, 4917, 1966, 2492, 7845, 7318, 327, 8671, 29845, 28186, 402, 4730, 267, 4917, 55, 275, 12657, 6216, 7985, 78, 4574, 435, 336, 2638, 5830, 78, 4574, 13, 17, 430, 267, 7375, 55, 275, 336, 2638, 10, 3890, 55, 398, 340, 291, 423, 761, 63, 2063, 63, 345, 9636, 365, 440, 488, 26, 288, 1851, 6216, 275, 4917, 55, 627, 302, 4574, 288, 5651, 275, 2069, 8, 1838, 8, 277, 423, 761, 63, 2063, 63, 345, 9636, 430, 288, 4917, 6216, 83, 275, 359, 846, 6216, 10, 82, 15, 454, 367, 519, 315, 291, 423, 761, 63, 2063, 63, 345, 9636, 61, 267, 587, 26, 288, 4917, 6216, 83, 275, 359, 3890, 55, 61, 627, 302, 4574, 398, 7375, 6216, 83, 275, 359, 16, 61, 435, 7287, 4127, 55, 61, 627, 334, 78, 4574, 13, 17, 430, 267, 4917, 55, 83, 275, 980, 14, 525, 14, 13223, 5434, 8, 1590, 14, 11186, 8, 513, 8, 3065, 8, 4127, 6216, 83, 12, 4917, 6216, 83, 7845, 421, 398, 6085, 52, 1483, 275, 359, 2119, 446, 4917, 40, 83, 59, 18, 10, 1143, 5667 ]
[ 199, 26, 1494, 6054, 16440, 14, 7928, 795, 733, 64, 365, 282, 859, 1314, 9314, 314, 2909, 199, 1618, 314, 1007, 2798, 315, 314, 9658, 14, 339, 1124, 7900, 5307, 1040, 267, 9314, 314, 3400, 402, 314, 6068, 626, 282, 1007, 2798, 911, 506, 267, 15090, 14, 710, 1329, 402, 4730, 436, 1329, 402, 4362, 402, 314, 6068, 267, 1929, 370, 506, 663, 14, 22383, 12, 314, 1007, 2798, 7054, 2633, 267, 334, 69, 14, 71, 2020, 3602, 12, 2451, 12, 5423, 4959, 883, 506, 15486, 379, 14, 339, 1124, 2610, 2798, 5307, 1040, 267, 9314, 314, 2909, 402, 314, 1007, 2798, 315, 314, 1627, 627, 7900, 5307, 4856, 421, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 334, 6116, 63, 646, 12, 4629, 12, 870, 63, 1593, 12, 717, 2649, 63, 5955, 9, 199, 199, 646, 3816, 199, 504, 3816, 14, 4912, 492, 3482, 199, 199, 646, 8027, 199, 1195, 6007, 275, 8027, 14, 1195, 6007, 199, 199, 646, 8027, 14, 15133, 465, 333, 15133, 199, 199, 646, 2680, 465, 980, 199, 646, 3598, 199, 199, 533, 16386, 5307, 1563, 8, 785, 304, 272, 408, 272, 437, 1300, 1021, 402, 16386, 5307, 626, 9314, 314, 3400, 402, 314, 6068, 272, 626, 282, 1007, 2798, 911, 506, 15090, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 30497, 12, 302, 4574, 12, 326, 4569, 63, 345, 9636, 29, 403, 12, 3462, 63, 345, 9636, 29, 403, 304, 267, 408, 267, 710, 1329, 402, 4730, 436, 1329, 402, 4362, 402, 314, 6068, 1929, 370, 267, 506, 663, 14, 22383, 12, 314, 10463, 402, 946, 2492, 436, 28186, 402, 4730, 436, 267, 4362, 883, 506, 2013, 14, 267, 408, 267, 327, 277, 14, 8941, 275, 9658, 267, 291, 423, 24590, 2360, 291, 423, 78, 4574, 275, 30497, 12, 302, 4574, 398, 291, 14, 409, 63, 3333, 63, 345, 9636, 8, 3333, 63, 345, 9636, 9, 267, 291, 14, 409, 63, 2063, 63, 345, 9636, 8, 2063, 63, 345, 9636, 9, 339, 347, 664, 63, 7660, 8, 277, 304, 267, 283, 362, 314, 3400, 402, 314, 6068, 12, 325, 14, 71, 2020, 499, 12, 19, 7, 267, 372, 291, 423, 24590, 12, 291, 423, 78, 4574, 339, 347, 664, 63, 13334, 63, 1162, 8, 277, 12, 6085, 29, 403, 304, 267, 986, 339, 347, 892, 63, 21430, 733, 8, 277, 12, 4355, 12, 1962, 3751, 29, 17, 12, 26384, 29, 17, 304, 267, 408, 267, 1218, 436, 372, 282, 6820, 1653, 5307, 1256, 14, 267, 408, 267, 4355, 17, 12, 4355, 18, 275, 4355, 267, 1007, 13701, 733, 275, 291, 59, 2102, 17, 26, 2102, 17, 11, 1143, 3751, 12, 4355, 18, 26, 2102, 18, 11, 4574, 10384, 61, 267, 372, 1007, 13701, 733, 2378, 347, 663, 63, 2063, 63, 345, 9636, 8, 277, 12, 3462, 63, 345, 9636, 304, 267, 291, 423, 761, 63, 2063, 63, 345, 9636, 275, 3462, 63, 345, 9636, 339, 347, 664, 63, 2063, 63, 345, 9636, 8, 277, 304, 267, 372, 291, 423, 761, 63, 2063, 63, 345, 9636, 339, 347, 663, 63, 3333, 63, 345, 9636, 8, 277, 12, 4569, 63, 345, 9636, 304, 267, 291, 423, 1143, 63, 3333, 63, 345, 9636, 275, 4569, 63, 345, 9636, 339, 347, 664, 63, 3333, 63, 345, 9636, 8, 277, 304, 267, 372, 291, 423, 1143, 63, 3333, 63, 345, 9636, 2378, 347, 664, 63, 3825, 63, 12658, 8, 277, 12, 6085, 304, 267, 408, 267, 372, 5548, 402, 9048, 436, 2746, 3421, 402, 4730, 12, 3602, 436, 267, 2451, 12266, 402, 4362, 14, 267, 408, 267, 30497, 12, 302, 4574, 275, 291, 14, 362, 63, 7660, 342, 398, 1007, 2798, 63, 1162, 275, 291, 14, 362, 63, 13334, 63, 1162, 8, 592, 9, 267, 3602, 275, 1007, 2798, 63, 1162, 14, 3039, 267, 2451, 275, 1007, 2798, 63, 1162, 14, 1019, 267, 9048, 275, 1007, 2798, 63, 1162, 14, 8305, 267, 2746, 275, 1007, 2798, 63, 1162, 14, 2119, 267, 336, 2638, 275, 1007, 2798, 63, 1162, 14, 87, 2638, 267, 394, 2638, 275, 1007, 2798, 63, 1162, 14, 72, 2638, 267, 12657, 6216, 275, 2451, 13, 3039, 267, 12657, 8436, 275, 2746, 13, 8305, 398, 327, 8671, 29845, 946, 2492, 402, 4362, 267, 4917, 40, 275, 12657, 8436, 7985, 24590, 435, 394, 2638, 5830, 24590, 13, 17, 430, 267, 7375, 40, 275, 394, 2638, 10, 3890, 40, 398, 340, 291, 423, 1143, 63, 3333, 63, 345, 9636, 365, 440, 488, 26, 288, 1851, 8436, 275, 4917, 40, 627, 30497, 288, 5651, 275, 2069, 8, 1838, 8, 277, 423, 1143, 63, 3333, 63, 345, 9636, 430, 288, 4917, 1966, 2492, 275, 359, 846, 8436, 10, 82, 15, 454, 367, 519, 315, 291, 423, 1143, 63, 3333, 63, 345, 9636, 61, 267, 587, 26, 288, 4917, 1966, 2492, 275, 359, 3890, 40, 61, 627, 30497, 398, 7375, 1966, 2492, 275, 359, 16, 61, 435, 7287, 4127, 40, 61, 627, 334, 24590, 13, 17, 430, 267, 4917, 40, 83, 275, 980, 14, 525, 14, 13223, 5434, 8, 1590, 14, 11186, 8, 513, 8, 3065, 8, 4127, 1966, 2492, 12, 4917, 1966, 2492, 7845, 7318, 327, 8671, 29845, 28186, 402, 4730, 267, 4917, 55, 275, 12657, 6216, 7985, 78, 4574, 435, 336, 2638, 5830, 78, 4574, 13, 17, 430, 267, 7375, 55, 275, 336, 2638, 10, 3890, 55, 398, 340, 291, 423, 761, 63, 2063, 63, 345, 9636, 365, 440, 488, 26, 288, 1851, 6216, 275, 4917, 55, 627, 302, 4574, 288, 5651, 275, 2069, 8, 1838, 8, 277, 423, 761, 63, 2063, 63, 345, 9636, 430, 288, 4917, 6216, 83, 275, 359, 846, 6216, 10, 82, 15, 454, 367, 519, 315, 291, 423, 761, 63, 2063, 63, 345, 9636, 61, 267, 587, 26, 288, 4917, 6216, 83, 275, 359, 3890, 55, 61, 627, 302, 4574, 398, 7375, 6216, 83, 275, 359, 16, 61, 435, 7287, 4127, 55, 61, 627, 334, 78, 4574, 13, 17, 430, 267, 4917, 55, 83, 275, 980, 14, 525, 14, 13223, 5434, 8, 1590, 14, 11186, 8, 513, 8, 3065, 8, 4127, 6216, 83, 12, 4917, 6216, 83, 7845, 421, 398, 6085, 52, 1483, 275, 359, 2119, 446, 4917, 40, 83, 59, 18, 10, 1143, 5667, 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, 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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 ]
heeraj123/oh-mainline
vendor/packages/django-assets/django_assets/filter/jspacker/jspacker.py
19
22540
## ParseMaster, version 1.0 (pre-release) (2005/05/12) x6 ## Copyright 2005, Dean Edwards ## Web: http://dean.edwards.name/ ## ## This software is licensed under the CC-GNU LGPL ## Web: http://creativecommons.org/licenses/LGPL/2.1/ ## ## Ported to Python by Florian Schulze import os, re # a multi-pattern parser class Pattern: def __init__(self, expression, replacement, length): self.expression = expression self.replacement = replacement self.length = length def __str__(self): return "(" + self.expression + ")" class Patterns(list): def __str__(self): return '|'.join([str(e) for e in self]) class ParseMaster: # constants EXPRESSION = 0 REPLACEMENT = 1 LENGTH = 2 GROUPS = re.compile(r"""\(""", re.M)#g SUB_REPLACE = re.compile(r"""\$\d""", re.M) INDEXED = re.compile(r"""^\$\d+$""", re.M) TRIM = re.compile(r"""(['"])\1\+(.*)\+\1\1$""", re.M) ESCAPE = re.compile(r"""\\.""", re.M)#g #QUOTE = re.compile(r"""'""", re.M) DELETED = re.compile("""\x01[^\x01]*\x01""", re.M)#g def __init__(self): # private self._patterns = Patterns() # patterns stored by index self._escaped = [] self.ignoreCase = False self.escapeChar = None def DELETE(self, match, offset): return "\x01" + match.group(offset) + "\x01" def _repl(self, a, o, r, i): while (i): m = a.group(o+i-1) if m is None: s = "" else: s = m r = r.replace("$" + str(i), s) i = i - 1 r = ParseMaster.TRIM.sub("$1", r) return r # public def add(self, expression="^$", replacement=None): if replacement is None: replacement = self.DELETE # count the number of sub-expressions # - add one because each pattern is itself a sub-expression length = len(ParseMaster.GROUPS.findall(self._internalEscape(str(expression)))) + 1 # does the pattern deal with sub-expressions? if (isinstance(replacement, str) and ParseMaster.SUB_REPLACE.match(replacement)): # a simple lookup? (e.g. "$2") if (ParseMaster.INDEXED.match(replacement)): # store the index (used for fast retrieval of matched strings) replacement = int(replacement[1:]) - 1 else: # a complicated lookup (e.g. "Hello $2 $1") # build a function to do the lookup i = length r = replacement replacement = lambda a,o: self._repl(a,o,r,i) # pass the modified arguments self._patterns.append(Pattern(expression, replacement, length)) # execute the global replacement def execute(self, string): if self.ignoreCase: r = re.compile(str(self._patterns), re.I | re.M) else: r = re.compile(str(self._patterns), re.M) string = self._escape(string, self.escapeChar) string = r.sub(self._replacement, string) string = self._unescape(string, self.escapeChar) string = ParseMaster.DELETED.sub("", string) return string # clear the patterns collections so that this object may be re-used def reset(self): self._patterns = Patterns() # this is the global replace function (it's quite complicated) def _replacement(self, match): i = 1 # loop through the patterns for pattern in self._patterns: if match.group(i) is not None: replacement = pattern.replacement if callable(replacement): return replacement(match, i) elif isinstance(replacement, (int, long)): return match.group(replacement+i) else: return replacement else: i = i+pattern.length # encode escaped characters def _escape(self, string, escapeChar=None): def repl(match): char = match.group(1) self._escaped.append(char) return escapeChar if escapeChar is None: return string r = re.compile("\\"+escapeChar+"(.)", re.M) result = r.sub(repl, string) return result # decode escaped characters def _unescape(self, string, escapeChar=None): def repl(match): try: #result = eval("'"+escapeChar + self._escaped.pop(0)+"'") result = escapeChar + self._escaped.pop(0) return result except IndexError: return escapeChar if escapeChar is None: return string r = re.compile("\\"+escapeChar, re.M) result = r.sub(repl, string) return result def _internalEscape(self, string): return ParseMaster.ESCAPE.sub("", string) ## packer, version 2.0 (2005/04/20) ## Copyright 2004-2005, Dean Edwards ## License: http://creativecommons.org/licenses/LGPL/2.1/ ## Ported to Python by Florian Schulze ## http://dean.edwards.name/packer/ class JavaScriptPacker: def __init__(self): self._basicCompressionParseMaster = self.getCompressionParseMaster(False) self._specialCompressionParseMaster = self.getCompressionParseMaster(True) def basicCompression(self, script): return self._basicCompressionParseMaster.execute(script) def specialCompression(self, script): return self._specialCompressionParseMaster.execute(script) def getCompressionParseMaster(self, specialChars): IGNORE = "$1" parser = ParseMaster() parser.escapeChar = '\\' # protect strings parser.add(r"""'[^']*?'""", IGNORE) parser.add(r'"[^"]*?"', IGNORE) # remove comments parser.add(r"""//[^\n\r]*?[\n\r]""") parser.add(r"""/\*[^*]*?\*+([^/][^*]*?\*+)*?/""") # protect regular expressions parser.add(r"""\s+(\/[^\/\n\r\*][^\/\n\r]*\/g?i?)""", "$2") parser.add(r"""[^\w\$\/'"*)\?:]\/[^\/\n\r\*][^\/\n\r]*\/g?i?""", IGNORE) # remove: ;;; doSomething(); if specialChars: parser.add(""";;;[^\n\r]+[\n\r]""") # remove redundant semi-colons parser.add(r""";+\s*([};])""", "$2") # remove white-space parser.add(r"""(\b|\$)\s+(\b|\$)""", "$2 $3") parser.add(r"""([+\-])\s+([+\-])""", "$2 $3") parser.add(r"""\s+""", "") return parser def getEncoder(self, ascii): mapping = {} base = ord('0') mapping.update(dict([(i, chr(i+base)) for i in range(10)])) base = ord('a') mapping.update(dict([(i+10, chr(i+base)) for i in range(26)])) base = ord('A') mapping.update(dict([(i+36, chr(i+base)) for i in range(26)])) base = 161 mapping.update(dict([(i+62, chr(i+base)) for i in range(95)])) # zero encoding # characters: 0123456789 def encode10(charCode): return str(charCode) # inherent base36 support # characters: 0123456789abcdefghijklmnopqrstuvwxyz def encode36(charCode): l = [] remainder = charCode while 1: result, remainder = divmod(remainder, 36) l.append(mapping[remainder]) if not result: break remainder = result l.reverse() return "".join(l) # hitch a ride on base36 and add the upper case alpha characters # characters: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ def encode62(charCode): l = [] remainder = charCode while 1: result, remainder = divmod(remainder, 62) l.append(mapping[remainder]) if not result: break remainder = result l.reverse() return "".join(l) # use high-ascii values def encode95(charCode): l = [] remainder = charCode while 1: result, remainder = divmod(remainder, 95) l.append(mapping[remainder+62]) if not result: break remainder = result l.reverse() return "".join(l) if ascii <= 10: return encode10 elif ascii <= 36: return encode36 elif ascii <= 62: return encode62 return encode95 def escape(self, script): script = script.replace("\\","\\\\") script = script.replace("'","\\'") script = script.replace('\n','\\n') #return re.sub(r"""([\\'](?!\n))""", "\\$1", script) return script def escape95(self, script): result = [] for x in script: if x>'\xa1': x = "\\x%0x" % ord(x) result.append(x) return "".join(result) def encodeKeywords(self, script, encoding, fastDecode): # escape high-ascii values already in the script (i.e. in strings) if (encoding > 62): script = self.escape95(script) # create the parser parser = ParseMaster() encode = self.getEncoder(encoding) # for high-ascii, don't encode single character low-ascii if encoding > 62: regexp = r"""\w\w+""" else: regexp = r"""\w+""" # build the word list keywords = self.analyze(script, regexp, encode) encoded = keywords['encoded'] # encode def repl(match, offset): return encoded.get(match.group(offset), "") parser.add(regexp, repl) # if encoded, wrap the script in a decoding function script = parser.execute(script) script = self.bootStrap(script, keywords, encoding, fastDecode) return script def analyze(self, script, regexp, encode): # analyse # retreive all words in the script regexp = re.compile(regexp, re.M) all = regexp.findall(script) sorted = [] # list of words sorted by frequency encoded = {} # dictionary of word->encoding protected = {} # instances of "protected" words if all: unsorted = [] _protected = {} values = {} count = {} all.reverse() for word in all: word = "$"+word if word not in count: count[word] = 0 j = len(unsorted) unsorted.append(word) # make a dictionary of all of the protected words in this script # these are words that might be mistaken for encoding values[j] = encode(j) _protected["$"+values[j]] = j count[word] = count[word] + 1 # prepare to sort the word list, first we must protect # words that are also used as codes. we assign them a code # equivalent to the word itself. # e.g. if "do" falls within our encoding range # then we store keywords["do"] = "do"; # this avoids problems when decoding sorted = [None] * len(unsorted) for word in unsorted: if word in _protected and isinstance(_protected[word], int): sorted[_protected[word]] = word[1:] protected[_protected[word]] = True count[word] = 0 unsorted.sort(lambda a,b: count[b]-count[a]) j = 0 for i in range(len(sorted)): if sorted[i] is None: sorted[i] = unsorted[j][1:] j = j + 1 encoded[sorted[i]] = values[i] return {'sorted': sorted, 'encoded': encoded, 'protected': protected} def encodePrivate(self, charCode): return "_"+str(charCode) def encodeSpecialChars(self, script): parser = ParseMaster() # replace: $name -> n, $$name -> $$na def repl(match, offset): #print offset, match.groups() length = len(match.group(offset + 2)) start = length - max(length - len(match.group(offset + 3)), 0) return match.group(offset + 1)[start:start+length] + match.group(offset + 4) parser.add(r"""((\$+)([a-zA-Z\$_]+))(\d*)""", repl) # replace: _name -> _0, double-underscore (__name) is ignored regexp = r"""\b_[A-Za-z\d]\w*""" # build the word list keywords = self.analyze(script, regexp, self.encodePrivate) # quick ref encoded = keywords['encoded'] def repl(match, offset): return encoded.get(match.group(offset), "") parser.add(regexp, repl) return parser.execute(script) # build the boot function used for loading and decoding def bootStrap(self, packed, keywords, encoding, fastDecode): ENCODE = re.compile(r"""\$encode\(\$count\)""") # $packed: the packed script #packed = self.escape(packed) #packed = [packed[x*10000:(x+1)*10000] for x in range((len(packed)/10000)+1)] #packed = "'" + "'+\n'".join(packed) + "'\n" packed = "'" + self.escape(packed) + "'" # $count: number of words contained in the script count = len(keywords['sorted']) # $ascii: base for encoding ascii = min(count, encoding) or 1 # $keywords: list of words contained in the script for i in keywords['protected']: keywords['sorted'][i] = "" # convert from a string to an array keywords = "'" + "|".join(keywords['sorted']) + "'.split('|')" encoding_functions = { 10: """ function($charCode) { return $charCode; }""", 36: """ function($charCode) { return $charCode.toString(36); }""", 62: """ function($charCode) { return ($charCode < _encoding ? "" : arguments.callee(parseInt($charCode / _encoding))) + (($charCode = $charCode % _encoding) > 35 ? String.fromCharCode($charCode + 29) : $charCode.toString(36)); }""", 95: """ function($charCode) { return ($charCode < _encoding ? "" : arguments.callee($charCode / _encoding)) + String.fromCharCode($charCode % _encoding + 161); }""" } # $encode: encoding function (used for decoding the script) encode = encoding_functions[encoding] encode = encode.replace('_encoding',"$ascii") encode = encode.replace('arguments.callee', "$encode") if ascii > 10: inline = "$count.toString($ascii)" else: inline = "$count" # $decode: code snippet to speed up decoding if fastDecode: # create the decoder decode = r"""// does the browser support String.replace where the // replacement value is a function? if (!''.replace(/^/, String)) { // decode all the values we need while ($count--) $decode[$encode($count)] = $keywords[$count] || $encode($count); // global replacement function $keywords = [function($encoded){return $decode[$encoded]}]; // generic match $encode = function(){return'\\w+'}; // reset the loop counter - we are now doing a global replace $count = 1; }""" if encoding > 62: decode = decode.replace('\\\\w', "[\\xa1-\\xff]") else: # perform the encoding inline for lower ascii values if ascii < 36: decode = ENCODE.sub(inline, decode) # special case: when $count==0 there ar no keywords. i want to keep # the basic shape of the unpacking funcion so i'll frig the code... if not count: raise NotImplemented #) $decode = $decode.replace(/(\$count)\s*=\s*1/, "$1=0"); # boot function unpack = r"""function($packed, $ascii, $count, $keywords, $encode, $decode) { while ($count--) if ($keywords[$count]) $packed = $packed.replace(new RegExp("\\b" + $encode($count) + "\\b", "g"), $keywords[$count]); return $packed; }""" if fastDecode: # insert the decoder #unpack = re.sub(r"""\{""", "{" + decode + ";", unpack) unpack = unpack.replace('{', "{" + decode + ";", 1) if encoding > 62: # high-ascii # get rid of the word-boundaries for regexp matches unpack = re.sub(r"""'\\\\b'\s*\+|\+\s*'\\\\b'""", "", unpack) if ascii > 36 or encoding > 62 or fastDecode: # insert the encode function #unpack = re.sub(r"""\{""", "{$encode=" + encode + ";", unpack) unpack = unpack.replace('{', "{$encode=" + encode + ";", 1) else: # perform the encoding inline unpack = ENCODE.sub(inline, unpack) # pack the boot function too unpack = self.pack(unpack, 0, False, True) # arguments params = [packed, str(ascii), str(count), keywords] if fastDecode: # insert placeholders for the decoder params.extend(['0', "{}"]) # the whole thing return "eval(" + unpack + "(" + ",".join(params) + "))\n"; def pack(self, script, encoding=0, fastDecode=False, specialChars=False, compaction=True): script = script+"\n" self._encoding = encoding self._fastDecode = fastDecode if specialChars: script = self.specialCompression(script) script = self.encodeSpecialChars(script) else: if compaction: script = self.basicCompression(script) if encoding: script = self.encodeKeywords(script, encoding, fastDecode) return script def run(): p = JavaScriptPacker() script = open('test_plone.js').read() result = p.pack(script, compaction=False, encoding=62, fastDecode=True) open('output.js','w').write(result) def run1(): test_scripts = [] test_scripts.append(("""// ----------------------------------------------------------------------- // public interface // ----------------------------------------------------------------------- cssQuery.toString = function() { return "function cssQuery() {\n [version " + version + "]\n}"; };""", 0, False, False, """cssQuery.toString=function(){return"function cssQuery() {\n [version "+version+"]\n}"};""")) test_scripts.append(("""function test(_localvar) { var $name = 'foo'; var $$dummy = 2; return $name + $$dummy; }""", 0, False, True, """function test(_0){var n='foo';var du=2;return n+du}""")) test_scripts.append(("""function _test($localvar) { var $name = 1; var _dummy = 2; var __foo = 3; return $name + _dummy + $localvar + __foo; }""", 0, False, True, """function _1(l){var n=1;var _0=2;var __foo=3;return n+_0+l+__foo}""")) test_scripts.append(("""function _test($localvar) { var $name = 1; var _dummy = 2; var __foo = 3; return $name + _dummy + $localvar + __foo; } function _bar(_ocalvar) { var $name = 1; var _dummy = 2; var __foo = 3; return $name + _dummy + $localvar + __foo; }""", 0, False, True, """function _3(l){var n=1;var _0=2;var __foo=3;return n+_0+l+__foo}function _2(_1){var n=1;var _0=2;var __foo=3;return n+_0+l+__foo}""")) test_scripts.append(("cssQuery1.js", 0, False, False, "cssQuery1-p1.js")) test_scripts.append(("cssQuery.js", 0, False, False, "cssQuery-p1.js")) test_scripts.append(("pack.js", 0, False, False, "pack-p1.js")) test_scripts.append(("cssQuery.js", 0, False, True, "cssQuery-p2.js")) # the following ones are different, because javascript might use an # unstable sort algorithm while python uses an stable sort algorithm test_scripts.append(("pack.js", 0, False, True, "pack-p2.js")) test_scripts.append(("test.js", 0, False, True, """function _4(l){var n=1;var _0=2;var __foo=3;return n+_0+l+__foo}function _3(_1){var n=1;var _2=2;var __foo=3;return n+_2+l+__foo}""")) test_scripts.append(("test.js", 10, False, False, """eval(function(p,a,c,k,e,d){while(c--){if(k[c]){p=p.replace(new RegExp("\\b"+e(c)+"\\b","g"),k[c])}}return p}('8 13($6){0 $4=1;0 7=2;0 5=3;9 $4+7+$6+5}8 11(12){0 $4=1;0 10=2;0 5=3;9 $4+10+$6+5}',10,14,'var||||name|__foo|localvar|_dummy|function|return|_2|_bar|_ocalvar|_test'.split('|'))) """)) test_scripts.append(("test.js", 62, False, False, """eval(function(p,a,c,k,e,d){while(c--){if(k[c]){p=p.replace(new RegExp("\\b"+e(c)+"\\b","g"),k[c])}}return p}('8 d($6){0 $4=1;0 7=2;0 5=3;9 $4+7+$6+5}8 b(c){0 $4=1;0 a=2;0 5=3;9 $4+a+$6+5}',14,14,'var||||name|__foo|localvar|_dummy|function|return|_2|_bar|_ocalvar|_test'.split('|'))) """)) test_scripts.append(("test.js", 95, False, False, "test-p4.js")) test_scripts.append(("cssQuery.js", 0, False, True, "cssQuery-p3.js")) test_scripts.append(("cssQuery.js", 62, False, True, "cssQuery-p4.js")) import difflib p = JavaScriptPacker() for script, encoding, fastDecode, specialChars, expected in test_scripts: if os.path.exists(script): _script = open(script).read() else: _script = script if os.path.exists(expected): _expected = open(expected).read() else: _expected = expected print script[:20], encoding, fastDecode, specialChars, expected[:20] print "="*40 result = p.pack(_script, encoding, fastDecode, specialChars) print len(result), len(_script) if (result != _expected): print "ERROR!!!!!!!!!!!!!!!!" print _expected print result #print list(difflib.unified_diff(result, _expected)) if __name__=='__main__': run()
agpl-3.0
[ 309, 221, 6077, 12288, 12, 1015, 413, 14, 16, 334, 657, 13, 3221, 9, 334, 9397, 15, 1717, 15, 713, 9, 671, 22, 199, 309, 221, 1898, 11811, 12, 1487, 290, 17379, 4751, 199, 309, 221, 6001, 26, 1455, 921, 271, 290, 14, 379, 4751, 14, 354, 15, 199, 309, 199, 309, 221, 961, 2032, 365, 18233, 1334, 314, 17586, 13, 17732, 32426, 199, 309, 221, 6001, 26, 1455, 921, 1353, 1905, 2330, 83, 14, 1308, 15, 2383, 15, 44, 12006, 15, 18, 14, 17, 15, 199, 309, 199, 309, 221, 510, 1376, 370, 2018, 701, 11040, 269, 5653, 22985, 348, 806, 199, 199, 646, 747, 12, 295, 199, 199, 3, 282, 3510, 13, 3401, 1798, 199, 199, 533, 27019, 26, 272, 347, 636, 826, 721, 277, 12, 3965, 12, 8343, 12, 2582, 304, 267, 291, 14, 5599, 275, 3965, 267, 291, 14, 15895, 275, 8343, 267, 291, 14, 1267, 275, 2582, 339, 347, 636, 495, 721, 277, 304, 267, 372, 26054, 435, 291, 14, 5599, 435, 19607, 199, 199, 533, 510, 4823, 8, 513, 304, 272, 347, 636, 495, 721, 277, 304, 267, 372, 21590, 904, 779, 495, 8, 69, 9, 367, 325, 315, 291, 566, 199, 199, 533, 6077, 12288, 26, 272, 327, 5262, 272, 7168, 1075, 275, 378, 272, 5363, 2749, 22194, 275, 413, 272, 491, 32106, 275, 499, 272, 15443, 51, 275, 295, 14, 2014, 8, 82, 19659, 8, 7208, 295, 14, 45, 28017, 71, 272, 7605, 63, 27010, 275, 295, 14, 2014, 8, 82, 19659, 16827, 68, 7208, 295, 14, 45, 9, 272, 17055, 1149, 275, 295, 14, 2014, 8, 82, 624, 12773, 16827, 68, 11, 4, 7208, 295, 14, 45, 9, 272, 9074, 1469, 275, 295, 14, 2014, 8, 82, 624, 2941, 3135, 60, 17, 60, 15622, 2795, 2862, 7896, 17, 60, 17, 4, 7208, 295, 14, 45, 9, 272, 17682, 275, 295, 14, 2014, 8, 82, 624, 1103, 17129, 295, 14, 45, 28017, 71, 272, 327, 18495, 275, 295, 14, 2014, 8, 82, 624, 7, 7208, 295, 14, 45, 9, 272, 12355, 18348, 275, 295, 14, 2014, 21723, 88, 614, 16045, 88, 614, 25739, 88, 614, 7208, 295, 14, 45, 28017, 71, 339, 347, 636, 826, 721, 277, 304, 267, 327, 5726, 267, 291, 423, 7435, 275, 510, 4823, 342, 257, 327, 7970, 5489, 701, 1478, 267, 291, 423, 13572, 275, 942, 267, 291, 14, 4247, 1538, 275, 756, 267, 291, 14, 3765, 1610, 275, 488, 339, 347, 15137, 8, 277, 12, 1336, 12, 3268, 304, 267, 372, 1867, 88, 614, 2, 435, 1336, 14, 923, 8, 2743, 9, 435, 1867, 88, 614, 2, 339, 347, 485, 16349, 8, 277, 12, 282, 12, 312, 12, 519, 12, 284, 304, 267, 1830, 334, 73, 304, 288, 333, 275, 282, 14, 923, 8, 79, 11, 73, 13, 17, 9, 288, 340, 333, 365, 488, 26, 355, 308, 275, 3087, 288, 587, 26, 355, 308, 275, 333, 288, 519, 275, 519, 14, 1814, 480, 17351, 435, 620, 8, 73, 395, 308, 9, 288, 284, 275, 284, 446, 413, 267, 519, 275, 6077, 12288, 14, 1766, 1469, 14, 954, 21506, 17, 401, 519, 9, 267, 372, 519, 339, 327, 4575, 272, 347, 1050, 8, 277, 12, 3965, 628, 62, 11918, 8343, 29, 403, 304, 267, 340, 8343, 365, 488, 26, 288, 8343, 275, 291, 14, 7014, 267, 327, 2338, 314, 1329, 402, 1007, 13, 15264, 267, 327, 221, 446, 1050, 1373, 2952, 1924, 3851, 365, 6337, 282, 1007, 13, 5599, 267, 2582, 275, 822, 8, 4003, 12288, 14, 27544, 14, 6452, 8, 277, 423, 4672, 10260, 8, 495, 8, 5599, 7845, 435, 413, 267, 327, 1630, 314, 3851, 7962, 543, 1007, 13, 15264, 31, 267, 340, 334, 6074, 8, 15895, 12, 620, 9, 436, 6077, 12288, 14, 6348, 63, 27010, 14, 1431, 8, 15895, 2298, 288, 327, 282, 3486, 4237, 31, 334, 69, 14, 71, 14, 7880, 18, 531, 288, 340, 334, 4003, 12288, 14, 10215, 1149, 14, 1431, 8, 15895, 2298, 355, 327, 3877, 314, 1478, 334, 2972, 367, 7377, 27157, 402, 7838, 3326, 9, 355, 8343, 275, 1109, 8, 15895, 59, 17, 5728, 446, 413, 288, 587, 26, 327, 282, 23515, 4237, 334, 69, 14, 71, 14, 298, 6257, 2672, 18, 2672, 17, 531, 355, 327, 1900, 282, 805, 370, 886, 314, 4237, 355, 284, 275, 2582, 355, 519, 275, 8343, 355, 8343, 275, 2400, 282, 12, 79, 26, 291, 423, 16349, 8, 65, 12, 79, 12, 82, 12, 73, 9, 267, 327, 986, 314, 6042, 2368, 267, 291, 423, 7435, 14, 740, 8, 9959, 8, 5599, 12, 8343, 12, 2582, 430, 339, 327, 5341, 314, 2288, 8343, 272, 347, 5341, 8, 277, 12, 1059, 304, 267, 340, 291, 14, 4247, 1538, 26, 288, 519, 275, 295, 14, 2014, 8, 495, 8, 277, 423, 7435, 395, 295, 14, 41, 1204, 295, 14, 45, 9, 267, 587, 26, 288, 519, 275, 295, 14, 2014, 8, 495, 8, 277, 423, 7435, 395, 295, 14, 45, 9, 267, 1059, 275, 291, 423, 3765, 8, 875, 12, 291, 14, 3765, 1610, 9, 267, 1059, 275, 519, 14, 954, 8, 277, 423, 15895, 12, 1059, 9, 267, 1059, 275, 291, 423, 22726, 8, 875, 12, 291, 14, 3765, 1610, 9, 267, 1059, 275, 6077, 12288, 14, 27408, 14, 954, 12398, 1059, 9, 267, 372, 1059, 339, 327, 5436, 314, 7970, 5055, 880, 626, 642, 909, 1443, 506, 295, 13, 2972, 272, 347, 5305, 8, 277, 304, 267, 291, 423, 7435, 275, 510, 4823, 342, 339, 327, 642, 365, 314, 2288, 3350, 805, 334, 390, 1159, 18794, 23515, 9, 272, 347, 485, 15895, 8, 277, 12, 1336, 304, 267, 284, 275, 413, 267, 327, 4438, 4012, 314, 7970, 267, 367, 3851, 315, 291, 423, 7435, 26, 288, 340, 1336, 14, 923, 8, 73, 9, 365, 440, 488, 26, 355, 8343, 275, 3851, 14, 15895, 355, 340, 4550, 8, 15895, 304, 490, 372, 8343, 8, 1431, 12, 284, 9, 355, 916, 1228, 8, 15895, 12, 334, 442, 12, 1846, 2298, 490, 372, 1336, 14, 923, 8, 15895, 11, 73, 9, 355, 587, 26, 490, 372, 8343, 288, 587, 26, 355, 284, 275, 284, 11, 3401, 14, 1267, 339, 327, 3752, 11077, 4110, 272, 347, 485, 3765 ]
[ 221, 6077, 12288, 12, 1015, 413, 14, 16, 334, 657, 13, 3221, 9, 334, 9397, 15, 1717, 15, 713, 9, 671, 22, 199, 309, 221, 1898, 11811, 12, 1487, 290, 17379, 4751, 199, 309, 221, 6001, 26, 1455, 921, 271, 290, 14, 379, 4751, 14, 354, 15, 199, 309, 199, 309, 221, 961, 2032, 365, 18233, 1334, 314, 17586, 13, 17732, 32426, 199, 309, 221, 6001, 26, 1455, 921, 1353, 1905, 2330, 83, 14, 1308, 15, 2383, 15, 44, 12006, 15, 18, 14, 17, 15, 199, 309, 199, 309, 221, 510, 1376, 370, 2018, 701, 11040, 269, 5653, 22985, 348, 806, 199, 199, 646, 747, 12, 295, 199, 199, 3, 282, 3510, 13, 3401, 1798, 199, 199, 533, 27019, 26, 272, 347, 636, 826, 721, 277, 12, 3965, 12, 8343, 12, 2582, 304, 267, 291, 14, 5599, 275, 3965, 267, 291, 14, 15895, 275, 8343, 267, 291, 14, 1267, 275, 2582, 339, 347, 636, 495, 721, 277, 304, 267, 372, 26054, 435, 291, 14, 5599, 435, 19607, 199, 199, 533, 510, 4823, 8, 513, 304, 272, 347, 636, 495, 721, 277, 304, 267, 372, 21590, 904, 779, 495, 8, 69, 9, 367, 325, 315, 291, 566, 199, 199, 533, 6077, 12288, 26, 272, 327, 5262, 272, 7168, 1075, 275, 378, 272, 5363, 2749, 22194, 275, 413, 272, 491, 32106, 275, 499, 272, 15443, 51, 275, 295, 14, 2014, 8, 82, 19659, 8, 7208, 295, 14, 45, 28017, 71, 272, 7605, 63, 27010, 275, 295, 14, 2014, 8, 82, 19659, 16827, 68, 7208, 295, 14, 45, 9, 272, 17055, 1149, 275, 295, 14, 2014, 8, 82, 624, 12773, 16827, 68, 11, 4, 7208, 295, 14, 45, 9, 272, 9074, 1469, 275, 295, 14, 2014, 8, 82, 624, 2941, 3135, 60, 17, 60, 15622, 2795, 2862, 7896, 17, 60, 17, 4, 7208, 295, 14, 45, 9, 272, 17682, 275, 295, 14, 2014, 8, 82, 624, 1103, 17129, 295, 14, 45, 28017, 71, 272, 327, 18495, 275, 295, 14, 2014, 8, 82, 624, 7, 7208, 295, 14, 45, 9, 272, 12355, 18348, 275, 295, 14, 2014, 21723, 88, 614, 16045, 88, 614, 25739, 88, 614, 7208, 295, 14, 45, 28017, 71, 339, 347, 636, 826, 721, 277, 304, 267, 327, 5726, 267, 291, 423, 7435, 275, 510, 4823, 342, 257, 327, 7970, 5489, 701, 1478, 267, 291, 423, 13572, 275, 942, 267, 291, 14, 4247, 1538, 275, 756, 267, 291, 14, 3765, 1610, 275, 488, 339, 347, 15137, 8, 277, 12, 1336, 12, 3268, 304, 267, 372, 1867, 88, 614, 2, 435, 1336, 14, 923, 8, 2743, 9, 435, 1867, 88, 614, 2, 339, 347, 485, 16349, 8, 277, 12, 282, 12, 312, 12, 519, 12, 284, 304, 267, 1830, 334, 73, 304, 288, 333, 275, 282, 14, 923, 8, 79, 11, 73, 13, 17, 9, 288, 340, 333, 365, 488, 26, 355, 308, 275, 3087, 288, 587, 26, 355, 308, 275, 333, 288, 519, 275, 519, 14, 1814, 480, 17351, 435, 620, 8, 73, 395, 308, 9, 288, 284, 275, 284, 446, 413, 267, 519, 275, 6077, 12288, 14, 1766, 1469, 14, 954, 21506, 17, 401, 519, 9, 267, 372, 519, 339, 327, 4575, 272, 347, 1050, 8, 277, 12, 3965, 628, 62, 11918, 8343, 29, 403, 304, 267, 340, 8343, 365, 488, 26, 288, 8343, 275, 291, 14, 7014, 267, 327, 2338, 314, 1329, 402, 1007, 13, 15264, 267, 327, 221, 446, 1050, 1373, 2952, 1924, 3851, 365, 6337, 282, 1007, 13, 5599, 267, 2582, 275, 822, 8, 4003, 12288, 14, 27544, 14, 6452, 8, 277, 423, 4672, 10260, 8, 495, 8, 5599, 7845, 435, 413, 267, 327, 1630, 314, 3851, 7962, 543, 1007, 13, 15264, 31, 267, 340, 334, 6074, 8, 15895, 12, 620, 9, 436, 6077, 12288, 14, 6348, 63, 27010, 14, 1431, 8, 15895, 2298, 288, 327, 282, 3486, 4237, 31, 334, 69, 14, 71, 14, 7880, 18, 531, 288, 340, 334, 4003, 12288, 14, 10215, 1149, 14, 1431, 8, 15895, 2298, 355, 327, 3877, 314, 1478, 334, 2972, 367, 7377, 27157, 402, 7838, 3326, 9, 355, 8343, 275, 1109, 8, 15895, 59, 17, 5728, 446, 413, 288, 587, 26, 327, 282, 23515, 4237, 334, 69, 14, 71, 14, 298, 6257, 2672, 18, 2672, 17, 531, 355, 327, 1900, 282, 805, 370, 886, 314, 4237, 355, 284, 275, 2582, 355, 519, 275, 8343, 355, 8343, 275, 2400, 282, 12, 79, 26, 291, 423, 16349, 8, 65, 12, 79, 12, 82, 12, 73, 9, 267, 327, 986, 314, 6042, 2368, 267, 291, 423, 7435, 14, 740, 8, 9959, 8, 5599, 12, 8343, 12, 2582, 430, 339, 327, 5341, 314, 2288, 8343, 272, 347, 5341, 8, 277, 12, 1059, 304, 267, 340, 291, 14, 4247, 1538, 26, 288, 519, 275, 295, 14, 2014, 8, 495, 8, 277, 423, 7435, 395, 295, 14, 41, 1204, 295, 14, 45, 9, 267, 587, 26, 288, 519, 275, 295, 14, 2014, 8, 495, 8, 277, 423, 7435, 395, 295, 14, 45, 9, 267, 1059, 275, 291, 423, 3765, 8, 875, 12, 291, 14, 3765, 1610, 9, 267, 1059, 275, 519, 14, 954, 8, 277, 423, 15895, 12, 1059, 9, 267, 1059, 275, 291, 423, 22726, 8, 875, 12, 291, 14, 3765, 1610, 9, 267, 1059, 275, 6077, 12288, 14, 27408, 14, 954, 12398, 1059, 9, 267, 372, 1059, 339, 327, 5436, 314, 7970, 5055, 880, 626, 642, 909, 1443, 506, 295, 13, 2972, 272, 347, 5305, 8, 277, 304, 267, 291, 423, 7435, 275, 510, 4823, 342, 339, 327, 642, 365, 314, 2288, 3350, 805, 334, 390, 1159, 18794, 23515, 9, 272, 347, 485, 15895, 8, 277, 12, 1336, 304, 267, 284, 275, 413, 267, 327, 4438, 4012, 314, 7970, 267, 367, 3851, 315, 291, 423, 7435, 26, 288, 340, 1336, 14, 923, 8, 73, 9, 365, 440, 488, 26, 355, 8343, 275, 3851, 14, 15895, 355, 340, 4550, 8, 15895, 304, 490, 372, 8343, 8, 1431, 12, 284, 9, 355, 916, 1228, 8, 15895, 12, 334, 442, 12, 1846, 2298, 490, 372, 1336, 14, 923, 8, 15895, 11, 73, 9, 355, 587, 26, 490, 372, 8343, 288, 587, 26, 355, 284, 275, 284, 11, 3401, 14, 1267, 339, 327, 3752, 11077, 4110, 272, 347, 485, 3765, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
soycode/pattern
pattern/server/cherrypy/cherrypy/__init__.py
37
21634
"""CherryPy is a pythonic, object-oriented HTTP framework. CherryPy consists of not one, but four separate API layers. The APPLICATION LAYER is the simplest. CherryPy applications are written as a tree of classes and methods, where each branch in the tree corresponds to a branch in the URL path. Each method is a 'page handler', which receives GET and POST params as keyword arguments, and returns or yields the (HTML) body of the response. The special method name 'index' is used for paths that end in a slash, and the special method name 'default' is used to handle multiple paths via a single handler. This layer also includes: * the 'exposed' attribute (and cherrypy.expose) * cherrypy.quickstart() * _cp_config attributes * cherrypy.tools (including cherrypy.session) * cherrypy.url() The ENVIRONMENT LAYER is used by developers at all levels. It provides information about the current request and response, plus the application and server environment, via a (default) set of top-level objects: * cherrypy.request * cherrypy.response * cherrypy.engine * cherrypy.server * cherrypy.tree * cherrypy.config * cherrypy.thread_data * cherrypy.log * cherrypy.HTTPError, NotFound, and HTTPRedirect * cherrypy.lib The EXTENSION LAYER allows advanced users to construct and share their own plugins. It consists of: * Hook API * Tool API * Toolbox API * Dispatch API * Config Namespace API Finally, there is the CORE LAYER, which uses the core API's to construct the default components which are available at higher layers. You can think of the default components as the 'reference implementation' for CherryPy. Megaframeworks (and advanced users) may replace the default components with customized or extended components. The core API's are: * Application API * Engine API * Request API * Server API * WSGI API These API's are described in the CherryPy specification: http://www.cherrypy.org/wiki/CherryPySpec """ __version__ = "3.2.4" from cherrypy._cpcompat import urljoin as _urljoin, urlencode as _urlencode from cherrypy._cpcompat import basestring, unicodestr, set from cherrypy._cperror import HTTPError, HTTPRedirect, InternalRedirect from cherrypy._cperror import NotFound, CherryPyException, TimeoutError from cherrypy import _cpdispatch as dispatch from cherrypy import _cptools tools = _cptools.default_toolbox Tool = _cptools.Tool from cherrypy import _cprequest from cherrypy.lib import httputil as _httputil from cherrypy import _cptree tree = _cptree.Tree() from cherrypy._cptree import Application from cherrypy import _cpwsgi as wsgi from cherrypy import process try: from cherrypy.process import win32 engine = win32.Win32Bus() engine.console_control_handler = win32.ConsoleCtrlHandler(engine) del win32 except ImportError: engine = process.bus # Timeout monitor. We add two channels to the engine # to which cherrypy.Application will publish. engine.listeners['before_request'] = set() engine.listeners['after_request'] = set() class _TimeoutMonitor(process.plugins.Monitor): def __init__(self, bus): self.servings = [] process.plugins.Monitor.__init__(self, bus, self.run) def before_request(self): self.servings.append((serving.request, serving.response)) def after_request(self): try: self.servings.remove((serving.request, serving.response)) except ValueError: pass def run(self): """Check timeout on all responses. (Internal)""" for req, resp in self.servings: resp.check_timeout() engine.timeout_monitor = _TimeoutMonitor(engine) engine.timeout_monitor.subscribe() engine.autoreload = process.plugins.Autoreloader(engine) engine.autoreload.subscribe() engine.thread_manager = process.plugins.ThreadManager(engine) engine.thread_manager.subscribe() engine.signal_handler = process.plugins.SignalHandler(engine) class _HandleSignalsPlugin(object): """Handle signals from other processes based on the configured platform handlers above.""" def __init__(self, bus): self.bus = bus def subscribe(self): """Add the handlers based on the platform""" if hasattr(self.bus, "signal_handler"): self.bus.signal_handler.subscribe() if hasattr(self.bus, "console_control_handler"): self.bus.console_control_handler.subscribe() engine.signals = _HandleSignalsPlugin(engine) from cherrypy import _cpserver server = _cpserver.Server() server.subscribe() def quickstart(root=None, script_name="", config=None): """Mount the given root, start the builtin server (and engine), then block. root: an instance of a "controller class" (a collection of page handler methods) which represents the root of the application. script_name: a string containing the "mount point" of the application. This should start with a slash, and be the path portion of the URL at which to mount the given root. For example, if root.index() will handle requests to "http://www.example.com:8080/dept/app1/", then the script_name argument would be "/dept/app1". It MUST NOT end in a slash. If the script_name refers to the root of the URI, it MUST be an empty string (not "/"). config: a file or dict containing application config. If this contains a [global] section, those entries will be used in the global (site-wide) config. """ if config: _global_conf_alias.update(config) tree.mount(root, script_name, config) engine.signals.subscribe() engine.start() engine.block() from cherrypy._cpcompat import threadlocal as _local class _Serving(_local): """An interface for registering request and response objects. Rather than have a separate "thread local" object for the request and the response, this class works as a single threadlocal container for both objects (and any others which developers wish to define). In this way, we can easily dump those objects when we stop/start a new HTTP conversation, yet still refer to them as module-level globals in a thread-safe way. """ request = _cprequest.Request(_httputil.Host("127.0.0.1", 80), _httputil.Host("127.0.0.1", 1111)) """ The request object for the current thread. In the main thread, and any threads which are not receiving HTTP requests, this is None.""" response = _cprequest.Response() """ The response object for the current thread. In the main thread, and any threads which are not receiving HTTP requests, this is None.""" def load(self, request, response): self.request = request self.response = response def clear(self): """Remove all attributes of self.""" self.__dict__.clear() serving = _Serving() class _ThreadLocalProxy(object): __slots__ = ['__attrname__', '__dict__'] def __init__(self, attrname): self.__attrname__ = attrname def __getattr__(self, name): child = getattr(serving, self.__attrname__) return getattr(child, name) def __setattr__(self, name, value): if name in ("__attrname__", ): object.__setattr__(self, name, value) else: child = getattr(serving, self.__attrname__) setattr(child, name, value) def __delattr__(self, name): child = getattr(serving, self.__attrname__) delattr(child, name) def _get_dict(self): child = getattr(serving, self.__attrname__) d = child.__class__.__dict__.copy() d.update(child.__dict__) return d __dict__ = property(_get_dict) def __getitem__(self, key): child = getattr(serving, self.__attrname__) return child[key] def __setitem__(self, key, value): child = getattr(serving, self.__attrname__) child[key] = value def __delitem__(self, key): child = getattr(serving, self.__attrname__) del child[key] def __contains__(self, key): child = getattr(serving, self.__attrname__) return key in child def __len__(self): child = getattr(serving, self.__attrname__) return len(child) def __nonzero__(self): child = getattr(serving, self.__attrname__) return bool(child) # Python 3 __bool__ = __nonzero__ # Create request and response object (the same objects will be used # throughout the entire life of the webserver, but will redirect # to the "serving" object) request = _ThreadLocalProxy('request') response = _ThreadLocalProxy('response') # Create thread_data object as a thread-specific all-purpose storage class _ThreadData(_local): """A container for thread-specific data.""" thread_data = _ThreadData() # Monkeypatch pydoc to allow help() to go through the threadlocal proxy. # Jan 2007: no Googleable examples of anyone else replacing pydoc.resolve. # The only other way would be to change what is returned from type(request) # and that's not possible in pure Python (you'd have to fake ob_type). def _cherrypy_pydoc_resolve(thing, forceload=0): """Given an object or a path to an object, get the object and its name.""" if isinstance(thing, _ThreadLocalProxy): thing = getattr(serving, thing.__attrname__) return _pydoc._builtin_resolve(thing, forceload) try: import pydoc as _pydoc _pydoc._builtin_resolve = _pydoc.resolve _pydoc.resolve = _cherrypy_pydoc_resolve except ImportError: pass from cherrypy import _cplogging class _GlobalLogManager(_cplogging.LogManager): """A site-wide LogManager; routes to app.log or global log as appropriate. This :class:`LogManager<cherrypy._cplogging.LogManager>` implements cherrypy.log() and cherrypy.log.access(). If either function is called during a request, the message will be sent to the logger for the current Application. If they are called outside of a request, the message will be sent to the site-wide logger. """ def __call__(self, *args, **kwargs): """Log the given message to the app.log or global log as appropriate.""" # Do NOT use try/except here. See http://www.cherrypy.org/ticket/945 if hasattr(request, 'app') and hasattr(request.app, 'log'): log = request.app.log else: log = self return log.error(*args, **kwargs) def access(self): """Log an access message to the app.log or global log as appropriate.""" try: return request.app.log.access() except AttributeError: return _cplogging.LogManager.access(self) log = _GlobalLogManager() # Set a default screen handler on the global log. log.screen = True log.error_file = '' # Using an access file makes CP about 10% slower. Leave off by default. log.access_file = '' def _buslog(msg, level): log.error(msg, 'ENGINE', severity=level) engine.subscribe('log', _buslog) # Helper functions for CP apps # def expose(func=None, alias=None): """Expose the function, optionally providing an alias or set of aliases.""" def expose_(func): func.exposed = True if alias is not None: if isinstance(alias, basestring): parents[alias.replace(".", "_")] = func else: for a in alias: parents[a.replace(".", "_")] = func return func import sys, types if isinstance(func, (types.FunctionType, types.MethodType)): if alias is None: # @expose func.exposed = True return func else: # func = expose(func, alias) parents = sys._getframe(1).f_locals return expose_(func) elif func is None: if alias is None: # @expose() parents = sys._getframe(1).f_locals return expose_ else: # @expose(alias="alias") or # @expose(alias=["alias1", "alias2"]) parents = sys._getframe(1).f_locals return expose_ else: # @expose("alias") or # @expose(["alias1", "alias2"]) parents = sys._getframe(1).f_locals alias = func return expose_ def popargs(*args, **kwargs): """A decorator for _cp_dispatch (cherrypy.dispatch.Dispatcher.dispatch_method_name). Optional keyword argument: handler=(Object or Function) Provides a _cp_dispatch function that pops off path segments into cherrypy.request.params under the names specified. The dispatch is then forwarded on to the next vpath element. Note that any existing (and exposed) member function of the class that popargs is applied to will override that value of the argument. For instance, if you have a method named "list" on the class decorated with popargs, then accessing "/list" will call that function instead of popping it off as the requested parameter. This restriction applies to all _cp_dispatch functions. The only way around this restriction is to create a "blank class" whose only function is to provide _cp_dispatch. If there are path elements after the arguments, or more arguments are requested than are available in the vpath, then the 'handler' keyword argument specifies the next object to handle the parameterized request. If handler is not specified or is None, then self is used. If handler is a function rather than an instance, then that function will be called with the args specified and the return value from that function used as the next object INSTEAD of adding the parameters to cherrypy.request.args. This decorator may be used in one of two ways: As a class decorator: @cherrypy.popargs('year', 'month', 'day') class Blog: def index(self, year=None, month=None, day=None): #Process the parameters here; any url like #/, /2009, /2009/12, or /2009/12/31 #will fill in the appropriate parameters. def create(self): #This link will still be available at /create. Defined functions #take precedence over arguments. Or as a member of a class: class Blog: _cp_dispatch = cherrypy.popargs('year', 'month', 'day') #... The handler argument may be used to mix arguments with built in functions. For instance, the following setup allows different activities at the day, month, and year level: class DayHandler: def index(self, year, month, day): #Do something with this day; probably list entries def delete(self, year, month, day): #Delete all entries for this day @cherrypy.popargs('day', handler=DayHandler()) class MonthHandler: def index(self, year, month): #Do something with this month; probably list entries def delete(self, year, month): #Delete all entries for this month @cherrypy.popargs('month', handler=MonthHandler()) class YearHandler: def index(self, year): #Do something with this year #... @cherrypy.popargs('year', handler=YearHandler()) class Root: def index(self): #... """ #Since keyword arg comes after *args, we have to process it ourselves #for lower versions of python. handler = None handler_call = False for k,v in kwargs.items(): if k == 'handler': handler = v else: raise TypeError( "cherrypy.popargs() got an unexpected keyword argument '{0}'" \ .format(k) ) import inspect if handler is not None \ and (hasattr(handler, '__call__') or inspect.isclass(handler)): handler_call = True def decorated(cls_or_self=None, vpath=None): if inspect.isclass(cls_or_self): #cherrypy.popargs is a class decorator cls = cls_or_self setattr(cls, dispatch.Dispatcher.dispatch_method_name, decorated) return cls #We're in the actual function self = cls_or_self parms = {} for arg in args: if not vpath: break parms[arg] = vpath.pop(0) if handler is not None: if handler_call: return handler(**parms) else: request.params.update(parms) return handler request.params.update(parms) #If we are the ultimate handler, then to prevent our _cp_dispatch #from being called again, we will resolve remaining elements through #getattr() directly. if vpath: return getattr(self, vpath.pop(0), None) else: return self return decorated def url(path="", qs="", script_name=None, base=None, relative=None): """Create an absolute URL for the given path. If 'path' starts with a slash ('/'), this will return (base + script_name + path + qs). If it does not start with a slash, this returns (base + script_name [+ request.path_info] + path + qs). If script_name is None, cherrypy.request will be used to find a script_name, if available. If base is None, cherrypy.request.base will be used (if available). Note that you can use cherrypy.tools.proxy to change this. Finally, note that this function can be used to obtain an absolute URL for the current request path (minus the querystring) by passing no args. If you call url(qs=cherrypy.request.query_string), you should get the original browser URL (assuming no internal redirections). If relative is None or not provided, request.app.relative_urls will be used (if available, else False). If False, the output will be an absolute URL (including the scheme, host, vhost, and script_name). If True, the output will instead be a URL that is relative to the current request path, perhaps including '..' atoms. If relative is the string 'server', the output will instead be a URL that is relative to the server root; i.e., it will start with a slash. """ if isinstance(qs, (tuple, list, dict)): qs = _urlencode(qs) if qs: qs = '?' + qs if request.app: if not path.startswith("/"): # Append/remove trailing slash from path_info as needed # (this is to support mistyped URL's without redirecting; # if you want to redirect, use tools.trailing_slash). pi = request.path_info if request.is_index is True: if not pi.endswith('/'): pi = pi + '/' elif request.is_index is False: if pi.endswith('/') and pi != '/': pi = pi[:-1] if path == "": path = pi else: path = _urljoin(pi, path) if script_name is None: script_name = request.script_name if base is None: base = request.base newurl = base + script_name + path + qs else: # No request.app (we're being called outside a request). # We'll have to guess the base from server.* attributes. # This will produce very different results from the above # if you're using vhosts or tools.proxy. if base is None: base = server.base() path = (script_name or "") + path newurl = base + path + qs if './' in newurl: # Normalize the URL by removing ./ and ../ atoms = [] for atom in newurl.split('/'): if atom == '.': pass elif atom == '..': atoms.pop() else: atoms.append(atom) newurl = '/'.join(atoms) # At this point, we should have a fully-qualified absolute URL. if relative is None: relative = getattr(request.app, "relative_urls", False) # See http://www.ietf.org/rfc/rfc2396.txt if relative == 'server': # "A relative reference beginning with a single slash character is # termed an absolute-path reference, as defined by <abs_path>..." # This is also sometimes called "server-relative". newurl = '/' + '/'.join(newurl.split('/', 3)[3:]) elif relative: # "A relative reference that does not begin with a scheme name # or a slash character is termed a relative-path reference." old = url(relative=False).split('/')[:-1] new = newurl.split('/') while old and new: a, b = old[0], new[0] if a != b: break old.pop(0) new.pop(0) new = (['..'] * len(old)) + new newurl = '/'.join(new) return newurl # import _cpconfig last so it can reference other top-level objects from cherrypy import _cpconfig # Use _global_conf_alias so quickstart can use 'config' as an arg # without shadowing cherrypy.config. config = _global_conf_alias = _cpconfig.Config() config.defaults = { 'tools.log_tracebacks.on': True, 'tools.log_headers.on': True, 'tools.trailing_slash.on': True, 'tools.encode.on': True } config.namespaces["log"] = lambda k, v: setattr(log, k, v) config.namespaces["checker"] = lambda k, v: setattr(checker, k, v) # Must reset to get our defaults applied. config.reset() from cherrypy import _cpchecker checker = _cpchecker.Checker() engine.subscribe('start', checker)
bsd-3-clause
[ 624, 1049, 281, 27794, 365, 282, 2366, 530, 12, 909, 13, 16039, 287, 471, 3101, 10059, 14, 421, 199, 1049, 281, 27794, 18581, 402, 440, 1373, 12, 1325, 11648, 7396, 3261, 9393, 14, 199, 199, 1918, 19525, 17939, 491, 3448, 540, 365, 314, 3486, 270, 14, 30992, 27794, 13103, 787, 5313, 465, 199, 65, 3123, 402, 3992, 436, 3102, 12, 2382, 1924, 5246, 315, 314, 3123, 13718, 370, 199, 65, 5246, 315, 314, 2851, 931, 14, 7048, 1083, 365, 282, 283, 1606, 3016, 297, 1314, 23192, 199, 2970, 436, 8761, 1862, 465, 4252, 2368, 12, 436, 2529, 503, 14801, 314, 334, 4943, 9, 199, 2030, 402, 314, 1177, 14, 710, 4539, 1083, 536, 283, 1080, 7, 365, 1202, 367, 3792, 199, 9099, 1284, 315, 282, 14457, 12, 436, 314, 4539, 1083, 536, 283, 885, 7, 365, 1202, 370, 199, 2479, 3663, 3792, 4799, 282, 2849, 3016, 14, 961, 4045, 2597, 6952, 26, 421, 627, 314, 283, 26717, 7, 2225, 334, 460, 13397, 14, 20586, 9, 199, 627, 13397, 14, 28957, 342, 199, 627, 485, 1850, 63, 888, 3004, 199, 627, 13397, 14, 2537, 334, 15768, 13397, 14, 1730, 9, 199, 627, 13397, 14, 633, 342, 199, 199, 1918, 5070, 13679, 615, 4479, 491, 3448, 540, 365, 1202, 701, 19782, 737, 1006, 11106, 14, 2779, 6571, 199, 11697, 3595, 314, 1453, 1056, 436, 1177, 12, 12254, 314, 4223, 199, 460, 1654, 3734, 12, 4799, 282, 334, 885, 9, 663, 402, 2746, 13, 1896, 2251, 26, 421, 627, 13397, 14, 1069, 199, 627, 13397, 14, 1310, 199, 627, 13397, 14, 3908, 199, 627, 13397, 14, 1000, 199, 627, 13397, 14, 2350, 199, 627, 13397, 14, 888, 199, 627, 13397, 14, 2671, 63, 576, 199, 627, 13397, 14, 793, 199, 627, 13397, 14, 12815, 12, 21909, 12, 436, 3101, 7071, 199, 627, 13397, 14, 773, 199, 199, 1918, 20203, 742, 3579, 491, 3448, 540, 6127, 19472, 4390, 370, 6982, 436, 8663, 3932, 5705, 199, 5265, 14, 2779, 18581, 402, 26, 421, 627, 24837, 3261, 199, 627, 15650, 3261, 199, 627, 15650, 1977, 3261, 199, 627, 28626, 3261, 199, 627, 4094, 19317, 3261, 199, 199, 8694, 1183, 12, 2337, 365, 314, 445, 5788, 491, 3448, 540, 12, 1314, 4440, 314, 6170, 3261, 1159, 370, 6982, 199, 1589, 849, 7323, 1314, 787, 2808, 737, 10948, 9393, 14, 2047, 883, 13516, 199, 1618, 314, 849, 7323, 465, 314, 283, 4443, 4514, 7, 367, 30992, 27794, 14, 199, 1352, 5294, 32037, 334, 460, 19472, 4390, 9, 1443, 3350, 314, 849, 7323, 199, 1045, 26707, 503, 9243, 7323, 14, 710, 6170, 3261, 1159, 787, 26, 421, 627, 13515, 3261, 199, 627, 12580, 3261, 199, 627, 4784, 3261, 199, 627, 7146, 3261, 199, 627, 9279, 3261, 199, 199, 20676, 3261, 1159, 787, 11736, 315, 314, 30992, 27794, 8929, 26, 199, 1014, 921, 1544, 14, 23438, 14, 1308, 15, 6797, 15, 1049, 281, 27794, 5307, 199, 624, 199, 199, 363, 1023, 363, 275, 298, 19, 14, 18, 14, 20, 2, 199, 199, 504, 13397, 423, 1850, 5819, 492, 20818, 465, 485, 17755, 12, 16511, 465, 485, 10738, 199, 504, 13397, 423, 1850, 5819, 492, 7116, 12, 2649, 495, 12, 663, 199, 199, 504, 13397, 423, 67, 529, 451, 492, 15050, 12, 3101, 7071, 12, 12624, 7071, 199, 504, 13397, 423, 67, 529, 451, 492, 21909, 12, 30992, 27794, 1726, 12, 31886, 199, 199, 504, 13397, 492, 485, 1850, 6052, 465, 7634, 199, 199, 504, 13397, 492, 485, 1850, 2537, 199, 2537, 275, 485, 1850, 2537, 14, 885, 63, 3557, 1977, 199, 5157, 275, 485, 1850, 2537, 14, 5157, 199, 199, 504, 13397, 492, 485, 67, 26762, 199, 504, 13397, 14, 773, 492, 1455, 1974, 465, 485, 1014, 1974, 199, 199, 504, 13397, 492, 485, 67, 541, 850, 199, 2350, 275, 485, 67, 541, 850, 14, 3987, 342, 199, 504, 13397, 423, 67, 541, 850, 492, 13515, 199, 504, 13397, 492, 485, 1850, 6508, 465, 12464, 199, 199, 504, 13397, 492, 2112, 199, 893, 26, 272, 687, 13397, 14, 1412, 492, 4747, 708, 272, 6869, 275, 4747, 708, 14, 8886, 708, 12106, 342, 272, 6869, 14, 6614, 63, 2785, 63, 2232, 275, 4747, 708, 14, 9270, 9778, 2461, 8, 3908, 9, 272, 2150, 4747, 708, 199, 2590, 3545, 26, 272, 6869, 275, 2112, 14, 5610, 421, 199, 3, 12878, 8372, 14, 2136, 1050, 2877, 9245, 370, 314, 6869, 199, 3, 370, 1314, 13397, 14, 5039, 911, 2780, 14, 199, 3908, 14, 17301, 459, 5182, 63, 1069, 418, 275, 663, 342, 199, 3908, 14, 17301, 459, 4399, 63, 1069, 418, 275, 663, 342, 199, 199, 533, 485, 6372, 13189, 8, 1412, 14, 5265, 14, 13189, 304, 339, 347, 636, 826, 721, 277, 12, 10414, 304, 267, 291, 14, 7297, 780, 275, 942, 267, 2112, 14, 5265, 14, 13189, 855, 826, 721, 277, 12, 10414, 12, 291, 14, 1065, 9, 339, 347, 2544, 63, 1069, 8, 277, 304, 267, 291, 14, 7297, 780, 14, 740, 1332, 14717, 14, 1069, 12, 22701, 14, 1310, 430, 339, 347, 2410, 63, 1069, 8, 277, 304, 267, 862, 26, 288, 291, 14, 7297, 780, 14, 2168, 1332, 14717, 14, 1069, 12, 22701, 14, 1310, 430, 267, 871, 1722, 26, 288, 986, 339, 347, 1255, 8, 277, 304, 267, 408, 1799, 2653, 641, 1006, 9320, 14, 334, 8405, 9471, 267, 367, 2648, 12, 3085, 315, 291, 14, 7297, 780, 26, 288, 3085, 14, 1074, 63, 2593, 342, 199, 3908, 14, 2593, 63, 7157, 275, 485, 6372, 13189, 8, 3908, 9, 199, 3908, 14, 2593, 63, 7157, 14, 10108, 342, 199, 199, 3908, 14, 27082, 912, 275, 2112, 14, 5265, 14, 23570, 720, 3422, 8, 3908, 9, 199, 3908, 14, 27082, 912, 14, 10108, 342, 199, 199, 3908, 14, 2671, 63, 2609, 275, 2112, 14, 5265, 14, 4436, 2988, 8, 3908, 9, 199, 3908, 14, 2671, 63, 2609, 14, 10108, 342, 199, 199, 3908, 14, 4653, 63, 2232, 275, 2112, 14, 5265, 14, 11274, 2461, 8, 3908, 9, 421, 199, 533, 485, 5940, 28536, 5061, 8, 785, 304, 272, 408, 5940, 10166, 687, 1163, 10358, 4079, 641, 314, 7526, 272, 4298, 8297, 3432, 1041, 339, 347, 636, 826, 721, 277, 12, 10414, 304, 267, 291, 14, 5610, 275, 10414, 339, 347, 23421, 8 ]
[ 1049, 281, 27794, 365, 282, 2366, 530, 12, 909, 13, 16039, 287, 471, 3101, 10059, 14, 421, 199, 1049, 281, 27794, 18581, 402, 440, 1373, 12, 1325, 11648, 7396, 3261, 9393, 14, 199, 199, 1918, 19525, 17939, 491, 3448, 540, 365, 314, 3486, 270, 14, 30992, 27794, 13103, 787, 5313, 465, 199, 65, 3123, 402, 3992, 436, 3102, 12, 2382, 1924, 5246, 315, 314, 3123, 13718, 370, 199, 65, 5246, 315, 314, 2851, 931, 14, 7048, 1083, 365, 282, 283, 1606, 3016, 297, 1314, 23192, 199, 2970, 436, 8761, 1862, 465, 4252, 2368, 12, 436, 2529, 503, 14801, 314, 334, 4943, 9, 199, 2030, 402, 314, 1177, 14, 710, 4539, 1083, 536, 283, 1080, 7, 365, 1202, 367, 3792, 199, 9099, 1284, 315, 282, 14457, 12, 436, 314, 4539, 1083, 536, 283, 885, 7, 365, 1202, 370, 199, 2479, 3663, 3792, 4799, 282, 2849, 3016, 14, 961, 4045, 2597, 6952, 26, 421, 627, 314, 283, 26717, 7, 2225, 334, 460, 13397, 14, 20586, 9, 199, 627, 13397, 14, 28957, 342, 199, 627, 485, 1850, 63, 888, 3004, 199, 627, 13397, 14, 2537, 334, 15768, 13397, 14, 1730, 9, 199, 627, 13397, 14, 633, 342, 199, 199, 1918, 5070, 13679, 615, 4479, 491, 3448, 540, 365, 1202, 701, 19782, 737, 1006, 11106, 14, 2779, 6571, 199, 11697, 3595, 314, 1453, 1056, 436, 1177, 12, 12254, 314, 4223, 199, 460, 1654, 3734, 12, 4799, 282, 334, 885, 9, 663, 402, 2746, 13, 1896, 2251, 26, 421, 627, 13397, 14, 1069, 199, 627, 13397, 14, 1310, 199, 627, 13397, 14, 3908, 199, 627, 13397, 14, 1000, 199, 627, 13397, 14, 2350, 199, 627, 13397, 14, 888, 199, 627, 13397, 14, 2671, 63, 576, 199, 627, 13397, 14, 793, 199, 627, 13397, 14, 12815, 12, 21909, 12, 436, 3101, 7071, 199, 627, 13397, 14, 773, 199, 199, 1918, 20203, 742, 3579, 491, 3448, 540, 6127, 19472, 4390, 370, 6982, 436, 8663, 3932, 5705, 199, 5265, 14, 2779, 18581, 402, 26, 421, 627, 24837, 3261, 199, 627, 15650, 3261, 199, 627, 15650, 1977, 3261, 199, 627, 28626, 3261, 199, 627, 4094, 19317, 3261, 199, 199, 8694, 1183, 12, 2337, 365, 314, 445, 5788, 491, 3448, 540, 12, 1314, 4440, 314, 6170, 3261, 1159, 370, 6982, 199, 1589, 849, 7323, 1314, 787, 2808, 737, 10948, 9393, 14, 2047, 883, 13516, 199, 1618, 314, 849, 7323, 465, 314, 283, 4443, 4514, 7, 367, 30992, 27794, 14, 199, 1352, 5294, 32037, 334, 460, 19472, 4390, 9, 1443, 3350, 314, 849, 7323, 199, 1045, 26707, 503, 9243, 7323, 14, 710, 6170, 3261, 1159, 787, 26, 421, 627, 13515, 3261, 199, 627, 12580, 3261, 199, 627, 4784, 3261, 199, 627, 7146, 3261, 199, 627, 9279, 3261, 199, 199, 20676, 3261, 1159, 787, 11736, 315, 314, 30992, 27794, 8929, 26, 199, 1014, 921, 1544, 14, 23438, 14, 1308, 15, 6797, 15, 1049, 281, 27794, 5307, 199, 624, 199, 199, 363, 1023, 363, 275, 298, 19, 14, 18, 14, 20, 2, 199, 199, 504, 13397, 423, 1850, 5819, 492, 20818, 465, 485, 17755, 12, 16511, 465, 485, 10738, 199, 504, 13397, 423, 1850, 5819, 492, 7116, 12, 2649, 495, 12, 663, 199, 199, 504, 13397, 423, 67, 529, 451, 492, 15050, 12, 3101, 7071, 12, 12624, 7071, 199, 504, 13397, 423, 67, 529, 451, 492, 21909, 12, 30992, 27794, 1726, 12, 31886, 199, 199, 504, 13397, 492, 485, 1850, 6052, 465, 7634, 199, 199, 504, 13397, 492, 485, 1850, 2537, 199, 2537, 275, 485, 1850, 2537, 14, 885, 63, 3557, 1977, 199, 5157, 275, 485, 1850, 2537, 14, 5157, 199, 199, 504, 13397, 492, 485, 67, 26762, 199, 504, 13397, 14, 773, 492, 1455, 1974, 465, 485, 1014, 1974, 199, 199, 504, 13397, 492, 485, 67, 541, 850, 199, 2350, 275, 485, 67, 541, 850, 14, 3987, 342, 199, 504, 13397, 423, 67, 541, 850, 492, 13515, 199, 504, 13397, 492, 485, 1850, 6508, 465, 12464, 199, 199, 504, 13397, 492, 2112, 199, 893, 26, 272, 687, 13397, 14, 1412, 492, 4747, 708, 272, 6869, 275, 4747, 708, 14, 8886, 708, 12106, 342, 272, 6869, 14, 6614, 63, 2785, 63, 2232, 275, 4747, 708, 14, 9270, 9778, 2461, 8, 3908, 9, 272, 2150, 4747, 708, 199, 2590, 3545, 26, 272, 6869, 275, 2112, 14, 5610, 421, 199, 3, 12878, 8372, 14, 2136, 1050, 2877, 9245, 370, 314, 6869, 199, 3, 370, 1314, 13397, 14, 5039, 911, 2780, 14, 199, 3908, 14, 17301, 459, 5182, 63, 1069, 418, 275, 663, 342, 199, 3908, 14, 17301, 459, 4399, 63, 1069, 418, 275, 663, 342, 199, 199, 533, 485, 6372, 13189, 8, 1412, 14, 5265, 14, 13189, 304, 339, 347, 636, 826, 721, 277, 12, 10414, 304, 267, 291, 14, 7297, 780, 275, 942, 267, 2112, 14, 5265, 14, 13189, 855, 826, 721, 277, 12, 10414, 12, 291, 14, 1065, 9, 339, 347, 2544, 63, 1069, 8, 277, 304, 267, 291, 14, 7297, 780, 14, 740, 1332, 14717, 14, 1069, 12, 22701, 14, 1310, 430, 339, 347, 2410, 63, 1069, 8, 277, 304, 267, 862, 26, 288, 291, 14, 7297, 780, 14, 2168, 1332, 14717, 14, 1069, 12, 22701, 14, 1310, 430, 267, 871, 1722, 26, 288, 986, 339, 347, 1255, 8, 277, 304, 267, 408, 1799, 2653, 641, 1006, 9320, 14, 334, 8405, 9471, 267, 367, 2648, 12, 3085, 315, 291, 14, 7297, 780, 26, 288, 3085, 14, 1074, 63, 2593, 342, 199, 3908, 14, 2593, 63, 7157, 275, 485, 6372, 13189, 8, 3908, 9, 199, 3908, 14, 2593, 63, 7157, 14, 10108, 342, 199, 199, 3908, 14, 27082, 912, 275, 2112, 14, 5265, 14, 23570, 720, 3422, 8, 3908, 9, 199, 3908, 14, 27082, 912, 14, 10108, 342, 199, 199, 3908, 14, 2671, 63, 2609, 275, 2112, 14, 5265, 14, 4436, 2988, 8, 3908, 9, 199, 3908, 14, 2671, 63, 2609, 14, 10108, 342, 199, 199, 3908, 14, 4653, 63, 2232, 275, 2112, 14, 5265, 14, 11274, 2461, 8, 3908, 9, 421, 199, 533, 485, 5940, 28536, 5061, 8, 785, 304, 272, 408, 5940, 10166, 687, 1163, 10358, 4079, 641, 314, 7526, 272, 4298, 8297, 3432, 1041, 339, 347, 636, 826, 721, 277, 12, 10414, 304, 267, 291, 14, 5610, 275, 10414, 339, 347, 23421, 8, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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529
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2010, Eucalyptus Systems, Inc. # All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, dis- # tribute, sublicense, and/or sell copies of the Software, and to permit # persons to whom the Software is furnished to do so, subject to the fol- # lowing conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. from boto.regioninfo import RegionInfo class EC2RegionInfo(RegionInfo): """ Represents an EC2 Region """ def __init__(self, connection=None, name=None, endpoint=None): from boto.ec2.connection import EC2Connection super(EC2RegionInfo, self).__init__(connection, name, endpoint, EC2Connection)
mit
[ 3, 1898, 334, 67, 9, 8315, 13, 6542, 603, 9414, 598, 26272, 1455, 921, 71, 26272, 14, 1308, 15, 199, 3, 1898, 334, 67, 9, 7129, 12, 662, 85, 915, 89, 541, 527, 15285, 12, 3277, 14, 199, 3, 2900, 4481, 4644, 14, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 199, 3, 1331, 402, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 199, 3, 298, 10337, 1288, 370, 7962, 315, 314, 2290, 1928, 10588, 12, 5893, 199, 3, 1928, 12305, 314, 4481, 370, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 2153, 13, 199, 3, 28420, 12, 13473, 12, 436, 15, 269, 12743, 6866, 402, 314, 2290, 12, 436, 370, 11291, 199, 3, 12103, 370, 12676, 314, 2290, 365, 13985, 370, 886, 880, 12, 5420, 370, 314, 1699, 13, 199, 3, 28486, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 199, 3, 315, 1006, 6866, 503, 13393, 12468, 402, 314, 2290, 14, 199, 3, 199, 3, 2334, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 7168, 199, 3, 1549, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 28471, 13, 199, 3, 28463, 12, 3092, 2381, 437, 3115, 3104, 2401, 13229, 14, 1621, 4825, 6461, 199, 3, 7000, 2334, 17632, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 5603, 12, 199, 3, 7061, 1621, 1261, 9612, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 4442, 12, 199, 3, 5738, 1634, 1549, 1621, 11287, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 5010, 13198, 199, 3, 1621, 2334, 4141, 14, 199, 199, 504, 6055, 14, 4551, 815, 492, 22240, 2354, 199, 199, 533, 15352, 18, 10708, 2354, 8, 10708, 2354, 304, 272, 408, 272, 21591, 376, 15352, 18, 22240, 272, 408, 339, 347, 636, 826, 721, 277, 12, 1950, 29, 403, 12, 536, 29, 403, 12, 6037, 29, 403, 304, 267, 687, 6055, 14, 825, 18, 14, 2105, 492, 15352, 18, 3225, 267, 1613, 8, 4220, 18, 10708, 2354, 12, 291, 2843, 826, 721, 2105, 12, 536, 12, 6037, 12, 1169, 15352, 18, 3225, 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 ]
[ 1898, 334, 67, 9, 8315, 13, 6542, 603, 9414, 598, 26272, 1455, 921, 71, 26272, 14, 1308, 15, 199, 3, 1898, 334, 67, 9, 7129, 12, 662, 85, 915, 89, 541, 527, 15285, 12, 3277, 14, 199, 3, 2900, 4481, 4644, 14, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 199, 3, 1331, 402, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 199, 3, 298, 10337, 1288, 370, 7962, 315, 314, 2290, 1928, 10588, 12, 5893, 199, 3, 1928, 12305, 314, 4481, 370, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 2153, 13, 199, 3, 28420, 12, 13473, 12, 436, 15, 269, 12743, 6866, 402, 314, 2290, 12, 436, 370, 11291, 199, 3, 12103, 370, 12676, 314, 2290, 365, 13985, 370, 886, 880, 12, 5420, 370, 314, 1699, 13, 199, 3, 28486, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 199, 3, 315, 1006, 6866, 503, 13393, 12468, 402, 314, 2290, 14, 199, 3, 199, 3, 2334, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 7168, 199, 3, 1549, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 28471, 13, 199, 3, 28463, 12, 3092, 2381, 437, 3115, 3104, 2401, 13229, 14, 1621, 4825, 6461, 199, 3, 7000, 2334, 17632, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 5603, 12, 199, 3, 7061, 1621, 1261, 9612, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 4442, 12, 199, 3, 5738, 1634, 1549, 1621, 11287, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 5010, 13198, 199, 3, 1621, 2334, 4141, 14, 199, 199, 504, 6055, 14, 4551, 815, 492, 22240, 2354, 199, 199, 533, 15352, 18, 10708, 2354, 8, 10708, 2354, 304, 272, 408, 272, 21591, 376, 15352, 18, 22240, 272, 408, 339, 347, 636, 826, 721, 277, 12, 1950, 29, 403, 12, 536, 29, 403, 12, 6037, 29, 403, 304, 267, 687, 6055, 14, 825, 18, 14, 2105, 492, 15352, 18, 3225, 267, 1613, 8, 4220, 18, 10708, 2354, 12, 291, 2843, 826, 721, 2105, 12, 536, 12, 6037, 12, 1169, 15352, 18, 3225, 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, 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, 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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 ]
wikimedia/operations-debs-linux
tools/perf/scripts/python/export-to-postgresql.py
617
16128
# export-to-postgresql.py: export perf data to a postgresql database # Copyright (c) 2014, Intel Corporation. # # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU General Public License, # version 2, as published by the Free Software Foundation. # # This program is distributed in the hope 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. import os import sys import struct import datetime from PySide.QtSql import * # Need to access PostgreSQL C library directly to use COPY FROM STDIN from ctypes import * libpq = CDLL("libpq.so.5") PQconnectdb = libpq.PQconnectdb PQconnectdb.restype = c_void_p PQfinish = libpq.PQfinish PQstatus = libpq.PQstatus PQexec = libpq.PQexec PQexec.restype = c_void_p PQresultStatus = libpq.PQresultStatus PQputCopyData = libpq.PQputCopyData PQputCopyData.argtypes = [ c_void_p, c_void_p, c_int ] PQputCopyEnd = libpq.PQputCopyEnd PQputCopyEnd.argtypes = [ c_void_p, c_void_p ] sys.path.append(os.environ['PERF_EXEC_PATH'] + \ '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') # These perf imports are not used at present #from perf_trace_context import * #from Core import * perf_db_export_mode = True perf_db_export_calls = False def usage(): print >> sys.stderr, "Usage is: export-to-postgresql.py <database name> [<columns>] [<calls>]" print >> sys.stderr, "where: columns 'all' or 'branches'" print >> sys.stderr, " calls 'calls' => create calls table" raise Exception("Too few arguments") if (len(sys.argv) < 2): usage() dbname = sys.argv[1] if (len(sys.argv) >= 3): columns = sys.argv[2] else: columns = "all" if columns not in ("all", "branches"): usage() branches = (columns == "branches") if (len(sys.argv) >= 4): if (sys.argv[3] == "calls"): perf_db_export_calls = True else: usage() output_dir_name = os.getcwd() + "/" + dbname + "-perf-data" os.mkdir(output_dir_name) def do_query(q, s): if (q.exec_(s)): return raise Exception("Query failed: " + q.lastError().text()) print datetime.datetime.today(), "Creating database..." db = QSqlDatabase.addDatabase('QPSQL') query = QSqlQuery(db) db.setDatabaseName('postgres') db.open() try: do_query(query, 'CREATE DATABASE ' + dbname) except: os.rmdir(output_dir_name) raise query.finish() query.clear() db.close() db.setDatabaseName(dbname) db.open() query = QSqlQuery(db) do_query(query, 'SET client_min_messages TO WARNING') do_query(query, 'CREATE TABLE selected_events (' 'id bigint NOT NULL,' 'name varchar(80))') do_query(query, 'CREATE TABLE machines (' 'id bigint NOT NULL,' 'pid integer,' 'root_dir varchar(4096))') do_query(query, 'CREATE TABLE threads (' 'id bigint NOT NULL,' 'machine_id bigint,' 'process_id bigint,' 'pid integer,' 'tid integer)') do_query(query, 'CREATE TABLE comms (' 'id bigint NOT NULL,' 'comm varchar(16))') do_query(query, 'CREATE TABLE comm_threads (' 'id bigint NOT NULL,' 'comm_id bigint,' 'thread_id bigint)') do_query(query, 'CREATE TABLE dsos (' 'id bigint NOT NULL,' 'machine_id bigint,' 'short_name varchar(256),' 'long_name varchar(4096),' 'build_id varchar(64))') do_query(query, 'CREATE TABLE symbols (' 'id bigint NOT NULL,' 'dso_id bigint,' 'sym_start bigint,' 'sym_end bigint,' 'binding integer,' 'name varchar(2048))') do_query(query, 'CREATE TABLE branch_types (' 'id integer NOT NULL,' 'name varchar(80))') if branches: do_query(query, 'CREATE TABLE samples (' 'id bigint NOT NULL,' 'evsel_id bigint,' 'machine_id bigint,' 'thread_id bigint,' 'comm_id bigint,' 'dso_id bigint,' 'symbol_id bigint,' 'sym_offset bigint,' 'ip bigint,' 'time bigint,' 'cpu integer,' 'to_dso_id bigint,' 'to_symbol_id bigint,' 'to_sym_offset bigint,' 'to_ip bigint,' 'branch_type integer,' 'in_tx boolean)') else: do_query(query, 'CREATE TABLE samples (' 'id bigint NOT NULL,' 'evsel_id bigint,' 'machine_id bigint,' 'thread_id bigint,' 'comm_id bigint,' 'dso_id bigint,' 'symbol_id bigint,' 'sym_offset bigint,' 'ip bigint,' 'time bigint,' 'cpu integer,' 'to_dso_id bigint,' 'to_symbol_id bigint,' 'to_sym_offset bigint,' 'to_ip bigint,' 'period bigint,' 'weight bigint,' 'transaction bigint,' 'data_src bigint,' 'branch_type integer,' 'in_tx boolean)') if perf_db_export_calls: do_query(query, 'CREATE TABLE call_paths (' 'id bigint NOT NULL,' 'parent_id bigint,' 'symbol_id bigint,' 'ip bigint)') do_query(query, 'CREATE TABLE calls (' 'id bigint NOT NULL,' 'thread_id bigint,' 'comm_id bigint,' 'call_path_id bigint,' 'call_time bigint,' 'return_time bigint,' 'branch_count bigint,' 'call_id bigint,' 'return_id bigint,' 'parent_call_path_id bigint,' 'flags integer)') do_query(query, 'CREATE VIEW samples_view AS ' 'SELECT ' 'id,' 'time,' 'cpu,' '(SELECT pid FROM threads WHERE id = thread_id) AS pid,' '(SELECT tid FROM threads WHERE id = thread_id) AS tid,' '(SELECT comm FROM comms WHERE id = comm_id) AS command,' '(SELECT name FROM selected_events WHERE id = evsel_id) AS event,' 'to_hex(ip) AS ip_hex,' '(SELECT name FROM symbols WHERE id = symbol_id) AS symbol,' 'sym_offset,' '(SELECT short_name FROM dsos WHERE id = dso_id) AS dso_short_name,' 'to_hex(to_ip) AS to_ip_hex,' '(SELECT name FROM symbols WHERE id = to_symbol_id) AS to_symbol,' 'to_sym_offset,' '(SELECT short_name FROM dsos WHERE id = to_dso_id) AS to_dso_short_name,' '(SELECT name FROM branch_types WHERE id = branch_type) AS branch_type_name,' 'in_tx' ' FROM samples') file_header = struct.pack("!11sii", "PGCOPY\n\377\r\n\0", 0, 0) file_trailer = "\377\377" def open_output_file(file_name): path_name = output_dir_name + "/" + file_name file = open(path_name, "w+") file.write(file_header) return file def close_output_file(file): file.write(file_trailer) file.close() def copy_output_file_direct(file, table_name): close_output_file(file) sql = "COPY " + table_name + " FROM '" + file.name + "' (FORMAT 'binary')" do_query(query, sql) # Use COPY FROM STDIN because security may prevent postgres from accessing the files directly def copy_output_file(file, table_name): conn = PQconnectdb("dbname = " + dbname) if (PQstatus(conn)): raise Exception("COPY FROM STDIN PQconnectdb failed") file.write(file_trailer) file.seek(0) sql = "COPY " + table_name + " FROM STDIN (FORMAT 'binary')" res = PQexec(conn, sql) if (PQresultStatus(res) != 4): raise Exception("COPY FROM STDIN PQexec failed") data = file.read(65536) while (len(data)): ret = PQputCopyData(conn, data, len(data)) if (ret != 1): raise Exception("COPY FROM STDIN PQputCopyData failed, error " + str(ret)) data = file.read(65536) ret = PQputCopyEnd(conn, None) if (ret != 1): raise Exception("COPY FROM STDIN PQputCopyEnd failed, error " + str(ret)) PQfinish(conn) def remove_output_file(file): name = file.name file.close() os.unlink(name) evsel_file = open_output_file("evsel_table.bin") machine_file = open_output_file("machine_table.bin") thread_file = open_output_file("thread_table.bin") comm_file = open_output_file("comm_table.bin") comm_thread_file = open_output_file("comm_thread_table.bin") dso_file = open_output_file("dso_table.bin") symbol_file = open_output_file("symbol_table.bin") branch_type_file = open_output_file("branch_type_table.bin") sample_file = open_output_file("sample_table.bin") if perf_db_export_calls: call_path_file = open_output_file("call_path_table.bin") call_file = open_output_file("call_table.bin") def trace_begin(): print datetime.datetime.today(), "Writing to intermediate files..." # id == 0 means unknown. It is easier to create records for them than replace the zeroes with NULLs evsel_table(0, "unknown") machine_table(0, 0, "unknown") thread_table(0, 0, 0, -1, -1) comm_table(0, "unknown") dso_table(0, 0, "unknown", "unknown", "") symbol_table(0, 0, 0, 0, 0, "unknown") sample_table(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) if perf_db_export_calls: call_path_table(0, 0, 0, 0) unhandled_count = 0 def trace_end(): print datetime.datetime.today(), "Copying to database..." copy_output_file(evsel_file, "selected_events") copy_output_file(machine_file, "machines") copy_output_file(thread_file, "threads") copy_output_file(comm_file, "comms") copy_output_file(comm_thread_file, "comm_threads") copy_output_file(dso_file, "dsos") copy_output_file(symbol_file, "symbols") copy_output_file(branch_type_file, "branch_types") copy_output_file(sample_file, "samples") if perf_db_export_calls: copy_output_file(call_path_file, "call_paths") copy_output_file(call_file, "calls") print datetime.datetime.today(), "Removing intermediate files..." remove_output_file(evsel_file) remove_output_file(machine_file) remove_output_file(thread_file) remove_output_file(comm_file) remove_output_file(comm_thread_file) remove_output_file(dso_file) remove_output_file(symbol_file) remove_output_file(branch_type_file) remove_output_file(sample_file) if perf_db_export_calls: remove_output_file(call_path_file) remove_output_file(call_file) os.rmdir(output_dir_name) print datetime.datetime.today(), "Adding primary keys" do_query(query, 'ALTER TABLE selected_events ADD PRIMARY KEY (id)') do_query(query, 'ALTER TABLE machines ADD PRIMARY KEY (id)') do_query(query, 'ALTER TABLE threads ADD PRIMARY KEY (id)') do_query(query, 'ALTER TABLE comms ADD PRIMARY KEY (id)') do_query(query, 'ALTER TABLE comm_threads ADD PRIMARY KEY (id)') do_query(query, 'ALTER TABLE dsos ADD PRIMARY KEY (id)') do_query(query, 'ALTER TABLE symbols ADD PRIMARY KEY (id)') do_query(query, 'ALTER TABLE branch_types ADD PRIMARY KEY (id)') do_query(query, 'ALTER TABLE samples ADD PRIMARY KEY (id)') if perf_db_export_calls: do_query(query, 'ALTER TABLE call_paths ADD PRIMARY KEY (id)') do_query(query, 'ALTER TABLE calls ADD PRIMARY KEY (id)') print datetime.datetime.today(), "Adding foreign keys" do_query(query, 'ALTER TABLE threads ' 'ADD CONSTRAINT machinefk FOREIGN KEY (machine_id) REFERENCES machines (id),' 'ADD CONSTRAINT processfk FOREIGN KEY (process_id) REFERENCES threads (id)') do_query(query, 'ALTER TABLE comm_threads ' 'ADD CONSTRAINT commfk FOREIGN KEY (comm_id) REFERENCES comms (id),' 'ADD CONSTRAINT threadfk FOREIGN KEY (thread_id) REFERENCES threads (id)') do_query(query, 'ALTER TABLE dsos ' 'ADD CONSTRAINT machinefk FOREIGN KEY (machine_id) REFERENCES machines (id)') do_query(query, 'ALTER TABLE symbols ' 'ADD CONSTRAINT dsofk FOREIGN KEY (dso_id) REFERENCES dsos (id)') do_query(query, 'ALTER TABLE samples ' 'ADD CONSTRAINT evselfk FOREIGN KEY (evsel_id) REFERENCES selected_events (id),' 'ADD CONSTRAINT machinefk FOREIGN KEY (machine_id) REFERENCES machines (id),' 'ADD CONSTRAINT threadfk FOREIGN KEY (thread_id) REFERENCES threads (id),' 'ADD CONSTRAINT commfk FOREIGN KEY (comm_id) REFERENCES comms (id),' 'ADD CONSTRAINT dsofk FOREIGN KEY (dso_id) REFERENCES dsos (id),' 'ADD CONSTRAINT symbolfk FOREIGN KEY (symbol_id) REFERENCES symbols (id),' 'ADD CONSTRAINT todsofk FOREIGN KEY (to_dso_id) REFERENCES dsos (id),' 'ADD CONSTRAINT tosymbolfk FOREIGN KEY (to_symbol_id) REFERENCES symbols (id)') if perf_db_export_calls: do_query(query, 'ALTER TABLE call_paths ' 'ADD CONSTRAINT parentfk FOREIGN KEY (parent_id) REFERENCES call_paths (id),' 'ADD CONSTRAINT symbolfk FOREIGN KEY (symbol_id) REFERENCES symbols (id)') do_query(query, 'ALTER TABLE calls ' 'ADD CONSTRAINT threadfk FOREIGN KEY (thread_id) REFERENCES threads (id),' 'ADD CONSTRAINT commfk FOREIGN KEY (comm_id) REFERENCES comms (id),' 'ADD CONSTRAINT call_pathfk FOREIGN KEY (call_path_id) REFERENCES call_paths (id),' 'ADD CONSTRAINT callfk FOREIGN KEY (call_id) REFERENCES samples (id),' 'ADD CONSTRAINT returnfk FOREIGN KEY (return_id) REFERENCES samples (id),' 'ADD CONSTRAINT parent_call_pathfk FOREIGN KEY (parent_call_path_id) REFERENCES call_paths (id)') do_query(query, 'CREATE INDEX pcpid_idx ON calls (parent_call_path_id)') if (unhandled_count): print datetime.datetime.today(), "Warning: ", unhandled_count, " unhandled events" print datetime.datetime.today(), "Done" def trace_unhandled(event_name, context, event_fields_dict): global unhandled_count unhandled_count += 1 def sched__sched_switch(*x): pass def evsel_table(evsel_id, evsel_name, *x): n = len(evsel_name) fmt = "!hiqi" + str(n) + "s" value = struct.pack(fmt, 2, 8, evsel_id, n, evsel_name) evsel_file.write(value) def machine_table(machine_id, pid, root_dir, *x): n = len(root_dir) fmt = "!hiqiii" + str(n) + "s" value = struct.pack(fmt, 3, 8, machine_id, 4, pid, n, root_dir) machine_file.write(value) def thread_table(thread_id, machine_id, process_id, pid, tid, *x): value = struct.pack("!hiqiqiqiiii", 5, 8, thread_id, 8, machine_id, 8, process_id, 4, pid, 4, tid) thread_file.write(value) def comm_table(comm_id, comm_str, *x): n = len(comm_str) fmt = "!hiqi" + str(n) + "s" value = struct.pack(fmt, 2, 8, comm_id, n, comm_str) comm_file.write(value) def comm_thread_table(comm_thread_id, comm_id, thread_id, *x): fmt = "!hiqiqiq" value = struct.pack(fmt, 3, 8, comm_thread_id, 8, comm_id, 8, thread_id) comm_thread_file.write(value) def dso_table(dso_id, machine_id, short_name, long_name, build_id, *x): n1 = len(short_name) n2 = len(long_name) n3 = len(build_id) fmt = "!hiqiqi" + str(n1) + "si" + str(n2) + "si" + str(n3) + "s" value = struct.pack(fmt, 5, 8, dso_id, 8, machine_id, n1, short_name, n2, long_name, n3, build_id) dso_file.write(value) def symbol_table(symbol_id, dso_id, sym_start, sym_end, binding, symbol_name, *x): n = len(symbol_name) fmt = "!hiqiqiqiqiii" + str(n) + "s" value = struct.pack(fmt, 6, 8, symbol_id, 8, dso_id, 8, sym_start, 8, sym_end, 4, binding, n, symbol_name) symbol_file.write(value) def branch_type_table(branch_type, name, *x): n = len(name) fmt = "!hiii" + str(n) + "s" value = struct.pack(fmt, 2, 4, branch_type, n, name) branch_type_file.write(value) def sample_table(sample_id, evsel_id, machine_id, thread_id, comm_id, dso_id, symbol_id, sym_offset, ip, time, cpu, to_dso_id, to_symbol_id, to_sym_offset, to_ip, period, weight, transaction, data_src, branch_type, in_tx, *x): if branches: value = struct.pack("!hiqiqiqiqiqiqiqiqiqiqiiiqiqiqiqiiiB", 17, 8, sample_id, 8, evsel_id, 8, machine_id, 8, thread_id, 8, comm_id, 8, dso_id, 8, symbol_id, 8, sym_offset, 8, ip, 8, time, 4, cpu, 8, to_dso_id, 8, to_symbol_id, 8, to_sym_offset, 8, to_ip, 4, branch_type, 1, in_tx) else: value = struct.pack("!hiqiqiqiqiqiqiqiqiqiqiiiqiqiqiqiqiqiqiqiiiB", 21, 8, sample_id, 8, evsel_id, 8, machine_id, 8, thread_id, 8, comm_id, 8, dso_id, 8, symbol_id, 8, sym_offset, 8, ip, 8, time, 4, cpu, 8, to_dso_id, 8, to_symbol_id, 8, to_sym_offset, 8, to_ip, 8, period, 8, weight, 8, transaction, 8, data_src, 4, branch_type, 1, in_tx) sample_file.write(value) def call_path_table(cp_id, parent_id, symbol_id, ip, *x): fmt = "!hiqiqiqiq" value = struct.pack(fmt, 4, 8, cp_id, 8, parent_id, 8, symbol_id, 8, ip) call_path_file.write(value) def call_return_table(cr_id, thread_id, comm_id, call_path_id, call_time, return_time, branch_count, call_id, return_id, parent_call_path_id, flags, *x): fmt = "!hiqiqiqiqiqiqiqiqiqiqii" value = struct.pack(fmt, 11, 8, cr_id, 8, thread_id, 8, comm_id, 8, call_path_id, 8, call_time, 8, return_time, 8, branch_count, 8, call_id, 8, return_id, 8, parent_call_path_id, 4, flags) call_file.write(value)
gpl-2.0
[ 3, 4843, 13, 475, 13, 15437, 14, 647, 26, 4843, 8582, 666, 370, 282, 25951, 3050, 199, 3, 1898, 334, 67, 9, 6927, 12, 20619, 11098, 14, 199, 3, 199, 3, 961, 2240, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 652, 199, 3, 1334, 314, 2895, 436, 3704, 402, 314, 1664, 1696, 1684, 844, 12, 199, 3, 1015, 499, 12, 465, 3267, 701, 314, 2868, 2290, 2752, 14, 199, 3, 199, 3, 961, 2240, 365, 1854, 315, 314, 3661, 652, 911, 506, 2997, 12, 1325, 2428, 199, 3, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 3169, 503, 199, 3, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 1696, 1684, 844, 367, 199, 3, 1655, 2436, 14, 199, 199, 646, 747, 199, 646, 984, 199, 646, 2702, 199, 646, 2197, 199, 199, 504, 1611, 15414, 14, 4238, 16790, 492, 627, 199, 199, 3, 14012, 370, 2879, 20175, 445, 3555, 5370, 370, 675, 9357, 4442, 30118, 568, 199, 504, 5577, 492, 627, 199, 773, 26295, 275, 445, 15982, 480, 773, 26295, 14, 1152, 14, 21, 531, 199, 48, 49, 2242, 697, 275, 1973, 26295, 14, 48, 49, 2242, 697, 199, 48, 49, 2242, 697, 14, 9990, 275, 286, 63, 1647, 63, 80, 199, 48, 49, 8192, 275, 1973, 26295, 14, 48, 49, 8192, 199, 48, 49, 1205, 275, 1973, 26295, 14, 48, 49, 1205, 199, 48, 49, 1628, 275, 1973, 26295, 14, 48, 49, 1628, 199, 48, 49, 1628, 14, 9990, 275, 286, 63, 1647, 63, 80, 199, 48, 49, 1099, 3694, 275, 1973, 26295, 14, 48, 49, 1099, 3694, 199, 48, 49, 524, 28518, 275, 1973, 26295, 14, 48, 49, 524, 28518, 199, 48, 49, 524, 28518, 14, 10025, 275, 359, 286, 63, 1647, 63, 80, 12, 286, 63, 1647, 63, 80, 12, 286, 63, 442, 1622, 199, 48, 49, 524, 5116, 3005, 275, 1973, 26295, 14, 48, 49, 524, 5116, 3005, 199, 48, 49, 524, 5116, 3005, 14, 10025, 275, 359, 286, 63, 1647, 63, 80, 12, 286, 63, 1647, 63, 80, 1622, 199, 199, 1274, 14, 515, 14, 740, 8, 736, 14, 2314, 459, 17038, 63, 10276, 63, 3243, 418, 435, 971, 199, 198, 9807, 6429, 15, 1548, 15, 12387, 13, 3921, 13, 9562, 15, 773, 15, 12387, 15, 3921, 358, 199, 199, 3, 5723, 8582, 8925, 787, 440, 1202, 737, 3451, 199, 3, 504, 8582, 63, 3446, 63, 1100, 492, 627, 199, 3, 504, 11672, 492, 627, 199, 199, 9452, 63, 697, 63, 3790, 63, 632, 275, 715, 199, 9452, 63, 697, 63, 3790, 63, 5352, 275, 756, 199, 199, 318, 4503, 837, 199, 198, 1361, 4331, 984, 14, 3083, 12, 298, 7692, 365, 26, 4843, 13, 475, 13, 15437, 14, 647, 665, 4659, 536, 30, 24936, 3406, 19109, 24936, 5352, 30, 8480, 199, 198, 1361, 4331, 984, 14, 3083, 12, 298, 4509, 26, 198, 3406, 198, 198, 7, 452, 7, 503, 283, 16896, 4065, 199, 198, 1361, 4331, 984, 14, 3083, 12, 298, 198, 198, 5352, 198, 198, 7, 5352, 7, 9265, 1218, 4882, 1817, 2, 199, 198, 3730, 2186, 480, 13749, 9284, 2368, 531, 199, 199, 692, 334, 552, 8, 1274, 14, 3020, 9, 665, 499, 304, 199, 198, 3807, 342, 199, 199, 13238, 275, 984, 14, 3020, 59, 17, 61, 199, 199, 692, 334, 552, 8, 1274, 14, 3020, 9, 2356, 650, 304, 199, 198, 3406, 275, 984, 14, 3020, 59, 18, 61, 199, 2836, 26, 199, 198, 3406, 275, 298, 452, 2, 199, 199, 692, 4362, 440, 315, 1689, 452, 401, 298, 16896, 2349, 199, 198, 3807, 342, 199, 199, 16896, 275, 334, 3406, 508, 298, 16896, 531, 199, 199, 692, 334, 552, 8, 1274, 14, 3020, 9, 2356, 841, 304, 199, 198, 692, 334, 1274, 14, 3020, 59, 19, 61, 508, 298, 5352, 2349, 507, 198, 9452, 63, 697, 63, 3790, 63, 5352, 275, 715, 199, 198, 2836, 26, 507, 198, 3807, 342, 199, 199, 1199, 63, 694, 63, 354, 275, 747, 14, 9458, 342, 435, 10609, 435, 21842, 435, 3905, 9452, 13, 576, 2, 199, 736, 14, 8215, 8, 1199, 63, 694, 63, 354, 9, 199, 199, 318, 886, 63, 1131, 8, 81, 12, 308, 304, 199, 198, 692, 334, 81, 14, 1628, 2531, 83, 2298, 507, 198, 1107, 199, 198, 3730, 2186, 480, 3227, 3405, 26, 298, 435, 1894, 14, 2019, 547, 1252, 505, 1012, 199, 199, 1361, 2197, 14, 2083, 14, 8136, 1062, 298, 14380, 3050, 11500, 199, 199, 697, 275, 1413, 16790, 7243, 14, 525, 7243, 360, 31208, 4657, 358, 199, 1131, 275, 1413, 16790, 3227, 8, 697, 9, 199, 697, 14, 409, 7243, 985, 360, 10675, 358, 199, 697, 14, 1490, 342, 199, 893, 26, 199, 198, 1117, 63, 1131, 8, 1131, 12, 283, 8366, 31705, 283, 435, 21842, 9, 199, 2590, 26, 199, 198, 736, 14, 19405, 8, 1199, 63, 694, 63, 354, 9, 199, 198, 3730, 199, 1131, 14, 8192, 342, 199, 1131, 14, 3584, 342, 199, 697, 14, 1600, 342, 199, 199, 697, 14, 409, 7243, 985, 8, 13238, 9, 199, 697, 14, 1490, 342, 199, 199, 1131, 275, 1413, 16790, 3227, 8, 697, 9, 199, 1117, 63, 1131, 8, 1131, 12, 283, 3597, 1890, 63, 827, 63, 3431, 2296, 14750, 358, 199, 199, 1117, 63, 1131, 8, 1131, 12, 283, 8366, 9934, 4895, 63, 4368, 661, 507, 198, 7, 344, 198, 198, 24884, 198, 198, 4609, 5962, 2584, 507, 198, 7, 354, 198, 198, 25545, 8, 1257, 28435, 199, 1117, 63, 1131, 8, 1131, 12, 283, 8366, 9934, 20601, 661, 507, 198, 7, 344, 198, 198, 24884, 198, 198, 4609, 5962, 2584, 507, 198, 7, 3150, 198, 198, 4115, 2584, 507, 198, 7, 1231, 63, 694, 221, 198, 25545, 8, 20579, 28435, 199, 1117, 63, 1131, 8, 1131, 12, 283, 8366, 9934, 7183, 661, 507, 198, 7, 344, 198, 198, 24884, 198, 198, 4609, 5962, 2584, 507, 198, 6704, 7176, 63, 344, 198, 24884, 2584, 507, 198, 7, 1412, 63, 344, 198, 24884, 2584, 507, 198, 7, 3150, 198, 198, 4115, 2584, 507, 198, 1133, 344, 198, 198, 4115, 5942, 199, 1117, 63, 1131, 8, 1131, 12, 283, 8366, 9934, 1923, 83, 661, 507, 198, 7, 344, 198, 198 ]
[ 4843, 13, 475, 13, 15437, 14, 647, 26, 4843, 8582, 666, 370, 282, 25951, 3050, 199, 3, 1898, 334, 67, 9, 6927, 12, 20619, 11098, 14, 199, 3, 199, 3, 961, 2240, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 652, 199, 3, 1334, 314, 2895, 436, 3704, 402, 314, 1664, 1696, 1684, 844, 12, 199, 3, 1015, 499, 12, 465, 3267, 701, 314, 2868, 2290, 2752, 14, 199, 3, 199, 3, 961, 2240, 365, 1854, 315, 314, 3661, 652, 911, 506, 2997, 12, 1325, 2428, 199, 3, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 3169, 503, 199, 3, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 1696, 1684, 844, 367, 199, 3, 1655, 2436, 14, 199, 199, 646, 747, 199, 646, 984, 199, 646, 2702, 199, 646, 2197, 199, 199, 504, 1611, 15414, 14, 4238, 16790, 492, 627, 199, 199, 3, 14012, 370, 2879, 20175, 445, 3555, 5370, 370, 675, 9357, 4442, 30118, 568, 199, 504, 5577, 492, 627, 199, 773, 26295, 275, 445, 15982, 480, 773, 26295, 14, 1152, 14, 21, 531, 199, 48, 49, 2242, 697, 275, 1973, 26295, 14, 48, 49, 2242, 697, 199, 48, 49, 2242, 697, 14, 9990, 275, 286, 63, 1647, 63, 80, 199, 48, 49, 8192, 275, 1973, 26295, 14, 48, 49, 8192, 199, 48, 49, 1205, 275, 1973, 26295, 14, 48, 49, 1205, 199, 48, 49, 1628, 275, 1973, 26295, 14, 48, 49, 1628, 199, 48, 49, 1628, 14, 9990, 275, 286, 63, 1647, 63, 80, 199, 48, 49, 1099, 3694, 275, 1973, 26295, 14, 48, 49, 1099, 3694, 199, 48, 49, 524, 28518, 275, 1973, 26295, 14, 48, 49, 524, 28518, 199, 48, 49, 524, 28518, 14, 10025, 275, 359, 286, 63, 1647, 63, 80, 12, 286, 63, 1647, 63, 80, 12, 286, 63, 442, 1622, 199, 48, 49, 524, 5116, 3005, 275, 1973, 26295, 14, 48, 49, 524, 5116, 3005, 199, 48, 49, 524, 5116, 3005, 14, 10025, 275, 359, 286, 63, 1647, 63, 80, 12, 286, 63, 1647, 63, 80, 1622, 199, 199, 1274, 14, 515, 14, 740, 8, 736, 14, 2314, 459, 17038, 63, 10276, 63, 3243, 418, 435, 971, 199, 198, 9807, 6429, 15, 1548, 15, 12387, 13, 3921, 13, 9562, 15, 773, 15, 12387, 15, 3921, 358, 199, 199, 3, 5723, 8582, 8925, 787, 440, 1202, 737, 3451, 199, 3, 504, 8582, 63, 3446, 63, 1100, 492, 627, 199, 3, 504, 11672, 492, 627, 199, 199, 9452, 63, 697, 63, 3790, 63, 632, 275, 715, 199, 9452, 63, 697, 63, 3790, 63, 5352, 275, 756, 199, 199, 318, 4503, 837, 199, 198, 1361, 4331, 984, 14, 3083, 12, 298, 7692, 365, 26, 4843, 13, 475, 13, 15437, 14, 647, 665, 4659, 536, 30, 24936, 3406, 19109, 24936, 5352, 30, 8480, 199, 198, 1361, 4331, 984, 14, 3083, 12, 298, 4509, 26, 198, 3406, 198, 198, 7, 452, 7, 503, 283, 16896, 4065, 199, 198, 1361, 4331, 984, 14, 3083, 12, 298, 198, 198, 5352, 198, 198, 7, 5352, 7, 9265, 1218, 4882, 1817, 2, 199, 198, 3730, 2186, 480, 13749, 9284, 2368, 531, 199, 199, 692, 334, 552, 8, 1274, 14, 3020, 9, 665, 499, 304, 199, 198, 3807, 342, 199, 199, 13238, 275, 984, 14, 3020, 59, 17, 61, 199, 199, 692, 334, 552, 8, 1274, 14, 3020, 9, 2356, 650, 304, 199, 198, 3406, 275, 984, 14, 3020, 59, 18, 61, 199, 2836, 26, 199, 198, 3406, 275, 298, 452, 2, 199, 199, 692, 4362, 440, 315, 1689, 452, 401, 298, 16896, 2349, 199, 198, 3807, 342, 199, 199, 16896, 275, 334, 3406, 508, 298, 16896, 531, 199, 199, 692, 334, 552, 8, 1274, 14, 3020, 9, 2356, 841, 304, 199, 198, 692, 334, 1274, 14, 3020, 59, 19, 61, 508, 298, 5352, 2349, 507, 198, 9452, 63, 697, 63, 3790, 63, 5352, 275, 715, 199, 198, 2836, 26, 507, 198, 3807, 342, 199, 199, 1199, 63, 694, 63, 354, 275, 747, 14, 9458, 342, 435, 10609, 435, 21842, 435, 3905, 9452, 13, 576, 2, 199, 736, 14, 8215, 8, 1199, 63, 694, 63, 354, 9, 199, 199, 318, 886, 63, 1131, 8, 81, 12, 308, 304, 199, 198, 692, 334, 81, 14, 1628, 2531, 83, 2298, 507, 198, 1107, 199, 198, 3730, 2186, 480, 3227, 3405, 26, 298, 435, 1894, 14, 2019, 547, 1252, 505, 1012, 199, 199, 1361, 2197, 14, 2083, 14, 8136, 1062, 298, 14380, 3050, 11500, 199, 199, 697, 275, 1413, 16790, 7243, 14, 525, 7243, 360, 31208, 4657, 358, 199, 1131, 275, 1413, 16790, 3227, 8, 697, 9, 199, 697, 14, 409, 7243, 985, 360, 10675, 358, 199, 697, 14, 1490, 342, 199, 893, 26, 199, 198, 1117, 63, 1131, 8, 1131, 12, 283, 8366, 31705, 283, 435, 21842, 9, 199, 2590, 26, 199, 198, 736, 14, 19405, 8, 1199, 63, 694, 63, 354, 9, 199, 198, 3730, 199, 1131, 14, 8192, 342, 199, 1131, 14, 3584, 342, 199, 697, 14, 1600, 342, 199, 199, 697, 14, 409, 7243, 985, 8, 13238, 9, 199, 697, 14, 1490, 342, 199, 199, 1131, 275, 1413, 16790, 3227, 8, 697, 9, 199, 1117, 63, 1131, 8, 1131, 12, 283, 3597, 1890, 63, 827, 63, 3431, 2296, 14750, 358, 199, 199, 1117, 63, 1131, 8, 1131, 12, 283, 8366, 9934, 4895, 63, 4368, 661, 507, 198, 7, 344, 198, 198, 24884, 198, 198, 4609, 5962, 2584, 507, 198, 7, 354, 198, 198, 25545, 8, 1257, 28435, 199, 1117, 63, 1131, 8, 1131, 12, 283, 8366, 9934, 20601, 661, 507, 198, 7, 344, 198, 198, 24884, 198, 198, 4609, 5962, 2584, 507, 198, 7, 3150, 198, 198, 4115, 2584, 507, 198, 7, 1231, 63, 694, 221, 198, 25545, 8, 20579, 28435, 199, 1117, 63, 1131, 8, 1131, 12, 283, 8366, 9934, 7183, 661, 507, 198, 7, 344, 198, 198, 24884, 198, 198, 4609, 5962, 2584, 507, 198, 6704, 7176, 63, 344, 198, 24884, 2584, 507, 198, 7, 1412, 63, 344, 198, 24884, 2584, 507, 198, 7, 3150, 198, 198, 4115, 2584, 507, 198, 1133, 344, 198, 198, 4115, 5942, 199, 1117, 63, 1131, 8, 1131, 12, 283, 8366, 9934, 1923, 83, 661, 507, 198, 7, 344, 198, 198, 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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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 ]
chillbu/cblib
thirdparty/protobuf-2.5.0/gtest/test/gtest_uninitialized_test.py
2901
2480
#!/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 warns the user when not initialized properly.""" __author__ = 'wan@google.com (Zhanyong Wan)' import gtest_test_utils COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_uninitialized_test_') def Assert(condition): if not condition: raise AssertionError def AssertEq(expected, actual): if expected != actual: print 'Expected: %s' % (expected,) print ' Actual: %s' % (actual,) raise AssertionError def TestExitCodeAndOutput(command): """Runs the given command and verifies its exit code and output.""" # Verifies that 'command' exits with code 1. p = gtest_test_utils.Subprocess(command) Assert(p.exited) AssertEq(1, p.exit_code) Assert('InitGoogleTest' in p.output) class GTestUninitializedTest(gtest_test_utils.TestCase): def testExitCodeAndOutput(self): TestExitCodeAndOutput(COMMAND) if __name__ == '__main__': gtest_test_utils.Main()
apache-2.0
[ 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, 3429, 561, 314, 922, 1380, 440, 10038, 7684, 1041, 199, 199, 363, 2502, 363, 275, 283, 20444, 32, 3098, 14, 957, 334, 12674, 1629, 951, 644, 290, 3171, 199, 199, 646, 9088, 63, 396, 63, 1208, 421, 199, 10761, 275, 9088, 63, 396, 63, 1208, 14, 28967, 27602, 360, 8385, 63, 324, 12486, 63, 396, 15452, 421, 199, 318, 10716, 8, 5394, 304, 523, 340, 440, 5558, 26, 272, 746, 9070, 421, 199, 318, 10716, 19706, 8, 2062, 12, 3503, 304, 523, 340, 1420, 1137, 3503, 26, 272, 870, 283, 6964, 26, 450, 83, 7, 450, 334, 2062, 4258, 272, 870, 283, 221, 18982, 1061, 26, 450, 83, 7, 450, 334, 6514, 4258, 272, 746, 9070, 421, 199, 318, 1379, 6699, 3034, 3325, 2959, 8, 1531, 304, 523, 408, 16291, 314, 1627, 1414, 436, 22694, 2399, 4458, 1233, 436, 1072, 1041, 819, 327, 26114, 626, 283, 1531, 7, 20100, 543, 1233, 413, 14, 523, 299, 275, 9088, 63, 396, 63, 1208, 14, 22299, 8, 1531, 9, 523, 10716, 8, 80, 14, 32290, 9, 523, 10716, 19706, 8, 17, 12, 299, 14, 2224, 63, 600, 9, 523, 10716, 360, 9346, 13266, 774, 7, 315, 299, 14, 1199, 9, 421, 199, 533, 598, 774, 1358, 12486, 774, 8, 8385, 63, 396, 63, 1208, 14, 1746, 304, 523, 347, 511, 6699, 3034, 3325, 2959, 8, 277, 304, 272, 1379, 6699, 3034, 3325, 2959, 8, 10761, 9, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 523, 9088, 63, 396, 63, 1208, 14, 6756, 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 ]
[ 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, 3429, 561, 314, 922, 1380, 440, 10038, 7684, 1041, 199, 199, 363, 2502, 363, 275, 283, 20444, 32, 3098, 14, 957, 334, 12674, 1629, 951, 644, 290, 3171, 199, 199, 646, 9088, 63, 396, 63, 1208, 421, 199, 10761, 275, 9088, 63, 396, 63, 1208, 14, 28967, 27602, 360, 8385, 63, 324, 12486, 63, 396, 15452, 421, 199, 318, 10716, 8, 5394, 304, 523, 340, 440, 5558, 26, 272, 746, 9070, 421, 199, 318, 10716, 19706, 8, 2062, 12, 3503, 304, 523, 340, 1420, 1137, 3503, 26, 272, 870, 283, 6964, 26, 450, 83, 7, 450, 334, 2062, 4258, 272, 870, 283, 221, 18982, 1061, 26, 450, 83, 7, 450, 334, 6514, 4258, 272, 746, 9070, 421, 199, 318, 1379, 6699, 3034, 3325, 2959, 8, 1531, 304, 523, 408, 16291, 314, 1627, 1414, 436, 22694, 2399, 4458, 1233, 436, 1072, 1041, 819, 327, 26114, 626, 283, 1531, 7, 20100, 543, 1233, 413, 14, 523, 299, 275, 9088, 63, 396, 63, 1208, 14, 22299, 8, 1531, 9, 523, 10716, 8, 80, 14, 32290, 9, 523, 10716, 19706, 8, 17, 12, 299, 14, 2224, 63, 600, 9, 523, 10716, 360, 9346, 13266, 774, 7, 315, 299, 14, 1199, 9, 421, 199, 533, 598, 774, 1358, 12486, 774, 8, 8385, 63, 396, 63, 1208, 14, 1746, 304, 523, 347, 511, 6699, 3034, 3325, 2959, 8, 277, 304, 272, 1379, 6699, 3034, 3325, 2959, 8, 10761, 9, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 523, 9088, 63, 396, 63, 1208, 14, 6756, 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, 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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 ]
sethportman/xhtml2pdf
xhtml2pdf/wsgi.py
56
3006
# -*- coding: utf-8 -*- # Copyright 2010 Dirk Holtwick, holtwick.it # # 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 xhtml2pdf.pisa as pisa import StringIO import logging log = logging.getLogger("xhtml2pdf.wsgi") class Filter(object): def __init__(self, app): self.app = app def __call__(self, environ, start_response): script_name = environ.get('SCRIPT_NAME', '') path_info = environ.get('PATH_INFO', '') sent = [] written_response = StringIO.StringIO() def replacement_start_response(status, headers, exc_info=None): if not self.should_filter(status, headers): return start_response(status, headers, exc_info) else: sent[:] = [status, headers, exc_info] return written_response.write app_iter = self.app(environ, replacement_start_response) if not sent: return app_iter status, headers, exc_info = sent try: for chunk in app_iter: written_response.write(chunk) finally: if hasattr(app_iter, 'close'): app_iter.close() body = written_response.getvalue() status, headers, body = self.filter( script_name, path_info, environ, status, headers, body) start_response(status, headers, exc_info) return [body] def should_filter(self, status, headers): print headers def filter(self, status, headers, body): raise NotImplementedError class HTMLFilter(Filter): def should_filter(self, status, headers): if not status.startswith('200'): return False for name, value in headers: if name.lower() == 'content-type': return value.startswith('text/html') return False class PisaMiddleware(HTMLFilter): def filter(self, script_name, path_info, environ, status, headers, body): topdf = environ.get("pisa.topdf", "") if topdf: dst = StringIO.StringIO() result = pisa.CreatePDF( body, dst, show_error_as_pdf=True, ) headers = [ ("content-type", "application/pdf"), ("content-disposition", "attachment; filename=" + topdf) ] body = dst.getvalue() return status, headers, body
apache-2.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 3, 1898, 7129, 25866, 75, 869, 393, 8122, 2000, 12, 394, 393, 8122, 2000, 14, 390, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 199, 646, 671, 1360, 18, 5607, 14, 80, 13655, 465, 299, 13655, 199, 646, 5228, 199, 199, 646, 2050, 199, 793, 275, 2050, 14, 5572, 480, 12909, 18, 5607, 14, 6508, 531, 199, 199, 533, 9388, 8, 785, 304, 339, 347, 636, 826, 721, 277, 12, 1145, 304, 267, 291, 14, 571, 275, 1145, 339, 347, 636, 1250, 721, 277, 12, 6160, 12, 1343, 63, 1310, 304, 267, 2884, 63, 354, 275, 6160, 14, 362, 360, 10484, 63, 2339, 297, 4074, 267, 931, 63, 815, 275, 6160, 14, 362, 360, 3243, 63, 4531, 297, 4074, 267, 4847, 275, 942, 267, 5313, 63, 1310, 275, 5228, 14, 6424, 342, 267, 347, 8343, 63, 928, 63, 1310, 8, 1205, 12, 2323, 12, 3178, 63, 815, 29, 403, 304, 288, 340, 440, 291, 14, 5626, 63, 1541, 8, 1205, 12, 2323, 304, 355, 372, 1343, 63, 1310, 8, 1205, 12, 2323, 12, 3178, 63, 815, 9, 288, 587, 26, 355, 4847, 5873, 275, 359, 1205, 12, 2323, 12, 3178, 63, 815, 61, 355, 372, 5313, 63, 1310, 14, 952, 267, 1145, 63, 1661, 275, 291, 14, 571, 8, 2314, 12, 8343, 63, 928, 63, 1310, 9, 267, 340, 440, 4847, 26, 288, 372, 1145, 63, 1661, 267, 2004, 12, 2323, 12, 3178, 63, 815, 275, 4847, 267, 862, 26, 288, 367, 3728, 315, 1145, 63, 1661, 26, 355, 5313, 63, 1310, 14, 952, 8, 4604, 9, 267, 3753, 26, 288, 340, 2688, 8, 571, 63, 1661, 12, 283, 1600, 735, 355, 1145, 63, 1661, 14, 1600, 342, 267, 2396, 275, 5313, 63, 1310, 14, 7150, 342, 267, 2004, 12, 2323, 12, 2396, 275, 291, 14, 1541, 8, 288, 2884, 63, 354, 12, 931, 63, 815, 12, 6160, 12, 2004, 12, 2323, 12, 2396, 9, 267, 1343, 63, 1310, 8, 1205, 12, 2323, 12, 3178, 63, 815, 9, 267, 372, 359, 2030, 61, 339, 347, 1077, 63, 1541, 8, 277, 12, 2004, 12, 2323, 304, 267, 870, 2323, 339, 347, 2457, 8, 277, 12, 2004, 12, 2323, 12, 2396, 304, 267, 746, 4279, 421, 199, 533, 4163, 4131, 8, 4131, 304, 339, 347, 1077, 63, 1541, 8, 277, 12, 2004, 12, 2323, 304, 267, 340, 440, 2004, 14, 2460, 360, 1840, 735, 288, 372, 756, 267, 367, 536, 12, 574, 315, 2323, 26, 288, 340, 536, 14, 2325, 342, 508, 283, 1317, 13, 466, 356, 355, 372, 574, 14, 2460, 360, 505, 15, 1360, 358, 267, 372, 756, 199, 199, 533, 510, 13655, 6608, 8, 4943, 4131, 304, 339, 347, 2457, 8, 277, 12, 288, 2884, 63, 354, 12, 288, 931, 63, 815, 12, 288, 6160, 12, 288, 2004, 12, 288, 2323, 12, 288, 2396, 304, 267, 2746, 1587, 275, 6160, 14, 362, 480, 80, 13655, 14, 2119, 1587, 401, 6899, 267, 340, 2746, 1587, 26, 288, 5042, 275, 5228, 14, 6424, 342, 288, 754, 275, 299, 13655, 14, 2499, 7638, 8, 355, 2396, 12, 355, 5042, 12, 355, 2498, 63, 705, 63, 305, 63, 5607, 29, 549, 12, 355, 776, 288, 2323, 275, 359, 355, 1689, 1317, 13, 466, 401, 298, 3578, 15, 5607, 1288, 355, 1689, 1317, 13, 20173, 401, 298, 8905, 27, 1788, 628, 435, 2746, 1587, 9, 355, 1622, 288, 2396, 275, 5042, 14, 7150, 342, 267, 372, 2004, 12, 2323, 12, 2396, 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 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 3, 1898, 7129, 25866, 75, 869, 393, 8122, 2000, 12, 394, 393, 8122, 2000, 14, 390, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 199, 646, 671, 1360, 18, 5607, 14, 80, 13655, 465, 299, 13655, 199, 646, 5228, 199, 199, 646, 2050, 199, 793, 275, 2050, 14, 5572, 480, 12909, 18, 5607, 14, 6508, 531, 199, 199, 533, 9388, 8, 785, 304, 339, 347, 636, 826, 721, 277, 12, 1145, 304, 267, 291, 14, 571, 275, 1145, 339, 347, 636, 1250, 721, 277, 12, 6160, 12, 1343, 63, 1310, 304, 267, 2884, 63, 354, 275, 6160, 14, 362, 360, 10484, 63, 2339, 297, 4074, 267, 931, 63, 815, 275, 6160, 14, 362, 360, 3243, 63, 4531, 297, 4074, 267, 4847, 275, 942, 267, 5313, 63, 1310, 275, 5228, 14, 6424, 342, 267, 347, 8343, 63, 928, 63, 1310, 8, 1205, 12, 2323, 12, 3178, 63, 815, 29, 403, 304, 288, 340, 440, 291, 14, 5626, 63, 1541, 8, 1205, 12, 2323, 304, 355, 372, 1343, 63, 1310, 8, 1205, 12, 2323, 12, 3178, 63, 815, 9, 288, 587, 26, 355, 4847, 5873, 275, 359, 1205, 12, 2323, 12, 3178, 63, 815, 61, 355, 372, 5313, 63, 1310, 14, 952, 267, 1145, 63, 1661, 275, 291, 14, 571, 8, 2314, 12, 8343, 63, 928, 63, 1310, 9, 267, 340, 440, 4847, 26, 288, 372, 1145, 63, 1661, 267, 2004, 12, 2323, 12, 3178, 63, 815, 275, 4847, 267, 862, 26, 288, 367, 3728, 315, 1145, 63, 1661, 26, 355, 5313, 63, 1310, 14, 952, 8, 4604, 9, 267, 3753, 26, 288, 340, 2688, 8, 571, 63, 1661, 12, 283, 1600, 735, 355, 1145, 63, 1661, 14, 1600, 342, 267, 2396, 275, 5313, 63, 1310, 14, 7150, 342, 267, 2004, 12, 2323, 12, 2396, 275, 291, 14, 1541, 8, 288, 2884, 63, 354, 12, 931, 63, 815, 12, 6160, 12, 2004, 12, 2323, 12, 2396, 9, 267, 1343, 63, 1310, 8, 1205, 12, 2323, 12, 3178, 63, 815, 9, 267, 372, 359, 2030, 61, 339, 347, 1077, 63, 1541, 8, 277, 12, 2004, 12, 2323, 304, 267, 870, 2323, 339, 347, 2457, 8, 277, 12, 2004, 12, 2323, 12, 2396, 304, 267, 746, 4279, 421, 199, 533, 4163, 4131, 8, 4131, 304, 339, 347, 1077, 63, 1541, 8, 277, 12, 2004, 12, 2323, 304, 267, 340, 440, 2004, 14, 2460, 360, 1840, 735, 288, 372, 756, 267, 367, 536, 12, 574, 315, 2323, 26, 288, 340, 536, 14, 2325, 342, 508, 283, 1317, 13, 466, 356, 355, 372, 574, 14, 2460, 360, 505, 15, 1360, 358, 267, 372, 756, 199, 199, 533, 510, 13655, 6608, 8, 4943, 4131, 304, 339, 347, 2457, 8, 277, 12, 288, 2884, 63, 354, 12, 288, 931, 63, 815, 12, 288, 6160, 12, 288, 2004, 12, 288, 2323, 12, 288, 2396, 304, 267, 2746, 1587, 275, 6160, 14, 362, 480, 80, 13655, 14, 2119, 1587, 401, 6899, 267, 340, 2746, 1587, 26, 288, 5042, 275, 5228, 14, 6424, 342, 288, 754, 275, 299, 13655, 14, 2499, 7638, 8, 355, 2396, 12, 355, 5042, 12, 355, 2498, 63, 705, 63, 305, 63, 5607, 29, 549, 12, 355, 776, 288, 2323, 275, 359, 355, 1689, 1317, 13, 466, 401, 298, 3578, 15, 5607, 1288, 355, 1689, 1317, 13, 20173, 401, 298, 8905, 27, 1788, 628, 435, 2746, 1587, 9, 355, 1622, 288, 2396, 275, 5042, 14, 7150, 342, 267, 372, 2004, 12, 2323, 12, 2396, 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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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 ]
unseenlaser/python-for-android
python-modules/zope/zope/interface/interfaces.py
50
24669
############################################################################## # # Copyright (c) 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Interface Package Interfaces $Id: interfaces.py 110699 2010-04-09 08:16:17Z regebro $ """ __docformat__ = 'restructuredtext' from zope.interface import Interface from zope.interface.interface import Attribute class IElement(Interface): """Objects that have basic documentation and tagged values. """ __name__ = Attribute('__name__', 'The object name') __doc__ = Attribute('__doc__', 'The object doc string') def getTaggedValue(tag): """Returns the value associated with `tag`. Raise a `KeyError` of the tag isn't set. """ def queryTaggedValue(tag, default=None): """Returns the value associated with `tag`. Return the default value of the tag isn't set. """ def getTaggedValueTags(): """Returns a list of all tags.""" def setTaggedValue(tag, value): """Associates `value` with `key`.""" class IAttribute(IElement): """Attribute descriptors""" interface = Attribute('interface', 'Stores the interface instance in which the ' 'attribute is located.') class IMethod(IAttribute): """Method attributes""" def getSignatureInfo(): """Returns the signature information. This method returns a dictionary with the following keys: o `positional` - All positional arguments. o `required` - A list of all required arguments. o `optional` - A list of all optional arguments. o `varargs` - The name of the varargs argument. o `kwargs` - The name of the kwargs argument. """ def getSignatureString(): """Return a signature string suitable for inclusion in documentation. This method returns the function signature string. For example, if you have `func(a, b, c=1, d='f')`, then the signature string is `(a, b, c=1, d='f')`. """ class ISpecification(Interface): """Object Behavioral specifications""" def extends(other, strict=True): """Test whether a specification extends another The specification extends other if it has other as a base interface or if one of it's bases extends other. If strict is false, then the specification extends itself. """ def isOrExtends(other): """Test whether the specification is or extends another """ def weakref(callback=None): """Return a weakref to the specification This method is, regrettably, needed to allow weakrefs to be computed to security-proxied specifications. While the zope.interface package does not require zope.security or zope.proxy, it has to be able to coexist with it. """ __bases__ = Attribute("""Base specifications A tuple if specifications from which this specification is directly derived. """) __sro__ = Attribute("""Specification-resolution order A tuple of the specification and all of it's ancestor specifications from most specific to least specific. (This is similar to the method-resolution order for new-style classes.) """) __iro__ = Attribute("""Interface-resolution order A tuple of the of the specification's ancestor interfaces from most specific to least specific. The specification itself is included if it is an interface. (This is similar to the method-resolution order for new-style classes.) """) def get(name, default=None): """Look up the description for a name If the named attribute is not defined, the default is returned. """ class IInterface(ISpecification, IElement): """Interface objects Interface objects describe the behavior of an object by containing useful information about the object. This information includes: o Prose documentation about the object. In Python terms, this is called the "doc string" of the interface. In this element, you describe how the object works in prose language and any other useful information about the object. o Descriptions of attributes. Attribute descriptions include the name of the attribute and prose documentation describing the attributes usage. o Descriptions of methods. Method descriptions can include: - Prose "doc string" documentation about the method and its usage. - A description of the methods arguments; how many arguments are expected, optional arguments and their default values, the position or arguments in the signature, whether the method accepts arbitrary arguments and whether the method accepts arbitrary keyword arguments. o Optional tagged data. Interface objects (and their attributes and methods) can have optional, application specific tagged data associated with them. Examples uses for this are examples, security assertions, pre/post conditions, and other possible information you may want to associate with an Interface or its attributes. Not all of this information is mandatory. For example, you may only want the methods of your interface to have prose documentation and not describe the arguments of the method in exact detail. Interface objects are flexible and let you give or take any of these components. Interfaces are created with the Python class statement using either Interface.Interface or another interface, as in:: from zope.interface import Interface class IMyInterface(Interface): '''Interface documentation''' def meth(arg1, arg2): '''Documentation for meth''' # Note that there is no self argument class IMySubInterface(IMyInterface): '''Interface documentation''' def meth2(): '''Documentation for meth2''' You use interfaces in two ways: o You assert that your object implement the interfaces. There are several ways that you can assert that an object implements an interface: 1. Call zope.interface.implements in your class definition. 2. Call zope.interfaces.directlyProvides on your object. 3. Call 'zope.interface.classImplements' to assert that instances of a class implement an interface. For example:: from zope.interface import classImplements classImplements(some_class, some_interface) This approach is useful when it is not an option to modify the class source. Note that this doesn't affect what the class itself implements, but only what its instances implement. o You query interface meta-data. See the IInterface methods and attributes for details. """ def providedBy(object): """Test whether the interface is implemented by the object Return true of the object asserts that it implements the interface, including asserting that it implements an extended interface. """ def implementedBy(class_): """Test whether the interface is implemented by instances of the class Return true of the class asserts that its instances implement the interface, including asserting that they implement an extended interface. """ def names(all=False): """Get the interface attribute names Return a sequence of the names of the attributes, including methods, included in the interface definition. Normally, only directly defined attributes are included. If a true positional or keyword argument is given, then attributes defined by base classes will be included. """ def namesAndDescriptions(all=False): """Get the interface attribute names and descriptions Return a sequence of the names and descriptions of the attributes, including methods, as name-value pairs, included in the interface definition. Normally, only directly defined attributes are included. If a true positional or keyword argument is given, then attributes defined by base classes will be included. """ def __getitem__(name): """Get the description for a name If the named attribute is not defined, a KeyError is raised. """ def direct(name): """Get the description for the name if it was defined by the interface If the interface doesn't define the name, returns None. """ def validateInvariants(obj, errors=None): """Validate invariants Validate object to defined invariants. If errors is None, raises first Invalid error; if errors is a list, appends all errors to list, then raises Invalid with the errors as the first element of the "args" tuple.""" def __contains__(name): """Test whether the name is defined by the interface""" def __iter__(): """Return an iterator over the names defined by the interface The names iterated include all of the names defined by the interface directly and indirectly by base interfaces. """ __module__ = Attribute("""The name of the module defining the interface""") class IDeclaration(ISpecification): """Interface declaration Declarations are used to express the interfaces implemented by classes or provided by objects. """ def __contains__(interface): """Test whether an interface is in the specification Return true if the given interface is one of the interfaces in the specification and false otherwise. """ def __iter__(): """Return an iterator for the interfaces in the specification """ def flattened(): """Return an iterator of all included and extended interfaces An iterator is returned for all interfaces either included in or extended by interfaces included in the specifications without duplicates. The interfaces are in "interface resolution order". The interface resolution order is such that base interfaces are listed after interfaces that extend them and, otherwise, interfaces are included in the order that they were defined in the specification. """ def __sub__(interfaces): """Create an interface specification with some interfaces excluded The argument can be an interface or an interface specifications. The interface or interfaces given in a specification are subtracted from the interface specification. Removing an interface that is not in the specification does not raise an error. Doing so has no effect. Removing an interface also removes sub-interfaces of the interface. """ def __add__(interfaces): """Create an interface specification with some interfaces added The argument can be an interface or an interface specifications. The interface or interfaces given in a specification are added to the interface specification. Adding an interface that is already in the specification does not raise an error. Doing so has no effect. """ def __nonzero__(): """Return a true value of the interface specification is non-empty """ class IInterfaceDeclaration(Interface): """Declare and check the interfaces of objects The functions defined in this interface are used to declare the interfaces that objects provide and to query the interfaces that have been declared. Interfaces can be declared for objects in two ways: - Interfaces are declared for instances of the object's class - Interfaces are declared for the object directly. The interfaces declared for an object are, therefore, the union of interfaces declared for the object directly and the interfaces declared for instances of the object's class. Note that we say that a class implements the interfaces provided by it's instances. An instance can also provide interfaces directly. The interfaces provided by an object are the union of the interfaces provided directly and the interfaces implemented by the class. """ def providedBy(ob): """Return the interfaces provided by an object This is the union of the interfaces directly provided by an object and interfaces implemented by it's class. The value returned is an IDeclaration. """ def implementedBy(class_): """Return the interfaces implemented for a class' instances The value returned is an IDeclaration. """ def classImplements(class_, *interfaces): """Declare additional interfaces implemented for instances of a class The arguments after the class are one or more interfaces or interface specifications (IDeclaration objects). The interfaces given (including the interfaces in the specifications) are added to any interfaces previously declared. Consider the following example:: class C(A, B): ... classImplements(C, I1, I2) Instances of ``C`` provide ``I1``, ``I2``, and whatever interfaces instances of ``A`` and ``B`` provide. """ def implementer(*interfaces): """Create a decorator for declaring interfaces implemented by a facory A callable is returned that makes an implements declaration on objects passed to it. """ def classImplementsOnly(class_, *interfaces): """Declare the only interfaces implemented by instances of a class The arguments after the class are one or more interfaces or interface specifications (IDeclaration objects). The interfaces given (including the interfaces in the specifications) replace any previous declarations. Consider the following example:: class C(A, B): ... classImplements(C, IA, IB. IC) classImplementsOnly(C. I1, I2) Instances of ``C`` provide only ``I1``, ``I2``, and regardless of whatever interfaces instances of ``A`` and ``B`` implement. """ def implementer_only(*interfaces): """Create a decorator for declaring the only interfaces implemented A callable is returned that makes an implements declaration on objects passed to it. """ def directlyProvidedBy(object): """Return the interfaces directly provided by the given object The value returned is an IDeclaration. """ def directlyProvides(object, *interfaces): """Declare interfaces declared directly for an object The arguments after the object are one or more interfaces or interface specifications (IDeclaration objects). The interfaces given (including the interfaces in the specifications) replace interfaces previously declared for the object. Consider the following example:: class C(A, B): ... ob = C() directlyProvides(ob, I1, I2) The object, ``ob`` provides ``I1``, ``I2``, and whatever interfaces instances have been declared for instances of ``C``. To remove directly provided interfaces, use ``directlyProvidedBy`` and subtract the unwanted interfaces. For example:: directlyProvides(ob, directlyProvidedBy(ob)-I2) removes I2 from the interfaces directly provided by ``ob``. The object, ``ob`` no longer directly provides ``I2``, although it might still provide ``I2`` if it's class implements ``I2``. To add directly provided interfaces, use ``directlyProvidedBy`` and include additional interfaces. For example:: directlyProvides(ob, directlyProvidedBy(ob), I2) adds I2 to the interfaces directly provided by ob. """ def alsoProvides(object, *interfaces): """Declare additional interfaces directly for an object:: alsoProvides(ob, I1) is equivalent to:: directlyProvides(ob, directlyProvidedBy(ob), I1) """ def noLongerProvides(object, interface): """Remove an interface from the list of an object's directly provided interfaces:: noLongerProvides(ob, I1) is equivalent to:: directlyProvides(ob, directlyProvidedBy(ob)-I1) with the exception that if ``I1`` is an interface that is provided by ``ob`` through the class's implementation, ValueError is raised. """ def implements(*interfaces): """Declare interfaces implemented by instances of a class This function is called in a class definition. The arguments are one or more interfaces or interface specifications (IDeclaration objects). The interfaces given (including the interfaces in the specifications) are added to any interfaces previously declared. Previous declarations include declarations for base classes unless implementsOnly was used. This function is provided for convenience. It provides a more convenient way to call classImplements. For example:: implements(I1) is equivalent to calling:: classImplements(C, I1) after the class has been created. Consider the following example:: class C(A, B): implements(I1, I2) Instances of ``C`` implement ``I1``, ``I2``, and whatever interfaces instances of ``A`` and ``B`` implement. """ def implementsOnly(*interfaces): """Declare the only interfaces implemented by instances of a class This function is called in a class definition. The arguments are one or more interfaces or interface specifications (IDeclaration objects). Previous declarations including declarations for base classes are overridden. This function is provided for convenience. It provides a more convenient way to call classImplementsOnly. For example:: implementsOnly(I1) is equivalent to calling:: classImplementsOnly(I1) after the class has been created. Consider the following example:: class C(A, B): implementsOnly(I1, I2) Instances of ``C`` implement ``I1``, ``I2``, regardless of what instances of ``A`` and ``B`` implement. """ def classProvides(*interfaces): """Declare interfaces provided directly by a class This function is called in a class definition. The arguments are one or more interfaces or interface specifications (IDeclaration objects). The given interfaces (including the interfaces in the specifications) are used to create the class's direct-object interface specification. An error will be raised if the module class has an direct interface specification. In other words, it is an error to call this function more than once in a class definition. Note that the given interfaces have nothing to do with the interfaces implemented by instances of the class. This function is provided for convenience. It provides a more convenient way to call directlyProvides for a class. For example:: classProvides(I1) is equivalent to calling:: directlyProvides(theclass, I1) after the class has been created. """ def provider(*interfaces): """A class decorator version of classProvides""" def moduleProvides(*interfaces): """Declare interfaces provided by a module This function is used in a module definition. The arguments are one or more interfaces or interface specifications (IDeclaration objects). The given interfaces (including the interfaces in the specifications) are used to create the module's direct-object interface specification. An error will be raised if the module already has an interface specification. In other words, it is an error to call this function more than once in a module definition. This function is provided for convenience. It provides a more convenient way to call directlyProvides for a module. For example:: moduleImplements(I1) is equivalent to:: directlyProvides(sys.modules[__name__], I1) """ def Declaration(*interfaces): """Create an interface specification The arguments are one or more interfaces or interface specifications (IDeclaration objects). A new interface specification (IDeclaration) with the given interfaces is returned. """ class IAdapterRegistry(Interface): """Provide an interface-based registry for adapters This registry registers objects that are in some sense "from" a sequence of specification to an interface and a name. No specific semantics are assumed for the registered objects, however, the most common application will be to register factories that adapt objects providing required specifications to a provided interface. """ def register(required, provided, name, value): """Register a value A value is registered for a *sequence* of required specifications, a provided interface, and a name. """ def registered(required, provided, name=u''): """Return the component registered for the given interfaces and name Unlike the lookup method, this methods won't retrieve components registered for more specific required interfaces or less specific provided interfaces. If no component was registered exactly for the given interfaces and name, then None is returned. """ def lookup(required, provided, name='', default=None): """Lookup a value A value is looked up based on a *sequence* of required specifications, a provided interface, and a name. """ def queryMultiAdapter(objects, provided, name=u'', default=None): """Adapt a sequence of objects to a named, provided, interface """ def lookup1(required, provided, name=u'', default=None): """Lookup a value using a single required interface A value is looked up based on a single required specifications, a provided interface, and a name. """ def queryAdapter(object, provided, name=u'', default=None): """Adapt an object using a registered adapter factory. """ def adapter_hook(provided, object, name=u'', default=None): """Adapt an object using a registered adapter factory. """ def lookupAll(required, provided): """Find all adapters from the required to the provided interfaces An iterable object is returned that provides name-value two-tuples. """ def names(required, provided): """Return the names for which there are registered objects """ def subscribe(required, provided, subscriber, name=u''): """Register a subscriber A subscriber is registered for a *sequence* of required specifications, a provided interface, and a name. Multiple subscribers may be registered for the same (or equivalent) interfaces. """ def subscriptions(required, provided, name=u''): """Get a sequence of subscribers Subscribers for a *sequence* of required interfaces, and a provided interface are returned. """ def subscribers(objects, provided, name=u''): """Get a sequence of subscription adapters """
apache-2.0
[ 4605, 199, 3, 199, 3, 1898, 334, 67, 9, 14790, 3107, 13458, 2752, 436, 23212, 14, 199, 3, 2900, 5924, 5702, 14, 199, 3, 199, 3, 961, 2032, 365, 5420, 370, 314, 1727, 1356, 402, 314, 3107, 13458, 1684, 844, 12, 199, 3, 3394, 499, 14, 17, 334, 58, 2749, 680, 221, 437, 1331, 402, 314, 3107, 2749, 1077, 21727, 642, 4084, 14, 199, 3, 5749, 4141, 2281, 7049, 298, 1179, 2281, 2, 2401, 1821, 2401, 11727, 7168, 1549, 5292, 199, 3, 2990, 9315, 9706, 12, 6931, 12, 5400, 2845, 5471, 2296, 12, 2334, 5292, 199, 3, 2990, 1634, 377, 16507, 12, 3169, 12, 437, 9741, 7834, 1621, 12600, 12, 2401, 3092, 199, 3, 2381, 437, 3115, 3104, 14, 199, 3, 199, 4605, 199, 624, 4267, 15665, 6551, 4309, 199, 199, 4, 1304, 26, 8386, 14, 647, 413, 7357, 1020, 7129, 13, 966, 13, 1643, 19363, 26, 975, 26, 1196, 58, 295, 303, 20670, 2672, 199, 624, 199, 363, 21841, 363, 275, 283, 26854, 7, 421, 199, 504, 20110, 14, 3266, 492, 14816, 199, 504, 20110, 14, 3266, 14, 3266, 492, 3882, 199, 199, 533, 473, 2162, 8, 4267, 304, 272, 408, 11188, 626, 1172, 5678, 3794, 436, 20018, 1338, 14, 272, 408, 339, 636, 354, 363, 275, 3882, 10714, 354, 7500, 283, 1918, 909, 536, 358, 272, 636, 1301, 363, 221, 275, 3882, 10714, 1301, 7500, 283, 1918, 909, 1382, 1059, 358, 339, 347, 664, 26403, 1110, 8, 1450, 304, 267, 408, 3407, 314, 574, 4568, 543, 658, 1450, 2313, 398, 14771, 282, 658, 10230, 64, 402, 314, 1947, 5712, 1133, 663, 14, 267, 408, 339, 347, 1827, 26403, 1110, 8, 1450, 12, 849, 29, 403, 304, 267, 408, 3407, 314, 574, 4568, 543, 658, 1450, 2313, 398, 1432, 314, 849, 574, 402, 314, 1947, 5712, 1133, 663, 14, 267, 408, 339, 347, 664, 26403, 1110, 9440, 837, 267, 408, 3407, 282, 769, 402, 1006, 3762, 1041, 339, 347, 663, 26403, 1110, 8, 1450, 12, 574, 304, 267, 408, 14889, 2335, 658, 585, 64, 543, 658, 498, 17105, 421, 199, 533, 473, 1646, 8, 41, 2162, 304, 272, 408, 1646, 15428, 624, 339, 3217, 275, 3882, 360, 3266, 297, 2079, 283, 4759, 470, 314, 3217, 1256, 315, 1314, 314, 283, 2079, 283, 3215, 365, 16180, 2659, 421, 199, 533, 473, 3767, 8, 41, 1646, 304, 272, 408, 3767, 3004, 624, 339, 347, 664, 10014, 2354, 837, 267, 408, 3407, 314, 4955, 2556, 14, 398, 961, 1083, 2529, 282, 2600, 543, 314, 2569, 2883, 26, 398, 312, 658, 17867, 64, 446, 2900, 11333, 2368, 14, 398, 312, 658, 2427, 64, 446, 437, 769, 402, 1006, 1415, 2368, 14, 398, 312, 658, 4144, 64, 446, 437, 769, 402, 1006, 2716, 2368, 14, 398, 312, 658, 27367, 64, 446, 710, 536, 402, 314, 23377, 1423, 14, 398, 312, 658, 958, 64, 446, 710, 536, 402, 314, 2074, 1423, 14, 267, 408, 339, 347, 664, 10014, 1558, 837, 267, 408, 1767, 282, 4955, 1059, 11233, 367, 20396, 315, 3794, 14, 398, 961, 1083, 2529, 314, 805, 4955, 1059, 14, 2104, 2893, 12, 340, 1265, 267, 1172, 658, 1532, 8, 65, 12, 330, 12, 286, 29, 17, 12, 366, 534, 70, 358, 3559, 2066, 314, 4955, 1059, 365, 16918, 65, 12, 330, 12, 267, 286, 29, 17, 12, 366, 534, 70, 358, 2313, 267, 408, 199, 199, 533, 2281, 910, 3477, 8, 4267, 304, 272, 408, 1692, 6423, 13115, 279, 28754, 624, 339, 347, 16879, 8, 1848, 12, 7478, 29, 549, 304, 267, 408, 774, 3775, 282, 8929, 16879, 4573, 398, 710, 8929, 16879, 1163, 340, 652, 965, 1163, 465, 282, 1300, 267, 3217, 503, 340, 1373, 402, 652, 1159, 9768, 16879, 1163, 14, 398, 982, 7478, 365, 3055, 12, 2066, 314, 8929, 16879, 6337, 14, 267, 408, 339, 347, 365, 2844, 4377, 795, 8, 1848, 304, 267, 408, 774, 3775, 314, 8929, 365, 503, 16879, 4573, 267, 408, 339, 347, 13852, 8, 3058, 29, 403, 304, 267, 408, 1767, 282, 13852, 370, 314, 8929, 398, 961, 1083, 365, 12, 1295, 3292, 2902, 590, 12, 4346, 370, 2040, 9282, 7655, 370, 506, 267, 9235, 370, 6391, 13, 8221, 5299, 28754, 14, 221, 22117, 314, 267, 20110, 14, 3266, 2559, 1630, 440, 4409, 20110, 14, 4416, 503, 267, 20110, 14, 3280, 12, 652, 965, 370, 506, 7688, 370, 512, 4494, 543, 652, 14, 398, 408, 339, 636, 12087, 363, 275, 3882, 4852, 1563, 28754, 339, 437, 2008, 340, 28754, 687, 1314, 642, 8929, 365, 272, 5370, 7131, 14, 339, 7857, 339, 636, 83, 293, 363, 275, 3882, 4852, 26235, 13, 12588, 1865, 339, 437, 2008, 402, 314, 8929, 436, 1006, 402, 652, 1159, 18432, 272, 28754, 687, 4750, 2488, 370, 5210, 2488, 14, 339, 334, 2765, 365, 8545, 370, 314, 1083, 13, 12588, 1865, 367, 892, 13, 2487, 3992, 4959, 272, 7857, 339, 636, 14352, 363, 275, 3882, 4852, 4267, 13, 12588, 1865, 339, 437, 2008, 402, 314, 402, 314, 8929, 1159, 18432, 8386, 687, 272, 4750, 2488, 370, 5210, 2488, 14, 221, 710, 8929, 6337, 365, 272, 5120, 340, 652, 365, 376, 3217, 14, 339, 334, 2765, 365, 8545, 370, 314, 1083, 13, 12588, 1865, 367, 892, 13, 2487, 3992, 4959, 272, 7857, 339, 347, 664, 8, 354, 12, 849, 29, 403, 304, 267, 408, 20926, 1536, 314, 1369, 367, 282, 536, 398, 982, 314, 4310, 2225, 365, 440, 3247, 12, 314, 849, 365, 267, 2138, 14, 267, 408, 421, 199, 533, 473, 4267, 8, 1311, 910, 3477, 12, 473, 2162, 304, 272, 408, 4267, 2251, 339, 14816, 2251, 13743, 314, 5953, 402, 376, 909, 701, 3035, 272, 2997, 2556, 3595, 314, 909, 14, 221, 961, 2556, 6952, 26, 2541, 312, 2165, 261, 3794, 3595, 314, 909, 14, 221, 1010, 2018, 2895, 12, 642, 267, 365, 2797, 314, 298, 1301, 1059, 2, 402, 314, 3217, 14, 221, 1010, 642, 1819, 12, 267, 1265, 13743, 4212, 314, 909, 5419, 315, 557, 261, 2637, 436, 1263, 267, 1163, 2997, 2556, 3595, 314, 909, 14, 2541, 312, 11994, 83, 402, 3004, 14, 221, 3882, 18714, 2387, 267, 314, 536, 402, 314, 2225, 436, 557, 261, 3794, 13660, 267, 314, 3004, 4503, 14, 2541, 312, 11994, 83, 402, 3102, 14, 221, 9075 ]
[ 199, 3, 199, 3, 1898, 334, 67, 9, 14790, 3107, 13458, 2752, 436, 23212, 14, 199, 3, 2900, 5924, 5702, 14, 199, 3, 199, 3, 961, 2032, 365, 5420, 370, 314, 1727, 1356, 402, 314, 3107, 13458, 1684, 844, 12, 199, 3, 3394, 499, 14, 17, 334, 58, 2749, 680, 221, 437, 1331, 402, 314, 3107, 2749, 1077, 21727, 642, 4084, 14, 199, 3, 5749, 4141, 2281, 7049, 298, 1179, 2281, 2, 2401, 1821, 2401, 11727, 7168, 1549, 5292, 199, 3, 2990, 9315, 9706, 12, 6931, 12, 5400, 2845, 5471, 2296, 12, 2334, 5292, 199, 3, 2990, 1634, 377, 16507, 12, 3169, 12, 437, 9741, 7834, 1621, 12600, 12, 2401, 3092, 199, 3, 2381, 437, 3115, 3104, 14, 199, 3, 199, 4605, 199, 624, 4267, 15665, 6551, 4309, 199, 199, 4, 1304, 26, 8386, 14, 647, 413, 7357, 1020, 7129, 13, 966, 13, 1643, 19363, 26, 975, 26, 1196, 58, 295, 303, 20670, 2672, 199, 624, 199, 363, 21841, 363, 275, 283, 26854, 7, 421, 199, 504, 20110, 14, 3266, 492, 14816, 199, 504, 20110, 14, 3266, 14, 3266, 492, 3882, 199, 199, 533, 473, 2162, 8, 4267, 304, 272, 408, 11188, 626, 1172, 5678, 3794, 436, 20018, 1338, 14, 272, 408, 339, 636, 354, 363, 275, 3882, 10714, 354, 7500, 283, 1918, 909, 536, 358, 272, 636, 1301, 363, 221, 275, 3882, 10714, 1301, 7500, 283, 1918, 909, 1382, 1059, 358, 339, 347, 664, 26403, 1110, 8, 1450, 304, 267, 408, 3407, 314, 574, 4568, 543, 658, 1450, 2313, 398, 14771, 282, 658, 10230, 64, 402, 314, 1947, 5712, 1133, 663, 14, 267, 408, 339, 347, 1827, 26403, 1110, 8, 1450, 12, 849, 29, 403, 304, 267, 408, 3407, 314, 574, 4568, 543, 658, 1450, 2313, 398, 1432, 314, 849, 574, 402, 314, 1947, 5712, 1133, 663, 14, 267, 408, 339, 347, 664, 26403, 1110, 9440, 837, 267, 408, 3407, 282, 769, 402, 1006, 3762, 1041, 339, 347, 663, 26403, 1110, 8, 1450, 12, 574, 304, 267, 408, 14889, 2335, 658, 585, 64, 543, 658, 498, 17105, 421, 199, 533, 473, 1646, 8, 41, 2162, 304, 272, 408, 1646, 15428, 624, 339, 3217, 275, 3882, 360, 3266, 297, 2079, 283, 4759, 470, 314, 3217, 1256, 315, 1314, 314, 283, 2079, 283, 3215, 365, 16180, 2659, 421, 199, 533, 473, 3767, 8, 41, 1646, 304, 272, 408, 3767, 3004, 624, 339, 347, 664, 10014, 2354, 837, 267, 408, 3407, 314, 4955, 2556, 14, 398, 961, 1083, 2529, 282, 2600, 543, 314, 2569, 2883, 26, 398, 312, 658, 17867, 64, 446, 2900, 11333, 2368, 14, 398, 312, 658, 2427, 64, 446, 437, 769, 402, 1006, 1415, 2368, 14, 398, 312, 658, 4144, 64, 446, 437, 769, 402, 1006, 2716, 2368, 14, 398, 312, 658, 27367, 64, 446, 710, 536, 402, 314, 23377, 1423, 14, 398, 312, 658, 958, 64, 446, 710, 536, 402, 314, 2074, 1423, 14, 267, 408, 339, 347, 664, 10014, 1558, 837, 267, 408, 1767, 282, 4955, 1059, 11233, 367, 20396, 315, 3794, 14, 398, 961, 1083, 2529, 314, 805, 4955, 1059, 14, 2104, 2893, 12, 340, 1265, 267, 1172, 658, 1532, 8, 65, 12, 330, 12, 286, 29, 17, 12, 366, 534, 70, 358, 3559, 2066, 314, 4955, 1059, 365, 16918, 65, 12, 330, 12, 267, 286, 29, 17, 12, 366, 534, 70, 358, 2313, 267, 408, 199, 199, 533, 2281, 910, 3477, 8, 4267, 304, 272, 408, 1692, 6423, 13115, 279, 28754, 624, 339, 347, 16879, 8, 1848, 12, 7478, 29, 549, 304, 267, 408, 774, 3775, 282, 8929, 16879, 4573, 398, 710, 8929, 16879, 1163, 340, 652, 965, 1163, 465, 282, 1300, 267, 3217, 503, 340, 1373, 402, 652, 1159, 9768, 16879, 1163, 14, 398, 982, 7478, 365, 3055, 12, 2066, 314, 8929, 16879, 6337, 14, 267, 408, 339, 347, 365, 2844, 4377, 795, 8, 1848, 304, 267, 408, 774, 3775, 314, 8929, 365, 503, 16879, 4573, 267, 408, 339, 347, 13852, 8, 3058, 29, 403, 304, 267, 408, 1767, 282, 13852, 370, 314, 8929, 398, 961, 1083, 365, 12, 1295, 3292, 2902, 590, 12, 4346, 370, 2040, 9282, 7655, 370, 506, 267, 9235, 370, 6391, 13, 8221, 5299, 28754, 14, 221, 22117, 314, 267, 20110, 14, 3266, 2559, 1630, 440, 4409, 20110, 14, 4416, 503, 267, 20110, 14, 3280, 12, 652, 965, 370, 506, 7688, 370, 512, 4494, 543, 652, 14, 398, 408, 339, 636, 12087, 363, 275, 3882, 4852, 1563, 28754, 339, 437, 2008, 340, 28754, 687, 1314, 642, 8929, 365, 272, 5370, 7131, 14, 339, 7857, 339, 636, 83, 293, 363, 275, 3882, 4852, 26235, 13, 12588, 1865, 339, 437, 2008, 402, 314, 8929, 436, 1006, 402, 652, 1159, 18432, 272, 28754, 687, 4750, 2488, 370, 5210, 2488, 14, 339, 334, 2765, 365, 8545, 370, 314, 1083, 13, 12588, 1865, 367, 892, 13, 2487, 3992, 4959, 272, 7857, 339, 636, 14352, 363, 275, 3882, 4852, 4267, 13, 12588, 1865, 339, 437, 2008, 402, 314, 402, 314, 8929, 1159, 18432, 8386, 687, 272, 4750, 2488, 370, 5210, 2488, 14, 221, 710, 8929, 6337, 365, 272, 5120, 340, 652, 365, 376, 3217, 14, 339, 334, 2765, 365, 8545, 370, 314, 1083, 13, 12588, 1865, 367, 892, 13, 2487, 3992, 4959, 272, 7857, 339, 347, 664, 8, 354, 12, 849, 29, 403, 304, 267, 408, 20926, 1536, 314, 1369, 367, 282, 536, 398, 982, 314, 4310, 2225, 365, 440, 3247, 12, 314, 849, 365, 267, 2138, 14, 267, 408, 421, 199, 533, 473, 4267, 8, 1311, 910, 3477, 12, 473, 2162, 304, 272, 408, 4267, 2251, 339, 14816, 2251, 13743, 314, 5953, 402, 376, 909, 701, 3035, 272, 2997, 2556, 3595, 314, 909, 14, 221, 961, 2556, 6952, 26, 2541, 312, 2165, 261, 3794, 3595, 314, 909, 14, 221, 1010, 2018, 2895, 12, 642, 267, 365, 2797, 314, 298, 1301, 1059, 2, 402, 314, 3217, 14, 221, 1010, 642, 1819, 12, 267, 1265, 13743, 4212, 314, 909, 5419, 315, 557, 261, 2637, 436, 1263, 267, 1163, 2997, 2556, 3595, 314, 909, 14, 2541, 312, 11994, 83, 402, 3004, 14, 221, 3882, 18714, 2387, 267, 314, 536, 402, 314, 2225, 436, 557, 261, 3794, 13660, 267, 314, 3004, 4503, 14, 2541, 312, 11994, 83, 402, 3102, 14, 221, 9075, 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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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 ]
shaufi10/odoo
addons/lunch/wizard/lunch_order.py
440
1299
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2012 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## from openerp.osv import fields, osv class lunch_order_order(osv.TransientModel): """ lunch order meal """ _name = 'lunch.order.order' _description = 'Wizard to order a meal' def order(self,cr,uid,ids,context=None): return self.pool.get('lunch.order.line').order(cr, uid, ids, context=context)
agpl-3.0
[ 3, 1882, 2644, 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, 7409, 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, 504, 5166, 14, 4795, 492, 1504, 12, 9506, 199, 199, 533, 634, 4689, 63, 1648, 63, 1648, 8, 4795, 14, 14612, 14928, 1685, 304, 272, 408, 634, 4689, 1865, 562, 279, 408, 272, 485, 354, 275, 283, 76, 4689, 14, 1648, 14, 1648, 7, 272, 485, 1802, 275, 283, 20120, 370, 1865, 282, 562, 279, 7, 339, 347, 1865, 8, 277, 12, 1556, 12, 1535, 12, 1580, 12, 1100, 29, 403, 304, 267, 372, 291, 14, 2293, 14, 362, 360, 76, 4689, 14, 1648, 14, 604, 1959, 1648, 8, 1556, 12, 1747, 12, 2762, 12, 1067, 29, 1100, 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 ]
[ 1882, 2644, 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, 7409, 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, 504, 5166, 14, 4795, 492, 1504, 12, 9506, 199, 199, 533, 634, 4689, 63, 1648, 63, 1648, 8, 4795, 14, 14612, 14928, 1685, 304, 272, 408, 634, 4689, 1865, 562, 279, 408, 272, 485, 354, 275, 283, 76, 4689, 14, 1648, 14, 1648, 7, 272, 485, 1802, 275, 283, 20120, 370, 1865, 282, 562, 279, 7, 339, 347, 1865, 8, 277, 12, 1556, 12, 1535, 12, 1580, 12, 1100, 29, 403, 304, 267, 372, 291, 14, 2293, 14, 362, 360, 76, 4689, 14, 1648, 14, 604, 1959, 1648, 8, 1556, 12, 1747, 12, 2762, 12, 1067, 29, 1100, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
pmateusz/browser-automation
source/Python/GetChromiumUrl.py
4
1541
import sys import re import requests import xml.etree.ElementTree as element_tree MAX_ATTEMTPS = 10 def get_last_change(): r = requests.get('http://commondatastorage.googleapis.com/chromium-browser-continuous/Win/LAST_CHANGE') r.raise_for_status() return int(r.text) def remove_default_namespace(xml): return re.sub(r'\sxmlns=(\'|")[^"]+\1', '', xml, count=1) def get_generation(last_change): r = requests.get("http://commondatastorage.googleapis.com/chromium-browser-snapshots?prefix=Win/" + str(last_change)) r.raise_for_status() doc = remove_default_namespace(r.text) tree = element_tree.fromstring(doc) for contents in tree.findall('Contents'): key = contents.findtext('Key') if key is None: continue if key.endswith('chrome-win32.zip'): generation = contents.findtext('Generation') if generation is None: continue return generation return None def get_download_url(change, generation): return 'https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Win%2F{0}%2Fchrome-win32.zip?generation={1}&alt=media'.format(change,generation) if __name__ == '__main__': last_change = get_last_change() min_change = max(0, last_change - MAX_ATTEMTPS) for change in range(last_change, min_change, -1): generation = get_generation(change) if generation is not None: download_url = get_download_url(change, generation) print(download_url) sys.exit() msg = 'Chromium has not been build for last {0} changes'.format(MAX_ATTEMTPS) print(msg, file=sys.stderr) sys.exit(-1)
mit
[ 646, 984, 199, 646, 295, 199, 646, 4145, 199, 646, 2748, 14, 9464, 14, 15325, 465, 1819, 63, 2350, 199, 199, 4283, 63, 11712, 2769, 52, 5067, 275, 1616, 199, 199, 318, 664, 63, 2019, 63, 1461, 837, 199, 198, 82, 275, 4145, 14, 362, 360, 1014, 921, 2330, 576, 3494, 14, 17533, 14, 957, 15, 13211, 13, 5750, 13, 23458, 15, 8886, 15, 16901, 63, 16062, 358, 199, 198, 82, 14, 3730, 63, 509, 63, 1205, 342, 199, 198, 1107, 1109, 8, 82, 14, 505, 9, 199, 199, 318, 2813, 63, 885, 63, 3251, 8, 1652, 304, 199, 198, 1107, 295, 14, 954, 8, 82, 1154, 83, 13991, 2687, 3985, 92, 531, 25153, 7896, 17, 297, 3260, 2748, 12, 2338, 29, 17, 9, 507, 199, 318, 664, 63, 15043, 8, 2019, 63, 1461, 304, 199, 198, 82, 275, 4145, 14, 362, 480, 1014, 921, 2330, 576, 3494, 14, 17533, 14, 957, 15, 13211, 13, 5750, 13, 15331, 31, 1861, 29, 8886, 6687, 435, 620, 8, 2019, 63, 1461, 430, 199, 198, 82, 14, 3730, 63, 509, 63, 1205, 342, 8299, 198, 1301, 275, 2813, 63, 885, 63, 3251, 8, 82, 14, 505, 9, 199, 198, 2350, 275, 1819, 63, 2350, 14, 13521, 8, 1301, 9, 199, 198, 509, 4072, 315, 3123, 14, 6452, 360, 11383, 735, 507, 198, 498, 275, 4072, 14, 30401, 360, 1197, 358, 507, 198, 692, 790, 365, 488, 26, 686, 198, 6958, 507, 198, 692, 790, 14, 4130, 360, 9887, 13, 2676, 708, 14, 3065, 735, 686, 198, 15043, 275, 4072, 14, 30401, 360, 18514, 358, 686, 198, 692, 10152, 365, 488, 26, 1585, 198, 6958, 686, 198, 1107, 10152, 199, 198, 1107, 488, 199, 199, 318, 664, 63, 4249, 63, 633, 8, 1461, 12, 10152, 304, 199, 198, 1107, 283, 2859, 921, 1544, 14, 17533, 14, 957, 15, 4249, 15, 3494, 15, 86, 17, 15, 66, 15, 13211, 13, 5750, 13, 15331, 15, 79, 15, 8886, 5, 18, 38, 91, 16, 22109, 18, 38, 9887, 13, 2676, 708, 14, 3065, 31, 15043, 3126, 17, 93, 6, 4478, 29, 4603, 1370, 908, 8, 1461, 12, 15043, 9, 507, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 199, 198, 2019, 63, 1461, 275, 664, 63, 2019, 63, 1461, 342, 199, 198, 827, 63, 1461, 275, 1390, 8, 16, 12, 2061, 63, 1461, 446, 9141, 63, 11712, 2769, 52, 5067, 9, 199, 198, 509, 1570, 315, 1425, 8, 2019, 63, 1461, 12, 1748, 63, 1461, 12, 446, 17, 304, 507, 198, 15043, 275, 664, 63, 15043, 8, 1461, 9, 507, 198, 692, 10152, 365, 440, 488, 26, 686, 198, 4249, 63, 633, 275, 664, 63, 4249, 63, 633, 8, 1461, 12, 10152, 9, 686, 198, 1361, 8, 4249, 63, 633, 9, 686, 198, 1274, 14, 2224, 342, 199, 198, 1328, 275, 283, 29381, 965, 440, 2757, 1900, 367, 2061, 469, 16, 93, 4493, 1370, 908, 8, 4283, 63, 11712, 2769, 52, 5067, 9, 199, 198, 1361, 8, 1328, 12, 570, 29, 1274, 14, 3083, 9, 199, 198, 1274, 14, 2224, 2801, 17, 9, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 984, 199, 646, 295, 199, 646, 4145, 199, 646, 2748, 14, 9464, 14, 15325, 465, 1819, 63, 2350, 199, 199, 4283, 63, 11712, 2769, 52, 5067, 275, 1616, 199, 199, 318, 664, 63, 2019, 63, 1461, 837, 199, 198, 82, 275, 4145, 14, 362, 360, 1014, 921, 2330, 576, 3494, 14, 17533, 14, 957, 15, 13211, 13, 5750, 13, 23458, 15, 8886, 15, 16901, 63, 16062, 358, 199, 198, 82, 14, 3730, 63, 509, 63, 1205, 342, 199, 198, 1107, 1109, 8, 82, 14, 505, 9, 199, 199, 318, 2813, 63, 885, 63, 3251, 8, 1652, 304, 199, 198, 1107, 295, 14, 954, 8, 82, 1154, 83, 13991, 2687, 3985, 92, 531, 25153, 7896, 17, 297, 3260, 2748, 12, 2338, 29, 17, 9, 507, 199, 318, 664, 63, 15043, 8, 2019, 63, 1461, 304, 199, 198, 82, 275, 4145, 14, 362, 480, 1014, 921, 2330, 576, 3494, 14, 17533, 14, 957, 15, 13211, 13, 5750, 13, 15331, 31, 1861, 29, 8886, 6687, 435, 620, 8, 2019, 63, 1461, 430, 199, 198, 82, 14, 3730, 63, 509, 63, 1205, 342, 8299, 198, 1301, 275, 2813, 63, 885, 63, 3251, 8, 82, 14, 505, 9, 199, 198, 2350, 275, 1819, 63, 2350, 14, 13521, 8, 1301, 9, 199, 198, 509, 4072, 315, 3123, 14, 6452, 360, 11383, 735, 507, 198, 498, 275, 4072, 14, 30401, 360, 1197, 358, 507, 198, 692, 790, 365, 488, 26, 686, 198, 6958, 507, 198, 692, 790, 14, 4130, 360, 9887, 13, 2676, 708, 14, 3065, 735, 686, 198, 15043, 275, 4072, 14, 30401, 360, 18514, 358, 686, 198, 692, 10152, 365, 488, 26, 1585, 198, 6958, 686, 198, 1107, 10152, 199, 198, 1107, 488, 199, 199, 318, 664, 63, 4249, 63, 633, 8, 1461, 12, 10152, 304, 199, 198, 1107, 283, 2859, 921, 1544, 14, 17533, 14, 957, 15, 4249, 15, 3494, 15, 86, 17, 15, 66, 15, 13211, 13, 5750, 13, 15331, 15, 79, 15, 8886, 5, 18, 38, 91, 16, 22109, 18, 38, 9887, 13, 2676, 708, 14, 3065, 31, 15043, 3126, 17, 93, 6, 4478, 29, 4603, 1370, 908, 8, 1461, 12, 15043, 9, 507, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 199, 198, 2019, 63, 1461, 275, 664, 63, 2019, 63, 1461, 342, 199, 198, 827, 63, 1461, 275, 1390, 8, 16, 12, 2061, 63, 1461, 446, 9141, 63, 11712, 2769, 52, 5067, 9, 199, 198, 509, 1570, 315, 1425, 8, 2019, 63, 1461, 12, 1748, 63, 1461, 12, 446, 17, 304, 507, 198, 15043, 275, 664, 63, 15043, 8, 1461, 9, 507, 198, 692, 10152, 365, 440, 488, 26, 686, 198, 4249, 63, 633, 275, 664, 63, 4249, 63, 633, 8, 1461, 12, 10152, 9, 686, 198, 1361, 8, 4249, 63, 633, 9, 686, 198, 1274, 14, 2224, 342, 199, 198, 1328, 275, 283, 29381, 965, 440, 2757, 1900, 367, 2061, 469, 16, 93, 4493, 1370, 908, 8, 4283, 63, 11712, 2769, 52, 5067, 9, 199, 198, 1361, 8, 1328, 12, 570, 29, 1274, 14, 3083, 9, 199, 198, 1274, 14, 2224, 2801, 17, 9, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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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 ]
mendersoftware/integration
testutils/api/proto_shell.py
1
2637
# Copyright 2021 Northern.tech AS # # 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 . import protomsg PROTO_TYPE_SHELL = 1 MSG_TYPE_SHELL_COMMAND = "shell" MSG_TYPE_SPAWN_SHELL = "new" MSG_TYPE_STOP_SHELL = "stop" MSG_BODY_SHELL_STARTED = b"Shell started" class ProtoShell: def __init__(self, ws): self.protomsg = protomsg.ProtoMsg(PROTO_TYPE_SHELL) self.ws = ws def startShell(self): self.protomsg.clear() self.protomsg.setTyp(MSG_TYPE_SPAWN_SHELL) msg = self.protomsg.encode(b"") self.ws.send(msg) msg = self.ws.recv() body = self.protomsg.decode(msg) assert self.protomsg.protoType == PROTO_TYPE_SHELL assert self.protomsg.typ == MSG_TYPE_SPAWN_SHELL, ( 'Did not receive confirmation that shell was started (received command "%s").' % self.protomsg.typ ) self.sid = self.protomsg.sid return body def sendInput(self, data): self.protomsg.clear() self.protomsg.setTyp(MSG_TYPE_SHELL_COMMAND) msg = self.protomsg.encode(data) self.ws.send(msg) def recvOutput(self, timeout=1): body = b"" try: while True: msg = self.ws.recv(timeout) body += self.protomsg.decode(msg) assert self.protomsg.protoType == PROTO_TYPE_SHELL assert ( self.protomsg.typ == MSG_TYPE_SHELL_COMMAND ), "Did not receive shell output." except TimeoutError: return body raise RuntimeError("Should never get here") def stopShell(self): self.protomsg.clear() self.protomsg.setTyp(MSG_TYPE_STOP_SHELL) msg = self.protomsg.encode(b"") self.ws.send(msg) msg = self.ws.recv() body = self.protomsg.decode(msg) assert self.protomsg.protoType == PROTO_TYPE_SHELL assert ( self.protomsg.typ == MSG_TYPE_STOP_SHELL ), "Did not receive confirmation that shell was started." self.sid = None return body
apache-2.0
[ 3, 1898, 499, 15385, 653, 269, 728, 78, 14, 15970, 4319, 199, 3, 199, 3, 259, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 259, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 259, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 263, 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, 199, 3, 259, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 259, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 259, 4204, 1334, 314, 844, 14, 199, 199, 504, 1275, 492, 4104, 1328, 199, 199, 7459, 63, 2711, 63, 29085, 275, 413, 199, 199, 9740, 63, 2711, 63, 29085, 63, 10761, 275, 298, 5641, 2, 199, 9740, 63, 2711, 63, 5763, 33, 3705, 63, 29085, 275, 298, 1222, 2, 199, 9740, 63, 2711, 63, 11632, 63, 29085, 275, 298, 2379, 2, 199, 199, 9740, 63, 23708, 63, 29085, 63, 32385, 275, 330, 2, 8529, 8239, 2, 421, 199, 533, 2165, 475, 8529, 26, 272, 347, 636, 826, 721, 277, 12, 10900, 304, 267, 291, 14, 2625, 1328, 275, 4104, 1328, 14, 8548, 6173, 8, 7459, 63, 2711, 63, 29085, 9, 267, 291, 14, 3569, 275, 10900, 339, 347, 1343, 8529, 8, 277, 304, 267, 291, 14, 2625, 1328, 14, 3584, 342, 398, 291, 14, 2625, 1328, 14, 409, 21718, 8, 9740, 63, 2711, 63, 5763, 33, 3705, 63, 29085, 9, 267, 1499, 275, 291, 14, 2625, 1328, 14, 2143, 8, 66, 7230, 267, 291, 14, 3569, 14, 2254, 8, 1328, 9, 398, 1499, 275, 291, 14, 3569, 14, 7637, 342, 267, 2396, 275, 291, 14, 2625, 1328, 14, 2708, 8, 1328, 9, 267, 702, 291, 14, 2625, 1328, 14, 2625, 804, 508, 3611, 2566, 63, 2711, 63, 29085, 267, 702, 291, 14, 2625, 1328, 14, 9749, 508, 23620, 63, 2711, 63, 5763, 33, 3705, 63, 29085, 12, 334, 288, 283, 17366, 440, 9128, 18791, 626, 5218, 1990, 8239, 334, 9226, 1414, 2071, 83, 3471, 7, 288, 450, 291, 14, 2625, 1328, 14, 9749, 267, 776, 267, 291, 14, 4148, 275, 291, 14, 2625, 1328, 14, 4148, 398, 372, 2396, 339, 347, 3222, 3205, 8, 277, 12, 666, 304, 267, 291, 14, 2625, 1328, 14, 3584, 342, 267, 291, 14, 2625, 1328, 14, 409, 21718, 8, 9740, 63, 2711, 63, 29085, 63, 10761, 9, 267, 1499, 275, 291, 14, 2625, 1328, 14, 2143, 8, 576, 9, 267, 291, 14, 3569, 14, 2254, 8, 1328, 9, 339, 347, 11904, 2959, 8, 277, 12, 2653, 29, 17, 304, 267, 2396, 275, 330, 341, 267, 862, 26, 288, 1830, 715, 26, 355, 1499, 275, 291, 14, 3569, 14, 7637, 8, 2593, 9, 355, 2396, 847, 291, 14, 2625, 1328, 14, 2708, 8, 1328, 9, 355, 702, 291, 14, 2625, 1328, 14, 2625, 804, 508, 3611, 2566, 63, 2711, 63, 29085, 355, 702, 334, 490, 291, 14, 2625, 1328, 14, 9749, 508, 23620, 63, 2711, 63, 29085, 63, 10761, 355, 2318, 298, 17366, 440, 9128, 5218, 1072, 2122, 267, 871, 31886, 26, 288, 372, 2396, 267, 746, 6064, 480, 11408, 7078, 664, 2348, 531, 339, 347, 3631, 8529, 8, 277, 304, 267, 291, 14, 2625, 1328, 14, 3584, 342, 267, 291, 14, 2625, 1328, 14, 409, 21718, 8, 9740, 63, 2711, 63, 11632, 63, 29085, 9, 267, 1499, 275, 291, 14, 2625, 1328, 14, 2143, 8, 66, 7230, 267, 291, 14, 3569, 14, 2254, 8, 1328, 9, 398, 1499, 275, 291, 14, 3569, 14, 7637, 342, 267, 2396, 275, 291, 14, 2625, 1328, 14, 2708, 8, 1328, 9, 267, 702, 291, 14, 2625, 1328, 14, 2625, 804, 508, 3611, 2566, 63, 2711, 63, 29085, 267, 702, 334, 288, 291, 14, 2625, 1328, 14, 9749, 508, 23620, 63, 2711, 63, 11632, 63, 29085, 267, 2318, 298, 17366, 440, 9128, 18791, 626, 5218, 1990, 8239, 2122, 267, 291, 14, 4148, 275, 488, 267, 372, 2396, 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 ]
[ 1898, 499, 15385, 653, 269, 728, 78, 14, 15970, 4319, 199, 3, 199, 3, 259, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 259, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 259, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 263, 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, 199, 3, 259, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 259, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 259, 4204, 1334, 314, 844, 14, 199, 199, 504, 1275, 492, 4104, 1328, 199, 199, 7459, 63, 2711, 63, 29085, 275, 413, 199, 199, 9740, 63, 2711, 63, 29085, 63, 10761, 275, 298, 5641, 2, 199, 9740, 63, 2711, 63, 5763, 33, 3705, 63, 29085, 275, 298, 1222, 2, 199, 9740, 63, 2711, 63, 11632, 63, 29085, 275, 298, 2379, 2, 199, 199, 9740, 63, 23708, 63, 29085, 63, 32385, 275, 330, 2, 8529, 8239, 2, 421, 199, 533, 2165, 475, 8529, 26, 272, 347, 636, 826, 721, 277, 12, 10900, 304, 267, 291, 14, 2625, 1328, 275, 4104, 1328, 14, 8548, 6173, 8, 7459, 63, 2711, 63, 29085, 9, 267, 291, 14, 3569, 275, 10900, 339, 347, 1343, 8529, 8, 277, 304, 267, 291, 14, 2625, 1328, 14, 3584, 342, 398, 291, 14, 2625, 1328, 14, 409, 21718, 8, 9740, 63, 2711, 63, 5763, 33, 3705, 63, 29085, 9, 267, 1499, 275, 291, 14, 2625, 1328, 14, 2143, 8, 66, 7230, 267, 291, 14, 3569, 14, 2254, 8, 1328, 9, 398, 1499, 275, 291, 14, 3569, 14, 7637, 342, 267, 2396, 275, 291, 14, 2625, 1328, 14, 2708, 8, 1328, 9, 267, 702, 291, 14, 2625, 1328, 14, 2625, 804, 508, 3611, 2566, 63, 2711, 63, 29085, 267, 702, 291, 14, 2625, 1328, 14, 9749, 508, 23620, 63, 2711, 63, 5763, 33, 3705, 63, 29085, 12, 334, 288, 283, 17366, 440, 9128, 18791, 626, 5218, 1990, 8239, 334, 9226, 1414, 2071, 83, 3471, 7, 288, 450, 291, 14, 2625, 1328, 14, 9749, 267, 776, 267, 291, 14, 4148, 275, 291, 14, 2625, 1328, 14, 4148, 398, 372, 2396, 339, 347, 3222, 3205, 8, 277, 12, 666, 304, 267, 291, 14, 2625, 1328, 14, 3584, 342, 267, 291, 14, 2625, 1328, 14, 409, 21718, 8, 9740, 63, 2711, 63, 29085, 63, 10761, 9, 267, 1499, 275, 291, 14, 2625, 1328, 14, 2143, 8, 576, 9, 267, 291, 14, 3569, 14, 2254, 8, 1328, 9, 339, 347, 11904, 2959, 8, 277, 12, 2653, 29, 17, 304, 267, 2396, 275, 330, 341, 267, 862, 26, 288, 1830, 715, 26, 355, 1499, 275, 291, 14, 3569, 14, 7637, 8, 2593, 9, 355, 2396, 847, 291, 14, 2625, 1328, 14, 2708, 8, 1328, 9, 355, 702, 291, 14, 2625, 1328, 14, 2625, 804, 508, 3611, 2566, 63, 2711, 63, 29085, 355, 702, 334, 490, 291, 14, 2625, 1328, 14, 9749, 508, 23620, 63, 2711, 63, 29085, 63, 10761, 355, 2318, 298, 17366, 440, 9128, 5218, 1072, 2122, 267, 871, 31886, 26, 288, 372, 2396, 267, 746, 6064, 480, 11408, 7078, 664, 2348, 531, 339, 347, 3631, 8529, 8, 277, 304, 267, 291, 14, 2625, 1328, 14, 3584, 342, 267, 291, 14, 2625, 1328, 14, 409, 21718, 8, 9740, 63, 2711, 63, 11632, 63, 29085, 9, 267, 1499, 275, 291, 14, 2625, 1328, 14, 2143, 8, 66, 7230, 267, 291, 14, 3569, 14, 2254, 8, 1328, 9, 398, 1499, 275, 291, 14, 3569, 14, 7637, 342, 267, 2396, 275, 291, 14, 2625, 1328, 14, 2708, 8, 1328, 9, 267, 702, 291, 14, 2625, 1328, 14, 2625, 804, 508, 3611, 2566, 63, 2711, 63, 29085, 267, 702, 334, 288, 291, 14, 2625, 1328, 14, 9749, 508, 23620, 63, 2711, 63, 11632, 63, 29085, 267, 2318, 298, 17366, 440, 9128, 18791, 626, 5218, 1990, 8239, 2122, 267, 291, 14, 4148, 275, 488, 267, 372, 2396, 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, 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, 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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 ]
schalkneethling/bedrock
bedrock/wordpress/tests/test_views.py
15
2306
from django.test import override_settings, RequestFactory import pytest import responses from bedrock.wordpress.models import BlogPost from bedrock.wordpress.tests.test_models import setup_responses, TEST_WP_BLOGS from bedrock.wordpress.views import BlogPostsView @responses.activate @override_settings(WP_BLOGS=TEST_WP_BLOGS) @pytest.mark.django_db def test_blog_posts_view(): setup_responses('firefox') BlogPost.objects.refresh('firefox') setup_responses('hacks') BlogPost.objects.refresh('hacks') req = RequestFactory().get('/') view = BlogPostsView(blog_slugs='firefox', blog_tags=['browser', 'jank'], template_name='mozorg/book.html') view.request = req blog_posts = view.get_context_data()['blog_posts'] assert len(blog_posts) == 2 assert blog_posts[0].wp_id == 10 assert blog_posts[1].wp_id == 69 # no tags defined view = BlogPostsView(blog_slugs='firefox', template_name='mozorg/book.html') view.request = req blog_posts = view.get_context_data()['blog_posts'] assert len(blog_posts) == 3 # multiple blogs view = BlogPostsView(blog_slugs=['firefox', 'hacks'], blog_posts_limit=8, template_name='mozorg/book.html') view.request = req blog_posts = view.get_context_data()['blog_posts'] assert len(blog_posts) == 6 # multiple blogs with tags view = BlogPostsView(blog_slugs=['firefox', 'hacks'], blog_tags=['browser', 'jank'], blog_posts_limit=8, template_name='mozorg/book.html') view.request = req blog_posts = view.get_context_data()['blog_posts'] assert len(blog_posts) == 4 # incorrect blog slug view = BlogPostsView(blog_slugs='not-a-blog', template_name='mozorg/book.html') view.request = req blog_posts = view.get_context_data()['blog_posts'] assert len(blog_posts) == 0 # no blog defined, but limited view = BlogPostsView(blog_posts_limit=2, blog_posts_template_variable='articles', template_name='mozorg/book.html') view.request = req blog_posts = view.get_context_data()['articles'] assert len(blog_posts) == 2
mpl-2.0
[ 504, 1639, 14, 396, 492, 4278, 63, 1751, 12, 18638, 199, 199, 646, 4613, 199, 646, 9320, 199, 199, 504, 30739, 24892, 14, 1027, 2915, 14, 992, 492, 29775, 6564, 199, 504, 30739, 24892, 14, 1027, 2915, 14, 2219, 14, 396, 63, 992, 492, 3272, 63, 10360, 12, 7393, 63, 22512, 63, 34, 4947, 51, 199, 504, 30739, 24892, 14, 1027, 2915, 14, 4196, 492, 29775, 6564, 83, 2768, 421, 199, 32, 10360, 14, 8222, 199, 32, 4415, 63, 1751, 8, 22512, 63, 34, 4947, 51, 29, 2864, 63, 22512, 63, 34, 4947, 51, 9, 199, 32, 4462, 14, 1657, 14, 1176, 63, 697, 199, 318, 511, 63, 11486, 63, 18084, 63, 1345, 837, 272, 3272, 63, 10360, 360, 15394, 358, 272, 29775, 6564, 14, 1462, 14, 6635, 360, 15394, 358, 272, 3272, 63, 10360, 360, 20875, 83, 358, 272, 29775, 6564, 14, 1462, 14, 6635, 360, 20875, 83, 358, 339, 2648, 275, 18638, 1252, 362, 7825, 272, 2455, 275, 29775, 6564, 83, 2768, 8, 11486, 63, 2482, 85, 458, 534, 15394, 297, 586, 19936, 63, 2969, 2968, 5750, 297, 283, 74, 3580, 995, 586, 1978, 63, 354, 534, 23120, 1308, 15, 2706, 14, 1360, 358, 272, 2455, 14, 1069, 275, 2648, 272, 19936, 63, 18084, 275, 2455, 14, 362, 63, 1100, 63, 576, 12047, 11486, 63, 18084, 418, 272, 702, 822, 8, 11486, 63, 18084, 9, 508, 499, 272, 702, 19936, 63, 18084, 59, 16, 1055, 14649, 63, 344, 508, 1616, 272, 702, 19936, 63, 18084, 59, 17, 1055, 14649, 63, 344, 508, 14610, 339, 327, 949, 3762, 3247, 272, 2455, 275, 29775, 6564, 83, 2768, 8, 11486, 63, 2482, 85, 458, 534, 15394, 297, 1978, 63, 354, 534, 23120, 1308, 15, 2706, 14, 1360, 358, 272, 2455, 14, 1069, 275, 2648, 272, 19936, 63, 18084, 275, 2455, 14, 362, 63, 1100, 63, 576, 12047, 11486, 63, 18084, 418, 272, 702, 822, 8, 11486, 63, 18084, 9, 508, 650, 339, 327, 3663, 330, 7270, 272, 2455, 275, 29775, 6564, 83, 2768, 8, 11486, 63, 2482, 85, 458, 2968, 15394, 297, 283, 20875, 83, 995, 586, 19936, 63, 18084, 63, 3097, 29, 24, 12, 586, 1978, 63, 354, 534, 23120, 1308, 15, 2706, 14, 1360, 358, 272, 2455, 14, 1069, 275, 2648, 272, 19936, 63, 18084, 275, 2455, 14, 362, 63, 1100, 63, 576, 12047, 11486, 63, 18084, 418, 272, 702, 822, 8, 11486, 63, 18084, 9, 508, 1227, 339, 327, 3663, 330, 7270, 543, 3762, 272, 2455, 275, 29775, 6564, 83, 2768, 8, 11486, 63, 2482, 85, 458, 2968, 15394, 297, 283, 20875, 83, 995, 586, 19936, 63, 2969, 2968, 5750, 297, 283, 74, 3580, 995, 586, 19936, 63, 18084, 63, 3097, 29, 24, 12, 586, 1978, 63, 354, 534, 23120, 1308, 15, 2706, 14, 1360, 358, 272, 2455, 14, 1069, 275, 2648, 272, 19936, 63, 18084, 275, 2455, 14, 362, 63, 1100, 63, 576, 12047, 11486, 63, 18084, 418, 272, 702, 822, 8, 11486, 63, 18084, 9, 508, 841, 339, 327, 8927, 19936, 8889, 272, 2455, 275, 29775, 6564, 83, 2768, 8, 11486, 63, 2482, 85, 458, 534, 1397, 13, 65, 13, 11486, 297, 1978, 63, 354, 534, 23120, 1308, 15, 2706, 14, 1360, 358, 272, 2455, 14, 1069, 275, 2648, 272, 19936, 63, 18084, 275, 2455, 14, 362, 63, 1100, 63, 576, 12047, 11486, 63, 18084, 418, 272, 702, 822, 8, 11486, 63, 18084, 9, 508, 378, 339, 327, 949, 19936, 3247, 12, 1325, 13988, 272, 2455, 275, 29775, 6564, 83, 2768, 8, 11486, 63, 18084, 63, 3097, 29, 18, 12, 586, 19936, 63, 18084, 63, 1160, 63, 1975, 534, 19813, 297, 586, 1978, 63, 354, 534, 23120, 1308, 15, 2706, 14, 1360, 358, 272, 2455, 14, 1069, 275, 2648, 272, 19936, 63, 18084, 275, 2455, 14, 362, 63, 1100, 63, 576, 12047, 19813, 418, 272, 702, 822, 8, 11486, 63, 18084, 9, 508, 499, 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 ]
[ 1639, 14, 396, 492, 4278, 63, 1751, 12, 18638, 199, 199, 646, 4613, 199, 646, 9320, 199, 199, 504, 30739, 24892, 14, 1027, 2915, 14, 992, 492, 29775, 6564, 199, 504, 30739, 24892, 14, 1027, 2915, 14, 2219, 14, 396, 63, 992, 492, 3272, 63, 10360, 12, 7393, 63, 22512, 63, 34, 4947, 51, 199, 504, 30739, 24892, 14, 1027, 2915, 14, 4196, 492, 29775, 6564, 83, 2768, 421, 199, 32, 10360, 14, 8222, 199, 32, 4415, 63, 1751, 8, 22512, 63, 34, 4947, 51, 29, 2864, 63, 22512, 63, 34, 4947, 51, 9, 199, 32, 4462, 14, 1657, 14, 1176, 63, 697, 199, 318, 511, 63, 11486, 63, 18084, 63, 1345, 837, 272, 3272, 63, 10360, 360, 15394, 358, 272, 29775, 6564, 14, 1462, 14, 6635, 360, 15394, 358, 272, 3272, 63, 10360, 360, 20875, 83, 358, 272, 29775, 6564, 14, 1462, 14, 6635, 360, 20875, 83, 358, 339, 2648, 275, 18638, 1252, 362, 7825, 272, 2455, 275, 29775, 6564, 83, 2768, 8, 11486, 63, 2482, 85, 458, 534, 15394, 297, 586, 19936, 63, 2969, 2968, 5750, 297, 283, 74, 3580, 995, 586, 1978, 63, 354, 534, 23120, 1308, 15, 2706, 14, 1360, 358, 272, 2455, 14, 1069, 275, 2648, 272, 19936, 63, 18084, 275, 2455, 14, 362, 63, 1100, 63, 576, 12047, 11486, 63, 18084, 418, 272, 702, 822, 8, 11486, 63, 18084, 9, 508, 499, 272, 702, 19936, 63, 18084, 59, 16, 1055, 14649, 63, 344, 508, 1616, 272, 702, 19936, 63, 18084, 59, 17, 1055, 14649, 63, 344, 508, 14610, 339, 327, 949, 3762, 3247, 272, 2455, 275, 29775, 6564, 83, 2768, 8, 11486, 63, 2482, 85, 458, 534, 15394, 297, 1978, 63, 354, 534, 23120, 1308, 15, 2706, 14, 1360, 358, 272, 2455, 14, 1069, 275, 2648, 272, 19936, 63, 18084, 275, 2455, 14, 362, 63, 1100, 63, 576, 12047, 11486, 63, 18084, 418, 272, 702, 822, 8, 11486, 63, 18084, 9, 508, 650, 339, 327, 3663, 330, 7270, 272, 2455, 275, 29775, 6564, 83, 2768, 8, 11486, 63, 2482, 85, 458, 2968, 15394, 297, 283, 20875, 83, 995, 586, 19936, 63, 18084, 63, 3097, 29, 24, 12, 586, 1978, 63, 354, 534, 23120, 1308, 15, 2706, 14, 1360, 358, 272, 2455, 14, 1069, 275, 2648, 272, 19936, 63, 18084, 275, 2455, 14, 362, 63, 1100, 63, 576, 12047, 11486, 63, 18084, 418, 272, 702, 822, 8, 11486, 63, 18084, 9, 508, 1227, 339, 327, 3663, 330, 7270, 543, 3762, 272, 2455, 275, 29775, 6564, 83, 2768, 8, 11486, 63, 2482, 85, 458, 2968, 15394, 297, 283, 20875, 83, 995, 586, 19936, 63, 2969, 2968, 5750, 297, 283, 74, 3580, 995, 586, 19936, 63, 18084, 63, 3097, 29, 24, 12, 586, 1978, 63, 354, 534, 23120, 1308, 15, 2706, 14, 1360, 358, 272, 2455, 14, 1069, 275, 2648, 272, 19936, 63, 18084, 275, 2455, 14, 362, 63, 1100, 63, 576, 12047, 11486, 63, 18084, 418, 272, 702, 822, 8, 11486, 63, 18084, 9, 508, 841, 339, 327, 8927, 19936, 8889, 272, 2455, 275, 29775, 6564, 83, 2768, 8, 11486, 63, 2482, 85, 458, 534, 1397, 13, 65, 13, 11486, 297, 1978, 63, 354, 534, 23120, 1308, 15, 2706, 14, 1360, 358, 272, 2455, 14, 1069, 275, 2648, 272, 19936, 63, 18084, 275, 2455, 14, 362, 63, 1100, 63, 576, 12047, 11486, 63, 18084, 418, 272, 702, 822, 8, 11486, 63, 18084, 9, 508, 378, 339, 327, 949, 19936, 3247, 12, 1325, 13988, 272, 2455, 275, 29775, 6564, 83, 2768, 8, 11486, 63, 18084, 63, 3097, 29, 18, 12, 586, 19936, 63, 18084, 63, 1160, 63, 1975, 534, 19813, 297, 586, 1978, 63, 354, 534, 23120, 1308, 15, 2706, 14, 1360, 358, 272, 2455, 14, 1069, 275, 2648, 272, 19936, 63, 18084, 275, 2455, 14, 362, 63, 1100, 63, 576, 12047, 19813, 418, 272, 702, 822, 8, 11486, 63, 18084, 9, 508, 499, 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, 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, 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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 ]
openstack/python-cloudkittyclient
cloudkittyclient/tests/unit/v1/test_storage.py
2
1337
# -*- coding: utf-8 -*- # Copyright 2018 Objectif Libre # # 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 cloudkittyclient.tests.unit.v1 import base class TestStorage(base.BaseAPIEndpointTestCase): def test_get_dataframes(self): self.storage.get_dataframes() self.api_client.get.assert_called_once_with('/v1/storage/dataframes') def test_get_dataframes_with_begin_end(self): self.storage.get_dataframes(begin='begin', end='end') try: self.api_client.get.assert_called_once_with( '/v1/storage/dataframes?begin=begin&end=end') # Passing a dict to urlencode can change arg order except AssertionError: self.api_client.get.assert_called_once_with( '/v1/storage/dataframes?end=end&begin=begin')
apache-2.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 1898, 14894, 24921, 825, 9142, 8003, 264, 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, 3, 199, 504, 8002, 6065, 369, 1258, 14, 2219, 14, 3248, 14, 86, 17, 492, 1300, 421, 199, 533, 1379, 6408, 8, 1095, 14, 1563, 3735, 11442, 1746, 304, 339, 347, 511, 63, 362, 63, 576, 8444, 8, 277, 304, 267, 291, 14, 3494, 14, 362, 63, 576, 8444, 342, 267, 291, 14, 1246, 63, 1258, 14, 362, 14, 479, 63, 3527, 63, 5089, 63, 1045, 2336, 86, 17, 15, 3494, 15, 576, 8444, 358, 339, 347, 511, 63, 362, 63, 576, 8444, 63, 1045, 63, 5037, 63, 500, 8, 277, 304, 267, 291, 14, 3494, 14, 362, 63, 576, 8444, 8, 5037, 534, 5037, 297, 1284, 534, 500, 358, 267, 862, 26, 288, 291, 14, 1246, 63, 1258, 14, 362, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 355, 1994, 86, 17, 15, 3494, 15, 576, 8444, 31, 5037, 29, 5037, 6, 500, 29, 500, 358, 267, 327, 31755, 282, 1211, 370, 16511, 883, 1570, 1680, 1865, 267, 871, 9070, 26, 288, 291, 14, 1246, 63, 1258, 14, 362, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 355, 1994, 86, 17, 15, 3494, 15, 576, 8444, 31, 500, 29, 500, 6, 5037, 29, 5037, 358, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 1898, 14894, 24921, 825, 9142, 8003, 264, 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, 3, 199, 504, 8002, 6065, 369, 1258, 14, 2219, 14, 3248, 14, 86, 17, 492, 1300, 421, 199, 533, 1379, 6408, 8, 1095, 14, 1563, 3735, 11442, 1746, 304, 339, 347, 511, 63, 362, 63, 576, 8444, 8, 277, 304, 267, 291, 14, 3494, 14, 362, 63, 576, 8444, 342, 267, 291, 14, 1246, 63, 1258, 14, 362, 14, 479, 63, 3527, 63, 5089, 63, 1045, 2336, 86, 17, 15, 3494, 15, 576, 8444, 358, 339, 347, 511, 63, 362, 63, 576, 8444, 63, 1045, 63, 5037, 63, 500, 8, 277, 304, 267, 291, 14, 3494, 14, 362, 63, 576, 8444, 8, 5037, 534, 5037, 297, 1284, 534, 500, 358, 267, 862, 26, 288, 291, 14, 1246, 63, 1258, 14, 362, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 355, 1994, 86, 17, 15, 3494, 15, 576, 8444, 31, 5037, 29, 5037, 6, 500, 29, 500, 358, 267, 327, 31755, 282, 1211, 370, 16511, 883, 1570, 1680, 1865, 267, 871, 9070, 26, 288, 291, 14, 1246, 63, 1258, 14, 362, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 355, 1994, 86, 17, 15, 3494, 15, 576, 8444, 31, 500, 29, 500, 6, 5037, 29, 5037, 358, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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,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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 ]
hackathon-3d/ice-cream-manwich-repo
server/src/BooksWithFriends/libs/django/utils/jslex.py
329
8041
"""JsLex: a lexer for Javascript""" # Originally from https://bitbucket.org/ned/jslex import re class Tok(object): """ A specification for a token class. """ num = 0 def __init__(self, name, regex, next=None): self.id = Tok.num Tok.num += 1 self.name = name self.regex = regex self.next = next def literals(choices, prefix="", suffix=""): """ Create a regex from a space-separated list of literal `choices`. If provided, `prefix` and `suffix` will be attached to each choice individually. """ return "|".join(prefix+re.escape(c)+suffix for c in choices.split()) class Lexer(object): """ A generic multi-state regex-based lexer. """ def __init__(self, states, first): self.regexes = {} self.toks = {} for state, rules in states.items(): parts = [] for tok in rules: groupid = "t%d" % tok.id self.toks[groupid] = tok parts.append("(?P<%s>%s)" % (groupid, tok.regex)) self.regexes[state] = re.compile("|".join(parts), re.MULTILINE|re.VERBOSE) self.state = first def lex(self, text): """ Lexically analyze `text`. Yields pairs (`name`, `tokentext`). """ end = len(text) state = self.state regexes = self.regexes toks = self.toks start = 0 while start < end: for match in regexes[state].finditer(text, start): name = match.lastgroup tok = toks[name] toktext = match.group(name) start += len(toktext) yield (tok.name, toktext) if tok.next: state = tok.next break self.state = state class JsLexer(Lexer): """ A Javascript lexer >>> lexer = JsLexer() >>> list(lexer.lex("a = 1")) [('id', 'a'), ('ws', ' '), ('punct', '='), ('ws', ' '), ('dnum', '1')] This doesn't properly handle non-Ascii characters in the Javascript source. """ # Because these tokens are matched as alternatives in a regex, longer # possibilities must appear in the list before shorter ones, for example, # '>>' before '>'. # # Note that we don't have to detect malformed Javascript, only properly # lex correct Javascript, so much of this is simplified. # Details of Javascript lexical structure are taken from # http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf # A useful explanation of automatic semicolon insertion is at # http://inimino.org/~inimino/blog/javascript_semicolons both_before = [ Tok("comment", r"/\*(.|\n)*?\*/"), Tok("linecomment", r"//.*?$"), Tok("ws", r"\s+"), Tok("keyword", literals(""" break case catch class const continue debugger default delete do else enum export extends finally for function if import in instanceof new return super switch this throw try typeof var void while with """, suffix=r"\b"), next='reg'), Tok("reserved", literals("null true false", suffix=r"\b"), next='div'), Tok("id", r""" ([a-zA-Z_$ ]|\\u[0-9a-fA-Z]{4}) # first char ([a-zA-Z_$0-9]|\\u[0-9a-fA-F]{4})* # rest chars """, next='div'), Tok("hnum", r"0[xX][0-9a-fA-F]+", next='div'), Tok("onum", r"0[0-7]+"), Tok("dnum", r""" ( (0|[1-9][0-9]*) # DecimalIntegerLiteral \. # dot [0-9]* # DecimalDigits-opt ([eE][-+]?[0-9]+)? # ExponentPart-opt | \. # dot [0-9]+ # DecimalDigits ([eE][-+]?[0-9]+)? # ExponentPart-opt | (0|[1-9][0-9]*) # DecimalIntegerLiteral ([eE][-+]?[0-9]+)? # ExponentPart-opt ) """, next='div'), Tok("punct", literals(""" >>>= === !== >>> <<= >>= <= >= == != << >> && || += -= *= %= &= |= ^= """), next="reg"), Tok("punct", literals("++ -- ) ]"), next='div'), Tok("punct", literals("{ } ( [ . ; , < > + - * % & | ^ ! ~ ? : ="), next='reg'), Tok("string", r'"([^"\\]|(\\(.|\n)))*?"', next='div'), Tok("string", r"'([^'\\]|(\\(.|\n)))*?'", next='div'), ] both_after = [ Tok("other", r"."), ] states = { 'div': # slash will mean division both_before + [ Tok("punct", literals("/= /"), next='reg'), ] + both_after, 'reg': # slash will mean regex both_before + [ Tok("regex", r""" / # opening slash # First character is.. ( [^*\\/[] # anything but * \ / or [ | \\. # or an escape sequence | \[ # or a class, which has ( [^\]\\] # anything but \ or ] | \\. # or an escape sequence )* # many times \] ) # Following characters are same, except for excluding a star ( [^\\/[] # anything but \ / or [ | \\. # or an escape sequence | \[ # or a class, which has ( [^\]\\] # anything but \ or ] | \\. # or an escape sequence )* # many times \] )* # many times / # closing slash [a-zA-Z0-9]* # trailing flags """, next='div'), ] + both_after, } def __init__(self): super(JsLexer, self).__init__(self.states, 'reg') def prepare_js_for_gettext(js): """ Convert the Javascript source `js` into something resembling C for xgettext. What actually happens is that all the regex literals are replaced with "REGEX". """ def escape_quotes(m): """Used in a regex to properly escape double quotes.""" s = m.group(0) if s == '"': return r'\"' else: return s lexer = JsLexer() c = [] for name, tok in lexer.lex(js): if name == 'regex': # C doesn't grok regexes, and they aren't needed for gettext, # so just output a string instead. tok = '"REGEX"'; elif name == 'string': # C doesn't have single-quoted strings, so make all strings # double-quoted. if tok.startswith("'"): guts = re.sub(r"\\.|.", escape_quotes, tok[1:-1]) tok = '"' + guts + '"' elif name == 'id': # C can't deal with Unicode escapes in identifiers. We don't # need them for gettext anyway, so replace them with something # innocuous tok = tok.replace("\\", "U"); c.append(tok) return ''.join(c)
gpl-2.0
[ 624, 16633, 44, 476, 26, 282, 10426, 367, 31861, 624, 199, 3, 31534, 1183, 687, 4178, 921, 25668, 14, 1308, 15, 7439, 15, 3596, 3113, 199, 646, 295, 199, 199, 533, 377, 745, 8, 785, 304, 272, 408, 272, 437, 8929, 367, 282, 1526, 1021, 14, 272, 408, 272, 1967, 275, 378, 339, 347, 636, 826, 721, 277, 12, 536, 12, 5163, 12, 2163, 29, 403, 304, 267, 291, 14, 344, 275, 377, 745, 14, 1507, 267, 377, 745, 14, 1507, 847, 413, 267, 291, 14, 354, 275, 536, 267, 291, 14, 3821, 275, 5163, 267, 291, 14, 2184, 275, 2163, 199, 199, 318, 18041, 8, 4577, 12, 2403, 8772, 4739, 17364, 272, 408, 272, 2790, 282, 5163, 687, 282, 4601, 13, 12794, 769, 402, 8785, 658, 4577, 2313, 339, 982, 2741, 12, 658, 1861, 64, 436, 658, 4511, 64, 911, 506, 10102, 370, 1924, 7141, 272, 7814, 3163, 14, 339, 408, 272, 372, 15733, 1674, 904, 8, 1861, 11, 264, 14, 3765, 8, 67, 6393, 4511, 367, 286, 315, 3415, 14, 1294, 1012, 421, 199, 533, 21125, 8, 785, 304, 272, 408, 272, 437, 7809, 3510, 13, 929, 5163, 13, 6788, 10426, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 6363, 12, 1642, 304, 267, 291, 14, 29283, 275, 1052, 267, 291, 14, 29328, 275, 1052, 398, 367, 1174, 12, 4713, 315, 6363, 14, 1744, 837, 288, 4184, 275, 942, 288, 367, 8431, 315, 4713, 26, 355, 1572, 344, 275, 298, 84, 5, 68, 2, 450, 8431, 14, 344, 355, 291, 14, 29328, 59, 923, 344, 61, 275, 8431, 355, 4184, 14, 740, 480, 2229, 48, 21110, 83, 6598, 83, 2924, 450, 334, 923, 344, 12, 8431, 14, 3821, 430, 288, 291, 14, 29283, 59, 929, 61, 275, 295, 14, 2014, 25795, 1674, 904, 8, 4181, 395, 295, 14, 16661, 92, 264, 14, 16075, 9, 398, 291, 14, 929, 275, 1642, 339, 347, 7103, 8, 277, 12, 1318, 304, 267, 408, 267, 491, 476, 7288, 19897, 658, 505, 2313, 398, 23771, 83, 6342, 13493, 354, 3559, 658, 1418, 505, 14963, 267, 408, 267, 1284, 275, 822, 8, 505, 9, 267, 1174, 275, 291, 14, 929, 267, 5163, 397, 275, 291, 14, 29283, 267, 28415, 275, 291, 14, 29328, 267, 1343, 275, 378, 398, 1830, 1343, 665, 1284, 26, 288, 367, 1336, 315, 5163, 397, 59, 929, 1055, 19373, 8, 505, 12, 1343, 304, 355, 536, 275, 1336, 14, 2019, 923, 355, 8431, 275, 28415, 59, 354, 61, 355, 8431, 505, 275, 1336, 14, 923, 8, 354, 9, 355, 1343, 847, 822, 8, 9305, 505, 9, 355, 1995, 334, 9305, 14, 354, 12, 8431, 505, 9, 2234, 340, 8431, 14, 2184, 26, 490, 1174, 275, 8431, 14, 2184, 490, 2059, 398, 291, 14, 929, 275, 1174, 421, 199, 533, 26231, 5838, 8, 5838, 304, 272, 408, 272, 437, 31861, 10426, 339, 1306, 10426, 275, 26231, 5838, 342, 272, 1306, 769, 8, 11729, 14, 3113, 480, 65, 275, 413, 2237, 272, 4274, 344, 297, 283, 65, 659, 661, 3569, 297, 283, 17748, 661, 27003, 297, 26143, 659, 661, 3569, 297, 283, 17748, 661, 68, 1507, 297, 283, 17, 5440, 339, 961, 3181, 1133, 7684, 2429, 2222, 13, 11129, 4110, 315, 314, 31861, 1350, 14, 272, 408, 339, 327, 13821, 3520, 4645, 787, 7838, 465, 8679, 10661, 315, 282, 5163, 12, 8088, 272, 327, 2086, 23422, 1471, 7468, 315, 314, 769, 2544, 18299, 7869, 12, 367, 2893, 12, 272, 327, 283, 1140, 7, 2544, 12696, 1370, 272, 327, 272, 327, 3390, 626, 781, 2793, 1133, 1172, 370, 9696, 24159, 31861, 12, 1454, 7684, 272, 327, 7103, 3211, 31861, 12, 880, 8298, 402, 642, 365, 26867, 14, 339, 327, 15621, 402, 31861, 7103, 2652, 5523, 787, 9394, 687, 272, 327, 1455, 921, 1544, 14, 825, 391, 13, 4404, 6279, 14, 1308, 15, 27190, 15, 1725, 15, 4220, 2054, 13, 840, 15, 4220, 2054, 13, 14820, 14, 5607, 339, 327, 437, 2997, 17531, 402, 4834, 18734, 12167, 22470, 365, 737, 272, 327, 1455, 921, 2730, 827, 79, 14, 1308, 22500, 2730, 827, 79, 15, 11486, 15, 9554, 63, 19290, 761, 4654, 339, 3865, 63, 5182, 275, 359, 267, 377, 745, 480, 3349, 401, 420, 519, 2, 6307, 5830, 14, 6113, 78, 3342, 8995, 15870, 1288, 267, 377, 745, 480, 604, 3349, 401, 221, 519, 2, 501, 6697, 4, 1288, 267, 377, 745, 480, 3569, 401, 3698, 519, 3212, 83, 11, 1288, 267, 377, 745, 480, 6691, 401, 420, 18041, 4852, 1816, 2059, 1930, 8579, 1021, 950, 1980, 14958, 1816, 849, 3145, 886, 587, 4952, 4843, 16879, 1816, 3753, 367, 805, 340, 492, 315, 1256, 1618, 1816, 892, 372, 1613, 6258, 642, 7978, 862, 730, 1618, 1816, 2729, 2309, 1830, 543, 1816, 10327, 4739, 29, 82, 3212, 66, 1288, 2163, 534, 1135, 659, 267, 377, 745, 480, 10421, 401, 258, 18041, 480, 2307, 2549, 3055, 401, 4739, 29, 82, 3212, 66, 1288, 2163, 534, 3015, 659, 267, 377, 745, 480, 344, 401, 3698, 519, 624, 1169, 7287, 65, 13, 6353, 13, 58, 63, 4, 257, 1622, 17780, 85, 59, 16, 13, 25, 65, 13, 13753, 13, 58, 8194, 20, 1552, 257, 327, 1642, 1495, 1169, 7287, 65, 13, 6353, 13, 58, 63, 4, 16, 13, 25, 11752, 1103, 85, 59, 16, 13, 25, 65, 13, 13753, 13, 38, 8194, 20, 1552, 10, 221, 327, 4618, 8365, 1169, 10327, 2163, 534, 3015, 659, 267, 377, 745, 480, 72, 1507, 401, 260, 519, 2, 16, 59, 24110, 1527, 16, 13, 25, 65, 13, 13753, 13, 38, 2807, 401, 2163, 534, 3015, 659, 267, 377, 745, 480, 265, 453, 401, 260, 519, 2, 16, 59, 16, 13, 23, 2807, 1288, 267, 377, 745, 480, 68, 1507, 401, 260, 519, 624, 1169, 334, 257, 334, 16, 17884, 17, 13, 25, 1527, 16, 13, 25, 23849, 258, 327, 6345, 2674, 7621, 1816, 971, 14, 8295, 327, 6308, 1816, 359, 16, 13, 25, 3672, 4519, 327, 6345, 29371, 13, 2992, 1816, 7287, 20565, 1527, 6793, 21852, 16, 13, 25, 23763, 221, 327, 1316, 10339, 8416, 13, 2992, 1169, 1204, 1816, 971, 14, 8295, 327, 6308, 1816, 359, 16, 13, 25, 2807, 4519, 327, 6345, 29371, 1816, 7287, 20565, 1527, 6793, 21852, 16, 13 ]
[ 16633, 44, 476, 26, 282, 10426, 367, 31861, 624, 199, 3, 31534, 1183, 687, 4178, 921, 25668, 14, 1308, 15, 7439, 15, 3596, 3113, 199, 646, 295, 199, 199, 533, 377, 745, 8, 785, 304, 272, 408, 272, 437, 8929, 367, 282, 1526, 1021, 14, 272, 408, 272, 1967, 275, 378, 339, 347, 636, 826, 721, 277, 12, 536, 12, 5163, 12, 2163, 29, 403, 304, 267, 291, 14, 344, 275, 377, 745, 14, 1507, 267, 377, 745, 14, 1507, 847, 413, 267, 291, 14, 354, 275, 536, 267, 291, 14, 3821, 275, 5163, 267, 291, 14, 2184, 275, 2163, 199, 199, 318, 18041, 8, 4577, 12, 2403, 8772, 4739, 17364, 272, 408, 272, 2790, 282, 5163, 687, 282, 4601, 13, 12794, 769, 402, 8785, 658, 4577, 2313, 339, 982, 2741, 12, 658, 1861, 64, 436, 658, 4511, 64, 911, 506, 10102, 370, 1924, 7141, 272, 7814, 3163, 14, 339, 408, 272, 372, 15733, 1674, 904, 8, 1861, 11, 264, 14, 3765, 8, 67, 6393, 4511, 367, 286, 315, 3415, 14, 1294, 1012, 421, 199, 533, 21125, 8, 785, 304, 272, 408, 272, 437, 7809, 3510, 13, 929, 5163, 13, 6788, 10426, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 6363, 12, 1642, 304, 267, 291, 14, 29283, 275, 1052, 267, 291, 14, 29328, 275, 1052, 398, 367, 1174, 12, 4713, 315, 6363, 14, 1744, 837, 288, 4184, 275, 942, 288, 367, 8431, 315, 4713, 26, 355, 1572, 344, 275, 298, 84, 5, 68, 2, 450, 8431, 14, 344, 355, 291, 14, 29328, 59, 923, 344, 61, 275, 8431, 355, 4184, 14, 740, 480, 2229, 48, 21110, 83, 6598, 83, 2924, 450, 334, 923, 344, 12, 8431, 14, 3821, 430, 288, 291, 14, 29283, 59, 929, 61, 275, 295, 14, 2014, 25795, 1674, 904, 8, 4181, 395, 295, 14, 16661, 92, 264, 14, 16075, 9, 398, 291, 14, 929, 275, 1642, 339, 347, 7103, 8, 277, 12, 1318, 304, 267, 408, 267, 491, 476, 7288, 19897, 658, 505, 2313, 398, 23771, 83, 6342, 13493, 354, 3559, 658, 1418, 505, 14963, 267, 408, 267, 1284, 275, 822, 8, 505, 9, 267, 1174, 275, 291, 14, 929, 267, 5163, 397, 275, 291, 14, 29283, 267, 28415, 275, 291, 14, 29328, 267, 1343, 275, 378, 398, 1830, 1343, 665, 1284, 26, 288, 367, 1336, 315, 5163, 397, 59, 929, 1055, 19373, 8, 505, 12, 1343, 304, 355, 536, 275, 1336, 14, 2019, 923, 355, 8431, 275, 28415, 59, 354, 61, 355, 8431, 505, 275, 1336, 14, 923, 8, 354, 9, 355, 1343, 847, 822, 8, 9305, 505, 9, 355, 1995, 334, 9305, 14, 354, 12, 8431, 505, 9, 2234, 340, 8431, 14, 2184, 26, 490, 1174, 275, 8431, 14, 2184, 490, 2059, 398, 291, 14, 929, 275, 1174, 421, 199, 533, 26231, 5838, 8, 5838, 304, 272, 408, 272, 437, 31861, 10426, 339, 1306, 10426, 275, 26231, 5838, 342, 272, 1306, 769, 8, 11729, 14, 3113, 480, 65, 275, 413, 2237, 272, 4274, 344, 297, 283, 65, 659, 661, 3569, 297, 283, 17748, 661, 27003, 297, 26143, 659, 661, 3569, 297, 283, 17748, 661, 68, 1507, 297, 283, 17, 5440, 339, 961, 3181, 1133, 7684, 2429, 2222, 13, 11129, 4110, 315, 314, 31861, 1350, 14, 272, 408, 339, 327, 13821, 3520, 4645, 787, 7838, 465, 8679, 10661, 315, 282, 5163, 12, 8088, 272, 327, 2086, 23422, 1471, 7468, 315, 314, 769, 2544, 18299, 7869, 12, 367, 2893, 12, 272, 327, 283, 1140, 7, 2544, 12696, 1370, 272, 327, 272, 327, 3390, 626, 781, 2793, 1133, 1172, 370, 9696, 24159, 31861, 12, 1454, 7684, 272, 327, 7103, 3211, 31861, 12, 880, 8298, 402, 642, 365, 26867, 14, 339, 327, 15621, 402, 31861, 7103, 2652, 5523, 787, 9394, 687, 272, 327, 1455, 921, 1544, 14, 825, 391, 13, 4404, 6279, 14, 1308, 15, 27190, 15, 1725, 15, 4220, 2054, 13, 840, 15, 4220, 2054, 13, 14820, 14, 5607, 339, 327, 437, 2997, 17531, 402, 4834, 18734, 12167, 22470, 365, 737, 272, 327, 1455, 921, 2730, 827, 79, 14, 1308, 22500, 2730, 827, 79, 15, 11486, 15, 9554, 63, 19290, 761, 4654, 339, 3865, 63, 5182, 275, 359, 267, 377, 745, 480, 3349, 401, 420, 519, 2, 6307, 5830, 14, 6113, 78, 3342, 8995, 15870, 1288, 267, 377, 745, 480, 604, 3349, 401, 221, 519, 2, 501, 6697, 4, 1288, 267, 377, 745, 480, 3569, 401, 3698, 519, 3212, 83, 11, 1288, 267, 377, 745, 480, 6691, 401, 420, 18041, 4852, 1816, 2059, 1930, 8579, 1021, 950, 1980, 14958, 1816, 849, 3145, 886, 587, 4952, 4843, 16879, 1816, 3753, 367, 805, 340, 492, 315, 1256, 1618, 1816, 892, 372, 1613, 6258, 642, 7978, 862, 730, 1618, 1816, 2729, 2309, 1830, 543, 1816, 10327, 4739, 29, 82, 3212, 66, 1288, 2163, 534, 1135, 659, 267, 377, 745, 480, 10421, 401, 258, 18041, 480, 2307, 2549, 3055, 401, 4739, 29, 82, 3212, 66, 1288, 2163, 534, 3015, 659, 267, 377, 745, 480, 344, 401, 3698, 519, 624, 1169, 7287, 65, 13, 6353, 13, 58, 63, 4, 257, 1622, 17780, 85, 59, 16, 13, 25, 65, 13, 13753, 13, 58, 8194, 20, 1552, 257, 327, 1642, 1495, 1169, 7287, 65, 13, 6353, 13, 58, 63, 4, 16, 13, 25, 11752, 1103, 85, 59, 16, 13, 25, 65, 13, 13753, 13, 38, 8194, 20, 1552, 10, 221, 327, 4618, 8365, 1169, 10327, 2163, 534, 3015, 659, 267, 377, 745, 480, 72, 1507, 401, 260, 519, 2, 16, 59, 24110, 1527, 16, 13, 25, 65, 13, 13753, 13, 38, 2807, 401, 2163, 534, 3015, 659, 267, 377, 745, 480, 265, 453, 401, 260, 519, 2, 16, 59, 16, 13, 23, 2807, 1288, 267, 377, 745, 480, 68, 1507, 401, 260, 519, 624, 1169, 334, 257, 334, 16, 17884, 17, 13, 25, 1527, 16, 13, 25, 23849, 258, 327, 6345, 2674, 7621, 1816, 971, 14, 8295, 327, 6308, 1816, 359, 16, 13, 25, 3672, 4519, 327, 6345, 29371, 13, 2992, 1816, 7287, 20565, 1527, 6793, 21852, 16, 13, 25, 23763, 221, 327, 1316, 10339, 8416, 13, 2992, 1169, 1204, 1816, 971, 14, 8295, 327, 6308, 1816, 359, 16, 13, 25, 2807, 4519, 327, 6345, 29371, 1816, 7287, 20565, 1527, 6793, 21852, 16, 13, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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 ]
guozanhua/mobile-chrome-apps
chrome-cordova/gcmServer/xmpp/jep0106.py
202
1488
# JID Escaping XEP-0106 for the xmpppy based transports written by Norman Rasmussen """This file is the XEP-0106 commands. Implemented commands as follows: 4.2 Encode : Encoding Transformation 4.3 Decode : Decoding Transformation """ xep0106mapping = [ [' ' ,'20'], ['"' ,'22'], ['&' ,'26'], ['\'','27'], ['/' ,'2f'], [':' ,'3a'], ['<' ,'3c'], ['>' ,'3e'], ['@' ,'40']] def JIDEncode(str): str = str.replace('\\5c', '\\5c5c') for each in xep0106mapping: str = str.replace('\\' + each[1], '\\5c' + each[1]) for each in xep0106mapping: str = str.replace(each[0], '\\' + each[1]) return str def JIDDecode(str): for each in xep0106mapping: str = str.replace('\\' + each[1], each[0]) return str.replace('\\5c', '\\') if __name__ == "__main__": def test(before,valid): during = JIDEncode(before) after = JIDDecode(during) if during == valid and after == before: print 'PASS Before: ' + before print 'PASS During: ' + during else: print 'FAIL Before: ' + before print 'FAIL During: ' + during print 'FAIL After : ' + after print test('jid escaping',r'jid\20escaping') test(r'\3and\2is\5@example.com',r'\5c3and\2is\5\40example.com') test(r'\3catsand\2catsis\5cats@example.com',r'\5c3catsand\2catsis\5c5cats\40example.com') test(r'\2plus\2is\4',r'\2plus\2is\4') test(r'foo\bar',r'foo\bar') test(r'foob\41r',r'foob\41r') test('here\'s_a wild_&_/cr%zy/_address@example.com',r'here\27s_a\20wild_\26_\2fcr%zy\2f_address\40example.com')
bsd-3-clause
[ 199, 3, 1603, 998, 662, 551, 17818, 1323, 6102, 13, 614, 1690, 367, 314, 671, 17901, 647, 4079, 7773, 83, 5313, 701, 20800, 290, 820, 11374, 527, 2464, 199, 199, 624, 2765, 570, 365, 314, 1323, 6102, 13, 614, 1690, 3718, 14, 199, 199, 3500, 3718, 465, 11924, 26, 199, 199, 20, 14, 18, 19244, 520, 19694, 6266, 1869, 199, 20, 14, 19, 22462, 520, 27368, 6266, 1869, 421, 199, 624, 199, 199, 88, 1545, 614, 1690, 4745, 275, 359, 199, 198, 459, 283, 20606, 1165, 995, 199, 198, 459, 4507, 20606, 1081, 995, 199, 198, 459, 6, 7, 20606, 1479, 995, 199, 198, 459, 3985, 1673, 1465, 995, 199, 198, 459, 4805, 20606, 18, 70, 995, 199, 198, 59, 5242, 20606, 19, 65, 995, 199, 198, 459, 28, 7, 20606, 19, 67, 995, 199, 198, 459, 3524, 20606, 19, 69, 995, 199, 198, 459, 32, 7, 20606, 2167, 6538, 199, 199, 318, 1603, 998, 9686, 8, 495, 304, 199, 198, 495, 275, 620, 14, 1814, 11671, 21, 67, 297, 6468, 21, 67, 21, 67, 358, 199, 198, 509, 1924, 315, 671, 1545, 614, 1690, 4745, 26, 507, 198, 495, 275, 620, 14, 1814, 11671, 7, 435, 1924, 59, 17, 467, 6468, 21, 67, 7, 435, 1924, 59, 17, 566, 199, 198, 509, 1924, 315, 671, 1545, 614, 1690, 4745, 26, 507, 198, 495, 275, 620, 14, 1814, 8, 10885, 59, 16, 467, 22548, 435, 1924, 59, 17, 566, 199, 198, 1107, 620, 199, 199, 318, 1603, 998, 9400, 8, 495, 304, 199, 198, 509, 1924, 315, 671, 1545, 614, 1690, 4745, 26, 507, 198, 495, 275, 620, 14, 1814, 11671, 7, 435, 1924, 59, 17, 467, 1924, 59, 16, 566, 199, 198, 1107, 620, 14, 1814, 11671, 21, 67, 297, 6468, 358, 199, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 199, 198, 318, 511, 8, 5182, 12, 1078, 304, 507, 198, 27868, 275, 1603, 998, 9686, 8, 5182, 9, 507, 198, 4399, 275, 1603, 998, 9400, 8, 27868, 9, 507, 198, 692, 5309, 508, 1686, 436, 2410, 508, 2544, 26, 686, 198, 1361, 283, 6909, 21467, 26, 283, 435, 2544, 686, 198, 1361, 283, 6909, 577, 4039, 26, 283, 435, 5309, 507, 198, 2836, 26, 686, 198, 1361, 283, 8784, 21467, 26, 283, 435, 2544, 686, 198, 1361, 283, 8784, 577, 4039, 26, 283, 435, 5309, 686, 198, 1361, 283, 8784, 12836, 520, 283, 435, 2410, 507, 198, 1361, 421, 198, 396, 360, 14203, 21375, 297, 82, 7, 14203, 60, 1165, 26306, 358, 199, 198, 396, 8, 82, 1154, 19, 460, 60, 18, 374, 60, 21, 32, 2694, 14, 957, 297, 82, 1154, 21, 67, 19, 460, 60, 18, 374, 60, 21, 60, 2167, 2694, 14, 957, 358, 199, 198, 396, 8, 82, 1154, 19, 25729, 460, 60, 18, 3385, 2316, 60, 21, 25729, 32, 2694, 14, 957, 297, 82, 1154, 21, 67, 19, 25729, 460, 60, 18, 3385, 2316, 60, 21, 67, 21, 25729, 60, 2167, 2694, 14, 957, 358, 199, 198, 396, 8, 82, 1154, 18, 6666, 60, 18, 374, 60, 20, 297, 82, 1154, 18, 6666, 60, 18, 374, 60, 20, 358, 199, 198, 396, 8, 82, 7, 1421, 60, 1700, 297, 82, 7, 1421, 60, 1700, 358, 199, 198, 396, 8, 82, 7, 1421, 66, 60, 2953, 82, 297, 82, 7, 1421, 66, 60, 2953, 82, 358, 199, 198, 396, 360, 1681, 3985, 83, 63, 65, 336, 668, 63, 6, 63, 15, 1556, 5, 3605, 15607, 1562, 32, 2694, 14, 957, 297, 82, 7, 1681, 60, 1465, 83, 63, 65, 60, 1165, 87, 668, 18005, 1479, 18005, 18, 70, 1556, 5, 3605, 60, 18, 70, 63, 1562, 60, 2167, 2694, 14, 957, 358, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 3, 1603, 998, 662, 551, 17818, 1323, 6102, 13, 614, 1690, 367, 314, 671, 17901, 647, 4079, 7773, 83, 5313, 701, 20800, 290, 820, 11374, 527, 2464, 199, 199, 624, 2765, 570, 365, 314, 1323, 6102, 13, 614, 1690, 3718, 14, 199, 199, 3500, 3718, 465, 11924, 26, 199, 199, 20, 14, 18, 19244, 520, 19694, 6266, 1869, 199, 20, 14, 19, 22462, 520, 27368, 6266, 1869, 421, 199, 624, 199, 199, 88, 1545, 614, 1690, 4745, 275, 359, 199, 198, 459, 283, 20606, 1165, 995, 199, 198, 459, 4507, 20606, 1081, 995, 199, 198, 459, 6, 7, 20606, 1479, 995, 199, 198, 459, 3985, 1673, 1465, 995, 199, 198, 459, 4805, 20606, 18, 70, 995, 199, 198, 59, 5242, 20606, 19, 65, 995, 199, 198, 459, 28, 7, 20606, 19, 67, 995, 199, 198, 459, 3524, 20606, 19, 69, 995, 199, 198, 459, 32, 7, 20606, 2167, 6538, 199, 199, 318, 1603, 998, 9686, 8, 495, 304, 199, 198, 495, 275, 620, 14, 1814, 11671, 21, 67, 297, 6468, 21, 67, 21, 67, 358, 199, 198, 509, 1924, 315, 671, 1545, 614, 1690, 4745, 26, 507, 198, 495, 275, 620, 14, 1814, 11671, 7, 435, 1924, 59, 17, 467, 6468, 21, 67, 7, 435, 1924, 59, 17, 566, 199, 198, 509, 1924, 315, 671, 1545, 614, 1690, 4745, 26, 507, 198, 495, 275, 620, 14, 1814, 8, 10885, 59, 16, 467, 22548, 435, 1924, 59, 17, 566, 199, 198, 1107, 620, 199, 199, 318, 1603, 998, 9400, 8, 495, 304, 199, 198, 509, 1924, 315, 671, 1545, 614, 1690, 4745, 26, 507, 198, 495, 275, 620, 14, 1814, 11671, 7, 435, 1924, 59, 17, 467, 1924, 59, 16, 566, 199, 198, 1107, 620, 14, 1814, 11671, 21, 67, 297, 6468, 358, 199, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 199, 198, 318, 511, 8, 5182, 12, 1078, 304, 507, 198, 27868, 275, 1603, 998, 9686, 8, 5182, 9, 507, 198, 4399, 275, 1603, 998, 9400, 8, 27868, 9, 507, 198, 692, 5309, 508, 1686, 436, 2410, 508, 2544, 26, 686, 198, 1361, 283, 6909, 21467, 26, 283, 435, 2544, 686, 198, 1361, 283, 6909, 577, 4039, 26, 283, 435, 5309, 507, 198, 2836, 26, 686, 198, 1361, 283, 8784, 21467, 26, 283, 435, 2544, 686, 198, 1361, 283, 8784, 577, 4039, 26, 283, 435, 5309, 686, 198, 1361, 283, 8784, 12836, 520, 283, 435, 2410, 507, 198, 1361, 421, 198, 396, 360, 14203, 21375, 297, 82, 7, 14203, 60, 1165, 26306, 358, 199, 198, 396, 8, 82, 1154, 19, 460, 60, 18, 374, 60, 21, 32, 2694, 14, 957, 297, 82, 1154, 21, 67, 19, 460, 60, 18, 374, 60, 21, 60, 2167, 2694, 14, 957, 358, 199, 198, 396, 8, 82, 1154, 19, 25729, 460, 60, 18, 3385, 2316, 60, 21, 25729, 32, 2694, 14, 957, 297, 82, 1154, 21, 67, 19, 25729, 460, 60, 18, 3385, 2316, 60, 21, 67, 21, 25729, 60, 2167, 2694, 14, 957, 358, 199, 198, 396, 8, 82, 1154, 18, 6666, 60, 18, 374, 60, 20, 297, 82, 1154, 18, 6666, 60, 18, 374, 60, 20, 358, 199, 198, 396, 8, 82, 7, 1421, 60, 1700, 297, 82, 7, 1421, 60, 1700, 358, 199, 198, 396, 8, 82, 7, 1421, 66, 60, 2953, 82, 297, 82, 7, 1421, 66, 60, 2953, 82, 358, 199, 198, 396, 360, 1681, 3985, 83, 63, 65, 336, 668, 63, 6, 63, 15, 1556, 5, 3605, 15607, 1562, 32, 2694, 14, 957, 297, 82, 7, 1681, 60, 1465, 83, 63, 65, 60, 1165, 87, 668, 18005, 1479, 18005, 18, 70, 1556, 5, 3605, 60, 18, 70, 63, 1562, 60, 2167, 2694, 14, 957, 358, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
shelvenzhou/BTCGPU
test/functional/disablewallet.py
33
1536
#!/usr/bin/env python3 # Copyright (c) 2015-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test a node with the -disablewallet option. - Test that validateaddress RPC works when running with -disablewallet - Test that it is not possible to mine to an invalid address. """ from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * class DisableWalletTest (BitcoinTestFramework): def __init__(self): super().__init__() self.setup_clean_chain = True self.num_nodes = 1 self.extra_args = [["-disablewallet"]] def run_test (self): # Make sure wallet is really disabled assert_raises_jsonrpc(-32601, 'Method not found', self.nodes[0].getwalletinfo) x = self.nodes[0].validateaddress('3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy') assert(x['isvalid'] == False) x = self.nodes[0].validateaddress('mneYUmWYsuk7kySiURxCi3AGxrAqZxLgPZ') assert(x['isvalid'] == True) # Checking mining to an address without a wallet. Generating to a valid address should succeed # but generating to an invalid address will fail. self.nodes[0].generatetoaddress(1, 'mneYUmWYsuk7kySiURxCi3AGxrAqZxLgPZ') assert_raises_jsonrpc(-5, "Invalid address", self.nodes[0].generatetoaddress, 1, '3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy') if __name__ == '__main__': DisableWalletTest ().main ()
mit
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 19, 199, 3, 1898, 334, 67, 9, 6900, 13, 9261, 710, 21158, 11672, 19782, 199, 3, 17484, 1334, 314, 10697, 2032, 4190, 12, 1937, 314, 23073, 199, 3, 570, 9685, 503, 1455, 921, 1544, 14, 16374, 14, 1308, 15, 2383, 15, 1147, 13, 1682, 14, 8624, 14, 199, 624, 774, 282, 1031, 543, 314, 446, 5993, 13892, 945, 14, 199, 199, 13, 1379, 626, 4107, 1562, 11785, 5419, 1380, 3879, 543, 446, 5993, 13892, 199, 13, 1379, 626, 652, 365, 440, 3962, 370, 30820, 370, 376, 3866, 2287, 14, 199, 624, 199, 199, 504, 511, 63, 4857, 14, 396, 63, 4857, 492, 21158, 26203, 199, 504, 511, 63, 4857, 14, 1974, 492, 627, 421, 199, 533, 17534, 55, 9478, 774, 334, 4734, 9061, 26203, 304, 339, 347, 636, 826, 721, 277, 304, 267, 1613, 11027, 826, 4533, 267, 291, 14, 2758, 63, 3118, 63, 4429, 275, 715, 267, 291, 14, 1507, 63, 2415, 275, 413, 267, 291, 14, 2911, 63, 589, 275, 24212, 13, 5993, 13892, 15261, 339, 347, 1255, 63, 396, 334, 277, 304, 267, 327, 4155, 3238, 20534, 365, 7710, 6980, 267, 702, 63, 3536, 63, 31395, 2801, 8342, 614, 12, 283, 3767, 440, 1911, 297, 291, 14, 2415, 59, 16, 1055, 362, 13892, 815, 9, 267, 671, 275, 291, 14, 2415, 59, 16, 1055, 3502, 1562, 360, 19, 42, 2905, 84, 17, 55, 80, 37, 58, 2898, 12874, 77, 49, 433, 825, 82, 9745, 73, 55, 11641, 81, 50, 72, 3705, 27480, 358, 267, 702, 8, 88, 459, 374, 1078, 418, 508, 756, 9, 267, 671, 275, 291, 14, 2415, 59, 16, 1055, 3502, 1562, 360, 22599, 57, 53, 77, 55, 57, 83, 3210, 23, 10562, 18934, 1230, 8163, 73, 19, 1254, 15775, 33, 81, 58, 88, 44, 71, 48, 58, 358, 267, 702, 8, 88, 459, 374, 1078, 418, 508, 715, 9, 398, 327, 25109, 1748, 316, 370, 376, 2287, 1928, 282, 20534, 14, 1464, 1958, 370, 282, 1686, 2287, 1077, 17961, 267, 327, 1325, 12999, 370, 376, 3866, 2287, 911, 2449, 14, 267, 291, 14, 2415, 59, 16, 1055, 4208, 475, 1562, 8, 17, 12, 283, 22599, 57, 53, 77, 55, 57, 83, 3210, 23, 10562, 18934, 1230, 8163, 73, 19, 1254, 15775, 33, 81, 58, 88, 44, 71, 48, 58, 358, 267, 702, 63, 3536, 63, 31395, 2801, 21, 12, 298, 3364, 2287, 401, 291, 14, 2415, 59, 16, 1055, 4208, 475, 1562, 12, 413, 12, 283, 19, 42, 2905, 84, 17, 55, 80, 37, 58, 2898, 12874, 77, 49, 433, 825, 82, 9745, 73, 55, 11641, 81, 50, 72, 3705, 27480, 358, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 17534, 55, 9478, 774, 334, 680, 973, 6248, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2647, 15, 1393, 15, 1813, 2366, 19, 199, 3, 1898, 334, 67, 9, 6900, 13, 9261, 710, 21158, 11672, 19782, 199, 3, 17484, 1334, 314, 10697, 2032, 4190, 12, 1937, 314, 23073, 199, 3, 570, 9685, 503, 1455, 921, 1544, 14, 16374, 14, 1308, 15, 2383, 15, 1147, 13, 1682, 14, 8624, 14, 199, 624, 774, 282, 1031, 543, 314, 446, 5993, 13892, 945, 14, 199, 199, 13, 1379, 626, 4107, 1562, 11785, 5419, 1380, 3879, 543, 446, 5993, 13892, 199, 13, 1379, 626, 652, 365, 440, 3962, 370, 30820, 370, 376, 3866, 2287, 14, 199, 624, 199, 199, 504, 511, 63, 4857, 14, 396, 63, 4857, 492, 21158, 26203, 199, 504, 511, 63, 4857, 14, 1974, 492, 627, 421, 199, 533, 17534, 55, 9478, 774, 334, 4734, 9061, 26203, 304, 339, 347, 636, 826, 721, 277, 304, 267, 1613, 11027, 826, 4533, 267, 291, 14, 2758, 63, 3118, 63, 4429, 275, 715, 267, 291, 14, 1507, 63, 2415, 275, 413, 267, 291, 14, 2911, 63, 589, 275, 24212, 13, 5993, 13892, 15261, 339, 347, 1255, 63, 396, 334, 277, 304, 267, 327, 4155, 3238, 20534, 365, 7710, 6980, 267, 702, 63, 3536, 63, 31395, 2801, 8342, 614, 12, 283, 3767, 440, 1911, 297, 291, 14, 2415, 59, 16, 1055, 362, 13892, 815, 9, 267, 671, 275, 291, 14, 2415, 59, 16, 1055, 3502, 1562, 360, 19, 42, 2905, 84, 17, 55, 80, 37, 58, 2898, 12874, 77, 49, 433, 825, 82, 9745, 73, 55, 11641, 81, 50, 72, 3705, 27480, 358, 267, 702, 8, 88, 459, 374, 1078, 418, 508, 756, 9, 267, 671, 275, 291, 14, 2415, 59, 16, 1055, 3502, 1562, 360, 22599, 57, 53, 77, 55, 57, 83, 3210, 23, 10562, 18934, 1230, 8163, 73, 19, 1254, 15775, 33, 81, 58, 88, 44, 71, 48, 58, 358, 267, 702, 8, 88, 459, 374, 1078, 418, 508, 715, 9, 398, 327, 25109, 1748, 316, 370, 376, 2287, 1928, 282, 20534, 14, 1464, 1958, 370, 282, 1686, 2287, 1077, 17961, 267, 327, 1325, 12999, 370, 376, 3866, 2287, 911, 2449, 14, 267, 291, 14, 2415, 59, 16, 1055, 4208, 475, 1562, 8, 17, 12, 283, 22599, 57, 53, 77, 55, 57, 83, 3210, 23, 10562, 18934, 1230, 8163, 73, 19, 1254, 15775, 33, 81, 58, 88, 44, 71, 48, 58, 358, 267, 702, 63, 3536, 63, 31395, 2801, 21, 12, 298, 3364, 2287, 401, 291, 14, 2415, 59, 16, 1055, 4208, 475, 1562, 12, 413, 12, 283, 19, 42, 2905, 84, 17, 55, 80, 37, 58, 2898, 12874, 77, 49, 433, 825, 82, 9745, 73, 55, 11641, 81, 50, 72, 3705, 27480, 358, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 17534, 55, 9478, 774, 334, 680, 973, 6248, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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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 ]
epitron/youtube-dl
youtube_dl/extractor/rtl2.py
12
7153
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..aes import aes_cbc_decrypt from ..compat import ( compat_b64decode, compat_ord, compat_str, ) from ..utils import ( bytes_to_intlist, ExtractorError, intlist_to_bytes, int_or_none, strip_or_none, ) class RTL2IE(InfoExtractor): IE_NAME = 'rtl2' _VALID_URL = r'http?://(?:www\.)?rtl2\.de/[^?#]*?/(?P<id>[^?#/]*?)(?:$|/(?:$|[?#]))' _TESTS = [{ 'url': 'http://www.rtl2.de/sendung/grip-das-motormagazin/folge/folge-203-0', 'info_dict': { 'id': 'folge-203-0', 'ext': 'f4v', 'title': 'GRIP sucht den Sommerkönig', 'description': 'md5:e3adbb940fd3c6e76fa341b8748b562f' }, 'params': { # rtmp download 'skip_download': True, }, }, { 'url': 'http://www.rtl2.de/sendung/koeln-50667/video/5512-anna/21040-anna-erwischt-alex/', 'info_dict': { 'id': '21040-anna-erwischt-alex', 'ext': 'mp4', 'title': 'Anna erwischt Alex!', 'description': 'Anna nimmt ihrem Vater nicht ab, dass er nicht spielt. Und tatsächlich erwischt sie ihn auf frischer Tat.' }, 'params': { # rtmp download 'skip_download': True, }, }] def _real_extract(self, url): # Some rtl2 urls have no slash at the end, so append it. if not url.endswith('/'): url += '/' video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) mobj = re.search( r'<div[^>]+data-collection="(?P<vico_id>\d+)"[^>]+data-video="(?P<vivi_id>\d+)"', webpage) if mobj: vico_id = mobj.group('vico_id') vivi_id = mobj.group('vivi_id') else: vico_id = self._html_search_regex( r'vico_id\s*:\s*([0-9]+)', webpage, 'vico_id') vivi_id = self._html_search_regex( r'vivi_id\s*:\s*([0-9]+)', webpage, 'vivi_id') info = self._download_json( 'http://www.rtl2.de/sites/default/modules/rtl2/mediathek/php/get_video_jw.php', video_id, query={ 'vico_id': vico_id, 'vivi_id': vivi_id, }) video_info = info['video'] title = video_info['titel'] formats = [] rtmp_url = video_info.get('streamurl') if rtmp_url: rtmp_url = rtmp_url.replace('\\', '') stream_url = 'mp4:' + self._html_search_regex(r'/ondemand/(.+)', rtmp_url, 'stream URL') rtmp_conn = ['S:connect', 'O:1', 'NS:pageUrl:' + url, 'NB:fpad:0', 'NN:videoFunction:1', 'O:0'] formats.append({ 'format_id': 'rtmp', 'url': rtmp_url, 'play_path': stream_url, 'player_url': 'http://www.rtl2.de/flashplayer/vipo_player.swf', 'page_url': url, 'flash_version': 'LNX 11,2,202,429', 'rtmp_conn': rtmp_conn, 'no_resume': True, 'preference': 1, }) m3u8_url = video_info.get('streamurl_hls') if m3u8_url: formats.extend(self._extract_akamai_formats(m3u8_url, video_id)) self._sort_formats(formats) return { 'id': video_id, 'title': title, 'thumbnail': video_info.get('image'), 'description': video_info.get('beschreibung'), 'duration': int_or_none(video_info.get('duration')), 'formats': formats, } class RTL2YouBaseIE(InfoExtractor): _BACKWERK_BASE_URL = 'https://p-you-backwerk.rtl2apps.de/' class RTL2YouIE(RTL2YouBaseIE): IE_NAME = 'rtl2:you' _VALID_URL = r'http?://you\.rtl2\.de/(?:video/\d+/|youplayer/index\.html\?.*?\bvid=)(?P<id>\d+)' _TESTS = [{ 'url': 'http://you.rtl2.de/video/3002/15740/MJUNIK%20%E2%80%93%20Home%20of%20YOU/307-hirn-wo-bist-du', 'info_dict': { 'id': '15740', 'ext': 'mp4', 'title': 'MJUNIK – Home of YOU - #307 Hirn, wo bist du?!', 'description': 'md5:ddaa95c61b372b12b66e115b2772fe01', 'age_limit': 12, }, }, { 'url': 'http://you.rtl2.de/youplayer/index.html?vid=15712', 'only_matching': True, }] _AES_KEY = b'\xe9W\xe4.<*\xb8\x1a\xd2\xb6\x92\xf3C\xd3\xefL\x1b\x03*\xbbbH\xc0\x03\xffo\xc2\xf2(\xaa\xaa!' _GEO_COUNTRIES = ['DE'] def _real_extract(self, url): video_id = self._match_id(url) stream_data = self._download_json( self._BACKWERK_BASE_URL + 'stream/video/' + video_id, video_id) data, iv = compat_b64decode(stream_data['streamUrl']).decode().split(':') stream_url = intlist_to_bytes(aes_cbc_decrypt( bytes_to_intlist(compat_b64decode(data)), bytes_to_intlist(self._AES_KEY), bytes_to_intlist(compat_b64decode(iv)) )) if b'rtl2_you_video_not_found' in stream_url: raise ExtractorError('video not found', expected=True) formats = self._extract_m3u8_formats( stream_url[:-compat_ord(stream_url[-1])].decode(), video_id, 'mp4', 'm3u8_native') self._sort_formats(formats) video_data = self._download_json( self._BACKWERK_BASE_URL + 'video/' + video_id, video_id) series = video_data.get('formatTitle') title = episode = video_data.get('title') or series if series and series != title: title = '%s - %s' % (series, title) return { 'id': video_id, 'title': title, 'formats': formats, 'description': strip_or_none(video_data.get('description')), 'thumbnail': video_data.get('image'), 'duration': int_or_none(stream_data.get('duration') or video_data.get('duration'), 1000), 'series': series, 'episode': episode, 'age_limit': int_or_none(video_data.get('minimumAge')), } class RTL2YouSeriesIE(RTL2YouBaseIE): IE_NAME = 'rtl2:you:series' _VALID_URL = r'http?://you\.rtl2\.de/videos/(?P<id>\d+)' _TEST = { 'url': 'http://you.rtl2.de/videos/115/dragon-ball', 'info_dict': { 'id': '115', }, 'playlist_mincount': 5, } def _real_extract(self, url): series_id = self._match_id(url) stream_data = self._download_json( self._BACKWERK_BASE_URL + 'videos', series_id, query={ 'formatId': series_id, 'limit': 1000000000, }) entries = [] for video in stream_data.get('videos', []): video_id = compat_str(video['videoId']) if not video_id: continue entries.append(self.url_result( 'http://you.rtl2.de/video/%s/%s' % (series_id, video_id), 'RTL2You', video_id)) return self.playlist_result(entries, series_id)
unlicense
[ 3, 2803, 26, 2774, 13, 24, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 295, 199, 199, 504, 1275, 2330, 492, 21298, 199, 504, 2508, 17499, 492, 282, 397, 63, 19279, 63, 15682, 199, 504, 2508, 5819, 492, 334, 272, 8434, 63, 66, 772, 2708, 12, 272, 8434, 63, 2181, 12, 272, 8434, 63, 495, 12, 199, 9, 199, 504, 2508, 1208, 492, 334, 272, 2783, 63, 475, 63, 442, 513, 12, 272, 19783, 12, 272, 1109, 513, 63, 475, 63, 2394, 12, 272, 1109, 63, 269, 63, 3592, 12, 272, 6202, 63, 269, 63, 3592, 12, 199, 9, 421, 199, 533, 820, 7308, 18, 4332, 8, 18283, 304, 272, 15292, 63, 2339, 275, 283, 25011, 18, 7, 272, 485, 5600, 63, 2632, 275, 519, 7, 1014, 24524, 1544, 20316, 25011, 18, 4537, 271, 15, 4735, 31, 3, 3672, 31, 9448, 48, 28, 344, 13489, 31, 3, 15, 3672, 17076, 5169, 31686, 32576, 4, 17884, 31, 3, 2459, 7, 272, 485, 7569, 275, 8910, 267, 283, 633, 356, 283, 1014, 921, 1544, 14, 25011, 18, 14, 271, 15, 2254, 10335, 15, 7928, 80, 13, 24315, 13, 27840, 5615, 4651, 262, 15, 5900, 303, 15, 5900, 303, 13, 11341, 13, 16, 297, 267, 283, 815, 63, 807, 356, 469, 288, 283, 344, 356, 283, 5900, 303, 13, 11341, 13, 16, 297, 288, 283, 832, 356, 283, 70, 20, 86, 297, 288, 283, 1213, 356, 283, 3975, 1772, 4066, 84, 5376, 428, 676, 2626, 75, 14614, 78, 528, 297, 288, 283, 1802, 356, 283, 1064, 21, 26, 69, 19, 350, 2501, 25, 2167, 2592, 19, 67, 22, 69, 2114, 667, 15590, 66, 24, 18770, 66, 18836, 70, 7, 267, 1660, 267, 283, 1162, 356, 469, 288, 327, 519, 2791, 5235, 288, 283, 2759, 63, 4249, 356, 715, 12, 267, 1660, 272, 1660, 469, 267, 283, 633, 356, 283, 1014, 921, 1544, 14, 25011, 18, 14, 271, 15, 2254, 10335, 15, 7697, 352, 78, 13, 1400, 14916, 15, 3722, 15, 1229, 713, 13, 1189, 65, 15, 12725, 2167, 13, 1189, 65, 13, 281, 87, 374, 335, 84, 13, 24421, 3678, 267, 283, 815, 63, 807, 356, 469, 288, 283, 344, 356, 283, 12725, 2167, 13, 1189, 65, 13, 281, 87, 374, 335, 84, 13, 24421, 297, 288, 283, 832, 356, 283, 311, 20, 297, 288, 283, 1213, 356, 283, 2493, 3540, 9266, 87, 374, 335, 84, 22986, 12389, 288, 283, 1802, 356, 283, 2493, 3540, 302, 20066, 84, 284, 72, 13179, 812, 6618, 302, 1158, 84, 2236, 12, 366, 405, 9266, 302, 1158, 84, 19441, 15330, 14, 738, 977, 307, 1956, 13733, 335, 317, 335, 9266, 87, 374, 335, 84, 308, 1873, 284, 6164, 282, 1286, 289, 5719, 7641, 377, 292, 3530, 267, 1660, 267, 283, 1162, 356, 469, 288, 327, 519, 2791, 5235, 288, 283, 2759, 63, 4249, 356, 715, 12, 267, 1660, 272, 14877, 339, 347, 485, 3093, 63, 5005, 8, 277, 12, 1166, 304, 267, 327, 6601, 519, 5019, 18, 8187, 1172, 949, 14457, 737, 314, 1284, 12, 880, 5666, 652, 14, 267, 340, 440, 1166, 14, 4130, 18265, 288, 1166, 847, 7324, 398, 3991, 63, 344, 275, 291, 423, 1431, 63, 344, 8, 633, 9, 267, 9248, 275, 291, 423, 4249, 63, 12022, 8, 633, 12, 3991, 63, 344, 9, 398, 14208, 275, 295, 14, 1733, 8, 288, 519, 7601, 3015, 25524, 576, 13, 3627, 628, 2229, 48, 28, 433, 331, 63, 344, 3072, 68, 20415, 25524, 576, 13, 3722, 628, 2229, 48, 28, 433, 433, 63, 344, 3072, 68, 20415, 297, 288, 9248, 9, 267, 340, 14208, 26, 288, 1321, 331, 63, 344, 275, 14208, 14, 923, 360, 433, 331, 63, 344, 358, 288, 1321, 433, 63, 344, 275, 14208, 14, 923, 360, 433, 433, 63, 344, 358, 267, 587, 26, 288, 1321, 331, 63, 344, 275, 291, 423, 1360, 63, 1733, 63, 3821, 8, 355, 519, 7, 433, 331, 63, 344, 60, 83, 10, 3427, 83, 10, 779, 16, 13, 25, 28798, 9248, 12, 283, 433, 331, 63, 344, 358, 288, 1321, 433, 63, 344, 275, 291, 423, 1360, 63, 1733, 63, 3821, 8, 355, 519, 7, 433, 433, 63, 344, 60, 83, 10, 3427, 83, 10, 779, 16, 13, 25, 28798, 9248, 12, 283, 433, 433, 63, 344, 358, 398, 2256, 275, 291, 423, 4249, 63, 1001, 8, 288, 283, 1014, 921, 1544, 14, 25011, 18, 14, 271, 15, 8619, 15, 885, 15, 3112, 15, 25011, 18, 15, 4603, 1589, 75, 15, 8624, 15, 362, 63, 3722, 63, 30561, 14, 8624, 297, 288, 3991, 63, 344, 12, 1827, 3126, 355, 283, 433, 331, 63, 344, 356, 1321, 331, 63, 344, 12, 355, 283, 433, 433, 63, 344, 356, 1321, 433, 63, 344, 12, 288, 3828, 267, 3991, 63, 815, 275, 2256, 459, 3722, 418, 267, 2538, 275, 3991, 63, 815, 459, 280, 14146, 418, 398, 6752, 275, 942, 398, 519, 2791, 63, 633, 275, 3991, 63, 815, 14, 362, 360, 1745, 633, 358, 267, 340, 519, 2791, 63, 633, 26, 288, 519, 2791, 63, 633, 275, 519, 2791, 63, 633, 14, 1814, 20786, 4074, 288, 2547, 63, 633, 275, 283, 311, 20, 4881, 435, 291, 423, 1360, 63, 1733, 63, 3821, 8, 82, 9807, 265, 24152, 7985, 6977, 3196, 519, 2791, 63, 633, 12, 283, 1745, 2851, 358, 288, 519, 2791, 63, 1631, 275, 788, 51, 26, 2242, 297, 283, 47, 26, 17, 297, 283, 2709, 26, 1606, 6417, 4881, 435, 1166, 12, 283, 16170, 26, 3997, 350, 26, 16, 297, 283, 7178, 26, 3722, 3481, 26, 17, 297, 283, 47, 26, 16, 418, 953, 6752, 14, 740, 2561, 355, 283, 908, 63, 344, 356, 283, 29649, 297, 355, 283, 633, 356, 519, 2791, 63, 633, 12, 355, 283, 2802, 63, 515, 356, 2547, 63, 633, 12, 355, 283, 6147, 63, 633, 356, 283, 1014, 921, 1544, 14, 25011, 18, 14, 271, 15, 11331, 6147, 15, 433, 555, 63, 6147, 14, 20426, 297, 355, 283, 1606, 63, 633, 356, 1166, 12, 355, 283, 11331, 63, 1023, 356, 283, 44, 16764, 4119, 12, 18, 12, 4999, 12, 14372, 297, 355, 283, 29649, 63, 1631, 356, 519, 2791, 63, 1631, 12, 355, 283, 889, 63, 9964, 356, 715 ]
[ 2803, 26, 2774, 13, 24, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 295, 199, 199, 504, 1275, 2330, 492, 21298, 199, 504, 2508, 17499, 492, 282, 397, 63, 19279, 63, 15682, 199, 504, 2508, 5819, 492, 334, 272, 8434, 63, 66, 772, 2708, 12, 272, 8434, 63, 2181, 12, 272, 8434, 63, 495, 12, 199, 9, 199, 504, 2508, 1208, 492, 334, 272, 2783, 63, 475, 63, 442, 513, 12, 272, 19783, 12, 272, 1109, 513, 63, 475, 63, 2394, 12, 272, 1109, 63, 269, 63, 3592, 12, 272, 6202, 63, 269, 63, 3592, 12, 199, 9, 421, 199, 533, 820, 7308, 18, 4332, 8, 18283, 304, 272, 15292, 63, 2339, 275, 283, 25011, 18, 7, 272, 485, 5600, 63, 2632, 275, 519, 7, 1014, 24524, 1544, 20316, 25011, 18, 4537, 271, 15, 4735, 31, 3, 3672, 31, 9448, 48, 28, 344, 13489, 31, 3, 15, 3672, 17076, 5169, 31686, 32576, 4, 17884, 31, 3, 2459, 7, 272, 485, 7569, 275, 8910, 267, 283, 633, 356, 283, 1014, 921, 1544, 14, 25011, 18, 14, 271, 15, 2254, 10335, 15, 7928, 80, 13, 24315, 13, 27840, 5615, 4651, 262, 15, 5900, 303, 15, 5900, 303, 13, 11341, 13, 16, 297, 267, 283, 815, 63, 807, 356, 469, 288, 283, 344, 356, 283, 5900, 303, 13, 11341, 13, 16, 297, 288, 283, 832, 356, 283, 70, 20, 86, 297, 288, 283, 1213, 356, 283, 3975, 1772, 4066, 84, 5376, 428, 676, 2626, 75, 14614, 78, 528, 297, 288, 283, 1802, 356, 283, 1064, 21, 26, 69, 19, 350, 2501, 25, 2167, 2592, 19, 67, 22, 69, 2114, 667, 15590, 66, 24, 18770, 66, 18836, 70, 7, 267, 1660, 267, 283, 1162, 356, 469, 288, 327, 519, 2791, 5235, 288, 283, 2759, 63, 4249, 356, 715, 12, 267, 1660, 272, 1660, 469, 267, 283, 633, 356, 283, 1014, 921, 1544, 14, 25011, 18, 14, 271, 15, 2254, 10335, 15, 7697, 352, 78, 13, 1400, 14916, 15, 3722, 15, 1229, 713, 13, 1189, 65, 15, 12725, 2167, 13, 1189, 65, 13, 281, 87, 374, 335, 84, 13, 24421, 3678, 267, 283, 815, 63, 807, 356, 469, 288, 283, 344, 356, 283, 12725, 2167, 13, 1189, 65, 13, 281, 87, 374, 335, 84, 13, 24421, 297, 288, 283, 832, 356, 283, 311, 20, 297, 288, 283, 1213, 356, 283, 2493, 3540, 9266, 87, 374, 335, 84, 22986, 12389, 288, 283, 1802, 356, 283, 2493, 3540, 302, 20066, 84, 284, 72, 13179, 812, 6618, 302, 1158, 84, 2236, 12, 366, 405, 9266, 302, 1158, 84, 19441, 15330, 14, 738, 977, 307, 1956, 13733, 335, 317, 335, 9266, 87, 374, 335, 84, 308, 1873, 284, 6164, 282, 1286, 289, 5719, 7641, 377, 292, 3530, 267, 1660, 267, 283, 1162, 356, 469, 288, 327, 519, 2791, 5235, 288, 283, 2759, 63, 4249, 356, 715, 12, 267, 1660, 272, 14877, 339, 347, 485, 3093, 63, 5005, 8, 277, 12, 1166, 304, 267, 327, 6601, 519, 5019, 18, 8187, 1172, 949, 14457, 737, 314, 1284, 12, 880, 5666, 652, 14, 267, 340, 440, 1166, 14, 4130, 18265, 288, 1166, 847, 7324, 398, 3991, 63, 344, 275, 291, 423, 1431, 63, 344, 8, 633, 9, 267, 9248, 275, 291, 423, 4249, 63, 12022, 8, 633, 12, 3991, 63, 344, 9, 398, 14208, 275, 295, 14, 1733, 8, 288, 519, 7601, 3015, 25524, 576, 13, 3627, 628, 2229, 48, 28, 433, 331, 63, 344, 3072, 68, 20415, 25524, 576, 13, 3722, 628, 2229, 48, 28, 433, 433, 63, 344, 3072, 68, 20415, 297, 288, 9248, 9, 267, 340, 14208, 26, 288, 1321, 331, 63, 344, 275, 14208, 14, 923, 360, 433, 331, 63, 344, 358, 288, 1321, 433, 63, 344, 275, 14208, 14, 923, 360, 433, 433, 63, 344, 358, 267, 587, 26, 288, 1321, 331, 63, 344, 275, 291, 423, 1360, 63, 1733, 63, 3821, 8, 355, 519, 7, 433, 331, 63, 344, 60, 83, 10, 3427, 83, 10, 779, 16, 13, 25, 28798, 9248, 12, 283, 433, 331, 63, 344, 358, 288, 1321, 433, 63, 344, 275, 291, 423, 1360, 63, 1733, 63, 3821, 8, 355, 519, 7, 433, 433, 63, 344, 60, 83, 10, 3427, 83, 10, 779, 16, 13, 25, 28798, 9248, 12, 283, 433, 433, 63, 344, 358, 398, 2256, 275, 291, 423, 4249, 63, 1001, 8, 288, 283, 1014, 921, 1544, 14, 25011, 18, 14, 271, 15, 8619, 15, 885, 15, 3112, 15, 25011, 18, 15, 4603, 1589, 75, 15, 8624, 15, 362, 63, 3722, 63, 30561, 14, 8624, 297, 288, 3991, 63, 344, 12, 1827, 3126, 355, 283, 433, 331, 63, 344, 356, 1321, 331, 63, 344, 12, 355, 283, 433, 433, 63, 344, 356, 1321, 433, 63, 344, 12, 288, 3828, 267, 3991, 63, 815, 275, 2256, 459, 3722, 418, 267, 2538, 275, 3991, 63, 815, 459, 280, 14146, 418, 398, 6752, 275, 942, 398, 519, 2791, 63, 633, 275, 3991, 63, 815, 14, 362, 360, 1745, 633, 358, 267, 340, 519, 2791, 63, 633, 26, 288, 519, 2791, 63, 633, 275, 519, 2791, 63, 633, 14, 1814, 20786, 4074, 288, 2547, 63, 633, 275, 283, 311, 20, 4881, 435, 291, 423, 1360, 63, 1733, 63, 3821, 8, 82, 9807, 265, 24152, 7985, 6977, 3196, 519, 2791, 63, 633, 12, 283, 1745, 2851, 358, 288, 519, 2791, 63, 1631, 275, 788, 51, 26, 2242, 297, 283, 47, 26, 17, 297, 283, 2709, 26, 1606, 6417, 4881, 435, 1166, 12, 283, 16170, 26, 3997, 350, 26, 16, 297, 283, 7178, 26, 3722, 3481, 26, 17, 297, 283, 47, 26, 16, 418, 953, 6752, 14, 740, 2561, 355, 283, 908, 63, 344, 356, 283, 29649, 297, 355, 283, 633, 356, 519, 2791, 63, 633, 12, 355, 283, 2802, 63, 515, 356, 2547, 63, 633, 12, 355, 283, 6147, 63, 633, 356, 283, 1014, 921, 1544, 14, 25011, 18, 14, 271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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 ]
ossdemura/django-miniblog
src/Lib/site-packages/django/conf/locale/pl/formats.py
504
1147
# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # from __future__ import unicode_literals # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j E Y' TIME_FORMAT = 'H:i' DATETIME_FORMAT = 'j E Y H:i' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j F' SHORT_DATE_FORMAT = 'd-m-Y' SHORT_DATETIME_FORMAT = 'd-m-Y H:i' FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior DATE_INPUT_FORMATS = [ '%d.%m.%Y', '%d.%m.%y', # '25.10.2006', '25.10.06' '%y-%m-%d', # '06-10-25' # '%d. %B %Y', '%d. %b. %Y', # '25. October 2006', '25. Oct. 2006' ] DATETIME_INPUT_FORMATS = [ '%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59' '%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200' '%d.%m.%Y %H:%M', # '25.10.2006 14:30' '%d.%m.%Y', # '25.10.2006' ] DECIMAL_SEPARATOR = ',' THOUSAND_SEPARATOR = ' ' NUMBER_GROUPING = 3
mit
[ 3, 1882, 2644, 26, 2774, 13, 24, 1882, 199, 3, 961, 570, 365, 1854, 1334, 314, 2011, 4190, 465, 314, 5634, 2559, 14, 199, 3, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 3, 710, 20841, 4807, 3326, 675, 314, 5634, 1434, 1475, 6302, 12, 199, 3, 1937, 1455, 921, 4757, 14, 14013, 14, 957, 15, 287, 15, 2374, 15, 1121, 15, 5876, 15, 10372, 12645, 602, 199, 5390, 63, 4807, 275, 283, 74, 662, 1488, 7, 199, 4961, 63, 4807, 275, 283, 40, 26, 73, 7, 199, 12488, 63, 4807, 275, 283, 74, 662, 1488, 869, 26, 73, 7, 199, 19216, 63, 16413, 63, 4807, 275, 283, 38, 1488, 7, 199, 16413, 63, 11655, 63, 4807, 275, 283, 74, 481, 7, 199, 13003, 63, 5390, 63, 4807, 275, 283, 68, 13, 77, 13, 57, 7, 199, 13003, 63, 12488, 63, 4807, 275, 283, 68, 13, 77, 13, 57, 221, 869, 26, 73, 7, 199, 12903, 63, 11655, 63, 3359, 63, 24929, 275, 413, 221, 327, 32740, 199, 199, 3, 710, 20841, 7321, 63, 14019, 3326, 675, 314, 2018, 14053, 1475, 6302, 12, 199, 3, 1937, 1455, 921, 4757, 14, 1548, 14, 1308, 15, 4342, 15, 2083, 14, 1360, 3, 6205, 13, 9866, 13, 17537, 199, 5390, 63, 7321, 63, 14019, 275, 359, 272, 1543, 68, 4111, 77, 4111, 57, 297, 1543, 68, 4111, 77, 4111, 89, 297, 258, 327, 283, 821, 14, 709, 14, 7968, 297, 283, 821, 14, 709, 14, 1690, 7, 272, 1543, 89, 3295, 77, 3295, 68, 297, 463, 327, 283, 1690, 13, 709, 13, 821, 7, 272, 327, 1543, 68, 14, 450, 34, 450, 57, 297, 1543, 68, 14, 450, 66, 14, 450, 57, 297, 221, 327, 283, 821, 14, 18365, 22459, 8315, 297, 283, 821, 14, 18365, 14, 8315, 7, 199, 61, 199, 12488, 63, 7321, 63, 14019, 275, 359, 272, 1543, 68, 4111, 77, 4111, 57, 450, 40, 2689, 45, 2689, 51, 297, 258, 327, 283, 821, 14, 709, 14, 7968, 4329, 26, 1216, 26, 1427, 7, 272, 1543, 68, 4111, 77, 4111, 57, 450, 40, 2689, 45, 2689, 51, 4111, 70, 297, 221, 327, 283, 821, 14, 709, 14, 7968, 4329, 26, 1216, 26, 1427, 14, 25080, 7, 272, 1543, 68, 4111, 77, 4111, 57, 450, 40, 2689, 45, 297, 263, 327, 283, 821, 14, 709, 14, 7968, 4329, 26, 1216, 7, 272, 1543, 68, 4111, 77, 4111, 57, 297, 4519, 327, 283, 821, 14, 709, 14, 7968, 7, 199, 61, 199, 23925, 63, 15828, 275, 13647, 199, 28714, 63, 15828, 275, 283, 10619, 7, 199, 9190, 63, 7823, 1206, 275, 650, 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 ]
[ 1882, 2644, 26, 2774, 13, 24, 1882, 199, 3, 961, 570, 365, 1854, 1334, 314, 2011, 4190, 465, 314, 5634, 2559, 14, 199, 3, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 3, 710, 20841, 4807, 3326, 675, 314, 5634, 1434, 1475, 6302, 12, 199, 3, 1937, 1455, 921, 4757, 14, 14013, 14, 957, 15, 287, 15, 2374, 15, 1121, 15, 5876, 15, 10372, 12645, 602, 199, 5390, 63, 4807, 275, 283, 74, 662, 1488, 7, 199, 4961, 63, 4807, 275, 283, 40, 26, 73, 7, 199, 12488, 63, 4807, 275, 283, 74, 662, 1488, 869, 26, 73, 7, 199, 19216, 63, 16413, 63, 4807, 275, 283, 38, 1488, 7, 199, 16413, 63, 11655, 63, 4807, 275, 283, 74, 481, 7, 199, 13003, 63, 5390, 63, 4807, 275, 283, 68, 13, 77, 13, 57, 7, 199, 13003, 63, 12488, 63, 4807, 275, 283, 68, 13, 77, 13, 57, 221, 869, 26, 73, 7, 199, 12903, 63, 11655, 63, 3359, 63, 24929, 275, 413, 221, 327, 32740, 199, 199, 3, 710, 20841, 7321, 63, 14019, 3326, 675, 314, 2018, 14053, 1475, 6302, 12, 199, 3, 1937, 1455, 921, 4757, 14, 1548, 14, 1308, 15, 4342, 15, 2083, 14, 1360, 3, 6205, 13, 9866, 13, 17537, 199, 5390, 63, 7321, 63, 14019, 275, 359, 272, 1543, 68, 4111, 77, 4111, 57, 297, 1543, 68, 4111, 77, 4111, 89, 297, 258, 327, 283, 821, 14, 709, 14, 7968, 297, 283, 821, 14, 709, 14, 1690, 7, 272, 1543, 89, 3295, 77, 3295, 68, 297, 463, 327, 283, 1690, 13, 709, 13, 821, 7, 272, 327, 1543, 68, 14, 450, 34, 450, 57, 297, 1543, 68, 14, 450, 66, 14, 450, 57, 297, 221, 327, 283, 821, 14, 18365, 22459, 8315, 297, 283, 821, 14, 18365, 14, 8315, 7, 199, 61, 199, 12488, 63, 7321, 63, 14019, 275, 359, 272, 1543, 68, 4111, 77, 4111, 57, 450, 40, 2689, 45, 2689, 51, 297, 258, 327, 283, 821, 14, 709, 14, 7968, 4329, 26, 1216, 26, 1427, 7, 272, 1543, 68, 4111, 77, 4111, 57, 450, 40, 2689, 45, 2689, 51, 4111, 70, 297, 221, 327, 283, 821, 14, 709, 14, 7968, 4329, 26, 1216, 26, 1427, 14, 25080, 7, 272, 1543, 68, 4111, 77, 4111, 57, 450, 40, 2689, 45, 297, 263, 327, 283, 821, 14, 709, 14, 7968, 4329, 26, 1216, 7, 272, 1543, 68, 4111, 77, 4111, 57, 297, 4519, 327, 283, 821, 14, 709, 14, 7968, 7, 199, 61, 199, 23925, 63, 15828, 275, 13647, 199, 28714, 63, 15828, 275, 283, 10619, 7, 199, 9190, 63, 7823, 1206, 275, 650, 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, 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, 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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 ]
fllodrab/Practica1
venv/lib/python2.7/site-packages/pip/vendor/html5lib/utils.py
250
2413
from __future__ import absolute_import, division, unicode_literals from types import ModuleType try: import xml.etree.cElementTree as default_etree except ImportError: import xml.etree.ElementTree as default_etree class MethodDispatcher(dict): """Dict with 2 special properties: On initiation, keys that are lists, sets or tuples are converted to multiple keys so accessing any one of the items in the original list-like object returns the matching value md = MethodDispatcher({("foo", "bar"):"baz"}) md["foo"] == "baz" A default value which can be set through the default attribute. """ def __init__(self, items=()): # Using _dictEntries instead of directly assigning to self is about # twice as fast. Please do careful performance testing before changing # anything here. _dictEntries = [] for name, value in items: if type(name) in (list, tuple, frozenset, set): for item in name: _dictEntries.append((item, value)) else: _dictEntries.append((name, value)) dict.__init__(self, _dictEntries) self.default = None def __getitem__(self, key): return dict.get(self, key, self.default) # Some utility functions to dal with weirdness around UCS2 vs UCS4 # python builds def isSurrogatePair(data): return (len(data) == 2 and ord(data[0]) >= 0xD800 and ord(data[0]) <= 0xDBFF and ord(data[1]) >= 0xDC00 and ord(data[1]) <= 0xDFFF) def surrogatePairToCodepoint(data): char_val = (0x10000 + (ord(data[0]) - 0xD800) * 0x400 + (ord(data[1]) - 0xDC00)) return char_val # Module Factory Factory (no, this isn't Java, I know) # Here to stop this being duplicated all over the place. def moduleFactoryFactory(factory): moduleCache = {} def moduleFactory(baseModule, *args, **kwargs): if isinstance(ModuleType.__name__, type("")): name = "_%s_factory" % baseModule.__name__ else: name = b"_%s_factory" % baseModule.__name__ if name in moduleCache: return moduleCache[name] else: mod = ModuleType(name) objs = factory(baseModule, *args, **kwargs) mod.__dict__.update(objs) moduleCache[name] = mod return mod return moduleFactory
gpl-3.0
[ 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 2649, 63, 5955, 199, 199, 504, 2943, 492, 5673, 804, 199, 199, 893, 26, 272, 492, 2748, 14, 9464, 14, 67, 15325, 465, 849, 63, 9464, 199, 2590, 3545, 26, 272, 492, 2748, 14, 9464, 14, 15325, 465, 849, 63, 9464, 421, 199, 533, 9075, 15461, 8, 807, 304, 272, 408, 2141, 543, 499, 4539, 4382, 26, 339, 4068, 11023, 425, 12, 2883, 626, 787, 5548, 12, 5951, 503, 6346, 787, 6702, 370, 272, 3663, 2883, 880, 18549, 1263, 1373, 402, 314, 2974, 315, 314, 3379, 272, 769, 13, 2930, 909, 2529, 314, 4877, 574, 339, 6128, 275, 9075, 15461, 2561, 480, 1421, 401, 298, 1700, 2349, 2, 6185, 5984, 272, 6128, 905, 1421, 937, 508, 298, 6185, 2, 339, 437, 849, 574, 1314, 883, 506, 663, 4012, 314, 849, 2225, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 2974, 23603, 267, 327, 11719, 485, 807, 17816, 3140, 402, 5370, 26694, 370, 291, 365, 3595, 267, 327, 13373, 465, 7377, 14, 7754, 886, 25082, 10238, 5343, 2544, 13729, 267, 327, 7003, 2348, 14, 267, 485, 807, 17816, 275, 942, 267, 367, 536, 12, 574, 315, 2974, 26, 288, 340, 730, 8, 354, 9, 315, 334, 513, 12, 2008, 12, 9522, 12, 663, 304, 355, 367, 1242, 315, 536, 26, 490, 485, 807, 17816, 14, 740, 1332, 1053, 12, 574, 430, 288, 587, 26, 355, 485, 807, 17816, 14, 740, 1332, 354, 12, 574, 430, 267, 1211, 855, 826, 721, 277, 12, 485, 807, 17816, 9, 267, 291, 14, 885, 275, 488, 339, 347, 636, 6095, 721, 277, 12, 790, 304, 267, 372, 1211, 14, 362, 8, 277, 12, 790, 12, 291, 14, 885, 9, 421, 199, 3, 6601, 11420, 3423, 370, 366, 279, 543, 22965, 4171, 6818, 21884, 18, 8118, 21884, 20, 199, 3, 2366, 14723, 199, 199, 318, 365, 11762, 13095, 12882, 8, 576, 304, 272, 372, 334, 552, 8, 576, 9, 508, 499, 436, 288, 6206, 8, 576, 59, 16, 566, 2356, 378, 8313, 6718, 436, 6206, 8, 576, 59, 16, 566, 2695, 378, 88, 2846, 1665, 436, 288, 6206, 8, 576, 59, 17, 566, 2356, 378, 88, 5196, 383, 436, 6206, 8, 576, 59, 17, 566, 2695, 378, 8313, 24254, 9, 421, 199, 318, 6296, 13095, 12882, 1378, 3034, 1403, 8, 576, 304, 272, 1495, 63, 637, 275, 334, 16, 88, 9943, 435, 334, 2181, 8, 576, 59, 16, 566, 446, 378, 8313, 6718, 9, 627, 378, 88, 5303, 435, 355, 334, 2181, 8, 576, 59, 17, 566, 446, 378, 88, 5196, 383, 430, 272, 372, 1495, 63, 637, 199, 199, 3, 5673, 23616, 23616, 334, 889, 12, 642, 5712, 1133, 9586, 12, 473, 5715, 9, 199, 3, 11842, 370, 3631, 642, 3769, 21747, 1006, 1806, 314, 4192, 14, 421, 199, 318, 859, 2927, 2927, 8, 3702, 304, 272, 859, 4437, 275, 1052, 339, 347, 859, 2927, 8, 1095, 2377, 12, 627, 589, 12, 1011, 958, 304, 267, 340, 1228, 8, 21820, 855, 354, 3108, 730, 11986, 2298, 288, 536, 275, 2668, 5, 83, 63, 3702, 2, 450, 1300, 2377, 855, 354, 363, 267, 587, 26, 288, 536, 275, 330, 2, 4970, 83, 63, 3702, 2, 450, 1300, 2377, 855, 354, 363, 398, 340, 536, 315, 859, 4437, 26, 288, 372, 859, 4437, 59, 354, 61, 267, 587, 26, 288, 3413, 275, 5673, 804, 8, 354, 9, 288, 13474, 275, 6434, 8, 1095, 2377, 12, 627, 589, 12, 1011, 958, 9, 288, 3413, 855, 807, 4343, 873, 8, 8718, 9, 288, 859, 4437, 59, 354, 61, 275, 3413, 288, 372, 3413, 339, 372, 859, 2927, 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 ]
[ 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 2649, 63, 5955, 199, 199, 504, 2943, 492, 5673, 804, 199, 199, 893, 26, 272, 492, 2748, 14, 9464, 14, 67, 15325, 465, 849, 63, 9464, 199, 2590, 3545, 26, 272, 492, 2748, 14, 9464, 14, 15325, 465, 849, 63, 9464, 421, 199, 533, 9075, 15461, 8, 807, 304, 272, 408, 2141, 543, 499, 4539, 4382, 26, 339, 4068, 11023, 425, 12, 2883, 626, 787, 5548, 12, 5951, 503, 6346, 787, 6702, 370, 272, 3663, 2883, 880, 18549, 1263, 1373, 402, 314, 2974, 315, 314, 3379, 272, 769, 13, 2930, 909, 2529, 314, 4877, 574, 339, 6128, 275, 9075, 15461, 2561, 480, 1421, 401, 298, 1700, 2349, 2, 6185, 5984, 272, 6128, 905, 1421, 937, 508, 298, 6185, 2, 339, 437, 849, 574, 1314, 883, 506, 663, 4012, 314, 849, 2225, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 2974, 23603, 267, 327, 11719, 485, 807, 17816, 3140, 402, 5370, 26694, 370, 291, 365, 3595, 267, 327, 13373, 465, 7377, 14, 7754, 886, 25082, 10238, 5343, 2544, 13729, 267, 327, 7003, 2348, 14, 267, 485, 807, 17816, 275, 942, 267, 367, 536, 12, 574, 315, 2974, 26, 288, 340, 730, 8, 354, 9, 315, 334, 513, 12, 2008, 12, 9522, 12, 663, 304, 355, 367, 1242, 315, 536, 26, 490, 485, 807, 17816, 14, 740, 1332, 1053, 12, 574, 430, 288, 587, 26, 355, 485, 807, 17816, 14, 740, 1332, 354, 12, 574, 430, 267, 1211, 855, 826, 721, 277, 12, 485, 807, 17816, 9, 267, 291, 14, 885, 275, 488, 339, 347, 636, 6095, 721, 277, 12, 790, 304, 267, 372, 1211, 14, 362, 8, 277, 12, 790, 12, 291, 14, 885, 9, 421, 199, 3, 6601, 11420, 3423, 370, 366, 279, 543, 22965, 4171, 6818, 21884, 18, 8118, 21884, 20, 199, 3, 2366, 14723, 199, 199, 318, 365, 11762, 13095, 12882, 8, 576, 304, 272, 372, 334, 552, 8, 576, 9, 508, 499, 436, 288, 6206, 8, 576, 59, 16, 566, 2356, 378, 8313, 6718, 436, 6206, 8, 576, 59, 16, 566, 2695, 378, 88, 2846, 1665, 436, 288, 6206, 8, 576, 59, 17, 566, 2356, 378, 88, 5196, 383, 436, 6206, 8, 576, 59, 17, 566, 2695, 378, 8313, 24254, 9, 421, 199, 318, 6296, 13095, 12882, 1378, 3034, 1403, 8, 576, 304, 272, 1495, 63, 637, 275, 334, 16, 88, 9943, 435, 334, 2181, 8, 576, 59, 16, 566, 446, 378, 8313, 6718, 9, 627, 378, 88, 5303, 435, 355, 334, 2181, 8, 576, 59, 17, 566, 446, 378, 88, 5196, 383, 430, 272, 372, 1495, 63, 637, 199, 199, 3, 5673, 23616, 23616, 334, 889, 12, 642, 5712, 1133, 9586, 12, 473, 5715, 9, 199, 3, 11842, 370, 3631, 642, 3769, 21747, 1006, 1806, 314, 4192, 14, 421, 199, 318, 859, 2927, 2927, 8, 3702, 304, 272, 859, 4437, 275, 1052, 339, 347, 859, 2927, 8, 1095, 2377, 12, 627, 589, 12, 1011, 958, 304, 267, 340, 1228, 8, 21820, 855, 354, 3108, 730, 11986, 2298, 288, 536, 275, 2668, 5, 83, 63, 3702, 2, 450, 1300, 2377, 855, 354, 363, 267, 587, 26, 288, 536, 275, 330, 2, 4970, 83, 63, 3702, 2, 450, 1300, 2377, 855, 354, 363, 398, 340, 536, 315, 859, 4437, 26, 288, 372, 859, 4437, 59, 354, 61, 267, 587, 26, 288, 3413, 275, 5673, 804, 8, 354, 9, 288, 13474, 275, 6434, 8, 1095, 2377, 12, 627, 589, 12, 1011, 958, 9, 288, 3413, 855, 807, 4343, 873, 8, 8718, 9, 288, 859, 4437, 59, 354, 61, 275, 3413, 288, 372, 3413, 339, 372, 859, 2927, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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