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
ahmadiga/min_edx
common/test/acceptance/tests/lms/test_lms_courseware.py
26
15868
# -*- coding: utf-8 -*- """ End-to-end tests for the LMS. """ import time from ..helpers import UniqueCourseTest from ...pages.studio.auto_auth import AutoAuthPage from ...pages.lms.create_mode import ModeCreationPage from ...pages.studio.overview import CourseOutlinePage from ...pages.lms.courseware import CoursewarePage, CoursewareSequentialTabPage from ...pages.lms.course_nav import CourseNavPage from ...pages.lms.problem import ProblemPage from ...pages.common.logout import LogoutPage from ...pages.lms.track_selection import TrackSelectionPage from ...pages.lms.pay_and_verify import PaymentAndVerificationFlow, FakePaymentPage from ...pages.lms.dashboard import DashboardPage from ...fixtures.course import CourseFixture, XBlockFixtureDesc class CoursewareTest(UniqueCourseTest): """ Test courseware. """ USERNAME = "STUDENT_TESTER" EMAIL = "student101@example.com" def setUp(self): super(CoursewareTest, self).setUp() self.courseware_page = CoursewarePage(self.browser, self.course_id) self.course_outline = CourseOutlinePage( self.browser, self.course_info['org'], self.course_info['number'], self.course_info['run'] ) # Install a course with sections/problems, tabs, updates, and handouts course_fix = CourseFixture( self.course_info['org'], self.course_info['number'], self.course_info['run'], self.course_info['display_name'] ) course_fix.add_children( XBlockFixtureDesc('chapter', 'Test Section 1').add_children( XBlockFixtureDesc('sequential', 'Test Subsection 1').add_children( XBlockFixtureDesc('problem', 'Test Problem 1') ) ), XBlockFixtureDesc('chapter', 'Test Section 2').add_children( XBlockFixtureDesc('sequential', 'Test Subsection 2').add_children( XBlockFixtureDesc('problem', 'Test Problem 2') ) ) ).install() # Auto-auth register for the course. self._auto_auth(self.USERNAME, self.EMAIL, False) def _goto_problem_page(self): """ Open problem page with assertion. """ self.courseware_page.visit() self.problem_page = ProblemPage(self.browser) self.assertEqual(self.problem_page.problem_name, 'TEST PROBLEM 1') def _auto_auth(self, username, email, staff): """ Logout and login with given credentials. """ AutoAuthPage(self.browser, username=username, email=email, course_id=self.course_id, staff=staff).visit() def test_courseware(self): """ Test courseware if recent visited subsection become unpublished. """ # Visit problem page as a student. self._goto_problem_page() # Logout and login as a staff user. LogoutPage(self.browser).visit() self._auto_auth("STAFF_TESTER", "staff101@example.com", True) # Visit course outline page in studio. self.course_outline.visit() # Set release date for subsection in future. self.course_outline.change_problem_release_date_in_studio() # Logout and login as a student. LogoutPage(self.browser).visit() self._auto_auth(self.USERNAME, self.EMAIL, False) # Visit courseware as a student. self.courseware_page.visit() # Problem name should be "TEST PROBLEM 2". self.assertEqual(self.problem_page.problem_name, 'TEST PROBLEM 2') class ProctoredExamTest(UniqueCourseTest): """ Test courseware. """ USERNAME = "STUDENT_TESTER" EMAIL = "student101@example.com" def setUp(self): super(ProctoredExamTest, self).setUp() self.courseware_page = CoursewarePage(self.browser, self.course_id) self.course_outline = CourseOutlinePage( self.browser, self.course_info['org'], self.course_info['number'], self.course_info['run'] ) # Install a course with sections/problems, tabs, updates, and handouts course_fix = CourseFixture( self.course_info['org'], self.course_info['number'], self.course_info['run'], self.course_info['display_name'] ) course_fix.add_advanced_settings({ "enable_proctored_exams": {"value": "true"} }) course_fix.add_children( XBlockFixtureDesc('chapter', 'Test Section 1').add_children( XBlockFixtureDesc('sequential', 'Test Subsection 1').add_children( XBlockFixtureDesc('problem', 'Test Problem 1') ) ) ).install() self.track_selection_page = TrackSelectionPage(self.browser, self.course_id) self.payment_and_verification_flow = PaymentAndVerificationFlow(self.browser, self.course_id) self.immediate_verification_page = PaymentAndVerificationFlow( self.browser, self.course_id, entry_point='verify-now' ) self.upgrade_page = PaymentAndVerificationFlow(self.browser, self.course_id, entry_point='upgrade') self.fake_payment_page = FakePaymentPage(self.browser, self.course_id) self.dashboard_page = DashboardPage(self.browser) self.problem_page = ProblemPage(self.browser) # Add a verified mode to the course ModeCreationPage( self.browser, self.course_id, mode_slug=u'verified', mode_display_name=u'Verified Certificate', min_price=10, suggested_prices='10,20' ).visit() # Auto-auth register for the course. self._auto_auth(self.USERNAME, self.EMAIL, False) def _auto_auth(self, username, email, staff): """ Logout and login with given credentials. """ AutoAuthPage(self.browser, username=username, email=email, course_id=self.course_id, staff=staff).visit() def _login_as_a_verified_user(self): """ login as a verififed user """ self._auto_auth(self.USERNAME, self.EMAIL, False) # the track selection page cannot be visited. see the other tests to see if any prereq is there. # Navigate to the track selection page self.track_selection_page.visit() # Enter the payment and verification flow by choosing to enroll as verified self.track_selection_page.enroll('verified') # Proceed to the fake payment page self.payment_and_verification_flow.proceed_to_payment() # Submit payment self.fake_payment_page.submit_payment() def test_can_create_proctored_exam_in_studio(self): """ Test that Proctored exam settings are visible in Studio. """ # Given that I am a staff member LogoutPage(self.browser).visit() self._auto_auth("STAFF_TESTER", "staff101@example.com", True) # When I visit the course outline page in studio. self.course_outline.visit() # And open the subsection edit dialog self.course_outline.open_exam_settings_dialog() # Then I can view all settings related to Proctored and timed exams self.assertTrue(self.course_outline.proctoring_items_are_displayed()) def test_proctored_exam_flow(self): """ Test that staff can create a proctored exam. """ # Given that I am a staff member on the exam settings section LogoutPage(self.browser).visit() self._auto_auth("STAFF_TESTER", "staff101@example.com", True) self.course_outline.visit() self.course_outline.open_exam_settings_dialog() # When I Make the exam proctored. self.course_outline.make_exam_proctored() # And I login as a verified student. LogoutPage(self.browser).visit() self._login_as_a_verified_user() # And visit the courseware as a verified student. self.courseware_page.visit() # Then I can see an option to take the exam as a proctored exam. self.assertTrue(self.courseware_page.can_start_proctored_exam) def test_timed_exam_flow(self): """ Test that staff can create a timed exam. """ # Given that I am a staff member on the exam settings section LogoutPage(self.browser).visit() self._auto_auth("STAFF_TESTER", "staff101@example.com", True) self.course_outline.visit() self.course_outline.open_exam_settings_dialog() # When I Make the exam timed. self.course_outline.make_exam_timed() # And I login as a verified student. LogoutPage(self.browser).visit() self._login_as_a_verified_user() # And visit the courseware as a verified student. self.courseware_page.visit() # And I start the timed exam self.courseware_page.start_timed_exam() # Then I am taken to the exam with a timer bar showing self.assertTrue(self.courseware_page.is_timer_bar_present) def test_time_allotted_field_is_not_visible_with_none_exam(self): """ Test that the time allotted text field is not shown if 'none' radio button is selected """ # Given that I am a staff member # And I have visited the course outline page in studio. # And the subsection edit dialog is open LogoutPage(self.browser).visit() self._auto_auth("STAFF_TESTER", "staff101@example.com", True) self.course_outline.visit() self.course_outline.open_exam_settings_dialog() # When I select the 'None' exams radio button self.course_outline.select_none_exam() # Then the time allotted text field becomes invisible self.assertFalse(self.course_outline.time_allotted_field_visible()) def test_time_allotted_field_is_visible_with_timed_exam(self): """ Test that the time allotted text field is shown if timed exam radio button is selected """ # Given that I am a staff member # And I have visited the course outline page in studio. # And the subsection edit dialog is open LogoutPage(self.browser).visit() self._auto_auth("STAFF_TESTER", "staff101@example.com", True) self.course_outline.visit() self.course_outline.open_exam_settings_dialog() # When I select the timed exams radio button self.course_outline.select_timed_exam() # Then the time allotted text field becomes visible self.assertTrue(self.course_outline.time_allotted_field_visible()) def test_time_allotted_field_is_visible_with_proctored_exam(self): """ Test that the time allotted text field is shown if proctored exam radio button is selected """ # Given that I am a staff member # And I have visited the course outline page in studio. # And the subsection edit dialog is open LogoutPage(self.browser).visit() self._auto_auth("STAFF_TESTER", "staff101@example.com", True) self.course_outline.visit() self.course_outline.open_exam_settings_dialog() # When I select the proctored exams radio button self.course_outline.select_proctored_exam() # Then the time allotted text field becomes visible self.assertTrue(self.course_outline.time_allotted_field_visible()) def test_time_allotted_field_is_visible_with_practice_exam(self): """ Test that the time allotted text field is shown if practice exam radio button is selected """ # Given that I am a staff member # And I have visited the course outline page in studio. # And the subsection edit dialog is open LogoutPage(self.browser).visit() self._auto_auth("STAFF_TESTER", "staff101@example.com", True) self.course_outline.visit() self.course_outline.open_exam_settings_dialog() # When I select the practice exams radio button self.course_outline.select_practice_exam() # Then the time allotted text field becomes visible self.assertTrue(self.course_outline.time_allotted_field_visible()) class CoursewareMultipleVerticalsTest(UniqueCourseTest): """ Test courseware with multiple verticals """ USERNAME = "STUDENT_TESTER" EMAIL = "student101@example.com" def setUp(self): super(CoursewareMultipleVerticalsTest, self).setUp() self.courseware_page = CoursewarePage(self.browser, self.course_id) self.course_outline = CourseOutlinePage( self.browser, self.course_info['org'], self.course_info['number'], self.course_info['run'] ) # Install a course with sections/problems, tabs, updates, and handouts course_fix = CourseFixture( self.course_info['org'], self.course_info['number'], self.course_info['run'], self.course_info['display_name'] ) course_fix.add_children( XBlockFixtureDesc('chapter', 'Test Section 1').add_children( XBlockFixtureDesc('sequential', 'Test Subsection 1').add_children( XBlockFixtureDesc('problem', 'Test Problem 1', data='<problem>problem 1 dummy body</problem>'), XBlockFixtureDesc('html', 'html 1', data="<html>html 1 dummy body</html>"), XBlockFixtureDesc('problem', 'Test Problem 2', data="<problem>problem 2 dummy body</problem>"), XBlockFixtureDesc('html', 'html 2', data="<html>html 2 dummy body</html>"), ), XBlockFixtureDesc('sequential', 'Test Subsection 2'), ), ).install() # Auto-auth register for the course. AutoAuthPage(self.browser, username=self.USERNAME, email=self.EMAIL, course_id=self.course_id, staff=False).visit() self.courseware_page.visit() self.course_nav = CourseNavPage(self.browser) def test_tab_position(self): # test that using the position in the url direct to correct tab in courseware self.course_nav.go_to_section('Test Section 1', 'Test Subsection 1') subsection_url = self.courseware_page.get_active_subsection_url() url_part_list = subsection_url.split('/') self.assertEqual(len(url_part_list), 9) course_id = url_part_list[4] chapter_id = url_part_list[-3] subsection_id = url_part_list[-2] problem1_page = CoursewareSequentialTabPage( self.browser, course_id=course_id, chapter=chapter_id, subsection=subsection_id, position=1 ).visit() self.assertIn('problem 1 dummy body', problem1_page.get_selected_tab_content()) html1_page = CoursewareSequentialTabPage( self.browser, course_id=course_id, chapter=chapter_id, subsection=subsection_id, position=2 ).visit() self.assertIn('html 1 dummy body', html1_page.get_selected_tab_content()) problem2_page = CoursewareSequentialTabPage( self.browser, course_id=course_id, chapter=chapter_id, subsection=subsection_id, position=3 ).visit() self.assertIn('problem 2 dummy body', problem2_page.get_selected_tab_content()) html2_page = CoursewareSequentialTabPage( self.browser, course_id=course_id, chapter=chapter_id, subsection=subsection_id, position=4 ).visit() self.assertIn('html 2 dummy body', html2_page.get_selected_tab_content())
agpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 624, 199, 3005, 13, 475, 13, 500, 2295, 367, 314, 27540, 14, 199, 624, 199, 646, 900, 199, 199, 504, 2508, 7546, 492, 18276, 6979, 774, 199, 504, 2263, 5856, 14, 19806, 14, 2495, 63, 1178, 492, 9195, 2817, 3276, 199, 504, 2263, 5856, 14, 15807, 14, 981, 63, 632, 492, 4900, 13921, 3276, 199, 504, 2263, 5856, 14, 19806, 14, 21753, 492, 5531, 21432, 3276, 199, 504, 2263, 5856, 14, 15807, 14, 17744, 492, 5531, 1068, 3276, 12, 5531, 1068, 18509, 7690, 3276, 199, 504, 2263, 5856, 14, 15807, 14, 1972, 63, 10927, 492, 5531, 31488, 3276, 199, 504, 2263, 5856, 14, 15807, 14, 6462, 492, 20980, 3276, 199, 504, 2263, 5856, 14, 2330, 14, 11646, 492, 5297, 548, 3276, 199, 504, 2263, 5856, 14, 15807, 14, 3885, 63, 5592, 492, 17507, 7713, 3276, 199, 504, 2263, 5856, 14, 15807, 14, 5989, 63, 460, 63, 4712, 492, 25523, 3325, 22595, 5060, 12, 7777, 22374, 3276, 199, 504, 2263, 5856, 14, 15807, 14, 9743, 492, 577, 1119, 3576, 3276, 199, 504, 2263, 8769, 14, 1972, 492, 5531, 12812, 12, 28802, 421, 199, 533, 5531, 1068, 774, 8, 11427, 6979, 774, 304, 272, 408, 272, 1379, 20736, 14, 272, 408, 272, 13044, 2339, 275, 298, 840, 29317, 63, 15472, 1157, 2, 272, 32320, 275, 298, 5500, 4893, 32, 2694, 14, 957, 2, 339, 347, 3613, 8, 277, 304, 267, 1613, 8, 6979, 1068, 774, 12, 291, 680, 5996, 342, 398, 291, 14, 17744, 63, 1606, 275, 5531, 1068, 3276, 8, 277, 14, 5750, 12, 291, 14, 1972, 63, 344, 9, 398, 291, 14, 1972, 63, 11550, 275, 5531, 21432, 3276, 8, 288, 291, 14, 5750, 12, 288, 291, 14, 1972, 63, 815, 459, 1308, 995, 288, 291, 14, 1972, 63, 815, 459, 1955, 995, 288, 291, 14, 1972, 63, 815, 459, 1065, 418, 267, 776, 398, 327, 13276, 282, 2518, 543, 10189, 15, 22959, 12, 12187, 12, 7029, 12, 436, 4926, 16816, 267, 2518, 63, 970, 275, 5531, 12812, 8, 288, 291, 14, 1972, 63, 815, 459, 1308, 995, 291, 14, 1972, 63, 815, 459, 1955, 995, 288, 291, 14, 1972, 63, 815, 459, 1065, 995, 291, 14, 1972, 63, 815, 459, 2918, 63, 354, 418, 267, 776, 398, 2518, 63, 970, 14, 525, 63, 3223, 8, 288, 28802, 360, 11316, 297, 283, 774, 15247, 413, 1959, 525, 63, 3223, 8, 355, 28802, 360, 16211, 297, 283, 774, 4804, 2792, 413, 1959, 525, 63, 3223, 8, 490, 28802, 360, 6462, 297, 283, 774, 20980, 413, 358, 355, 776, 288, 2318, 288, 28802, 360, 11316, 297, 283, 774, 15247, 499, 1959, 525, 63, 3223, 8, 355, 28802, 360, 16211, 297, 283, 774, 4804, 2792, 499, 1959, 525, 63, 3223, 8, 490, 28802, 360, 6462, 297, 283, 774, 20980, 499, 358, 355, 776, 288, 776, 267, 7092, 3174, 342, 398, 327, 9195, 13, 1178, 2274, 367, 314, 2518, 14, 267, 291, 423, 2495, 63, 1178, 8, 277, 14, 11958, 12, 291, 14, 10089, 12, 756, 9, 339, 347, 485, 14867, 63, 6462, 63, 1606, 8, 277, 304, 267, 408, 267, 3232, 5160, 2034, 543, 14412, 14, 267, 408, 267, 291, 14, 17744, 63, 1606, 14, 5427, 342, 267, 291, 14, 6462, 63, 1606, 275, 20980, 3276, 8, 277, 14, 5750, 9, 267, 291, 14, 629, 8, 277, 14, 6462, 63, 1606, 14, 6462, 63, 354, 12, 283, 2864, 3611, 34, 25847, 413, 358, 339, 347, 485, 2495, 63, 1178, 8, 277, 12, 3434, 12, 3031, 12, 12622, 304, 267, 408, 267, 5297, 548, 436, 4676, 543, 1627, 6235, 14, 267, 408, 267, 9195, 2817, 3276, 8, 277, 14, 5750, 12, 3434, 29, 2473, 12, 3031, 29, 2123, 12, 2151, 2518, 63, 344, 29, 277, 14, 1972, 63, 344, 12, 12622, 29, 7018, 680, 5427, 342, 339, 347, 511, 63, 17744, 8, 277, 304, 267, 408, 267, 1379, 20736, 340, 8058, 15867, 19876, 8649, 625, 8987, 14, 267, 408, 398, 327, 29614, 5160, 2034, 465, 282, 6474, 14, 267, 291, 423, 14867, 63, 6462, 63, 1606, 342, 398, 327, 5297, 548, 436, 4676, 465, 282, 12622, 922, 14, 267, 5297, 548, 3276, 8, 277, 14, 5750, 680, 5427, 342, 267, 291, 423, 2495, 63, 1178, 480, 840, 25900, 63, 15472, 1157, 401, 298, 7018, 4893, 32, 2694, 14, 957, 401, 715, 9, 398, 327, 29614, 2518, 17964, 2034, 315, 410, 5208, 14, 267, 291, 14, 1972, 63, 11550, 14, 5427, 342, 398, 327, 2494, 4683, 1434, 367, 19876, 315, 6466, 14, 267, 291, 14, 1972, 63, 11550, 14, 1461, 63, 6462, 63, 3221, 63, 602, 63, 262, 63, 19806, 342, 398, 327, 5297, 548, 436, 4676, 465, 282, 6474, 14, 267, 5297, 548, 3276, 8, 277, 14, 5750, 680, 5427, 342, 267, 291, 423, 2495, 63, 1178, 8, 277, 14, 11958, 12, 291, 14, 10089, 12, 756, 9, 398, 327, 29614, 20736, 465, 282, 6474, 14, 267, 291, 14, 17744, 63, 1606, 14, 5427, 342, 267, 327, 20980, 536, 1077, 506, 298, 2864, 3611, 34, 25847, 499, 1674, 267, 291, 14, 629, 8, 277, 14, 6462, 63, 1606, 14, 6462, 63, 354, 12, 283, 2864, 3611, 34, 25847, 499, 358, 421, 199, 533, 2165, 319, 2908, 920, 455, 774, 8, 11427, 6979, 774, 304, 272, 408, 272, 1379, 20736, 14, 272, 408, 272, 13044, 2339, 275, 298, 840, 29317, 63, 15472, 1157, 2, 272, 32320, 275, 298, 5500, 4893, 32, 2694, 14, 957, 2, 339, 347, 3613, 8, 277, 304, 267, 1613, 8, 919, 319, 2908, 920, 455, 774, 12, 291, 680, 5996, 342, 398, 291, 14, 17744, 63, 1606, 275, 5531, 1068, 3276, 8, 277, 14, 5750, 12, 291, 14, 1972, 63, 344, 9, 398, 291, 14, 1972, 63, 11550, 275, 5531, 21432, 3276, 8, 288, 291, 14, 5750, 12, 288, 291, 14, 1972, 63, 815, 459, 1308, 995, 288, 291, 14, 1972, 63, 815, 459, 1955, 995, 288, 291, 14, 1972, 63, 815, 459, 1065, 418, 267, 776, 398, 327, 13276, 282, 2518, 543, 10189, 15, 22959, 12, 12187, 12, 7029, 12, 436, 4926, 16816, 267, 2518, 63, 970, 275, 5531, 12812, 8, 288, 291, 14, 1972, 63, 815, 459, 1308, 995, 291, 14, 1972, 63, 815 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 624, 199, 3005, 13, 475, 13, 500, 2295, 367, 314, 27540, 14, 199, 624, 199, 646, 900, 199, 199, 504, 2508, 7546, 492, 18276, 6979, 774, 199, 504, 2263, 5856, 14, 19806, 14, 2495, 63, 1178, 492, 9195, 2817, 3276, 199, 504, 2263, 5856, 14, 15807, 14, 981, 63, 632, 492, 4900, 13921, 3276, 199, 504, 2263, 5856, 14, 19806, 14, 21753, 492, 5531, 21432, 3276, 199, 504, 2263, 5856, 14, 15807, 14, 17744, 492, 5531, 1068, 3276, 12, 5531, 1068, 18509, 7690, 3276, 199, 504, 2263, 5856, 14, 15807, 14, 1972, 63, 10927, 492, 5531, 31488, 3276, 199, 504, 2263, 5856, 14, 15807, 14, 6462, 492, 20980, 3276, 199, 504, 2263, 5856, 14, 2330, 14, 11646, 492, 5297, 548, 3276, 199, 504, 2263, 5856, 14, 15807, 14, 3885, 63, 5592, 492, 17507, 7713, 3276, 199, 504, 2263, 5856, 14, 15807, 14, 5989, 63, 460, 63, 4712, 492, 25523, 3325, 22595, 5060, 12, 7777, 22374, 3276, 199, 504, 2263, 5856, 14, 15807, 14, 9743, 492, 577, 1119, 3576, 3276, 199, 504, 2263, 8769, 14, 1972, 492, 5531, 12812, 12, 28802, 421, 199, 533, 5531, 1068, 774, 8, 11427, 6979, 774, 304, 272, 408, 272, 1379, 20736, 14, 272, 408, 272, 13044, 2339, 275, 298, 840, 29317, 63, 15472, 1157, 2, 272, 32320, 275, 298, 5500, 4893, 32, 2694, 14, 957, 2, 339, 347, 3613, 8, 277, 304, 267, 1613, 8, 6979, 1068, 774, 12, 291, 680, 5996, 342, 398, 291, 14, 17744, 63, 1606, 275, 5531, 1068, 3276, 8, 277, 14, 5750, 12, 291, 14, 1972, 63, 344, 9, 398, 291, 14, 1972, 63, 11550, 275, 5531, 21432, 3276, 8, 288, 291, 14, 5750, 12, 288, 291, 14, 1972, 63, 815, 459, 1308, 995, 288, 291, 14, 1972, 63, 815, 459, 1955, 995, 288, 291, 14, 1972, 63, 815, 459, 1065, 418, 267, 776, 398, 327, 13276, 282, 2518, 543, 10189, 15, 22959, 12, 12187, 12, 7029, 12, 436, 4926, 16816, 267, 2518, 63, 970, 275, 5531, 12812, 8, 288, 291, 14, 1972, 63, 815, 459, 1308, 995, 291, 14, 1972, 63, 815, 459, 1955, 995, 288, 291, 14, 1972, 63, 815, 459, 1065, 995, 291, 14, 1972, 63, 815, 459, 2918, 63, 354, 418, 267, 776, 398, 2518, 63, 970, 14, 525, 63, 3223, 8, 288, 28802, 360, 11316, 297, 283, 774, 15247, 413, 1959, 525, 63, 3223, 8, 355, 28802, 360, 16211, 297, 283, 774, 4804, 2792, 413, 1959, 525, 63, 3223, 8, 490, 28802, 360, 6462, 297, 283, 774, 20980, 413, 358, 355, 776, 288, 2318, 288, 28802, 360, 11316, 297, 283, 774, 15247, 499, 1959, 525, 63, 3223, 8, 355, 28802, 360, 16211, 297, 283, 774, 4804, 2792, 499, 1959, 525, 63, 3223, 8, 490, 28802, 360, 6462, 297, 283, 774, 20980, 499, 358, 355, 776, 288, 776, 267, 7092, 3174, 342, 398, 327, 9195, 13, 1178, 2274, 367, 314, 2518, 14, 267, 291, 423, 2495, 63, 1178, 8, 277, 14, 11958, 12, 291, 14, 10089, 12, 756, 9, 339, 347, 485, 14867, 63, 6462, 63, 1606, 8, 277, 304, 267, 408, 267, 3232, 5160, 2034, 543, 14412, 14, 267, 408, 267, 291, 14, 17744, 63, 1606, 14, 5427, 342, 267, 291, 14, 6462, 63, 1606, 275, 20980, 3276, 8, 277, 14, 5750, 9, 267, 291, 14, 629, 8, 277, 14, 6462, 63, 1606, 14, 6462, 63, 354, 12, 283, 2864, 3611, 34, 25847, 413, 358, 339, 347, 485, 2495, 63, 1178, 8, 277, 12, 3434, 12, 3031, 12, 12622, 304, 267, 408, 267, 5297, 548, 436, 4676, 543, 1627, 6235, 14, 267, 408, 267, 9195, 2817, 3276, 8, 277, 14, 5750, 12, 3434, 29, 2473, 12, 3031, 29, 2123, 12, 2151, 2518, 63, 344, 29, 277, 14, 1972, 63, 344, 12, 12622, 29, 7018, 680, 5427, 342, 339, 347, 511, 63, 17744, 8, 277, 304, 267, 408, 267, 1379, 20736, 340, 8058, 15867, 19876, 8649, 625, 8987, 14, 267, 408, 398, 327, 29614, 5160, 2034, 465, 282, 6474, 14, 267, 291, 423, 14867, 63, 6462, 63, 1606, 342, 398, 327, 5297, 548, 436, 4676, 465, 282, 12622, 922, 14, 267, 5297, 548, 3276, 8, 277, 14, 5750, 680, 5427, 342, 267, 291, 423, 2495, 63, 1178, 480, 840, 25900, 63, 15472, 1157, 401, 298, 7018, 4893, 32, 2694, 14, 957, 401, 715, 9, 398, 327, 29614, 2518, 17964, 2034, 315, 410, 5208, 14, 267, 291, 14, 1972, 63, 11550, 14, 5427, 342, 398, 327, 2494, 4683, 1434, 367, 19876, 315, 6466, 14, 267, 291, 14, 1972, 63, 11550, 14, 1461, 63, 6462, 63, 3221, 63, 602, 63, 262, 63, 19806, 342, 398, 327, 5297, 548, 436, 4676, 465, 282, 6474, 14, 267, 5297, 548, 3276, 8, 277, 14, 5750, 680, 5427, 342, 267, 291, 423, 2495, 63, 1178, 8, 277, 14, 11958, 12, 291, 14, 10089, 12, 756, 9, 398, 327, 29614, 20736, 465, 282, 6474, 14, 267, 291, 14, 17744, 63, 1606, 14, 5427, 342, 267, 327, 20980, 536, 1077, 506, 298, 2864, 3611, 34, 25847, 499, 1674, 267, 291, 14, 629, 8, 277, 14, 6462, 63, 1606, 14, 6462, 63, 354, 12, 283, 2864, 3611, 34, 25847, 499, 358, 421, 199, 533, 2165, 319, 2908, 920, 455, 774, 8, 11427, 6979, 774, 304, 272, 408, 272, 1379, 20736, 14, 272, 408, 272, 13044, 2339, 275, 298, 840, 29317, 63, 15472, 1157, 2, 272, 32320, 275, 298, 5500, 4893, 32, 2694, 14, 957, 2, 339, 347, 3613, 8, 277, 304, 267, 1613, 8, 919, 319, 2908, 920, 455, 774, 12, 291, 680, 5996, 342, 398, 291, 14, 17744, 63, 1606, 275, 5531, 1068, 3276, 8, 277, 14, 5750, 12, 291, 14, 1972, 63, 344, 9, 398, 291, 14, 1972, 63, 11550, 275, 5531, 21432, 3276, 8, 288, 291, 14, 5750, 12, 288, 291, 14, 1972, 63, 815, 459, 1308, 995, 288, 291, 14, 1972, 63, 815, 459, 1955, 995, 288, 291, 14, 1972, 63, 815, 459, 1065, 418, 267, 776, 398, 327, 13276, 282, 2518, 543, 10189, 15, 22959, 12, 12187, 12, 7029, 12, 436, 4926, 16816, 267, 2518, 63, 970, 275, 5531, 12812, 8, 288, 291, 14, 1972, 63, 815, 459, 1308, 995, 291, 14, 1972, 63, 815, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
akhilari7/pa-dude
lib/python2.7/site-packages/chardet/mbcssm.py
1783
19590
######################## 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 .constants import eStart, eError, eItsMe # BIG5 BIG5_cls = ( 1,1,1,1,1,1,1,1, # 00 - 07 #allow 0x00 as legal value 1,1,1,1,1,1,0,0, # 08 - 0f 1,1,1,1,1,1,1,1, # 10 - 17 1,1,1,0,1,1,1,1, # 18 - 1f 1,1,1,1,1,1,1,1, # 20 - 27 1,1,1,1,1,1,1,1, # 28 - 2f 1,1,1,1,1,1,1,1, # 30 - 37 1,1,1,1,1,1,1,1, # 38 - 3f 2,2,2,2,2,2,2,2, # 40 - 47 2,2,2,2,2,2,2,2, # 48 - 4f 2,2,2,2,2,2,2,2, # 50 - 57 2,2,2,2,2,2,2,2, # 58 - 5f 2,2,2,2,2,2,2,2, # 60 - 67 2,2,2,2,2,2,2,2, # 68 - 6f 2,2,2,2,2,2,2,2, # 70 - 77 2,2,2,2,2,2,2,1, # 78 - 7f 4,4,4,4,4,4,4,4, # 80 - 87 4,4,4,4,4,4,4,4, # 88 - 8f 4,4,4,4,4,4,4,4, # 90 - 97 4,4,4,4,4,4,4,4, # 98 - 9f 4,3,3,3,3,3,3,3, # a0 - a7 3,3,3,3,3,3,3,3, # a8 - af 3,3,3,3,3,3,3,3, # b0 - b7 3,3,3,3,3,3,3,3, # b8 - bf 3,3,3,3,3,3,3,3, # c0 - c7 3,3,3,3,3,3,3,3, # c8 - cf 3,3,3,3,3,3,3,3, # d0 - d7 3,3,3,3,3,3,3,3, # d8 - df 3,3,3,3,3,3,3,3, # e0 - e7 3,3,3,3,3,3,3,3, # e8 - ef 3,3,3,3,3,3,3,3, # f0 - f7 3,3,3,3,3,3,3,0 # f8 - ff ) BIG5_st = ( eError,eStart,eStart, 3,eError,eError,eError,eError,#00-07 eError,eError,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eError,#08-0f eError,eStart,eStart,eStart,eStart,eStart,eStart,eStart#10-17 ) Big5CharLenTable = (0, 1, 1, 2, 0) Big5SMModel = {'classTable': BIG5_cls, 'classFactor': 5, 'stateTable': BIG5_st, 'charLenTable': Big5CharLenTable, 'name': 'Big5'} # CP949 CP949_cls = ( 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,0,0, # 00 - 0f 1,1,1,1,1,1,1,1, 1,1,1,0,1,1,1,1, # 10 - 1f 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, # 20 - 2f 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, # 30 - 3f 1,4,4,4,4,4,4,4, 4,4,4,4,4,4,4,4, # 40 - 4f 4,4,5,5,5,5,5,5, 5,5,5,1,1,1,1,1, # 50 - 5f 1,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5, # 60 - 6f 5,5,5,5,5,5,5,5, 5,5,5,1,1,1,1,1, # 70 - 7f 0,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, # 80 - 8f 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, # 90 - 9f 6,7,7,7,7,7,7,7, 7,7,7,7,7,8,8,8, # a0 - af 7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7, # b0 - bf 7,7,7,7,7,7,9,2, 2,3,2,2,2,2,2,2, # c0 - cf 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, # d0 - df 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, # e0 - ef 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,0, # f0 - ff ) CP949_st = ( #cls= 0 1 2 3 4 5 6 7 8 9 # previous state = eError,eStart, 3,eError,eStart,eStart, 4, 5,eError, 6, # eStart eError,eError,eError,eError,eError,eError,eError,eError,eError,eError, # eError eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe, # eItsMe eError,eError,eStart,eStart,eError,eError,eError,eStart,eStart,eStart, # 3 eError,eError,eStart,eStart,eStart,eStart,eStart,eStart,eStart,eStart, # 4 eError,eStart,eStart,eStart,eStart,eStart,eStart,eStart,eStart,eStart, # 5 eError,eStart,eStart,eStart,eStart,eError,eError,eStart,eStart,eStart, # 6 ) CP949CharLenTable = (0, 1, 2, 0, 1, 1, 2, 2, 0, 2) CP949SMModel = {'classTable': CP949_cls, 'classFactor': 10, 'stateTable': CP949_st, 'charLenTable': CP949CharLenTable, 'name': 'CP949'} # EUC-JP EUCJP_cls = ( 4,4,4,4,4,4,4,4, # 00 - 07 4,4,4,4,4,4,5,5, # 08 - 0f 4,4,4,4,4,4,4,4, # 10 - 17 4,4,4,5,4,4,4,4, # 18 - 1f 4,4,4,4,4,4,4,4, # 20 - 27 4,4,4,4,4,4,4,4, # 28 - 2f 4,4,4,4,4,4,4,4, # 30 - 37 4,4,4,4,4,4,4,4, # 38 - 3f 4,4,4,4,4,4,4,4, # 40 - 47 4,4,4,4,4,4,4,4, # 48 - 4f 4,4,4,4,4,4,4,4, # 50 - 57 4,4,4,4,4,4,4,4, # 58 - 5f 4,4,4,4,4,4,4,4, # 60 - 67 4,4,4,4,4,4,4,4, # 68 - 6f 4,4,4,4,4,4,4,4, # 70 - 77 4,4,4,4,4,4,4,4, # 78 - 7f 5,5,5,5,5,5,5,5, # 80 - 87 5,5,5,5,5,5,1,3, # 88 - 8f 5,5,5,5,5,5,5,5, # 90 - 97 5,5,5,5,5,5,5,5, # 98 - 9f 5,2,2,2,2,2,2,2, # a0 - a7 2,2,2,2,2,2,2,2, # a8 - af 2,2,2,2,2,2,2,2, # b0 - b7 2,2,2,2,2,2,2,2, # b8 - bf 2,2,2,2,2,2,2,2, # c0 - c7 2,2,2,2,2,2,2,2, # c8 - cf 2,2,2,2,2,2,2,2, # d0 - d7 2,2,2,2,2,2,2,2, # d8 - df 0,0,0,0,0,0,0,0, # e0 - e7 0,0,0,0,0,0,0,0, # e8 - ef 0,0,0,0,0,0,0,0, # f0 - f7 0,0,0,0,0,0,0,5 # f8 - ff ) EUCJP_st = ( 3, 4, 3, 5,eStart,eError,eError,eError,#00-07 eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe,#08-0f eItsMe,eItsMe,eStart,eError,eStart,eError,eError,eError,#10-17 eError,eError,eStart,eError,eError,eError, 3,eError,#18-1f 3,eError,eError,eError,eStart,eStart,eStart,eStart#20-27 ) EUCJPCharLenTable = (2, 2, 2, 3, 1, 0) EUCJPSMModel = {'classTable': EUCJP_cls, 'classFactor': 6, 'stateTable': EUCJP_st, 'charLenTable': EUCJPCharLenTable, 'name': 'EUC-JP'} # EUC-KR EUCKR_cls = ( 1,1,1,1,1,1,1,1, # 00 - 07 1,1,1,1,1,1,0,0, # 08 - 0f 1,1,1,1,1,1,1,1, # 10 - 17 1,1,1,0,1,1,1,1, # 18 - 1f 1,1,1,1,1,1,1,1, # 20 - 27 1,1,1,1,1,1,1,1, # 28 - 2f 1,1,1,1,1,1,1,1, # 30 - 37 1,1,1,1,1,1,1,1, # 38 - 3f 1,1,1,1,1,1,1,1, # 40 - 47 1,1,1,1,1,1,1,1, # 48 - 4f 1,1,1,1,1,1,1,1, # 50 - 57 1,1,1,1,1,1,1,1, # 58 - 5f 1,1,1,1,1,1,1,1, # 60 - 67 1,1,1,1,1,1,1,1, # 68 - 6f 1,1,1,1,1,1,1,1, # 70 - 77 1,1,1,1,1,1,1,1, # 78 - 7f 0,0,0,0,0,0,0,0, # 80 - 87 0,0,0,0,0,0,0,0, # 88 - 8f 0,0,0,0,0,0,0,0, # 90 - 97 0,0,0,0,0,0,0,0, # 98 - 9f 0,2,2,2,2,2,2,2, # a0 - a7 2,2,2,2,2,3,3,3, # a8 - af 2,2,2,2,2,2,2,2, # b0 - b7 2,2,2,2,2,2,2,2, # b8 - bf 2,2,2,2,2,2,2,2, # c0 - c7 2,3,2,2,2,2,2,2, # c8 - cf 2,2,2,2,2,2,2,2, # d0 - d7 2,2,2,2,2,2,2,2, # d8 - df 2,2,2,2,2,2,2,2, # e0 - e7 2,2,2,2,2,2,2,2, # e8 - ef 2,2,2,2,2,2,2,2, # f0 - f7 2,2,2,2,2,2,2,0 # f8 - ff ) EUCKR_st = ( eError,eStart, 3,eError,eError,eError,eError,eError,#00-07 eItsMe,eItsMe,eItsMe,eItsMe,eError,eError,eStart,eStart #08-0f ) EUCKRCharLenTable = (0, 1, 2, 0) EUCKRSMModel = {'classTable': EUCKR_cls, 'classFactor': 4, 'stateTable': EUCKR_st, 'charLenTable': EUCKRCharLenTable, 'name': 'EUC-KR'} # EUC-TW EUCTW_cls = ( 2,2,2,2,2,2,2,2, # 00 - 07 2,2,2,2,2,2,0,0, # 08 - 0f 2,2,2,2,2,2,2,2, # 10 - 17 2,2,2,0,2,2,2,2, # 18 - 1f 2,2,2,2,2,2,2,2, # 20 - 27 2,2,2,2,2,2,2,2, # 28 - 2f 2,2,2,2,2,2,2,2, # 30 - 37 2,2,2,2,2,2,2,2, # 38 - 3f 2,2,2,2,2,2,2,2, # 40 - 47 2,2,2,2,2,2,2,2, # 48 - 4f 2,2,2,2,2,2,2,2, # 50 - 57 2,2,2,2,2,2,2,2, # 58 - 5f 2,2,2,2,2,2,2,2, # 60 - 67 2,2,2,2,2,2,2,2, # 68 - 6f 2,2,2,2,2,2,2,2, # 70 - 77 2,2,2,2,2,2,2,2, # 78 - 7f 0,0,0,0,0,0,0,0, # 80 - 87 0,0,0,0,0,0,6,0, # 88 - 8f 0,0,0,0,0,0,0,0, # 90 - 97 0,0,0,0,0,0,0,0, # 98 - 9f 0,3,4,4,4,4,4,4, # a0 - a7 5,5,1,1,1,1,1,1, # a8 - af 1,1,1,1,1,1,1,1, # b0 - b7 1,1,1,1,1,1,1,1, # b8 - bf 1,1,3,1,3,3,3,3, # c0 - c7 3,3,3,3,3,3,3,3, # c8 - cf 3,3,3,3,3,3,3,3, # d0 - d7 3,3,3,3,3,3,3,3, # d8 - df 3,3,3,3,3,3,3,3, # e0 - e7 3,3,3,3,3,3,3,3, # e8 - ef 3,3,3,3,3,3,3,3, # f0 - f7 3,3,3,3,3,3,3,0 # f8 - ff ) EUCTW_st = ( eError,eError,eStart, 3, 3, 3, 4,eError,#00-07 eError,eError,eError,eError,eError,eError,eItsMe,eItsMe,#08-0f eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eError,eStart,eError,#10-17 eStart,eStart,eStart,eError,eError,eError,eError,eError,#18-1f 5,eError,eError,eError,eStart,eError,eStart,eStart,#20-27 eStart,eError,eStart,eStart,eStart,eStart,eStart,eStart #28-2f ) EUCTWCharLenTable = (0, 0, 1, 2, 2, 2, 3) EUCTWSMModel = {'classTable': EUCTW_cls, 'classFactor': 7, 'stateTable': EUCTW_st, 'charLenTable': EUCTWCharLenTable, 'name': 'x-euc-tw'} # GB2312 GB2312_cls = ( 1,1,1,1,1,1,1,1, # 00 - 07 1,1,1,1,1,1,0,0, # 08 - 0f 1,1,1,1,1,1,1,1, # 10 - 17 1,1,1,0,1,1,1,1, # 18 - 1f 1,1,1,1,1,1,1,1, # 20 - 27 1,1,1,1,1,1,1,1, # 28 - 2f 3,3,3,3,3,3,3,3, # 30 - 37 3,3,1,1,1,1,1,1, # 38 - 3f 2,2,2,2,2,2,2,2, # 40 - 47 2,2,2,2,2,2,2,2, # 48 - 4f 2,2,2,2,2,2,2,2, # 50 - 57 2,2,2,2,2,2,2,2, # 58 - 5f 2,2,2,2,2,2,2,2, # 60 - 67 2,2,2,2,2,2,2,2, # 68 - 6f 2,2,2,2,2,2,2,2, # 70 - 77 2,2,2,2,2,2,2,4, # 78 - 7f 5,6,6,6,6,6,6,6, # 80 - 87 6,6,6,6,6,6,6,6, # 88 - 8f 6,6,6,6,6,6,6,6, # 90 - 97 6,6,6,6,6,6,6,6, # 98 - 9f 6,6,6,6,6,6,6,6, # a0 - a7 6,6,6,6,6,6,6,6, # a8 - af 6,6,6,6,6,6,6,6, # b0 - b7 6,6,6,6,6,6,6,6, # b8 - bf 6,6,6,6,6,6,6,6, # c0 - c7 6,6,6,6,6,6,6,6, # c8 - cf 6,6,6,6,6,6,6,6, # d0 - d7 6,6,6,6,6,6,6,6, # d8 - df 6,6,6,6,6,6,6,6, # e0 - e7 6,6,6,6,6,6,6,6, # e8 - ef 6,6,6,6,6,6,6,6, # f0 - f7 6,6,6,6,6,6,6,0 # f8 - ff ) GB2312_st = ( eError,eStart,eStart,eStart,eStart,eStart, 3,eError,#00-07 eError,eError,eError,eError,eError,eError,eItsMe,eItsMe,#08-0f eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eError,eError,eStart,#10-17 4,eError,eStart,eStart,eError,eError,eError,eError,#18-1f eError,eError, 5,eError,eError,eError,eItsMe,eError,#20-27 eError,eError,eStart,eStart,eStart,eStart,eStart,eStart #28-2f ) # To be accurate, the length of class 6 can be either 2 or 4. # But it is not necessary to discriminate between the two since # it is used for frequency analysis only, and we are validing # each code range there as well. So it is safe to set it to be # 2 here. GB2312CharLenTable = (0, 1, 1, 1, 1, 1, 2) GB2312SMModel = {'classTable': GB2312_cls, 'classFactor': 7, 'stateTable': GB2312_st, 'charLenTable': GB2312CharLenTable, 'name': 'GB2312'} # Shift_JIS SJIS_cls = ( 1,1,1,1,1,1,1,1, # 00 - 07 1,1,1,1,1,1,0,0, # 08 - 0f 1,1,1,1,1,1,1,1, # 10 - 17 1,1,1,0,1,1,1,1, # 18 - 1f 1,1,1,1,1,1,1,1, # 20 - 27 1,1,1,1,1,1,1,1, # 28 - 2f 1,1,1,1,1,1,1,1, # 30 - 37 1,1,1,1,1,1,1,1, # 38 - 3f 2,2,2,2,2,2,2,2, # 40 - 47 2,2,2,2,2,2,2,2, # 48 - 4f 2,2,2,2,2,2,2,2, # 50 - 57 2,2,2,2,2,2,2,2, # 58 - 5f 2,2,2,2,2,2,2,2, # 60 - 67 2,2,2,2,2,2,2,2, # 68 - 6f 2,2,2,2,2,2,2,2, # 70 - 77 2,2,2,2,2,2,2,1, # 78 - 7f 3,3,3,3,3,2,2,3, # 80 - 87 3,3,3,3,3,3,3,3, # 88 - 8f 3,3,3,3,3,3,3,3, # 90 - 97 3,3,3,3,3,3,3,3, # 98 - 9f #0xa0 is illegal in sjis encoding, but some pages does #contain such byte. We need to be more error forgiven. 2,2,2,2,2,2,2,2, # a0 - a7 2,2,2,2,2,2,2,2, # a8 - af 2,2,2,2,2,2,2,2, # b0 - b7 2,2,2,2,2,2,2,2, # b8 - bf 2,2,2,2,2,2,2,2, # c0 - c7 2,2,2,2,2,2,2,2, # c8 - cf 2,2,2,2,2,2,2,2, # d0 - d7 2,2,2,2,2,2,2,2, # d8 - df 3,3,3,3,3,3,3,3, # e0 - e7 3,3,3,3,3,4,4,4, # e8 - ef 3,3,3,3,3,3,3,3, # f0 - f7 3,3,3,3,3,0,0,0) # f8 - ff SJIS_st = ( eError,eStart,eStart, 3,eError,eError,eError,eError,#00-07 eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe,#08-0f eItsMe,eItsMe,eError,eError,eStart,eStart,eStart,eStart #10-17 ) SJISCharLenTable = (0, 1, 1, 2, 0, 0) SJISSMModel = {'classTable': SJIS_cls, 'classFactor': 6, 'stateTable': SJIS_st, 'charLenTable': SJISCharLenTable, 'name': 'Shift_JIS'} # UCS2-BE UCS2BE_cls = ( 0,0,0,0,0,0,0,0, # 00 - 07 0,0,1,0,0,2,0,0, # 08 - 0f 0,0,0,0,0,0,0,0, # 10 - 17 0,0,0,3,0,0,0,0, # 18 - 1f 0,0,0,0,0,0,0,0, # 20 - 27 0,3,3,3,3,3,0,0, # 28 - 2f 0,0,0,0,0,0,0,0, # 30 - 37 0,0,0,0,0,0,0,0, # 38 - 3f 0,0,0,0,0,0,0,0, # 40 - 47 0,0,0,0,0,0,0,0, # 48 - 4f 0,0,0,0,0,0,0,0, # 50 - 57 0,0,0,0,0,0,0,0, # 58 - 5f 0,0,0,0,0,0,0,0, # 60 - 67 0,0,0,0,0,0,0,0, # 68 - 6f 0,0,0,0,0,0,0,0, # 70 - 77 0,0,0,0,0,0,0,0, # 78 - 7f 0,0,0,0,0,0,0,0, # 80 - 87 0,0,0,0,0,0,0,0, # 88 - 8f 0,0,0,0,0,0,0,0, # 90 - 97 0,0,0,0,0,0,0,0, # 98 - 9f 0,0,0,0,0,0,0,0, # a0 - a7 0,0,0,0,0,0,0,0, # a8 - af 0,0,0,0,0,0,0,0, # b0 - b7 0,0,0,0,0,0,0,0, # b8 - bf 0,0,0,0,0,0,0,0, # c0 - c7 0,0,0,0,0,0,0,0, # c8 - cf 0,0,0,0,0,0,0,0, # d0 - d7 0,0,0,0,0,0,0,0, # d8 - df 0,0,0,0,0,0,0,0, # e0 - e7 0,0,0,0,0,0,0,0, # e8 - ef 0,0,0,0,0,0,0,0, # f0 - f7 0,0,0,0,0,0,4,5 # f8 - ff ) UCS2BE_st = ( 5, 7, 7,eError, 4, 3,eError,eError,#00-07 eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe,#08-0f eItsMe,eItsMe, 6, 6, 6, 6,eError,eError,#10-17 6, 6, 6, 6, 6,eItsMe, 6, 6,#18-1f 6, 6, 6, 6, 5, 7, 7,eError,#20-27 5, 8, 6, 6,eError, 6, 6, 6,#28-2f 6, 6, 6, 6,eError,eError,eStart,eStart #30-37 ) UCS2BECharLenTable = (2, 2, 2, 0, 2, 2) UCS2BESMModel = {'classTable': UCS2BE_cls, 'classFactor': 6, 'stateTable': UCS2BE_st, 'charLenTable': UCS2BECharLenTable, 'name': 'UTF-16BE'} # UCS2-LE UCS2LE_cls = ( 0,0,0,0,0,0,0,0, # 00 - 07 0,0,1,0,0,2,0,0, # 08 - 0f 0,0,0,0,0,0,0,0, # 10 - 17 0,0,0,3,0,0,0,0, # 18 - 1f 0,0,0,0,0,0,0,0, # 20 - 27 0,3,3,3,3,3,0,0, # 28 - 2f 0,0,0,0,0,0,0,0, # 30 - 37 0,0,0,0,0,0,0,0, # 38 - 3f 0,0,0,0,0,0,0,0, # 40 - 47 0,0,0,0,0,0,0,0, # 48 - 4f 0,0,0,0,0,0,0,0, # 50 - 57 0,0,0,0,0,0,0,0, # 58 - 5f 0,0,0,0,0,0,0,0, # 60 - 67 0,0,0,0,0,0,0,0, # 68 - 6f 0,0,0,0,0,0,0,0, # 70 - 77 0,0,0,0,0,0,0,0, # 78 - 7f 0,0,0,0,0,0,0,0, # 80 - 87 0,0,0,0,0,0,0,0, # 88 - 8f 0,0,0,0,0,0,0,0, # 90 - 97 0,0,0,0,0,0,0,0, # 98 - 9f 0,0,0,0,0,0,0,0, # a0 - a7 0,0,0,0,0,0,0,0, # a8 - af 0,0,0,0,0,0,0,0, # b0 - b7 0,0,0,0,0,0,0,0, # b8 - bf 0,0,0,0,0,0,0,0, # c0 - c7 0,0,0,0,0,0,0,0, # c8 - cf 0,0,0,0,0,0,0,0, # d0 - d7 0,0,0,0,0,0,0,0, # d8 - df 0,0,0,0,0,0,0,0, # e0 - e7 0,0,0,0,0,0,0,0, # e8 - ef 0,0,0,0,0,0,0,0, # f0 - f7 0,0,0,0,0,0,4,5 # f8 - ff ) UCS2LE_st = ( 6, 6, 7, 6, 4, 3,eError,eError,#00-07 eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe,#08-0f eItsMe,eItsMe, 5, 5, 5,eError,eItsMe,eError,#10-17 5, 5, 5,eError, 5,eError, 6, 6,#18-1f 7, 6, 8, 8, 5, 5, 5,eError,#20-27 5, 5, 5,eError,eError,eError, 5, 5,#28-2f 5, 5, 5,eError, 5,eError,eStart,eStart #30-37 ) UCS2LECharLenTable = (2, 2, 2, 2, 2, 2) UCS2LESMModel = {'classTable': UCS2LE_cls, 'classFactor': 6, 'stateTable': UCS2LE_st, 'charLenTable': UCS2LECharLenTable, 'name': 'UTF-16LE'} # UTF-8 UTF8_cls = ( 1,1,1,1,1,1,1,1, # 00 - 07 #allow 0x00 as a legal value 1,1,1,1,1,1,0,0, # 08 - 0f 1,1,1,1,1,1,1,1, # 10 - 17 1,1,1,0,1,1,1,1, # 18 - 1f 1,1,1,1,1,1,1,1, # 20 - 27 1,1,1,1,1,1,1,1, # 28 - 2f 1,1,1,1,1,1,1,1, # 30 - 37 1,1,1,1,1,1,1,1, # 38 - 3f 1,1,1,1,1,1,1,1, # 40 - 47 1,1,1,1,1,1,1,1, # 48 - 4f 1,1,1,1,1,1,1,1, # 50 - 57 1,1,1,1,1,1,1,1, # 58 - 5f 1,1,1,1,1,1,1,1, # 60 - 67 1,1,1,1,1,1,1,1, # 68 - 6f 1,1,1,1,1,1,1,1, # 70 - 77 1,1,1,1,1,1,1,1, # 78 - 7f 2,2,2,2,3,3,3,3, # 80 - 87 4,4,4,4,4,4,4,4, # 88 - 8f 4,4,4,4,4,4,4,4, # 90 - 97 4,4,4,4,4,4,4,4, # 98 - 9f 5,5,5,5,5,5,5,5, # a0 - a7 5,5,5,5,5,5,5,5, # a8 - af 5,5,5,5,5,5,5,5, # b0 - b7 5,5,5,5,5,5,5,5, # b8 - bf 0,0,6,6,6,6,6,6, # c0 - c7 6,6,6,6,6,6,6,6, # c8 - cf 6,6,6,6,6,6,6,6, # d0 - d7 6,6,6,6,6,6,6,6, # d8 - df 7,8,8,8,8,8,8,8, # e0 - e7 8,8,8,8,8,9,8,8, # e8 - ef 10,11,11,11,11,11,11,11, # f0 - f7 12,13,13,13,14,15,0,0 # f8 - ff ) UTF8_st = ( eError,eStart,eError,eError,eError,eError, 12, 10,#00-07 9, 11, 8, 7, 6, 5, 4, 3,#08-0f eError,eError,eError,eError,eError,eError,eError,eError,#10-17 eError,eError,eError,eError,eError,eError,eError,eError,#18-1f eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,#20-27 eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,#28-2f eError,eError, 5, 5, 5, 5,eError,eError,#30-37 eError,eError,eError,eError,eError,eError,eError,eError,#38-3f eError,eError,eError, 5, 5, 5,eError,eError,#40-47 eError,eError,eError,eError,eError,eError,eError,eError,#48-4f eError,eError, 7, 7, 7, 7,eError,eError,#50-57 eError,eError,eError,eError,eError,eError,eError,eError,#58-5f eError,eError,eError,eError, 7, 7,eError,eError,#60-67 eError,eError,eError,eError,eError,eError,eError,eError,#68-6f eError,eError, 9, 9, 9, 9,eError,eError,#70-77 eError,eError,eError,eError,eError,eError,eError,eError,#78-7f eError,eError,eError,eError,eError, 9,eError,eError,#80-87 eError,eError,eError,eError,eError,eError,eError,eError,#88-8f eError,eError, 12, 12, 12, 12,eError,eError,#90-97 eError,eError,eError,eError,eError,eError,eError,eError,#98-9f eError,eError,eError,eError,eError, 12,eError,eError,#a0-a7 eError,eError,eError,eError,eError,eError,eError,eError,#a8-af eError,eError, 12, 12, 12,eError,eError,eError,#b0-b7 eError,eError,eError,eError,eError,eError,eError,eError,#b8-bf eError,eError,eStart,eStart,eStart,eStart,eError,eError,#c0-c7 eError,eError,eError,eError,eError,eError,eError,eError #c8-cf ) UTF8CharLenTable = (0, 1, 0, 0, 0, 0, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6) UTF8SMModel = {'classTable': UTF8_cls, 'classFactor': 16, 'stateTable': UTF8_st, 'charLenTable': UTF8CharLenTable, 'name': 'UTF-8'}
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, 5559, 492, 325, 3162, 12, 19424, 12, 325, 12278, 199, 199, 3, 16524, 21, 199, 199, 18643, 21, 63, 1886, 275, 334, 272, 413, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 221, 327, 8733, 446, 24937, 259, 327, 3306, 378, 88, 383, 465, 18393, 574, 272, 413, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 16, 12, 16, 12, 221, 327, 19363, 446, 378, 70, 272, 413, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 221, 327, 1616, 446, 5557, 272, 413, 12, 17, 12, 17, 12, 16, 12, 17, 12, 17, 12, 17, 12, 17, 12, 221, 327, 6155, 446, 413, 70, 272, 413, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 221, 327, 3388, 446, 8087, 272, 413, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 221, 327, 7294, 446, 499, 70, 272, 413, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 221, 327, 4233, 446, 6877, 272, 413, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 221, 327, 10448, 446, 650, 70, 272, 499, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 221, 327, 6335, 446, 10954, 272, 499, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 221, 327, 9615, 446, 841, 70, 272, 499, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 221, 327, 5238, 446, 12699, 272, 499, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 221, 327, 13713, 446, 959, 70, 272, 499, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 221, 327, 5212, 446, 13296, 272, 499, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 221, 327, 10851, 446, 1227, 70, 272, 499, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 221, 327, 10045, 446, 8375, 272, 499, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 17, 12, 221, 327, 14679, 446, 1520, 70, 272, 841, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 221, 327, 5939, 446, 10513, 272, 841, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 221, 327, 10523, 446, 1695, 70, 272, 841, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 221, 327, 9137, 446, 15997, 272, 841, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 221, 327, 16096, 446, 1749, 70, 272, 841, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 282, 16, 446, 282, 23, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 282, 24, 446, 15871, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 330, 16, 446, 330, 23, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 330, 24, 446, 18839, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 286, 16, 446, 286, 23, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 286, 24, 446, 3980, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 366, 16, 446, 366, 23, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 366, 24, 446, 4051, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 325, 16, 446, 325, 23, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 325, 24, 446, 9530, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 289, 16, 446, 289, 23, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 16, 221, 327, 289, 24, 446, 16328, 199, 9, 199, 199, 18643 ]
[ 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, 5559, 492, 325, 3162, 12, 19424, 12, 325, 12278, 199, 199, 3, 16524, 21, 199, 199, 18643, 21, 63, 1886, 275, 334, 272, 413, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 221, 327, 8733, 446, 24937, 259, 327, 3306, 378, 88, 383, 465, 18393, 574, 272, 413, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 16, 12, 16, 12, 221, 327, 19363, 446, 378, 70, 272, 413, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 221, 327, 1616, 446, 5557, 272, 413, 12, 17, 12, 17, 12, 16, 12, 17, 12, 17, 12, 17, 12, 17, 12, 221, 327, 6155, 446, 413, 70, 272, 413, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 221, 327, 3388, 446, 8087, 272, 413, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 221, 327, 7294, 446, 499, 70, 272, 413, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 221, 327, 4233, 446, 6877, 272, 413, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 17, 12, 221, 327, 10448, 446, 650, 70, 272, 499, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 221, 327, 6335, 446, 10954, 272, 499, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 221, 327, 9615, 446, 841, 70, 272, 499, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 221, 327, 5238, 446, 12699, 272, 499, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 221, 327, 13713, 446, 959, 70, 272, 499, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 221, 327, 5212, 446, 13296, 272, 499, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 221, 327, 10851, 446, 1227, 70, 272, 499, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 221, 327, 10045, 446, 8375, 272, 499, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 18, 12, 17, 12, 221, 327, 14679, 446, 1520, 70, 272, 841, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 221, 327, 5939, 446, 10513, 272, 841, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 221, 327, 10523, 446, 1695, 70, 272, 841, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 221, 327, 9137, 446, 15997, 272, 841, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 20, 12, 221, 327, 16096, 446, 1749, 70, 272, 841, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 282, 16, 446, 282, 23, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 282, 24, 446, 15871, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 330, 16, 446, 330, 23, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 330, 24, 446, 18839, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 286, 16, 446, 286, 23, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 286, 24, 446, 3980, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 366, 16, 446, 366, 23, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 366, 24, 446, 4051, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 325, 16, 446, 325, 23, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 19, 12, 221, 327, 325, 24, 446, 9530, 272, 650, 12, 19, 12, 19, 12, 19, 12, 19, 12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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 ]
subutai/nupic
src/nupic/algorithms/backtracking_tm_shim.py
6
9992
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2014, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero Public License version 3 as # published by the Free Software Foundation. # # 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 Public License for more details. # # You should have received a copy of the GNU Affero Public License # along with this program. If not, see http://www.gnu.org/licenses. # # http://numenta.org/licenses/ # ---------------------------------------------------------------------- """ A shim for the TM class that transparently implements TemporalMemory, for use with OPF. """ import numpy from nupic.bindings.algorithms import TemporalMemory as TemporalMemoryCPP from nupic.algorithms.monitor_mixin.temporal_memory_monitor_mixin import ( TemporalMemoryMonitorMixin) from nupic.algorithms.temporal_memory import TemporalMemory class MonitoredTemporalMemory(TemporalMemoryMonitorMixin, TemporalMemory): def __init__(self, *args, **kwargs): TemporalMemoryMonitorMixin.__init__(self, *args, **kwargs) TemporalMemory.__init__(self, *args, **kwargs) @classmethod def read(cls, proto): """ Intercepts TemporalMemory deserialization request in order to initialize `TemporalMemoryMonitorMixin` state @param proto (DynamicStructBuilder) Proto object @return (TemporalMemory) TemporalMemory shim instance """ tm = super(TemporalMemoryMonitorMixin, cls).read(proto) # initialize `TemporalMemoryMonitorMixin` attributes tm.mmName = None tm._mmTraces = None tm._mmData = None tm.mmClearHistory() tm._mmResetActive = True return tm class TMShimMixin(object): """ TM => Temporal Memory shim class. """ def __init__(self, numberOfCols=500, cellsPerColumn=10, initialPerm=0.11, connectedPerm=0.50, minThreshold=8, newSynapseCount=15, permanenceInc=0.10, permanenceDec=0.10, permanenceMax=1.0, activationThreshold=12, predictedSegmentDecrement=0.0, maxSegmentsPerCell=255, maxSynapsesPerSegment=255, globalDecay=0.10, maxAge=100000, pamLength=1, verbosity=0, outputType="normal", seed=42): """ Translate parameters and initialize member variables specific to `backtracking_tm.py`. """ super(TMShimMixin, self).__init__( columnDimensions=(numberOfCols,), cellsPerColumn=cellsPerColumn, activationThreshold=activationThreshold, initialPermanence=initialPerm, connectedPermanence=connectedPerm, minThreshold=minThreshold, maxNewSynapseCount=newSynapseCount, permanenceIncrement=permanenceInc, permanenceDecrement=permanenceDec, predictedSegmentDecrement=predictedSegmentDecrement, maxSegmentsPerCell=maxSegmentsPerCell, maxSynapsesPerSegment=maxSynapsesPerSegment, seed=seed) self.infActiveState = {"t": None} @classmethod def read(cls, proto): """ Intercepts TemporalMemory deserialization request in order to initialize `self.infActiveState` @param proto (DynamicStructBuilder) Proto object @return (TemporalMemory) TemporalMemory shim instance """ tm = super(TMShimMixin, cls).read(proto) tm.infActiveState = {"t": None} return tm def compute(self, bottomUpInput, enableLearn, computeInfOutput=None): """ (From `backtracking_tm.py`) Handle one compute, possibly learning. @param bottomUpInput The bottom-up input, typically from a spatial pooler @param enableLearn If true, perform learning @param computeInfOutput If None, default behavior is to disable the inference output when enableLearn is on. If true, compute the inference output If false, do not compute the inference output """ super(TMShimMixin, self).compute(set(bottomUpInput.nonzero()[0]), learn=enableLearn) numberOfCells = self.numberOfCells() activeState = numpy.zeros(numberOfCells) activeState[self.getActiveCells()] = 1 self.infActiveState["t"] = activeState output = numpy.zeros(numberOfCells) output[self.getPredictiveCells()] = 1 output[self.getActiveCells()] = 1 return output def topDownCompute(self, topDownIn=None): """ (From `backtracking_tm.py`) Top-down compute - generate expected input given output of the TM @param topDownIn top down input from the level above us @returns best estimate of the TM input that would have generated bottomUpOut. """ output = numpy.zeros(self.numberOfColumns()) columns = [self.columnForCell(idx) for idx in self.getPredictiveCells()] output[columns] = 1 return output def getActiveState(self): activeState = numpy.zeros(self.numberOfCells()) activeState[self.getActiveCells()] = 1 return activeState def getPredictedState(self): predictedState = numpy.zeros(self.numberOfCells()) predictedState[self.getPredictiveCells()] = 1 return predictedState def getLearnActiveStateT(self): state = numpy.zeros([self.numberOfColumns(), self.getCellsPerColumn()]) return state class TMShim(TMShimMixin, TemporalMemory): pass class TMCPPShim(TMShimMixin, TemporalMemoryCPP): pass class MonitoredTMShim(MonitoredTemporalMemory): """ TM => Monitored Temporal Memory shim class. TODO: This class is not very DRY. This whole file needs to be replaced by a pure TemporalMemory region (WIP at https://github.com/numenta/nupic.research/pull/247). """ def __init__(self, numberOfCols=500, cellsPerColumn=10, initialPerm=0.11, connectedPerm=0.50, minThreshold=8, newSynapseCount=15, permanenceInc=0.10, permanenceDec=0.10, permanenceMax=1.0, activationThreshold=12, predictedSegmentDecrement=0.0, maxSegmentsPerCell=255, maxSynapsesPerSegment=255, globalDecay=0.10, maxAge=100000, pamLength=1, verbosity=0, outputType="normal", seed=42): """ Translate parameters and initialize member variables specific to `backtracking_tm.py`. """ super(MonitoredTMShim, self).__init__( columnDimensions=(numberOfCols,), cellsPerColumn=cellsPerColumn, activationThreshold=activationThreshold, initialPermanence=initialPerm, connectedPermanence=connectedPerm, minThreshold=minThreshold, maxNewSynapseCount=newSynapseCount, permanenceIncrement=permanenceInc, permanenceDecrement=permanenceDec, predictedSegmentDecrement=predictedSegmentDecrement, maxSegmentsPerCell=maxSegmentsPerCell, maxSynapsesPerSegment=maxSynapsesPerSegment, seed=seed) self.infActiveState = {"t": None} @classmethod def read(cls, proto): """ Intercepts TemporalMemory deserialization request in order to initialize `self.infActiveState` @param proto (DynamicStructBuilder) Proto object @return (TemporalMemory) TemporalMemory shim instance """ tm = super(MonitoredTMShim, cls).read(proto) tm.infActiveState = {"t": None} return tm def compute(self, bottomUpInput, enableLearn, computeInfOutput=None): """ (From `backtracking_tm.py`) Handle one compute, possibly learning. @param bottomUpInput The bottom-up input, typically from a spatial pooler @param enableLearn If true, perform learning @param computeInfOutput If None, default behavior is to disable the inference output when enableLearn is on. If true, compute the inference output If false, do not compute the inference output """ super(MonitoredTMShim, self).compute(set(bottomUpInput.nonzero()[0]), learn=enableLearn) numberOfCells = self.numberOfCells() activeState = numpy.zeros(numberOfCells) activeState[self.getActiveCells()] = 1 self.infActiveState["t"] = activeState output = numpy.zeros(numberOfCells) output[self.getPredictiveCells() + self.getActiveCells()] = 1 return output def topDownCompute(self, topDownIn=None): """ (From `backtracking_tm.py`) Top-down compute - generate expected input given output of the TM @param topDownIn top down input from the level above us @returns best estimate of the TM input that would have generated bottomUpOut. """ output = numpy.zeros(self.numberOfColumns()) columns = [self.columnForCell(idx) for idx in self.getPredictiveCells()] output[columns] = 1 return output def getActiveState(self): activeState = numpy.zeros(self.numberOfCells()) activeState[self.getActiveCells()] = 1 return activeState def getPredictedState(self): predictedState = numpy.zeros(self.numberOfCells()) predictedState[self.getPredictiveCells()] = 1 return predictedState def getLearnActiveStateT(self): state = numpy.zeros([self.numberOfColumns(), self.cellsPerColumn]) return state
agpl-3.0
[ 3, 20359, 199, 3, 22783, 16078, 367, 8883, 24024, 27799, 334, 21988, 26769, 9, 199, 3, 1898, 334, 35, 9, 6927, 12, 22783, 12, 3277, 14, 221, 4158, 1265, 1172, 376, 25025, 199, 3, 543, 22783, 12, 3277, 2020, 367, 282, 7396, 4190, 367, 642, 2032, 1233, 12, 314, 199, 3, 2569, 2895, 436, 3704, 4838, 26, 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, 4265, 1684, 844, 1015, 650, 465, 199, 3, 3267, 701, 314, 2868, 2290, 2752, 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, 199, 3, 1666, 314, 1664, 4265, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 4265, 1684, 844, 199, 3, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 1455, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 14, 199, 3, 199, 3, 1455, 921, 78, 18952, 14, 1308, 15, 2383, 15, 199, 3, 20359, 199, 199, 624, 199, 33, 25905, 367, 314, 377, 45, 1021, 626, 17265, 590, 9031, 12540, 19849, 8628, 12, 199, 509, 675, 543, 9827, 38, 14, 199, 624, 199, 199, 646, 2680, 199, 504, 26084, 14, 10880, 14, 24365, 492, 12540, 19849, 8628, 465, 12540, 19849, 8628, 14533, 199, 199, 504, 26084, 14, 24365, 14, 7157, 63, 20406, 14, 30574, 63, 4844, 63, 7157, 63, 20406, 492, 334, 523, 12540, 19849, 8628, 13189, 4256, 9, 199, 504, 26084, 14, 24365, 14, 30574, 63, 4844, 492, 12540, 19849, 8628, 421, 199, 533, 10953, 17043, 6530, 19849, 8628, 8, 6530, 19849, 8628, 13189, 4256, 12, 2892, 12540, 19849, 8628, 304, 523, 347, 636, 826, 721, 277, 12, 627, 589, 12, 1011, 958, 304, 272, 12540, 19849, 8628, 13189, 4256, 855, 826, 721, 277, 12, 627, 589, 12, 1011, 958, 9, 272, 12540, 19849, 8628, 855, 826, 721, 277, 12, 627, 589, 12, 1011, 958, 9, 819, 768, 3744, 523, 347, 1586, 8, 1886, 12, 4104, 304, 272, 408, 272, 6551, 716, 83, 12540, 19849, 8628, 477, 12161, 1056, 315, 1865, 370, 8265, 272, 658, 6530, 19849, 8628, 13189, 4256, 64, 1174, 339, 768, 635, 4104, 334, 14451, 4836, 6437, 9, 2165, 475, 909, 339, 768, 1107, 334, 6530, 19849, 8628, 9, 12540, 19849, 8628, 25905, 1256, 272, 408, 272, 7352, 275, 1613, 8, 6530, 19849, 8628, 13189, 4256, 12, 843, 680, 739, 8, 2625, 9, 339, 327, 8265, 658, 6530, 19849, 8628, 13189, 4256, 64, 3004, 272, 7352, 14, 596, 985, 275, 488, 272, 7352, 423, 596, 2437, 823, 275, 488, 272, 7352, 423, 596, 1451, 275, 488, 272, 7352, 14, 596, 9721, 12114, 342, 272, 7352, 423, 596, 9637, 7472, 275, 715, 272, 372, 7352, 4388, 199, 533, 377, 45, 2662, 1017, 4256, 8, 785, 304, 523, 408, 523, 377, 45, 9265, 12540, 19849, 15825, 25905, 1021, 14, 523, 408, 523, 347, 636, 826, 721, 277, 12, 2049, 28127, 17203, 29, 5783, 12, 2049, 10106, 2623, 4547, 29, 709, 12, 2049, 2536, 23554, 29, 16, 14, 845, 12, 2049, 8539, 23554, 29, 16, 14, 1400, 12, 2049, 1748, 12109, 29, 24, 12, 2049, 892, 17746, 19111, 2353, 29, 1046, 12, 2049, 1126, 24492, 30612, 29, 16, 14, 709, 12, 2049, 1126, 24492, 8584, 29, 16, 14, 709, 12, 2049, 1126, 24492, 4261, 29, 17, 14, 16, 12, 2049, 10361, 12109, 29, 713, 12, 2049, 14746, 12520, 8584, 264, 434, 29, 16, 14, 16, 12, 2049, 1390, 23287, 2623, 8108, 29, 2299, 12, 2049, 1390, 17746, 25036, 2623, 12520, 29, 2299, 12, 2049, 2288, 872, 9972, 29, 16, 14, 709, 12, 2049, 1390, 20480, 29, 15274, 12, 2049, 299, 455, 4625, 29, 17, 12, 2049, 8661, 29, 16, 12, 2049, 1072, 804, 628, 3302, 401, 2049, 6347, 29, 2260, 304, 272, 408, 272, 25540, 2633, 436, 8265, 3653, 2860, 2488, 370, 658, 894, 14428, 63, 7574, 14, 647, 2313, 272, 408, 272, 1613, 8, 20690, 2662, 1017, 4256, 12, 291, 2843, 826, 721, 489, 2763, 23370, 2687, 23922, 17203, 4706, 489, 10106, 2623, 4547, 29, 9041, 2623, 4547, 12, 489, 10361, 12109, 29, 12312, 12109, 12, 489, 2536, 2623, 24492, 29, 2747, 23554, 12, 489, 8539, 2623, 24492, 29, 7113, 23554, 12, 489, 1748, 12109, 29, 827, 12109, 12, 489, 1390, 4665, 17746, 19111, 2353, 29, 1222, 17746, 19111, 2353, 12, 489, 1126, 24492, 29485, 29, 529, 24492, 30612, 12, 489, 1126, 24492, 8584, 264, 434, 29, 529, 24492, 8584, 12, 489, 14746, 12520, 8584, 264, 434, 29, 21118, 12520, 8584, 264, 434, 12, 489, 1390, 23287, 2623, 8108, 29, 988, 23287, 2623, 8108, 12, 489, 1390, 17746, 25036, 2623, 12520, 29, 988, 17746, 25036, 2623, 12520, 12, 489, 6347, 29, 5176, 9, 339, 291, 14, 4904, 7472, 2223, 275, 2420, 84, 582, 488, 93, 8330, 768, 3744, 523, 347, 1586, 8, 1886, 12, 4104, 304, 272, 408, 272, 6551, 716, 83, 12540, 19849, 8628, 477, 12161, 1056, 315, 1865, 370, 8265, 272, 658, 277, 14, 4904, 7472, 2223, 64, 339, 768, 635, 4104, 334, 14451, 4836, 6437, 9, 2165, 475, 909, 339, 768, 1107, 334, 6530, 19849, 8628, 9, 12540, 19849, 8628, 25905, 1256, 272, 408, 272, 7352, 275, 1613, 8, 20690, 2662, 1017, 4256, 12, 843, 680, 739, 8, 2625, 9, 272, 7352, 14, 4904, 7472, 2223, 275, 2420, 84, 582, 488, 93, 272, 372, 7352, 8330, 347, 4526, 8, 277, 12, 9048, 1721, 3205, 12, 4756, 21424, 12, 4526, 17354, 2959, 29, 403, 304, 272, 408, 272, 334, 2532, 658, 894, 14428, 63, 7574, 14, 647, 10522, 272, 8690, 1373, 4526, 12, 12570, 9328, 14, 339, 768, 635, 9048, 1721, 3205, 258, 710, 9048, 13, 384, 1324, 12, 13609, 687, 282, 11469, 1115, 79, 1435, 272, 768, 635, 4756, 21424, 755, 982, 2549, 12, 5147, 9328, 272, 768, 635, 4526, 17354, 2959, 221, 982, 488, 12, 849, 5953, 365, 370, 3507, 314, 17353, 2490, 1072, 1380, 4756, 21424, 365, 641, 14, 2490, 982, 2549, 12, 4526, 314, 17353 ]
[ 20359, 199, 3, 22783, 16078, 367, 8883, 24024, 27799, 334, 21988, 26769, 9, 199, 3, 1898, 334, 35, 9, 6927, 12, 22783, 12, 3277, 14, 221, 4158, 1265, 1172, 376, 25025, 199, 3, 543, 22783, 12, 3277, 2020, 367, 282, 7396, 4190, 367, 642, 2032, 1233, 12, 314, 199, 3, 2569, 2895, 436, 3704, 4838, 26, 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, 4265, 1684, 844, 1015, 650, 465, 199, 3, 3267, 701, 314, 2868, 2290, 2752, 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, 199, 3, 1666, 314, 1664, 4265, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 4265, 1684, 844, 199, 3, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 1455, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 14, 199, 3, 199, 3, 1455, 921, 78, 18952, 14, 1308, 15, 2383, 15, 199, 3, 20359, 199, 199, 624, 199, 33, 25905, 367, 314, 377, 45, 1021, 626, 17265, 590, 9031, 12540, 19849, 8628, 12, 199, 509, 675, 543, 9827, 38, 14, 199, 624, 199, 199, 646, 2680, 199, 504, 26084, 14, 10880, 14, 24365, 492, 12540, 19849, 8628, 465, 12540, 19849, 8628, 14533, 199, 199, 504, 26084, 14, 24365, 14, 7157, 63, 20406, 14, 30574, 63, 4844, 63, 7157, 63, 20406, 492, 334, 523, 12540, 19849, 8628, 13189, 4256, 9, 199, 504, 26084, 14, 24365, 14, 30574, 63, 4844, 492, 12540, 19849, 8628, 421, 199, 533, 10953, 17043, 6530, 19849, 8628, 8, 6530, 19849, 8628, 13189, 4256, 12, 2892, 12540, 19849, 8628, 304, 523, 347, 636, 826, 721, 277, 12, 627, 589, 12, 1011, 958, 304, 272, 12540, 19849, 8628, 13189, 4256, 855, 826, 721, 277, 12, 627, 589, 12, 1011, 958, 9, 272, 12540, 19849, 8628, 855, 826, 721, 277, 12, 627, 589, 12, 1011, 958, 9, 819, 768, 3744, 523, 347, 1586, 8, 1886, 12, 4104, 304, 272, 408, 272, 6551, 716, 83, 12540, 19849, 8628, 477, 12161, 1056, 315, 1865, 370, 8265, 272, 658, 6530, 19849, 8628, 13189, 4256, 64, 1174, 339, 768, 635, 4104, 334, 14451, 4836, 6437, 9, 2165, 475, 909, 339, 768, 1107, 334, 6530, 19849, 8628, 9, 12540, 19849, 8628, 25905, 1256, 272, 408, 272, 7352, 275, 1613, 8, 6530, 19849, 8628, 13189, 4256, 12, 843, 680, 739, 8, 2625, 9, 339, 327, 8265, 658, 6530, 19849, 8628, 13189, 4256, 64, 3004, 272, 7352, 14, 596, 985, 275, 488, 272, 7352, 423, 596, 2437, 823, 275, 488, 272, 7352, 423, 596, 1451, 275, 488, 272, 7352, 14, 596, 9721, 12114, 342, 272, 7352, 423, 596, 9637, 7472, 275, 715, 272, 372, 7352, 4388, 199, 533, 377, 45, 2662, 1017, 4256, 8, 785, 304, 523, 408, 523, 377, 45, 9265, 12540, 19849, 15825, 25905, 1021, 14, 523, 408, 523, 347, 636, 826, 721, 277, 12, 2049, 28127, 17203, 29, 5783, 12, 2049, 10106, 2623, 4547, 29, 709, 12, 2049, 2536, 23554, 29, 16, 14, 845, 12, 2049, 8539, 23554, 29, 16, 14, 1400, 12, 2049, 1748, 12109, 29, 24, 12, 2049, 892, 17746, 19111, 2353, 29, 1046, 12, 2049, 1126, 24492, 30612, 29, 16, 14, 709, 12, 2049, 1126, 24492, 8584, 29, 16, 14, 709, 12, 2049, 1126, 24492, 4261, 29, 17, 14, 16, 12, 2049, 10361, 12109, 29, 713, 12, 2049, 14746, 12520, 8584, 264, 434, 29, 16, 14, 16, 12, 2049, 1390, 23287, 2623, 8108, 29, 2299, 12, 2049, 1390, 17746, 25036, 2623, 12520, 29, 2299, 12, 2049, 2288, 872, 9972, 29, 16, 14, 709, 12, 2049, 1390, 20480, 29, 15274, 12, 2049, 299, 455, 4625, 29, 17, 12, 2049, 8661, 29, 16, 12, 2049, 1072, 804, 628, 3302, 401, 2049, 6347, 29, 2260, 304, 272, 408, 272, 25540, 2633, 436, 8265, 3653, 2860, 2488, 370, 658, 894, 14428, 63, 7574, 14, 647, 2313, 272, 408, 272, 1613, 8, 20690, 2662, 1017, 4256, 12, 291, 2843, 826, 721, 489, 2763, 23370, 2687, 23922, 17203, 4706, 489, 10106, 2623, 4547, 29, 9041, 2623, 4547, 12, 489, 10361, 12109, 29, 12312, 12109, 12, 489, 2536, 2623, 24492, 29, 2747, 23554, 12, 489, 8539, 2623, 24492, 29, 7113, 23554, 12, 489, 1748, 12109, 29, 827, 12109, 12, 489, 1390, 4665, 17746, 19111, 2353, 29, 1222, 17746, 19111, 2353, 12, 489, 1126, 24492, 29485, 29, 529, 24492, 30612, 12, 489, 1126, 24492, 8584, 264, 434, 29, 529, 24492, 8584, 12, 489, 14746, 12520, 8584, 264, 434, 29, 21118, 12520, 8584, 264, 434, 12, 489, 1390, 23287, 2623, 8108, 29, 988, 23287, 2623, 8108, 12, 489, 1390, 17746, 25036, 2623, 12520, 29, 988, 17746, 25036, 2623, 12520, 12, 489, 6347, 29, 5176, 9, 339, 291, 14, 4904, 7472, 2223, 275, 2420, 84, 582, 488, 93, 8330, 768, 3744, 523, 347, 1586, 8, 1886, 12, 4104, 304, 272, 408, 272, 6551, 716, 83, 12540, 19849, 8628, 477, 12161, 1056, 315, 1865, 370, 8265, 272, 658, 277, 14, 4904, 7472, 2223, 64, 339, 768, 635, 4104, 334, 14451, 4836, 6437, 9, 2165, 475, 909, 339, 768, 1107, 334, 6530, 19849, 8628, 9, 12540, 19849, 8628, 25905, 1256, 272, 408, 272, 7352, 275, 1613, 8, 20690, 2662, 1017, 4256, 12, 843, 680, 739, 8, 2625, 9, 272, 7352, 14, 4904, 7472, 2223, 275, 2420, 84, 582, 488, 93, 272, 372, 7352, 8330, 347, 4526, 8, 277, 12, 9048, 1721, 3205, 12, 4756, 21424, 12, 4526, 17354, 2959, 29, 403, 304, 272, 408, 272, 334, 2532, 658, 894, 14428, 63, 7574, 14, 647, 10522, 272, 8690, 1373, 4526, 12, 12570, 9328, 14, 339, 768, 635, 9048, 1721, 3205, 258, 710, 9048, 13, 384, 1324, 12, 13609, 687, 282, 11469, 1115, 79, 1435, 272, 768, 635, 4756, 21424, 755, 982, 2549, 12, 5147, 9328, 272, 768, 635, 4526, 17354, 2959, 221, 982, 488, 12, 849, 5953, 365, 370, 3507, 314, 17353, 2490, 1072, 1380, 4756, 21424, 365, 641, 14, 2490, 982, 2549, 12, 4526, 314, 17353, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
Tranzystorek/servo
tests/wpt/css-tests/css-text-decor-3_dev/html/reference/support/generate-text-emphasis-line-height-tests.py
829
3431
#!/usr/bin/env python # - * - coding: UTF-8 - * - """ This script generates tests text-emphasis-line-height-001 ~ 004 except 001z. They test the line height expansion in different directions. This script outputs a list of all tests it generated in the format of Mozilla reftest.list to the stdout. """ from __future__ import unicode_literals TEST_FILE = 'text-emphasis-line-height-{:03}{}.html' TEST_TEMPLATE = '''<!DOCTYPE html> <meta charset="utf-8"> <title>CSS Test: text-emphasis line height, {pos}, {wm}, {tag}</title> <link rel="author" title="Xidorn Quan" href="https://www.upsuper.org"> <link rel="author" title="Mozilla" href="https://www.mozilla.org"> <link rel="help" href="https://drafts.csswg.org/css-text-decor-3/#text-emphasis-position-property"> <meta name="assert" content="text emphasis marks should expand the line height like ruby if necessary"> <link rel="match" href="text-emphasis-line-height-{index:03}-ref.html"> <p>Pass if the emphasis marks are {dir} the black line:</p> {start}試験テスト{end} ''' REF_FILE = 'text-emphasis-line-height-{:03}-ref.html' REF_TEMPLATE='''<!DOCTYPE html> <meta charset="utf-8"> <title>CSS Reference: text-emphasis line height, {pos}</title> <link rel="author" title="Xidorn Quan" href="https://www.upsuper.org"> <link rel="author" title="Mozilla" href="https://www.mozilla.org"> <style> rt {{ font-variant-east-asian: inherit; }} </style> <p>Pass if the emphasis marks are {dir} the black line:</p> <div style="line-height: 1; border-{pos}: 1px solid black; writing-mode: {wm}; ruby-position: {posval}"><ruby>試<rt>&#x25CF;</rt>験<rt>&#x25CF;</rt>テ<rt>&#x25CF;</rt>ス<rt>&#x25CF;</rt>ト<rt>&#x25CF;</rt></ruby></div> ''' STYLE1 = 'line-height: 1; border-{pos}: 1px solid black; ' + \ 'writing-mode: {wm}; text-emphasis-position: {posval};' STYLE2 = 'text-emphasis: circle;' TAGS = [ # (tag, start, end) ('div', '<div style="{style1}{style2}">', '</div>'), ('span', '<div style="{style1}"><span style="{style2}">', '</span></div>'), ] POSITIONS = [ # pos, text-emphasis-position, ruby-position, # writing-modes, dir text ('top', 'over right', 'over', ['horizontal-tb'], 'below'), ('bottom', 'under right', 'under', ['horizontal-tb'], 'over'), ('right', 'over right', 'over', ['vertical-rl', 'vertical-lr'], 'to the left of'), ('left', 'over left', 'under', ['vertical-rl', 'vertical-lr'], 'to the right of'), ] import string def write_file(filename, content): with open(filename, 'wb') as f: f.write(content.encode('UTF-8')) print("# START tests from {}".format(__file__)) idx = 0 for (pos, emphasis_pos, ruby_pos, wms, dir) in POSITIONS: idx += 1 ref_file = REF_FILE.format(idx) content = REF_TEMPLATE.format(pos=pos, dir=dir, wm=wms[0], posval=ruby_pos) write_file(ref_file, content) suffix = iter(string.ascii_lowercase) for wm in wms: style1 = STYLE1.format(pos=pos, wm=wm, posval=emphasis_pos) for (tag, start, end) in TAGS: test_file = TEST_FILE.format(idx, next(suffix)) content = TEST_TEMPLATE.format( pos=pos, wm=wm, tag=tag, index=idx, dir=dir, start=start.format(style1=style1, style2=STYLE2), end=end) write_file(test_file, content) print("== {} {}".format(test_file, ref_file)) print("# END tests from {}".format(__file__))
mpl-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 446, 627, 446, 2803, 26, 9094, 13, 24, 446, 627, 446, 199, 199, 624, 199, 2765, 2884, 12821, 2295, 1318, 13, 28907, 13, 604, 13, 3333, 13, 4587, 6146, 378, 966, 871, 199, 4587, 90, 14, 9322, 511, 314, 1004, 4569, 14819, 315, 3365, 28820, 14, 961, 199, 1579, 4704, 282, 769, 402, 1006, 2295, 652, 4046, 315, 314, 1475, 402, 17728, 199, 30155, 14, 513, 370, 314, 3839, 14, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 2864, 63, 3817, 275, 283, 505, 13, 28907, 13, 604, 13, 3333, 24185, 26, 1644, 93, 31270, 1360, 7, 199, 2864, 63, 7433, 275, 1449, 11230, 16556, 3517, 30, 199, 28, 2024, 5960, 628, 1624, 13, 24, 1743, 199, 28, 1213, 30, 14391, 1379, 26, 1318, 13, 28907, 1004, 4569, 12, 469, 1712, 1386, 469, 16240, 1386, 469, 1450, 17890, 1213, 30, 199, 28, 1073, 4668, 628, 2502, 2, 2538, 628, 56, 344, 6161, 5843, 290, 2, 4369, 628, 2859, 921, 1544, 14, 384, 4792, 14, 1308, 1743, 199, 28, 1073, 4668, 628, 2502, 2, 2538, 628, 22285, 2, 4369, 628, 2859, 921, 1544, 14, 12102, 14, 1308, 1743, 199, 28, 1073, 4668, 628, 3437, 2, 4369, 628, 2859, 921, 7185, 83, 14, 3919, 23596, 14, 1308, 15, 3919, 13, 505, 13, 6518, 13, 19, 12645, 505, 13, 28907, 13, 3124, 13, 1829, 1743, 199, 28, 2024, 536, 628, 479, 2, 1564, 628, 505, 9052, 24059, 17370, 1077, 6544, 314, 1004, 4569, 2839, 31855, 340, 5784, 1743, 199, 28, 1073, 4668, 628, 1431, 2, 4369, 628, 505, 13, 28907, 13, 604, 13, 3333, 24185, 1080, 26, 1644, 17063, 1121, 14, 1360, 1743, 199, 28, 80, 30, 4986, 340, 314, 9052, 24059, 17370, 787, 469, 694, 93, 314, 12136, 1004, 9919, 80, 30, 199, 91, 928, 93, 165, 103, 100, 166, 102, 242, 5692, 229, 25111, 23869, 91, 500, 93, 199, 2344, 199, 199, 8279, 63, 3817, 275, 283, 505, 13, 28907, 13, 604, 13, 3333, 24185, 26, 1644, 17063, 1121, 14, 1360, 7, 199, 8279, 63, 7433, 19938, 11230, 16556, 3517, 30, 199, 28, 2024, 5960, 628, 1624, 13, 24, 1743, 199, 28, 1213, 30, 14391, 10944, 26, 1318, 13, 28907, 1004, 4569, 12, 469, 1712, 17890, 1213, 30, 199, 28, 1073, 4668, 628, 2502, 2, 2538, 628, 56, 344, 6161, 5843, 290, 2, 4369, 628, 2859, 921, 1544, 14, 384, 4792, 14, 1308, 1743, 199, 28, 1073, 4668, 628, 2502, 2, 2538, 628, 22285, 2, 4369, 628, 2859, 921, 1544, 14, 12102, 14, 1308, 1743, 199, 28, 2487, 30, 14059, 8448, 5023, 13, 8759, 13, 14346, 13, 305, 5653, 26, 8287, 27, 3586, 3068, 2487, 30, 199, 28, 80, 30, 4986, 340, 314, 9052, 24059, 17370, 787, 469, 694, 93, 314, 12136, 1004, 9919, 80, 30, 199, 28, 3015, 3449, 628, 604, 13, 3333, 26, 413, 27, 9162, 24185, 1712, 9160, 413, 5326, 18609, 12136, 27, 3575, 13, 632, 26, 469, 16240, 12084, 31855, 13, 3124, 26, 469, 1712, 637, 93, 8186, 21952, 30, 165, 103, 100, 28, 2591, 30, 7997, 88, 821, 5487, 12279, 2591, 30, 166, 102, 242, 28, 2591, 30, 7997, 88, 821, 5487, 12279, 2591, 30, 5692, 229, 28, 2591, 30, 7997, 88, 821, 5487, 12279, 2591, 30, 25111, 28, 2591, 30, 7997, 88, 821, 5487, 12279, 2591, 30, 23869, 28, 2591, 30, 7997, 88, 821, 5487, 12279, 2591, 2957, 21952, 2957, 3015, 30, 199, 2344, 199, 199, 18466, 17, 275, 283, 604, 13, 3333, 26, 413, 27, 9162, 24185, 1712, 9160, 413, 5326, 18609, 12136, 27, 283, 435, 971, 268, 283, 14827, 13, 632, 26, 469, 16240, 12084, 1318, 13, 28907, 13, 3124, 26, 469, 1712, 637, 93, 8942, 199, 18466, 18, 275, 283, 505, 13, 28907, 26, 17990, 8942, 199, 199, 17626, 275, 359, 272, 327, 334, 1450, 12, 1343, 12, 1284, 9, 272, 661, 3015, 297, 2650, 3015, 3449, 18448, 2487, 17, 8847, 2487, 18, 93, 1743, 297, 11936, 3015, 25642, 272, 661, 3751, 297, 2650, 3015, 3449, 18448, 2487, 17, 93, 8186, 3751, 3449, 18448, 2487, 18, 93, 1743, 297, 11936, 3751, 2957, 3015, 25642, 272, 1622, 199, 27998, 2823, 275, 359, 272, 327, 2086, 12, 1318, 13, 28907, 13, 3124, 12, 31855, 13, 3124, 12, 272, 327, 257, 3575, 13, 10433, 12, 2935, 1318, 272, 661, 2119, 297, 283, 1883, 2451, 297, 283, 1883, 297, 267, 788, 11392, 13, 5842, 995, 283, 12843, 659, 272, 661, 8305, 297, 283, 7138, 2451, 297, 283, 7138, 297, 267, 788, 11392, 13, 5842, 995, 283, 1883, 659, 272, 661, 1019, 297, 283, 1883, 2451, 297, 283, 1883, 297, 267, 788, 7870, 13, 4308, 297, 283, 7870, 13, 7493, 995, 283, 475, 314, 3602, 402, 659, 272, 661, 3039, 297, 283, 1883, 3602, 297, 283, 7138, 297, 267, 788, 7870, 13, 4308, 297, 283, 7870, 13, 7493, 995, 283, 475, 314, 2451, 402, 659, 272, 1622, 199, 199, 646, 1059, 199, 199, 318, 2218, 63, 493, 8, 1501, 12, 1564, 304, 272, 543, 1551, 8, 1501, 12, 283, 6603, 358, 465, 289, 26, 267, 289, 14, 952, 8, 1317, 14, 2143, 360, 6610, 13, 24, 1333, 199, 199, 1361, 10064, 13910, 2295, 687, 8352, 908, 3460, 493, 8964, 199, 2996, 275, 378, 199, 509, 334, 1712, 12, 9052, 24059, 63, 1712, 12, 31855, 63, 1712, 12, 336, 706, 12, 2935, 9, 315, 510, 3100, 649, 2823, 26, 272, 4280, 847, 413, 272, 2984, 63, 493, 275, 5363, 38, 63, 3817, 14, 908, 8, 2996, 9, 272, 1564, 275, 5363, 38, 63, 7433, 14, 908, 8, 1712, 29, 1712, 12, 2935, 29, 694, 12, 29835, 29, 30297, 59, 16, 467, 2086, 637, 29, 21952, 63, 1712, 9, 272, 2218, 63, 493, 8, 1121, 63, 493, 12, 1564, 9, 272, 4739, 275, 2740, 8, 875, 14, 4371, 63, 21636, 9, 272, 367, 29835, 315, 336, 706, 26, 267, 3449, 17, 275, 428, 2099, 906, 17, 14, 908, 8, 1712, 29, 1712, 12, 29835, 29, 16240, 12, 2086, 637, 29, 28907, 63, 1712, 9, 267, 367, 334, 1450, 12, 1343, 12, 1284, 9, 315, 18395, 51, 26, 288, 511, 63, 493, 275, 7393, 63, 3817, 14, 908, 8 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 446, 627, 446, 2803, 26, 9094, 13, 24, 446, 627, 446, 199, 199, 624, 199, 2765, 2884, 12821, 2295, 1318, 13, 28907, 13, 604, 13, 3333, 13, 4587, 6146, 378, 966, 871, 199, 4587, 90, 14, 9322, 511, 314, 1004, 4569, 14819, 315, 3365, 28820, 14, 961, 199, 1579, 4704, 282, 769, 402, 1006, 2295, 652, 4046, 315, 314, 1475, 402, 17728, 199, 30155, 14, 513, 370, 314, 3839, 14, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 2864, 63, 3817, 275, 283, 505, 13, 28907, 13, 604, 13, 3333, 24185, 26, 1644, 93, 31270, 1360, 7, 199, 2864, 63, 7433, 275, 1449, 11230, 16556, 3517, 30, 199, 28, 2024, 5960, 628, 1624, 13, 24, 1743, 199, 28, 1213, 30, 14391, 1379, 26, 1318, 13, 28907, 1004, 4569, 12, 469, 1712, 1386, 469, 16240, 1386, 469, 1450, 17890, 1213, 30, 199, 28, 1073, 4668, 628, 2502, 2, 2538, 628, 56, 344, 6161, 5843, 290, 2, 4369, 628, 2859, 921, 1544, 14, 384, 4792, 14, 1308, 1743, 199, 28, 1073, 4668, 628, 2502, 2, 2538, 628, 22285, 2, 4369, 628, 2859, 921, 1544, 14, 12102, 14, 1308, 1743, 199, 28, 1073, 4668, 628, 3437, 2, 4369, 628, 2859, 921, 7185, 83, 14, 3919, 23596, 14, 1308, 15, 3919, 13, 505, 13, 6518, 13, 19, 12645, 505, 13, 28907, 13, 3124, 13, 1829, 1743, 199, 28, 2024, 536, 628, 479, 2, 1564, 628, 505, 9052, 24059, 17370, 1077, 6544, 314, 1004, 4569, 2839, 31855, 340, 5784, 1743, 199, 28, 1073, 4668, 628, 1431, 2, 4369, 628, 505, 13, 28907, 13, 604, 13, 3333, 24185, 1080, 26, 1644, 17063, 1121, 14, 1360, 1743, 199, 28, 80, 30, 4986, 340, 314, 9052, 24059, 17370, 787, 469, 694, 93, 314, 12136, 1004, 9919, 80, 30, 199, 91, 928, 93, 165, 103, 100, 166, 102, 242, 5692, 229, 25111, 23869, 91, 500, 93, 199, 2344, 199, 199, 8279, 63, 3817, 275, 283, 505, 13, 28907, 13, 604, 13, 3333, 24185, 26, 1644, 17063, 1121, 14, 1360, 7, 199, 8279, 63, 7433, 19938, 11230, 16556, 3517, 30, 199, 28, 2024, 5960, 628, 1624, 13, 24, 1743, 199, 28, 1213, 30, 14391, 10944, 26, 1318, 13, 28907, 1004, 4569, 12, 469, 1712, 17890, 1213, 30, 199, 28, 1073, 4668, 628, 2502, 2, 2538, 628, 56, 344, 6161, 5843, 290, 2, 4369, 628, 2859, 921, 1544, 14, 384, 4792, 14, 1308, 1743, 199, 28, 1073, 4668, 628, 2502, 2, 2538, 628, 22285, 2, 4369, 628, 2859, 921, 1544, 14, 12102, 14, 1308, 1743, 199, 28, 2487, 30, 14059, 8448, 5023, 13, 8759, 13, 14346, 13, 305, 5653, 26, 8287, 27, 3586, 3068, 2487, 30, 199, 28, 80, 30, 4986, 340, 314, 9052, 24059, 17370, 787, 469, 694, 93, 314, 12136, 1004, 9919, 80, 30, 199, 28, 3015, 3449, 628, 604, 13, 3333, 26, 413, 27, 9162, 24185, 1712, 9160, 413, 5326, 18609, 12136, 27, 3575, 13, 632, 26, 469, 16240, 12084, 31855, 13, 3124, 26, 469, 1712, 637, 93, 8186, 21952, 30, 165, 103, 100, 28, 2591, 30, 7997, 88, 821, 5487, 12279, 2591, 30, 166, 102, 242, 28, 2591, 30, 7997, 88, 821, 5487, 12279, 2591, 30, 5692, 229, 28, 2591, 30, 7997, 88, 821, 5487, 12279, 2591, 30, 25111, 28, 2591, 30, 7997, 88, 821, 5487, 12279, 2591, 30, 23869, 28, 2591, 30, 7997, 88, 821, 5487, 12279, 2591, 2957, 21952, 2957, 3015, 30, 199, 2344, 199, 199, 18466, 17, 275, 283, 604, 13, 3333, 26, 413, 27, 9162, 24185, 1712, 9160, 413, 5326, 18609, 12136, 27, 283, 435, 971, 268, 283, 14827, 13, 632, 26, 469, 16240, 12084, 1318, 13, 28907, 13, 3124, 26, 469, 1712, 637, 93, 8942, 199, 18466, 18, 275, 283, 505, 13, 28907, 26, 17990, 8942, 199, 199, 17626, 275, 359, 272, 327, 334, 1450, 12, 1343, 12, 1284, 9, 272, 661, 3015, 297, 2650, 3015, 3449, 18448, 2487, 17, 8847, 2487, 18, 93, 1743, 297, 11936, 3015, 25642, 272, 661, 3751, 297, 2650, 3015, 3449, 18448, 2487, 17, 93, 8186, 3751, 3449, 18448, 2487, 18, 93, 1743, 297, 11936, 3751, 2957, 3015, 25642, 272, 1622, 199, 27998, 2823, 275, 359, 272, 327, 2086, 12, 1318, 13, 28907, 13, 3124, 12, 31855, 13, 3124, 12, 272, 327, 257, 3575, 13, 10433, 12, 2935, 1318, 272, 661, 2119, 297, 283, 1883, 2451, 297, 283, 1883, 297, 267, 788, 11392, 13, 5842, 995, 283, 12843, 659, 272, 661, 8305, 297, 283, 7138, 2451, 297, 283, 7138, 297, 267, 788, 11392, 13, 5842, 995, 283, 1883, 659, 272, 661, 1019, 297, 283, 1883, 2451, 297, 283, 1883, 297, 267, 788, 7870, 13, 4308, 297, 283, 7870, 13, 7493, 995, 283, 475, 314, 3602, 402, 659, 272, 661, 3039, 297, 283, 1883, 3602, 297, 283, 7138, 297, 267, 788, 7870, 13, 4308, 297, 283, 7870, 13, 7493, 995, 283, 475, 314, 2451, 402, 659, 272, 1622, 199, 199, 646, 1059, 199, 199, 318, 2218, 63, 493, 8, 1501, 12, 1564, 304, 272, 543, 1551, 8, 1501, 12, 283, 6603, 358, 465, 289, 26, 267, 289, 14, 952, 8, 1317, 14, 2143, 360, 6610, 13, 24, 1333, 199, 199, 1361, 10064, 13910, 2295, 687, 8352, 908, 3460, 493, 8964, 199, 2996, 275, 378, 199, 509, 334, 1712, 12, 9052, 24059, 63, 1712, 12, 31855, 63, 1712, 12, 336, 706, 12, 2935, 9, 315, 510, 3100, 649, 2823, 26, 272, 4280, 847, 413, 272, 2984, 63, 493, 275, 5363, 38, 63, 3817, 14, 908, 8, 2996, 9, 272, 1564, 275, 5363, 38, 63, 7433, 14, 908, 8, 1712, 29, 1712, 12, 2935, 29, 694, 12, 29835, 29, 30297, 59, 16, 467, 2086, 637, 29, 21952, 63, 1712, 9, 272, 2218, 63, 493, 8, 1121, 63, 493, 12, 1564, 9, 272, 4739, 275, 2740, 8, 875, 14, 4371, 63, 21636, 9, 272, 367, 29835, 315, 336, 706, 26, 267, 3449, 17, 275, 428, 2099, 906, 17, 14, 908, 8, 1712, 29, 1712, 12, 29835, 29, 16240, 12, 2086, 637, 29, 28907, 63, 1712, 9, 267, 367, 334, 1450, 12, 1343, 12, 1284, 9, 315, 18395, 51, 26, 288, 511, 63, 493, 275, 7393, 63, 3817, 14, 908, 8, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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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 ]
ales-erjavec/orange-bio
orangecontrib/bio/chem.py
3
50948
"""A library for searching frequent molecular fragments (substructures) based on the Mining Molecular Fragments: Finding Relevant Substructures of Molecules Christian Borgelt and Michael R. Berthold. Classes (see their corresponding __doc__ strings for further detail): Fragment : Representation of the fragment FragmentMiner : The main class that does the search Fragmenter : A class that is used to fragment an ExampleTable FragmentBasedLearner : A learner wrapper class that first runs the molecular fragmentation on the data """ try: from openbabel import OBMol, OBAtom, OBBond, OBSmartsPattern, OBConversion, OBMolAtomIter, OBMolBondIter, OBAtomBondIter except ImportError: pass ##from pybel import * from copy import deepcopy import Orange import orange import sys, os debug=False class Atom(object): def __init__(self, molecule, atomicNum=6, aromaticFlag=False, atomIndex=0): self.molecule=molecule self.atomicNum=atomicNum self.aromaticFlag=aromaticFlag self.atomIndex=atomIndex self.extendedIndex=0 self.lastExtendedBondOrder=1 self.lastExtendedAtomicNum=1 self.molecule.AddAtom(self) def GetAtomicNum(self): return self.atomicNum def IsAromatic(self): return self.aromaticFlag def Match(self, atom): #Match this atom to an OBAtom if self.atomicNum==atom.GetAtomicNum() and self.IsAromatic()==atom.IsAromatic(): return True else: return False def GetIdx(self): return self.atomIndex class Bond(object): def __init__(self, molecule, atom1=None, atom2=None, bondOrder=1): self.molecule=molecule self.atom1=atom1 self.atom2=atom2 self.bondOrder=bondOrder self.molecule.AddBond(self) def GetBondOrder(self): return self.bondOrder def GetNbrAtom(self, atom): if atom==self.atom1: return self.atom2 elif atom==self. atom2: return self.atom1 else: raise Exception("Atom does not belong to this bond") def Match(self, bond): #Match this bond to an OBBond if self.GetbondOrder()==bond.GetBondOrder(): return True else: return False class Ring(object): def __init__(self, molecule, obRing, embeding): self.molecule=molecule molecule.AddRing(self) self.ringAtoms=[] self.isAromatic=obRing.IsAromatic() reverseEmbedingDict=embeding.GetReverseDict() newAtoms={} self.extendedIndex=oldNextExtendedIndex=molecule.nextExtendedIndex for ind1, ind2 in GetRingPairs(obRing._path): atom1=embeding.GetReverseEmbededAtom(ind1, None) or newAtoms.get(ind1, None) if not atom1: atom1=Atom(molecule, embeding.molecule.GetAtom(ind1).GetAtomicNum(), obRing.IsAromatic()) newAtoms[ind1]=atom1 embeding[atom1.atomIndex]=ind1 atom2=embeding.GetReverseEmbededAtom(ind2, None) or newAtoms.get(ind2, None) if not atom2: atom2=Atom(molecule, embeding.molecule.GetAtom(ind2).GetAtomicNum(), obRing.IsAromatic()) newAtoms[ind2]=atom2 embeding[atom2.atomIndex]=ind2 Bond(molecule, atom1, atom2, embeding.molecule.GetBond(ind1, ind2).GetBondOrder()) self.ringAtoms.append(atom1) for atom in newAtoms.values(): atom.extendedIndex=oldNextExtendedIndex self.extendedIndex=oldNextExtendedIndex molecule.nextExtendedIndex=oldNextExtendedIndex+1 def Size(self): return len(self.ringAtoms) def __getattr__(self, name): if name == "_path": return [a.GetIdx() for a in self.ringAtoms] raise AttributeError class Molecule(object): def __init__(self): self.atoms=[] self.bonds=[] self.rings=[] self.nextExtendedIndex=0 def __deepcopy__(self, memo): mol=Molecule() memo[id(self)]=mol mol.__in_place_deepcopy__(self, memo) return mol def __in_place_deepcopy__(self, mol, memo): if debug: print "Copying molecule" self.atoms=deepcopy(mol.atoms, memo) #memo[mol.atoms]=self.atoms self.bonds=deepcopy(mol.bonds, memo) #memo[mol.bonds]=self.bonds self.rings=deepcopy(mol.rings, memo) self.nextExtendedIndex=mol.nextExtendedIndex #memo[mol.rings]=self.rings""" def AddAtom(self, atom): if atom in self.atoms: raise Exception("Atom already present") self.atoms.append(atom) atom.atomIndex=len(self.atoms)-1 atom.extendedIndex=self.nextExtendedIndex self.nextExtendedIndex+=1 def AddBond(self, bond): if bond in self.bonds: raise Exception("Bond already present") self.bonds.append(bond) bond.bondIndex=len(self.bonds)-1 def AddRing(self, ring): if ring in self.rings: raise Exception("Ring already present") self.rings.append(ring) ring.ringIndex=len(self.rings)-1 def GetBond(self, atom1, atom2): for bond in self.bonds: if bond.atom1==atom1 and bond.atom2==atom2: return bond if bond.atom1==atom2 and bond.atom2==atom1: return bond return None def GetAtom(self, index): return self.atoms[index] def cmpAtoms(atom1, atom2): return atom1.GetAtomicNum()==atom2.GetAtomicNum() and atom1.IsAromatic()==atom2.IsAromatic() def cmpAtomBonds(bond1, bond2): return bond1.IsAromatic() and bond2.IsAromatic() or bond1.GetBondOrder()==bond2.GetBondOrder() class Embeding(dict): def __init__(self, embeding={}, molecule=None, fragment=None): dict.__init__(self, embeding) self.molecule=molecule self.fragment=fragment if embeding.__class__==Embeding: if not self.molecule: self.molecule=embeding.molecule if not self.fragment: self.fragment=embeding.fragment def __deepcopy__(self, memo): if id(self.fragment) in memo: return Embeding(self, fragment=memo[id(self.fragment)]) else: return Embeding(self) def GetEmbededAtom(self, atomInd): return self.molecule.GetAtom(self.__getitem__(atomInd)) def GetReverseEmbededAtom(self, atomInd, default=None): rev=self.GetReverseDict() if atomInd in rev: return self.fragment.atoms[rev[atomInd]] else: return default def GetReverseDict(self): return dict([(value, key) for key, value in self.items()]) def GetRingPairs(list): return reduce(lambda a,b:a+[(a[-1][1],b)], list[1:], [(list[-1],list[0])]) class FragmentExtension(object): def __init__(self, startAtomInd, embedings): self.startAtomInd=startAtomInd self.embedings=embedings def IsEquivalent(self, extension): pass def MergeFrom(self, extension): pass def Extend(self, fragment): pass class FragmentExtensionByAtom(FragmentExtension): def __init__(self, atomicNum, aromatic, atomIndices, embedings): self.atomicNum=atomicNum self.aromatic=aromatic self.atomIndices=atomIndices self.embedings=embedings def IsEquivalent(self, extension): return self.atomicNum==extension.atomicNum and self.aromatic==extension.aromatic def MergeFrom(self, extension): self.embedings.extend(extension.embedings) self.atomIndices.extend(extension.atomIndices) def Extend(self, fragment): atom=Atom(fragment, self.atomicNum, self.aromatic) embedings=[Embeding(e, fragment=fragment)for e in self.embedings] for embeding, atomInd in zip(embedings, self.atomIndices): embeding[atom.atomIndex]=atomInd fragment.embedings=embedings class FragmentExtensionByBondAtom(FragmentExtension): def __init__(self, startAtomInd, bondOrder, endAtoms, embedings): FragmentExtension.__init__(self, startAtomInd, embedings) self.bondOrder=bondOrder self.endAtoms=endAtoms def IsEquivalent(self, extension): return self.startAtomInd==extension.startAtomInd and self.bondOrder==extension.bondOrder and cmpAtoms(self.endAtoms[0], extension.endAtoms[0]) def MergeFrom(self, extension): self.endAtoms.extend(extension.endAtoms) self.embedings.extend(extension.embedings) def Extend(self, fragment): if debug: print "Extending by bond and atom" sAtom=fragment.atoms[self.startAtomInd] atom=Atom(fragment, self.endAtoms[0].GetAtomicNum(),self.endAtoms[0].IsAromatic()) #atom.SetAtomicNum(self.endAtoms[0].GetAtomicNum()) Bond(fragment, sAtom, atom, self.bondOrder) sAtom.lastExtendedBondOrder=self.bondOrder sAtom.lastExtendedAtomicNum=atom.GetAtomicNum() fragment.lastExtendedAtomIndex=sAtom.extendedIndex embedings=[Embeding(e, fragment=fragment)for e in self.embedings] for embeding, endAtom in zip(embedings, self.endAtoms): embeding[atom.atomIndex]=endAtom.GetIdx() fragment.embedings=embedings class FragmentExtensionByBond(FragmentExtension): def __init__(self, startAtomInd, bondOrder, endAtomInd, embedings): FragmentExtension.__init__(self, startAtomInd, embedings) self.bondOrder=bondOrder self.endAtomInd=endAtomInd def IsEquivalent(self, extension): return self.startAtomInd==extension.startAtomInd and self.bondOrder==extension.bondOrder and self.endAtomInd==extension.endAtomInd def MergeFrom(self, extension): self.embedings.extend(extension.embedings) def Extend(self, fragment): if debug: print "Extending by bond" sAtom=fragment.atoms[self.startAtomInd] eAtom=fragment.atoms[self.endAtomInd] Bond(fragment, sAtom, eAtom, self.bondOrder) sAtom.lastExtendedBondOrder=self.bondOrder sAtom.lastExtendedAtomicNum=eAtom.GetAtomicNum() fragment.lastExtendedAtomIndex=sAtom.extendedIndex fragment.embedings=[Embeding(e, fragment=fragment) for e in self.embedings] class FragmentExtensionByBondRing(FragmentExtension): def __init__(self, startAtomInd, bondOrder, endAtoms, rings, embedings): FragmentExtension.__init__(self, startAtomInd, embedings) self.bondOrder=bondOrder self.endAtoms=endAtoms self.rings=rings def GetRingMapping(self, endAtom1, ring1, embeding1, endAtom2, ring2, embeding2): rDict1=embeding1.GetReverseDict() rDict2=embeding2.GetReverseDict() ringMappings=[] i=list(ring1._path).index(endAtom1.GetIdx()) c0=list(ring1._path)[i:]+list(ring1._path)[:i] i=list(ring2._path).index(endAtom2.GetIdx()) c1=list(ring2._path)[i:]+list(ring2._path)[:i] l=list(c1[1:]) #l=list(c1[:-1]) l.reverse() c2=[c1[0]]+l #c2=[c1[-1]]+l for c in [c1,c2]: mapping=[] for (ra11, ra12), (ra21, ra22) in zip(GetRingPairs(map(lambda i:ring1.GetParent().GetAtom(i), c0)),GetRingPairs(map(lambda i:ring2.GetParent().GetAtom(i), c))): if cmpAtoms(ra12, ra22) and cmpAtomBonds(ring1.GetParent().GetBond(ra11, ra12), ring2.GetParent().GetBond(ra21, ra22)): mapping.append((ra12.GetIdx(), ra22.GetIdx())) else: break else: ringMappings.append(dict(mapping)) return ringMappings def IsEquivalent(self, extension): if self.startAtomInd==extension.startAtomInd and self.bondOrder==extension.bondOrder and len(self.rings[0]._path)==len(extension.rings[0]._path) \ and self.rings[0].fingerprint==extension.rings[0].fingerprint: return bool(self.GetRingMapping(self.endAtoms[0], self.rings[0], self.embedings[0], extension.endAtoms[0], extension.rings[0], extension.embedings[0])) return False def MergeFrom(self, extension): self.endAtoms.extend(extension.endAtoms) self.embedings.extend(extension.embedings) self.rings.extend(extension.rings) def Extend(self, fragment): if debug: print "Extending by ring and bond" sAtom=fragment.atoms[self.startAtomInd] endAtom1=self.endAtoms[0] ring1=self.rings[0] #One ring to rule them all embeding1=Embeding(self.embedings[0], fragment=fragment) #Add all the atoms and bonds in the ring newRing=Ring(fragment, ring1, embeding1) #Changes embeding Bond(fragment, fragment.atoms[self.startAtomInd], fragment.atoms[embeding1.GetReverseDict()[endAtom1.GetIdx()]], self.bondOrder) sAtom.lastExtendedAtomicNum=endAtom1.GetAtomicNum() sAtom.lastExtendedBondOrder=self.bondOrder fragment.lastExtendedAtomIndex=sAtom.extendedIndex #Update embedings #embeding1=self.embedings[0] fragment.embedings=[] for endAtom, ring, embeding in zip(self.endAtoms, self.rings, self.embedings): #embeding[sAtom.atomIndex]=endAtom.GetIdx() mappings=self.GetRingMapping(endAtom1, ring1, embeding1, endAtom, ring, embeding) for map in mappings: embeding=Embeding(embeding, fragment=fragment) for atom in newRing.ringAtoms: embeding[atom.atomIndex]=map[embeding1[atom.atomIndex]] embeding[newRing]=ring fragment.embedings.append(embeding) class FragmentExtensionByRing(FragmentExtension): def __init__(self, rings, embedings): FragmentExtension.__init__(self, 0, embedings) self.rings=rings def GetRingMapping(self, ring1, embeding1, ring2, embeding2): rDict1=embeding1.GetReverseDict() rDict2=embeding2.GetReverseDict() ringMappings=[] for i in range(ring2.Size()): c1=list(ring2._path)[i:]+list(ring2._path)[:i] l=list(c1[1:]) l.reverse() c2=[c1[0]]+l for c in [c1,c2]: mapping=[] for (ra11, ra12), (ra21, ra22) in zip(GetRingPairs(map(lambda i:ring1.GetParent().GetAtom(i), ring1._path)),GetRingPairs(map(lambda i:ring2.GetParent().GetAtom(i), c))): if cmpAtoms(ra12, ra22) and cmpAtomBonds(ring1.GetParent().GetBond(ra11, ra12), ring2.GetParent().GetBond(ra21, ra22)) and rDict1.get(ra12.GetIdx(), None)==rDict2.get(ra22.GetIdx(), None): mapping.append((ra12.GetIdx(), ra22.GetIdx())) else: break else: ringMappings.append(dict(mapping)) return ringMappings def IsEquivalent(self, extension): if len(self.rings[0]._path)==len(extension.rings[0]._path) and self.rings[0].fingerprint==extension.rings[0].fingerprint: return bool(self.GetRingMapping(self.rings[0], self.embedings[0], extension.rings[0], extension.embedings[0])) return False def MergeFrom(self, extension): self.rings.extend(extension.rings) self.embedings.extend(extension.embedings) def Extend(self, fragment): if debug: print "Extending by ring" ring1=self.rings[0] tmpEmbeding=Embeding(self.embedings[0],fragment=fragment) newRing=Ring(fragment, ring1, tmpEmbeding) #Changes embeding embeding1=self.embedings[0] ## fragment.lastExtendedAtomIndex=sAtom.extendedIndex fragment.embedings=[] for ring, embeding in zip(self.rings, self.embedings): mappings=self.GetRingMapping(ring1, embeding1, ring, embeding) for map in mappings: embeding=Embeding(embeding, fragment=fragment) for atom in newRing.ringAtoms: embeding[atom.atomIndex]=map[tmpEmbeding[atom.atomIndex]] embeding[newRing]=ring fragment.embedings.append(embeding) class Fragment(Molecule): """A class representing a molecular fragment Methods: ToOBMol() : Returns an openbabel.OBMol object representation ToSmiles() : Returns a SMILES code representation ToCanonicalSmiles() : Returns a canonical SMILES code representation Support() : Returns the support of the fragment in the active set OcurrencesIn(smiles): Returns the number of times a fragment is containd in the molecule represented by the smiles code argument ContainedIn(smiles) : Returns True if the fragment is present in the molecule represented by the smiles code argument """ def __init__(self, miner=None, excludeAtomList=[]): Molecule.__init__(self) self.embedings=[] self.miner=miner self.excludeAtomList=excludeAtomList self.lastExtendedAtomicNum=0 self.lastExtendedAtomIndex=0 self.writer=OBConversion() self.writer.SetInAndOutFormats("smi","smi") def __deepcopy__(self, memo): f=Fragment() memo[id(self)]=f Molecule.__in_place_deepcopy__(f, self, memo) f.embedings=[Embeding(e,fragment=f) for e in self.embedings] f.miner=self.miner f.excludeAtomList=self.excludeAtomList f.lastExtendedAtomIndex=self.lastExtendedAtomIndex return f def InitializeFragment(self, atomicNum): mol=OBMol() atom=Atom(self, atomicNum) for mol in self.miner.GetAllMolecules(): for a in OBMolAtomIter(mol): if atom.Match(a): self.embedings.append(Embeding({atom.atomIndex : a.GetIdx()}, molecule=mol, fragment=self)) def IsAtomExcluded(self, atom): return atom.GetAtomicNum() in self.excludeAtomList def GetCandidateAtoms(self): return filter(lambda a:a.extendedIndex>=self.lastExtendedAtomIndex, self.atoms) def GetCandidateRings(self): return filter(lambda r:r.extendedIndex>=self.lastExtendedAtomIndex, self.rings) def FilterRings(self, candidateRings, embeding): for ring1 in candidateRings: for ring2 in filter(lambda r:type(r)==type(ring1), embeding.values()): if ring1.this==ring2.this: break else: yield ring1 def GetCandidatesFromAtom(self, atomInd, embeding): candidates=[] reverseEmbedingDict=embeding.GetReverseDict() atom=embeding.GetEmbededAtom(atomInd) if atom.GetParent().NumHvyAtoms()==1: return candidates for bond in OBAtomBondIter(atom): #crashes if the atom is alone in a molecule nbrAtom=bond.GetNbrAtom(atom) if self.IsAtomExcluded(nbrAtom): continue if bond.GetBondOrder()>self.atoms[atomInd].lastExtendedBondOrder or (bond.GetBondOrder()==self.atoms[atomInd].lastExtendedBondOrder and nbrAtom.GetAtomicNum()>=self.atoms[atomInd].lastExtendedAtomicNum): if self.miner.addWholeRings: #Whole rings are added at the same time (no new bond can connect to an atom already in the embeding) if nbrAtom.IsInRing(): if not bond.IsInRing(): #ring to ring extensions are handled in GetRingCandidatesFromRing for ring in self.FilterRings(self.miner.rings[embeding.molecule], embeding): if ring.IsMember(nbrAtom): candidates.append(FragmentExtensionByBondRing(atomInd, bond.GetBondOrder(), [nbrAtom], [ring], [embeding])) ## elif len(self.atoms)==1: # ## for ring in self.FilterRings(self.miner.rings[embeding.molecule], embeding): ## if ring.IsMember(nbrAtom) and ring.IsMember(atom) and ring not in addedRings: ## candidates.append(FragmentExtensionByRing([ring], [embeding])) ## addedRings.append(ring) elif nbrAtom.GetIdx() not in reverseEmbedingDict: candidates.append(FragmentExtensionByBondAtom(atomInd, bond.GetBondOrder(), [nbrAtom], [embeding])) else: if nbrAtom.GetIdx() in reverseEmbedingDict: if not self.GetBond(self.GetAtom(atomInd), self.GetAtom(reverseEmbedingDict[nbrAtom.GetIdx()])) : candidates.append(FragmentExtensionByBond(atomInd, bond.GetBondOrder(), reverseEmbedingDict[nbrAtom.GetIdx()], [embeding])) else: candidates.append(FragmentExtensionByBondAtom(atomInd, bond.GetBondOrder(), [nbrAtom], [embeding])) #candidates.sort(lambda a,b:cmp(a[0],b[0]) or cmp(a[1].GetAtomicNum(),b[1].GetAtomicNum())) return candidates def GetRingCandidatesFromRing(self, ring, embeding): candidates=[] reverseEmbedingDict=embeding.GetReverseDict() for candidateRing in self.FilterRings(self.miner.rings[embeding.molecule], embeding): for atom in ring.ringAtoms: if candidateRing.IsMember(embeding.GetEmbededAtom(atom.atomIndex)): candidates.append(FragmentExtensionByRing([candidateRing], [embeding])) break return candidates def GetCandidatesFromEmbeding(self, embeding): candidates=[] if len(self.atoms)==1 and self.miner.addWholeRings: atom=embeding.GetEmbededAtom(self.atoms[0].GetIdx()) if atom.IsInRing(): for ring in embeding.molecule.rings: if ring.IsMember(atom): candidates.append(FragmentExtensionByRing([ring],[embeding])) return candidates if debug: print "Parsing candidate bonds" for atom in self.GetCandidateAtoms(): candidates.extend(self.GetCandidatesFromAtom(atom.atomIndex, embeding)) if debug: print "Parsing candidate rings" for ring in self.GetCandidateRings(): candidates.extend(self.GetRingCandidatesFromRing(ring, embeding)) return candidates def Extend(self): if debug :print "Extending" candidates=[] for embeding in self.embedings: c=self.GetCandidatesFromEmbeding(embeding) candidates.extend(c) #embedingDict[embeding]=c #group equivalent candidates if debug: print "Grouping candidates" groups=[] for extension in candidates: for ext in groups: if ext.__class__==extension.__class__ and ext.IsEquivalent(extension): ext.MergeFrom(extension) break else: groups.append(extension) #generate new fragments if debug: print "Generating new fragments" newFragments=[] for extension in groups: #set_trace() f=deepcopy(self) extension.Extend(f) newFragments.append(f) return newFragments def ToOBMol(self): atomCache={} mol=OBMol() mol.BeginModify() for sourceAtom in self.atoms: atom=mol.NewAtom() atom.SetAtomicNum(sourceAtom.GetAtomicNum()) if sourceAtom.IsAromatic(): atom.SetAromatic() ## atom.SetSpinMultiplicity(2) atomCache[sourceAtom]=atom for sourceBond in self.bonds: mol.AddBond(atomCache[sourceBond.atom1].GetIdx(), atomCache[sourceBond.atom2].GetIdx(), sourceBond.GetBondOrder()) ## mol.SetAromaticPerceived() mol.AssignSpinMultiplicity() ## mol.UnsetAromaticPerceived() mol.EndModify() return mol def ToSmiles(self): writer=OBConversion() writer.SetInAndOutFormats("smi", "smi") return writer.WriteString(self.ToOBMol()).strip() def ToCannonicalSmiles(self): atomCache={} mol=OBMol() for sourceAtom in self.atoms: atom=mol.NewAtom() atom.SetAtomicNum(sourceAtom.GetAtomicNum()) if sourceAtom.IsAromatic(): atom.SetAromatic() atom.SetSpinMultiplicity(2) atomCache[sourceAtom]=atom for sourceBond in self.bonds: mol.AddBond(atomCache[sourceBond.atom1].GetIdx(), atomCache[sourceBond.atom2].GetIdx(), sourceBond.GetBondOrder()) writer=OBConversion() writer.SetInAndOutFormats("smi", "can") return writer.WriteString(mol).strip() def Support(self, activeSet=None): activeSet=self.miner.activeSet if activeSet==None else activeSet uniqueMolecules=set() for embeding in self.embedings: if embeding.molecule in activeSet: uniqueMolecules.add(embeding.molecule) ## s=set(filter(lambda mol:self.ContainedIn(mol), self.miner.GetAllMolecules())) ## if len(s) != len(uniqueMolecules): ## writer=OBConversion() ## writer.SetInAndOutFormats("smi", "smi") ## print "\n",self.ToSmiles() ## for m in uniqueMolecules: print writer.WriteString(m).strip() ## for m in s: print writer.WriteString(m).strip() return float(len(uniqueMolecules))/float(len(activeSet) or 1) def OcurrencesIn(self, molecule): pattern=OBSmartsPattern() pattern.Init(self.ToSmiles()) return pattern.Match(molecule) def ContainedIn(self, molecule): return bool(self.OcurrencesIn(molecule)) class FragmentMiner(object): """A class for finding frequent molecular fragments Attributes: active : list of smiles codes of active molecules inactive : list of smiles codes of inactive molecules minSupport : minimum frequency in the active set of the fragments to search for maxSupport : maximum frequency in the inactive set of the fragments to search for addWholeRings : if True rings will be added as a whole rather then atom by atom canonicalPruning : if True a cache of all cannonical codes of all fragments will be kept to avoid redundant search findClosed : finds only fragments that are not sub-structures of any other fragment with the same support (default: True) Example: >>> miner = FragmentMiner(active = ["CC(C=N)=O", "c1ccccc1C=O", "SCC(N)O"], inactive = [], minSupport = 0.6) >>> for fragment in miner.Search(): ... print fragment.ToSmiles() , "Support: %.3f" %fragment.Support() """ def __init__(self, active, inactive=[], minSupport=0.2, maxSupport=0.2, addWholeRings=True, canonicalPruning=True, findClosed=True): self.active=filter(lambda m:m, map(self.LoadMolecules, active)) self.inactive=filter(lambda m:m, map(self.LoadMolecules, inactive)) self.minSupport=minSupport self.maxSupport=maxSupport self.rings={} self.atomCount={} self.findClosed=findClosed self.addWholeRings=addWholeRings self.canonicalPruning=canonicalPruning self.canonicalPruningSet={} self.loader=OBConversion() self.loader.SetInAndOutFormats("smi","smi") def LoadMolecules(self, smiles): mol=LoadMolFromSmiles(smiles) ## if mol: ## mol.StripSalts() return mol def GetAllMolecules(self): return self.active+self.inactive def Initialize(self): """Initializes the search""" self.initialFragments=[] self.rings={} self.atomCount={} self.canonicalPruningSet={} candidates=[] ringCandidates=[] for mol in self.GetAllMolecules(): mol.rings=self.rings[mol]=list(mol.GetSSSR()) for ring in mol.rings: ring.fingerprint=set([mol.GetAtom(i).GetAtomicNum() for i in ring._path]) ## for ring in mol.rings: ## candidates.append(FragmentExtensionByRing([ring],[Embeding(molecule=mol)])) for mol in self.GetAllMolecules(): for atom in OBMolAtomIter(mol): self.atomCount[atom.GetAtomicNum()]= self.atomCount[atom.GetAtomicNum()]+1 if atom.GetAtomicNum() in self.atomCount else 1 if not (atom.GetAtomicNum()==6 and atom.IsInRing()): candidates.append(FragmentExtensionByAtom(atom.GetAtomicNum(), atom.IsAromatic(), [atom.GetIdx()], [Embeding(molecule=mol)])) groups=[] candidates.sort(lambda a,b: cmp(self.atomCount[a.atomicNum], self.atomCount[b.atomicNum])) for extension in candidates: for ext in groups: if type(ext)==type(extension) and ext.IsEquivalent(extension): ext.MergeFrom(extension) break else: groups.append(extension) lst=self.atomCount.items() lst.sort(lambda a,b:cmp(a[1], b[1])) self.initialFragments=[] lst=[t[0] for t in lst] for extension in groups: if type(extension)==FragmentExtensionByAtom: f=Fragment(miner=self, excludeAtomList=lst[:lst.index(extension.atomicNum)]) else: f=Fragment(miner=self) extension.Extend(f) self.initialFragments.append(f) ## self.initialFragments.reverse() ## excludeList=[] ## for atom, c in lst: ## f=Fragment(miner=self, excludeAtomList=excludeList) ## f.InitializeFragment(atom) ## self.initialFragments.append(f) ## excludeList.append(atom) self.activeSet=set(self.active) self.inactiveSet=set(self.inactive) def TraverseTree(self, fragment): if self.canonicalPruning: codeWord=fragment.ToCannonicalSmiles() if codeWord in self.canonicalPruningSet: return self.canonicalPruningSet[codeWord] else: self.canonicalPruningSet[codeWord]=fragment.Support(self.activeSet) extended=fragment.Extend() extended=filter(lambda f:f.Support(self.activeSet)>=self.minSupport, extended) superStructSupport=[] for frag in extended: #print self.loader.WriteString(frag.ToOBMol()) superStructSupport.append(self.TraverseTree(frag)) support=fragment.Support(self.activeSet) if support>=self.minSupport and fragment.Support(self.inactiveSet)<=self.maxSupport: if not self.findClosed or (support not in superStructSupport): print fragment.ToSmiles().strip()+" %.2f %.2f" % (support, fragment.Support(self.inactiveSet)) self.foundFragments.append(fragment) return support def Search(self): """Runs the search and returns the found fragments""" self.Initialize() ## set_trace() self.foundFragments=[] for fragment in self.initialFragments: self.TraverseTree(fragment) #self.foundFragments=filter(lambda f:f.Support(self.inactive)<=self.maxSupport, self.foundFragments) return self.foundFragments def TraverseTreeIterator(self, fragment): if self.canonicalPruning: codeWord=fragment.ToCannonicalSmiles() if codeWord in self.canonicalPruningSet: raise StopIteration else: self.canonicalPruningSet[codeWord]=fragment.Support(self.activeSet) extended=fragment.Extend() extended=filter(lambda f:f.Support(self.activeSet)>=self.minSupport, extended) superStructSupport=[] for frag in extended: #print self.loader.WriteString(frag.ToOBMol()) iter=self.TraverseTreeIterator(frag) try: while True: f=iter.next() superStructSupport.append(f.Support(self.active)) yield f except StopIteration: pass superStructSupport.append(self.TraverseTree(frag)) support=fragment.Support(self.activeSet) if support>=self.minSupport and fragment.Support(self.inactiveSet)<=self.maxSupport: if not self.findClosed or (support not in superStructSupport): #print fragment.ToSmiles().strip()+" %.2f %.2f" % (support, fragment.Support(self.inactiveSet)) #self.foundFragments.append(fragment) yield fragment #return support def SearchIterator(self): """Runs the search and returns the found fragments one by one""" self.Initialize() ## set_trace() self.foundFragments=[] for fragment in self.initialFragments: iter=self.TraverseTreeIterator(fragment) try: while True: yield iter.next() except StopIteration: pass #self.foundFragments=filter(lambda f:f.Support(self.inactive)<=self.maxSupport, self.foundFragments) #return self.foundFragments def LoadMolFromSmiles(smiles): """Returns an OBMol construcetd from an SMILES code""" smiles = sorted(smiles.split("."), key=len)[-1] ## Strip salts mol=OBMol() loader=OBConversion() loader.SetInAndOutFormats("smi","smi") if not loader.ReadString(mol, smiles): return None mol.smilesCode=smiles return mol class Fragmenter(object): """An object that is used to fragment an ExampleTable Attributes: minSupport : minimum frequency in the active set of the fragments to search for (default: 0.2) maxSupport : maximum frequency in the inactive set of the fragments to search for (default: 0.2) findClosed : finds only fragments that are not sub-structures of any other fragment with the same support (default: True) Example: >>> fragmenter=Fragmenter(minSupport=0.1, maxSupport=0.05) >>> data, fragments=fragmenter(data, "SMILES", lambda ex:ex.getclass()) """ def __init__(self, minSupport=0.2, maxSupport=0.2, canonicalPruning=True, findClosed=True): self.minSupport=minSupport self.maxSupport=maxSupport self.canonicalPruning=canonicalPruning self.findClosed=findClosed def __call__(self, data, smilesAttr=None, activeFunc=lambda e:True, useCannonicalFragments=True): """Takes a data-set, and runs the FragmentMiner on it. Returns a new data-set and the fragments. The new data-set contains new attributes that represent the presence of a fragment that was found. Arguments: data : the dataset smilesAttr : the attribute in the data that contains the SMILES codes activeFunc : a function that takes an example from the data-set and returns True if the example should be considered as active (if none is provided all examples are considered active) useCannonicalFragments : if True use cannonical smiles for fragment attribute names else use regular smiles (defaut: True) """ if not smilesAttr: smilesAttr=self.FindSmilesAttr(data) active=filter(lambda s:s, [str(e[smilesAttr]) for e in data if activeFunc(e)]) inactive=filter(lambda s:s, [str(e[smilesAttr]) for e in data if not activeFunc(e)]) miner=FragmentMiner(active, inactive, self.minSupport, self.maxSupport, canonicalPruning=self.canonicalPruning, findClosed=self.findClosed) self.fragments=fragments=miner.Search() fragVars=[orange.EnumVariable(frag.ToCannonicalSmiles() if useCannonicalFragments else frag.ToSmiles(), values=["0", "1"]) for frag in fragments] smilesInFragments=dict([(fragment, set([embeding.molecule.smilesCode for embeding in fragment.embedings]) ) for fragment in fragments]) from functools import partial def getVal(var, fragment, smilesAttr, example, returnWhat): mol=LoadMolFromSmiles(str(example[smilesAttr])) ## print "GetVal" return (fragment.ContainedIn(mol) and var(1) or var(0)) if mol else var(None) for var, frag in zip(fragVars, fragments): var.getValueFrom=partial(getVal,var, frag, smilesAttr) vars=data.domain.attributes+fragVars+(data.domain.classVar and [data.domain.classVar] or []) domain=orange.Domain(vars, data.domain.classVar and 1 or 0) domain.addmetas(data.domain.getmetas()) table=orange.ExampleTable(domain) for e in data: vals=[e[attr] for attr in data.domain.attributes]+[1 if str(e[smilesAttr]) in smilesInFragments[fragment] else (None if e[smilesAttr].isSpecial() else 0) for fragment in fragments] vals=vals + [e.getclass()] if data.domain.classVar else vals ex=orange.Example(domain, vals) for key, val in e.getmetas().items(): ex[key]=val table.append(ex) return table, fragments def FindSmilesAttr(self, data): data=data.select(orange.MakeRandomIndices2(data, min(20, len(data)))) stringVars=filter(lambda var:type(var)==orange.StringVariable, data.domain.attributes+data.domain.getmetas().values()) count=dict.fromkeys(stringVars, 0) for example in data: for var in stringVars: if LoadMolFromSmiles(str(example[var])): count[var]+=1 count=count.items() count.sort(lambda a,b:cmp(a[1], b[1])) return count[-1][0] from Orange.orng import orngSVM class FragmentBasedLearner(orange.Learner): """A learner wrapper class that first runs the molecular fragmentation on the data. Attributes: smilesAttr : Attribute in the data that contains the smiles codes (if none is provided it will try to make a smart guess) learner : learner that will be used to actualy learn on the fragmented data (default: orngSVM.SVMLearner) minSupport : minimum frequency in the active set of the fragments to search for maxSupport : maximum frequency in the inactive set of the fragments to search for activeFunc : a function that takes an example from the learning data-set and returns True if the example should be considered as active (if none is provided all examples are considered active) findClosed : finds only fragments that are not sub-structures of any other fragment with the same support (default: True) """ def __new__(cls, data=None, weights=0, **kwds): learner=orange.Learner.__new__(cls, **kwds) if data: learner.__init__(**kwds) return learner(data) else: return learner def __init__(self, learner=orngSVM.SVMLearner(probability=True), name="FragmentBasedLearner", minSupport=0.2, maxSupport=0.2, smilesAttr=None, findClosed=True, activeFunc=lambda e:True): self.name=name self.learner=learner self.minSupport=minSupport self.smilesAttr=smilesAttr self.activeFunc=activeFunc self.maxSupport=maxSupport self.findClosed=findClosed def __call__(self, data, weight=0): fragmenter=Fragmenter(minSupport=self.minSupport, maxSupport=self.maxSupport, findClosed=self.findClosed) data, fragments=fragmenter(data, self.smilesAttr, self.activeFunc) return FragmentBasedClassifier(self.learner(data), data.domain) class FragmentBasedClassifier(object): def __init__(self, classifier, domain): self.classifier=classifier self.domain=domain def __call__(self, example, getBoth=orange.GetValue): example=orange.Example(self.domain, example) return self.classifier(example, getBoth) def Count(smiles, fragment): mols=filter(lambda m:m, map(LoadMolFromSmiles, smiles)) ## for mol in mols: mol.StripSalts() pattern=OBSmartsPattern() pattern.Init(fragment) return len(filter(lambda m:pattern.Match(m, True), mols)) def ContaindIn(smiles, fragment): mol=LoadMolFromSmiles(smiles) pattern=OBSmartsPattern() pattern.Init(fragment) return bool(pattern.Match(mol)) """ Viasualizations =============== """ try: from oasa.svg_out import svg_out as _svg_out from oasa.pybel_bridge import PybelConverter from oasa.coords_generator import coords_generator from oasa import dom_extensions except ImportError: try: from bkchem.oasa.oasa.svg_out import svg_out as _svg_out from bkchem.oasa.oasa.pybel_bridge import PybelConverter from bkchem.oasa.oasa.coords_generator import coords_generator from bkchem.oasa.oasa import dom_extensions except ImportError: class _svg_out(object): def __init__(self, *args, **kwargs): raise ImportError("OASA library not found") try: from oasa.cairo_out import cairo_out as _cairo_out except ImportError: try: from bkchem.oasa.oasa.cairo_out import cairo_out as _cairo_out except ImportError: class _cairo_out(object): def __init__(self, *args, **kwargs): raise ImportError("OASA library not found") class cairo_out(_cairo_out): atom_colors = {"A":(0, 0, 0), "R":(255, 0, 0)} def __init__(self, **kwargs): _cairo_out.__init__(self, **kwargs) self.atom_colors.update({"A":(0, 0, 0), "R":(255, 0, 0)}) def _draw_edge(self, e): v1, v2 = e.vertices s1, s2 = v1.symbol, v2.symbol matched = v1 in self.ob_matched and v2 in self.ob_matched ## 'A' and 'R' are used because they are in oasa periodic table and indicate any atom or any atom except hydrogen v1.symbol = "R" if matched else "A" v2.symbol = "R" if matched else "A" if matched: ## Set the default color argument for _draw_line to red self._draw_line.im_func.func_defaults = self._draw_line.im_func.func_defaults[:2]+ ((255, 0, 0),) _cairo_out._draw_edge(self, e) if matched: ## Restore the default color self._draw_line.im_func.func_defaults = self._draw_line.im_func.func_defaults[:2]+ ((0, 0, 0),) v1.symbol, v2.symbol = s1, s2 def _draw_vertex(self, v): if v in self.ob_matched: color = self.atom_colors.get(v.symbol, None) self.atom_colors[v.symbol] = (255, 0, 0) _cairo_out._draw_vertex(self, v) ## Restore the atom colors if color: self.atom_colors[v.symbol] = color else: del self.atom_colors[v.symbol] else: _cairo_out._draw_vertex(self, v) def mol_to_cairo(self, molSmiles, fragSmiles=None, file="mol.png"): import pybel molSmiles = max(molSmiles.split("."), key = lambda s:len(s)) mol = pybel.readstring("smi", molSmiles) if fragSmiles: pattern=pybel.Smarts(fragSmiles) matches = pattern.findall(mol) self.ob_matched = reduce(set.union, matches if matches != False else [], set()) else: self.ob_matched = set() # from oasa.pybel_bridge import PybelConverter o_mol, idx2oa = PybelConverter.pybel_to_oasa_molecule_with_atom_map(mol) # from oasa.coords_generator import coords_generator gen = coords_generator(30) gen.calculate_coords(o_mol, bond_length=30, force=True) ## self.oasa2obidx = dict([(value, key) for key, value in ix2oa.items()]) self.ob_matched = [idx2oa[i] for i in self.ob_matched] self.color_bonds = True return _cairo_out.mol_to_cairo(self, o_mol, file) import xml.dom.minidom as dom class svg_out(_svg_out): def __init__(self, **kwargs): _svg_out.__init__(self, **kwargs) self._curr_color = "rgb(0%, 0%, 0%)" def _draw_edge(self, e): v1, v2 = e.vertices matched = v1 in self.ob_matched and v2 in self.ob_matched if matched: self._curr_color = "rgb(255, 0, 0)" else: self._curr_color = "rgb(0, 0, 0)" _svg_out._draw_edge(self, e) def _draw_vertex(self, v): if v in self.ob_matched: self._curr_color = "rgb(255, 0, 0)" else: self._curr_color = "rgb(0, 0, 0)" _svg_out._draw_vertex(self, v) def _draw_line( self, parent, start, end, line_width=1, capstyle=""): x1, y1 = start x2, y2 = end # from oasa import dom_extensions line = dom_extensions.elementUnder( parent, 'line', (( 'x1', str( x1)), ( 'y1', str( y1)), ( 'x2', str( x2)), ( 'y2', str( y2)), ( 'stroke', self._curr_color))) def _draw_text( self, parent, xy, text, font_name="Arial", font_size=16): x, y = xy # from oasa import dom_extensions dom_extensions.textOnlyElementUnder( parent, "text", text, (( "x", str( x)), ( "y", str( y)), ( "font-family", font_name), ( "font-size", str( font_size)), ( 'stroke', self._curr_color))) def mol_to_svg(self, molSmiles, fragSmiles=None): import pybel molSmiles = max(molSmiles.split("."), key = lambda s:len(s)) mol = pybel.readstring("smi", molSmiles) if fragSmiles: pattern=pybel.Smarts(fragSmiles) matches = pattern.findall(mol) self.ob_matched = reduce(set.union, matches if matches != False else [], set()) else: self.ob_matched = set() # from oasa.pybel_bridge import PybelConverter o_mol, idx2oa = PybelConverter.pybel_to_oasa_molecule_with_atom_map(mol) # from oasa.coords_generator import coords_generator gen = coords_generator(30) gen.calculate_coords(o_mol, bond_length=30, force=True) ## self.oasa2obidx = dict([(value, key) for key, value in ix2oa.items()]) self.ob_matched = [idx2oa[i] for i in self.ob_matched] return _svg_out.mol_to_svg(self, o_mol) def mol_to_png(molSmiles, fragSmiles=None, file="mol.png", size=None): d = cairo_out() d.mol_to_cairo(molSmiles, fragSmiles) if size != None: import Image image = Image.open(file) width, height = image.size resize_factor = float(size) / max(width, height) width, height = int(width * resize_factor), int(height * resize_factor) image = image.resize((width, height), Image.ANTIALIAS) newimage = Image.new("RGB", size=(size, size), color=(255, 255, 255)) newimage.paste(image, (size - width, size - height)) newimage.save(file) def mol_to_svg(molSmiles, fragSmiles=None, file="mol.svg"): c = svg_out() tree = c.mol_to_svg(molSmiles, fragSmiles) if type(file) == str: file = open(file, "w") file.write( tree.toprettyxml()) def _test_draw(): ## mol_to_png("CC1CC2C(CC(=O)O2)OC3CC4C(CC(C5C(O4)CC=CCC6C(O5)CC=CC7C(O6)CCCC8C(O7)(CC9C(O8)CC2C(O9)C(CC(O2)CC(=C)C=O)O)C)C)OC3(C1)C", "Scc", "mol1.png") ## mol_to_png("CN(C)CCCN1c2ccccc2Sc3c1cc(cc3)C(F)(F)F", "Scc", "mol1.png") ## mol_to_png("CN(C)CCCN1c2ccccc2Sc3c1cc(cc3)C(F)(F)F", "NCC", "mol2.png") ## mol_to_png("CN(C)CCCN1c2ccccc2Sc3c1cc(cc3)C(F)(F)F", "Ncc", "mol3.png") ## mol_to_png("CN(C)CCCN1c2ccccc2Sc3c1cc(cc3)C(F)(F)F", "NCCC", "mol3.png") mol_to_svg("CN(C)CCCN1c2ccccc2Sc3c1cc(cc3)C(F)(F)F", "Scc", "mol1.svg") mol_to_svg("CN(C)CCCN1c2ccccc2Sc3c1cc(cc3)C(F)(F)F", "Ncc", "mol2.svg") mol_to_svg("CN(C)CCCN1c2ccccc2Sc3c1cc(cc3)C(F)(F)F", "NCC", "mol3.svg") def _test(): import orange d=orange.ExampleTable("E:\chem\mutagen_raw.tab") active=[str(e["SMILES"]) for e in d if str(e[-1])=="1"] inactive=[str(e["SMILES"]) for e in d if str(e[-1])=="0"] ## d=orange.ExampleTable("E:\PCLedit_s.tab") ## active=[str(e["SMILES"]) for e in d if not e["SMILES"].isSpecial()][:100] ## print active ## inactive=[] ## active=["NC(C)C(=O)O", "NC(CS)C(=O)O", "NC(CO)C(=O)O"] ## active=["CCS(O)(O)N", "CCS(O)(C)N", "CS(O)(C)N", "CCS(=N)N", "CS(=N)N", "CS(=N)O"] ## active=["NC(S)c1ccccc1","NCC1=CC=CC=C1", "NCC1C=CC=CC=1", "c1ccccc1C(N)C(=S(O)C)c2ccccc2"] ## active=["c1ccccc1C(N)C(=S(O)C)c2ccccc2"] ## active=["O=C1C=CC(=O)C=C1","O=C1CCCCCN1"] ## active=["C1SC2CCN2C1C(=O)"] ## active=["CCCCCCc1ccc(O)cc1O","Nc1ccc(O)c(N)c1", "Cc1cc(C)c(N)cc1C", "CN(C)C(=S)S[Zn]SC(=S)N(C)C", "NC(=O)N(CCO)N=O"] ## active=["CC(C)CCCC(C)C1CCC2C3CC=C4CC(CCC4(C)C3CCC12C)OC(=O)Cc5ccc(cc5)N(CCCl)CCCl","Cc1cc(C)c(N=Nc2c(O)c(cc3cc(ccc23)S(=O)(=O)O)S(=O)(=O)O)cc1CCNNCc1ccc(cc1)C(=O)NC(C)C","CC(C)(Oc1ccc(cc1)C2CCCc3ccccc23)C(=O)O","CCn1cc(C(=O)O)c(=O)c2ccc(C)nc12"] active=["CN(C)CCCN1c2ccccc2Sc3c1cc(cc3)C(F)(F)F", "CN(C)CCCN1c2ccccc2Sc3c1cc(cc3)Cl","CN1CCCCC1CCN2c3ccccc3Sc4c2cc(cc4)SC","c1ccc2c(c1)N(c3cc(ccc3S2)Cl)CCCN4CCN(CC4)CCO", "CN1CCN(CC1)CCCN2c3ccccc3Sc4c2cc(cc4)S(=O)(=O)N(C)C", "CN1CCC(=C2c3ccccc3Sc4c2cccc4)CC1", "[U]-C-S-P"] ## active=["CN(C)CCCN1c2ccccc2Sc3c1cc(cc3)C(F)(F)F", "CN(C)CCCN1c2ccccc2Sc3c1cc(cc3)Cl","CN1CCCCC1CCN2c3ccccc3Sc4c2cc(cc4)SC"] ## active=["CN(C)CCCN1c2ccccc2Sc3c1cc(cc3)C(F)(F)F", "CN(C)CCCN1c2ccccc2Sc3c1cc(cc3)Cl"] ## set_trace() miner=FragmentMiner(active, inactive[:0], minSupport=0.1, maxSupport=0.1, addWholeRings=True, canonicalPruning=True) fragments=miner.Search() ## for f in fragments: ## print f.ToSmiles() def _test1(): import orange data=orange.ExampleTable("E:\chem\mutagen_raw.tab") ## data=orange.ExampleTable("E:\chem\smiles.tab") fragmenter=Fragmenter(minSupport=0.02, maxSupport=0.1, canonicalPruning=True) ## set_trace() data, fragments1=fragmenter(data, "SMILES") #, lambda e:str(e[-1])=="1") ## data, fragments2=fragmenter(data, "SMILES", lambda e:str(e[-1])=="0") data.save("E:\chem\mutagen_raw_frag.tab") if __name__=="__main__": import time sTime=time.clock() _test_draw() print time.clock()-sTime
gpl-3.0
[ 624, 33, 3555, 367, 18112, 28914, 1303, 10251, 2238, 21495, 334, 954, 13547, 9, 4079, 641, 314, 199, 4649, 316, 3930, 10251, 2238, 481, 2527, 1470, 26, 6668, 316, 799, 9723, 4804, 13547, 402, 3930, 14413, 83, 199, 1049, 18824, 5653, 699, 24591, 4116, 436, 16922, 820, 14, 23207, 273, 1753, 14, 199, 15711, 334, 3239, 3932, 5226, 636, 1301, 363, 3326, 367, 9848, 10093, 304, 272, 481, 4338, 263, 520, 17634, 425, 402, 314, 7956, 272, 481, 4338, 4649, 281, 257, 520, 710, 2446, 1021, 626, 1630, 314, 2754, 272, 481, 2527, 28826, 420, 520, 437, 1021, 626, 365, 1202, 370, 7956, 376, 5679, 3186, 272, 481, 4338, 20409, 21424, 281, 259, 520, 437, 22876, 4975, 1021, 626, 1642, 7858, 314, 1303, 10251, 2238, 11101, 3117, 641, 314, 666, 199, 624, 199, 199, 893, 26, 272, 687, 1551, 66, 902, 492, 593, 15225, 393, 12, 593, 4134, 3151, 12, 593, 5342, 7835, 12, 593, 11087, 77, 32611, 9959, 12, 28652, 20403, 12, 593, 15225, 393, 12097, 3315, 12, 593, 15225, 393, 34, 7835, 3315, 12, 593, 4134, 3151, 34, 7835, 3315, 199, 2590, 3545, 26, 272, 986, 199, 199, 309, 504, 1134, 20621, 492, 627, 199, 504, 1331, 492, 14800, 199, 646, 593, 1842, 199, 646, 29713, 199, 646, 984, 12, 747, 421, 199, 1757, 29, 797, 199, 199, 533, 18840, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 26350, 12, 15374, 5667, 29, 22, 12, 282, 293, 3889, 5318, 29, 797, 12, 6222, 2681, 29, 16, 304, 267, 291, 14, 26310, 29, 26310, 267, 291, 14, 10910, 5667, 29, 10910, 5667, 267, 291, 14, 285, 79, 3889, 5318, 29, 285, 79, 3889, 5318, 267, 291, 14, 4188, 2681, 29, 4188, 2681, 267, 291, 14, 10525, 2681, 29, 16, 267, 291, 14, 2019, 14107, 34, 7835, 4738, 29, 17, 267, 291, 14, 2019, 14107, 31931, 5667, 29, 17, 267, 291, 14, 26310, 14, 1123, 12097, 8, 277, 9, 272, 347, 2372, 31931, 5667, 8, 277, 304, 372, 291, 14, 10910, 5667, 272, 347, 29719, 293, 3889, 8, 277, 304, 372, 291, 14, 285, 79, 3889, 5318, 272, 347, 9814, 8, 277, 12, 6222, 304, 267, 327, 4486, 642, 6222, 370, 376, 593, 4134, 3151, 267, 340, 291, 14, 10910, 5667, 389, 4188, 14, 1002, 31931, 5667, 342, 436, 291, 14, 14104, 293, 3889, 342, 389, 4188, 14, 14104, 293, 3889, 837, 288, 372, 715, 267, 587, 26, 288, 372, 756, 272, 347, 2372, 12215, 8, 277, 304, 267, 372, 291, 14, 4188, 2681, 199, 199, 533, 699, 7835, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 26350, 12, 6222, 17, 29, 403, 12, 6222, 18, 29, 403, 12, 23119, 4738, 29, 17, 304, 267, 291, 14, 26310, 29, 26310, 267, 291, 14, 4188, 17, 29, 4188, 17, 267, 291, 14, 4188, 18, 29, 4188, 18, 267, 291, 14, 21410, 4738, 29, 21410, 4738, 267, 291, 14, 26310, 14, 1123, 34, 7835, 8, 277, 9, 272, 347, 2372, 34, 7835, 4738, 8, 277, 304, 372, 291, 14, 21410, 4738, 272, 347, 2372, 46, 3289, 12097, 8, 277, 12, 6222, 304, 267, 340, 6222, 389, 277, 14, 4188, 17, 26, 288, 372, 291, 14, 4188, 18, 267, 916, 6222, 389, 277, 14, 6222, 18, 26, 288, 372, 221, 291, 14, 4188, 17, 267, 587, 26, 288, 746, 2186, 480, 12097, 1630, 440, 13511, 370, 642, 23119, 531, 272, 347, 9814, 8, 277, 12, 23119, 304, 267, 327, 4486, 642, 23119, 370, 376, 593, 5342, 7835, 267, 340, 291, 14, 1002, 21410, 4738, 342, 389, 21410, 14, 1002, 34, 7835, 4738, 837, 288, 372, 715, 267, 587, 26, 288, 372, 756, 199, 199, 533, 820, 316, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 26350, 12, 2607, 15420, 12, 6441, 316, 304, 267, 291, 14, 26310, 29, 26310, 267, 26350, 14, 1123, 15420, 8, 277, 9, 267, 291, 14, 5985, 33, 12606, 9811, 267, 291, 14, 374, 33, 293, 3889, 29, 2873, 15420, 14, 14104, 293, 3889, 342, 267, 3837, 13200, 316, 2141, 29, 6427, 316, 14, 1002, 14987, 2141, 342, 267, 892, 33, 12606, 7622, 267, 291, 14, 10525, 2681, 29, 1753, 5765, 14107, 2681, 29, 26310, 14, 2184, 14107, 2681, 267, 367, 7654, 17, 12, 7654, 18, 315, 2372, 15420, 12882, 83, 8, 2873, 15420, 423, 515, 304, 288, 6222, 17, 29, 6427, 316, 14, 1002, 14987, 37, 887, 6133, 12097, 8, 688, 17, 12, 488, 9, 503, 892, 33, 12606, 14, 362, 8, 688, 17, 12, 488, 9, 288, 340, 440, 6222, 17, 26, 355, 6222, 17, 29, 12097, 8, 26310, 12, 6441, 316, 14, 26310, 14, 1002, 12097, 8, 688, 17, 680, 1002, 31931, 5667, 1062, 2607, 15420, 14, 14104, 293, 3889, 1012, 355, 892, 33, 12606, 59, 688, 17, 10404, 4188, 17, 355, 6441, 316, 59, 4188, 17, 14, 4188, 2681, 10404, 688, 17, 288, 6222, 18, 29, 6427, 316, 14, 1002, 14987, 37, 887, 6133, 12097, 8, 688, 18, 12, 488, 9, 503, 892, 33, 12606, 14, 362, 8, 688, 18, 12, 488, 9, 288, 340, 440, 6222, 18, 26, 355, 6222, 18, 29, 12097, 8, 26310, 12, 6441, 316, 14, 26310, 14, 1002, 12097, 8, 688, 18, 680, 1002, 31931, 5667, 1062, 2607, 15420, 14, 14104, 293, 3889, 1012, 355, 892, 33, 12606, 59, 688, 18, 10404, 4188, 18, 355, 6441, 316, 59, 4188, 18, 14, 4188, 2681, 10404, 688, 18, 288, 699, 7835, 8, 26310, 12, 6222, 17, 12, 6222, 18, 12, 6441, 316, 14, 26310, 14, 1002, 34, 7835, 8, 688, 17, 12, 7654, 18, 680, 1002, 34, 7835, 4738, 1012, 288, 291, 14, 5985, 33, 12606, 14, 740, 8, 4188, 17, 9, 267, 367, 6222, 315, 892, 33, 12606, 14, 1459, 837, 288, 6222, 14, 10525, 2681, 29, 1753, 5765, 14107, 2681, 267, 291, 14, 10525, 2681, 29, 1753, 5765, 14107, 2681, 267, 26350, 14, 2184, 14107, 2681, 29, 1753, 5765, 14107, 2681, 11, 17, 272, 347, 14579, 8, 277, 304, 267, 372, 822, 8, 277, 14, 5985, 33, 12606, 9, 272, 347, 636, 5675, 721, 277, 12, 536, 304, 267, 340, 536, 508, 2668, 515, 582, 288, 372, 359, 65, 14, 1002, 12215, 342, 367, 282, 315, 291, 14 ]
[ 33, 3555, 367, 18112, 28914, 1303, 10251, 2238, 21495, 334, 954, 13547, 9, 4079, 641, 314, 199, 4649, 316, 3930, 10251, 2238, 481, 2527, 1470, 26, 6668, 316, 799, 9723, 4804, 13547, 402, 3930, 14413, 83, 199, 1049, 18824, 5653, 699, 24591, 4116, 436, 16922, 820, 14, 23207, 273, 1753, 14, 199, 15711, 334, 3239, 3932, 5226, 636, 1301, 363, 3326, 367, 9848, 10093, 304, 272, 481, 4338, 263, 520, 17634, 425, 402, 314, 7956, 272, 481, 4338, 4649, 281, 257, 520, 710, 2446, 1021, 626, 1630, 314, 2754, 272, 481, 2527, 28826, 420, 520, 437, 1021, 626, 365, 1202, 370, 7956, 376, 5679, 3186, 272, 481, 4338, 20409, 21424, 281, 259, 520, 437, 22876, 4975, 1021, 626, 1642, 7858, 314, 1303, 10251, 2238, 11101, 3117, 641, 314, 666, 199, 624, 199, 199, 893, 26, 272, 687, 1551, 66, 902, 492, 593, 15225, 393, 12, 593, 4134, 3151, 12, 593, 5342, 7835, 12, 593, 11087, 77, 32611, 9959, 12, 28652, 20403, 12, 593, 15225, 393, 12097, 3315, 12, 593, 15225, 393, 34, 7835, 3315, 12, 593, 4134, 3151, 34, 7835, 3315, 199, 2590, 3545, 26, 272, 986, 199, 199, 309, 504, 1134, 20621, 492, 627, 199, 504, 1331, 492, 14800, 199, 646, 593, 1842, 199, 646, 29713, 199, 646, 984, 12, 747, 421, 199, 1757, 29, 797, 199, 199, 533, 18840, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 26350, 12, 15374, 5667, 29, 22, 12, 282, 293, 3889, 5318, 29, 797, 12, 6222, 2681, 29, 16, 304, 267, 291, 14, 26310, 29, 26310, 267, 291, 14, 10910, 5667, 29, 10910, 5667, 267, 291, 14, 285, 79, 3889, 5318, 29, 285, 79, 3889, 5318, 267, 291, 14, 4188, 2681, 29, 4188, 2681, 267, 291, 14, 10525, 2681, 29, 16, 267, 291, 14, 2019, 14107, 34, 7835, 4738, 29, 17, 267, 291, 14, 2019, 14107, 31931, 5667, 29, 17, 267, 291, 14, 26310, 14, 1123, 12097, 8, 277, 9, 272, 347, 2372, 31931, 5667, 8, 277, 304, 372, 291, 14, 10910, 5667, 272, 347, 29719, 293, 3889, 8, 277, 304, 372, 291, 14, 285, 79, 3889, 5318, 272, 347, 9814, 8, 277, 12, 6222, 304, 267, 327, 4486, 642, 6222, 370, 376, 593, 4134, 3151, 267, 340, 291, 14, 10910, 5667, 389, 4188, 14, 1002, 31931, 5667, 342, 436, 291, 14, 14104, 293, 3889, 342, 389, 4188, 14, 14104, 293, 3889, 837, 288, 372, 715, 267, 587, 26, 288, 372, 756, 272, 347, 2372, 12215, 8, 277, 304, 267, 372, 291, 14, 4188, 2681, 199, 199, 533, 699, 7835, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 26350, 12, 6222, 17, 29, 403, 12, 6222, 18, 29, 403, 12, 23119, 4738, 29, 17, 304, 267, 291, 14, 26310, 29, 26310, 267, 291, 14, 4188, 17, 29, 4188, 17, 267, 291, 14, 4188, 18, 29, 4188, 18, 267, 291, 14, 21410, 4738, 29, 21410, 4738, 267, 291, 14, 26310, 14, 1123, 34, 7835, 8, 277, 9, 272, 347, 2372, 34, 7835, 4738, 8, 277, 304, 372, 291, 14, 21410, 4738, 272, 347, 2372, 46, 3289, 12097, 8, 277, 12, 6222, 304, 267, 340, 6222, 389, 277, 14, 4188, 17, 26, 288, 372, 291, 14, 4188, 18, 267, 916, 6222, 389, 277, 14, 6222, 18, 26, 288, 372, 221, 291, 14, 4188, 17, 267, 587, 26, 288, 746, 2186, 480, 12097, 1630, 440, 13511, 370, 642, 23119, 531, 272, 347, 9814, 8, 277, 12, 23119, 304, 267, 327, 4486, 642, 23119, 370, 376, 593, 5342, 7835, 267, 340, 291, 14, 1002, 21410, 4738, 342, 389, 21410, 14, 1002, 34, 7835, 4738, 837, 288, 372, 715, 267, 587, 26, 288, 372, 756, 199, 199, 533, 820, 316, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 26350, 12, 2607, 15420, 12, 6441, 316, 304, 267, 291, 14, 26310, 29, 26310, 267, 26350, 14, 1123, 15420, 8, 277, 9, 267, 291, 14, 5985, 33, 12606, 9811, 267, 291, 14, 374, 33, 293, 3889, 29, 2873, 15420, 14, 14104, 293, 3889, 342, 267, 3837, 13200, 316, 2141, 29, 6427, 316, 14, 1002, 14987, 2141, 342, 267, 892, 33, 12606, 7622, 267, 291, 14, 10525, 2681, 29, 1753, 5765, 14107, 2681, 29, 26310, 14, 2184, 14107, 2681, 267, 367, 7654, 17, 12, 7654, 18, 315, 2372, 15420, 12882, 83, 8, 2873, 15420, 423, 515, 304, 288, 6222, 17, 29, 6427, 316, 14, 1002, 14987, 37, 887, 6133, 12097, 8, 688, 17, 12, 488, 9, 503, 892, 33, 12606, 14, 362, 8, 688, 17, 12, 488, 9, 288, 340, 440, 6222, 17, 26, 355, 6222, 17, 29, 12097, 8, 26310, 12, 6441, 316, 14, 26310, 14, 1002, 12097, 8, 688, 17, 680, 1002, 31931, 5667, 1062, 2607, 15420, 14, 14104, 293, 3889, 1012, 355, 892, 33, 12606, 59, 688, 17, 10404, 4188, 17, 355, 6441, 316, 59, 4188, 17, 14, 4188, 2681, 10404, 688, 17, 288, 6222, 18, 29, 6427, 316, 14, 1002, 14987, 37, 887, 6133, 12097, 8, 688, 18, 12, 488, 9, 503, 892, 33, 12606, 14, 362, 8, 688, 18, 12, 488, 9, 288, 340, 440, 6222, 18, 26, 355, 6222, 18, 29, 12097, 8, 26310, 12, 6441, 316, 14, 26310, 14, 1002, 12097, 8, 688, 18, 680, 1002, 31931, 5667, 1062, 2607, 15420, 14, 14104, 293, 3889, 1012, 355, 892, 33, 12606, 59, 688, 18, 10404, 4188, 18, 355, 6441, 316, 59, 4188, 18, 14, 4188, 2681, 10404, 688, 18, 288, 699, 7835, 8, 26310, 12, 6222, 17, 12, 6222, 18, 12, 6441, 316, 14, 26310, 14, 1002, 34, 7835, 8, 688, 17, 12, 7654, 18, 680, 1002, 34, 7835, 4738, 1012, 288, 291, 14, 5985, 33, 12606, 14, 740, 8, 4188, 17, 9, 267, 367, 6222, 315, 892, 33, 12606, 14, 1459, 837, 288, 6222, 14, 10525, 2681, 29, 1753, 5765, 14107, 2681, 267, 291, 14, 10525, 2681, 29, 1753, 5765, 14107, 2681, 267, 26350, 14, 2184, 14107, 2681, 29, 1753, 5765, 14107, 2681, 11, 17, 272, 347, 14579, 8, 277, 304, 267, 372, 822, 8, 277, 14, 5985, 33, 12606, 9, 272, 347, 636, 5675, 721, 277, 12, 536, 304, 267, 340, 536, 508, 2668, 515, 582, 288, 372, 359, 65, 14, 1002, 12215, 342, 367, 282, 315, 291, 14, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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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 ]
DOE-NEPA/geonode_2.0_to_2.4_migration
migrate_actstream_follow_modified.py
1
1661
#!/usr/bin/python import os import psycopg2 import sys import django_content_type_mapping file = open("/home/" + os.getlogin() + "/.pgpass", "r") pgpasses = [] for line in file: pgpasses.append(line.rstrip("\n").split(":")) file.close() for pgpass in pgpasses: #print str(pgpass) if pgpass[0] == "54.236.235.110" and pgpass[3] == "geonode": src_pgpass = pgpass if pgpass[0] == "54.197.226.56" and pgpass[3] == "geonode": dst_pgpass = pgpass src = psycopg2.connect(host=src_pgpass[0], database="geonode2", user=src_pgpass[3], password=src_pgpass[4]) dst = psycopg2.connect(host=dst_pgpass[0], database="geonode", user=dst_pgpass[3], password=dst_pgpass[4]) src_cur = src.cursor() dst_cur = dst.cursor() src_cur.execute("select id, user_id, content_type_id, object_id, actor_only, started from actstream_follow") for src_row in src_cur: assignments = [] #id assignments.append(src_row[0]) #user_id assignments.append(src_row[1]) #content_type_id assignments.append(get_django_content_type_id(src_row[2])) #object_id assignments.append(src_row[3]) #actor_only assignments.append(src_row[4]) #started assignments.append(src_row[5]) try: dst_cur.execute("insert into actstream_follow(id, user_id, content_type_id, object_id, actor_only, started) values (%s, %s, %s, %s, %s, %s)", assignments) dst.commit() except Exception as error: print print type(error) print str(error) + "select id, user_id, content_type_id, object_id, actor_only, started from actstream_follow" print str(src_row) dst.rollback() dst.commit() src_cur.close() dst_cur.close() src.close() dst.close()
gpl-2.0
[ 3381, 2647, 15, 1393, 15, 1548, 199, 646, 747, 199, 646, 15492, 18, 199, 646, 984, 199, 646, 1639, 63, 1317, 63, 466, 63, 4745, 199, 199, 493, 275, 1551, 4769, 4219, 6687, 435, 747, 14, 362, 2886, 342, 435, 3286, 14, 4198, 1529, 401, 298, 82, 531, 199, 4198, 16027, 275, 942, 199, 509, 1004, 315, 570, 26, 523, 299, 4927, 1916, 14, 740, 8, 604, 14, 6735, 4582, 78, 3471, 1294, 20308, 2237, 199, 493, 14, 1600, 342, 199, 199, 509, 10275, 1529, 315, 299, 4927, 1916, 26, 523, 327, 1361, 620, 8, 4198, 1529, 9, 523, 340, 10275, 1529, 59, 16, 61, 508, 298, 1477, 14, 10008, 14, 8276, 14, 6019, 2, 436, 10275, 1529, 59, 19, 61, 508, 298, 303, 29118, 582, 272, 2928, 63, 4198, 1529, 275, 10275, 1529, 523, 340, 10275, 1529, 59, 16, 61, 508, 221, 298, 1477, 14, 11165, 14, 11085, 14, 1367, 2, 221, 436, 10275, 1529, 59, 19, 61, 508, 298, 303, 29118, 582, 272, 5042, 63, 4198, 1529, 275, 10275, 1529, 199, 199, 2164, 275, 15492, 18, 14, 2242, 8, 1102, 29, 2164, 63, 4198, 1529, 59, 16, 467, 3050, 628, 303, 29118, 18, 401, 922, 29, 2164, 63, 4198, 1529, 59, 19, 467, 2505, 29, 2164, 63, 4198, 1529, 59, 20, 566, 199, 199, 5119, 275, 15492, 18, 14, 2242, 8, 1102, 29, 5119, 63, 4198, 1529, 59, 16, 467, 3050, 628, 303, 29118, 401, 221, 922, 29, 5119, 63, 4198, 1529, 59, 19, 467, 2505, 29, 5119, 63, 4198, 1529, 59, 20, 566, 199, 199, 2164, 63, 895, 275, 2928, 14, 3937, 342, 199, 199, 5119, 63, 895, 275, 5042, 14, 3937, 342, 199, 199, 2164, 63, 895, 14, 2526, 480, 2416, 1305, 12, 922, 63, 344, 12, 1564, 63, 466, 63, 344, 12, 909, 63, 344, 12, 20318, 63, 2118, 12, 8239, 687, 2454, 1745, 63, 7207, 531, 199, 199, 509, 2928, 63, 1143, 315, 2928, 63, 895, 26, 523, 18121, 275, 942, 523, 327, 344, 523, 18121, 14, 740, 8, 2164, 63, 1143, 59, 16, 566, 523, 327, 751, 63, 344, 523, 18121, 14, 740, 8, 2164, 63, 1143, 59, 17, 566, 523, 327, 1317, 63, 466, 63, 344, 523, 18121, 14, 740, 8, 362, 63, 1176, 63, 1317, 63, 466, 63, 344, 8, 2164, 63, 1143, 59, 18, 2459, 523, 327, 785, 63, 344, 523, 18121, 14, 740, 8, 2164, 63, 1143, 59, 19, 566, 523, 327, 5021, 63, 2118, 523, 18121, 14, 740, 8, 2164, 63, 1143, 59, 20, 566, 523, 327, 8924, 523, 18121, 14, 740, 8, 2164, 63, 1143, 59, 21, 566, 12244, 862, 26, 272, 5042, 63, 895, 14, 2526, 480, 3176, 1901, 2454, 1745, 63, 7207, 8, 344, 12, 922, 63, 344, 12, 1564, 63, 466, 63, 344, 12, 909, 63, 344, 12, 20318, 63, 2118, 12, 8239, 9, 1338, 4366, 83, 12, 450, 83, 12, 450, 83, 12, 450, 83, 12, 450, 83, 12, 450, 83, 4186, 18121, 9, 272, 5042, 14, 3543, 342, 523, 871, 2186, 465, 1125, 26, 272, 870, 5591, 870, 730, 8, 705, 9, 272, 870, 620, 8, 705, 9, 435, 298, 2416, 1305, 12, 922, 63, 344, 12, 1564, 63, 466, 63, 344, 12, 909, 63, 344, 12, 20318, 63, 2118, 12, 8239, 687, 2454, 1745, 63, 7207, 2, 272, 870, 620, 8, 2164, 63, 1143, 9, 272, 5042, 14, 10437, 342, 199, 199, 5119, 14, 3543, 342, 199, 199, 2164, 63, 895, 14, 1600, 342, 199, 199, 5119, 63, 895, 14, 1600, 342, 199, 199, 2164, 14, 1600, 342, 199, 199, 5119, 14, 1600, 342, 421, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2647, 15, 1393, 15, 1548, 199, 646, 747, 199, 646, 15492, 18, 199, 646, 984, 199, 646, 1639, 63, 1317, 63, 466, 63, 4745, 199, 199, 493, 275, 1551, 4769, 4219, 6687, 435, 747, 14, 362, 2886, 342, 435, 3286, 14, 4198, 1529, 401, 298, 82, 531, 199, 4198, 16027, 275, 942, 199, 509, 1004, 315, 570, 26, 523, 299, 4927, 1916, 14, 740, 8, 604, 14, 6735, 4582, 78, 3471, 1294, 20308, 2237, 199, 493, 14, 1600, 342, 199, 199, 509, 10275, 1529, 315, 299, 4927, 1916, 26, 523, 327, 1361, 620, 8, 4198, 1529, 9, 523, 340, 10275, 1529, 59, 16, 61, 508, 298, 1477, 14, 10008, 14, 8276, 14, 6019, 2, 436, 10275, 1529, 59, 19, 61, 508, 298, 303, 29118, 582, 272, 2928, 63, 4198, 1529, 275, 10275, 1529, 523, 340, 10275, 1529, 59, 16, 61, 508, 221, 298, 1477, 14, 11165, 14, 11085, 14, 1367, 2, 221, 436, 10275, 1529, 59, 19, 61, 508, 298, 303, 29118, 582, 272, 5042, 63, 4198, 1529, 275, 10275, 1529, 199, 199, 2164, 275, 15492, 18, 14, 2242, 8, 1102, 29, 2164, 63, 4198, 1529, 59, 16, 467, 3050, 628, 303, 29118, 18, 401, 922, 29, 2164, 63, 4198, 1529, 59, 19, 467, 2505, 29, 2164, 63, 4198, 1529, 59, 20, 566, 199, 199, 5119, 275, 15492, 18, 14, 2242, 8, 1102, 29, 5119, 63, 4198, 1529, 59, 16, 467, 3050, 628, 303, 29118, 401, 221, 922, 29, 5119, 63, 4198, 1529, 59, 19, 467, 2505, 29, 5119, 63, 4198, 1529, 59, 20, 566, 199, 199, 2164, 63, 895, 275, 2928, 14, 3937, 342, 199, 199, 5119, 63, 895, 275, 5042, 14, 3937, 342, 199, 199, 2164, 63, 895, 14, 2526, 480, 2416, 1305, 12, 922, 63, 344, 12, 1564, 63, 466, 63, 344, 12, 909, 63, 344, 12, 20318, 63, 2118, 12, 8239, 687, 2454, 1745, 63, 7207, 531, 199, 199, 509, 2928, 63, 1143, 315, 2928, 63, 895, 26, 523, 18121, 275, 942, 523, 327, 344, 523, 18121, 14, 740, 8, 2164, 63, 1143, 59, 16, 566, 523, 327, 751, 63, 344, 523, 18121, 14, 740, 8, 2164, 63, 1143, 59, 17, 566, 523, 327, 1317, 63, 466, 63, 344, 523, 18121, 14, 740, 8, 362, 63, 1176, 63, 1317, 63, 466, 63, 344, 8, 2164, 63, 1143, 59, 18, 2459, 523, 327, 785, 63, 344, 523, 18121, 14, 740, 8, 2164, 63, 1143, 59, 19, 566, 523, 327, 5021, 63, 2118, 523, 18121, 14, 740, 8, 2164, 63, 1143, 59, 20, 566, 523, 327, 8924, 523, 18121, 14, 740, 8, 2164, 63, 1143, 59, 21, 566, 12244, 862, 26, 272, 5042, 63, 895, 14, 2526, 480, 3176, 1901, 2454, 1745, 63, 7207, 8, 344, 12, 922, 63, 344, 12, 1564, 63, 466, 63, 344, 12, 909, 63, 344, 12, 20318, 63, 2118, 12, 8239, 9, 1338, 4366, 83, 12, 450, 83, 12, 450, 83, 12, 450, 83, 12, 450, 83, 12, 450, 83, 4186, 18121, 9, 272, 5042, 14, 3543, 342, 523, 871, 2186, 465, 1125, 26, 272, 870, 5591, 870, 730, 8, 705, 9, 272, 870, 620, 8, 705, 9, 435, 298, 2416, 1305, 12, 922, 63, 344, 12, 1564, 63, 466, 63, 344, 12, 909, 63, 344, 12, 20318, 63, 2118, 12, 8239, 687, 2454, 1745, 63, 7207, 2, 272, 870, 620, 8, 2164, 63, 1143, 9, 272, 5042, 14, 10437, 342, 199, 199, 5119, 14, 3543, 342, 199, 199, 2164, 63, 895, 14, 1600, 342, 199, 199, 5119, 63, 895, 14, 1600, 342, 199, 199, 2164, 14, 1600, 342, 199, 199, 5119, 14, 1600, 342, 421, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
DBeath/flask-feedrsub
feedrsub/utils/security.py
1
4868
import functools from flask import request, current_app as app, make_response from flask_security import Security, current_user from flask_security.decorators import _check_http_auth from flask_security.forms import ForgotPasswordForm, RegisterForm, SendConfirmationForm from flask_wtf import RecaptchaField from werkzeug.exceptions import abort class ExtendedRegisterForm(RegisterForm): # name = StringField('Name', [Required()]) pass class RecaptchaRegisterForm(ExtendedRegisterForm): recaptcha = RecaptchaField() class RecaptchaForgotPasswordForm(ForgotPasswordForm): recaptcha = RecaptchaField() class RecaptchaSendConfirmationForm(SendConfirmationForm): recaptcha = RecaptchaField() def configure_security(app, datastore): register_form = ExtendedRegisterForm confirm_register_form = ExtendedRegisterForm forgot_password_form = ForgotPasswordForm send_confirmation_form = SendConfirmationForm if app.config.get("SECURITY_RECAPTCHA_ENABLED"): register_form = RecaptchaRegisterForm confirm_register_form = RecaptchaRegisterForm forgot_password_form = RecaptchaForgotPasswordForm send_confirmation_form = RecaptchaSendConfirmationForm Security( app=app, datastore=datastore, register_form=register_form, confirm_register_form=confirm_register_form, forgot_password_form=forgot_password_form, send_confirmation_form=send_confirmation_form, ) def abort_if_not_same_user_public_id(user_public_id: str, status_code: int = 403): """ Abort the request and return an HTTP error if the provided user_public_id is not the same as the public Id of the currently authorized user. This is not a decorator as we sometimes need to use it in the view. :param user_public_id: url-safe public Id of the user that this resource belongs to :param status_code: Optional status code of the error """ if not is_same_user_public_id(user_public_id): abort(status_code) def is_same_user_public_id(user_public_id: str) -> bool: """ Checks if provided authorization is for same User as user_public_id. This is not a decorator as we sometimes need to use it in the view. :param user_public_id: Id of the user that this resource belongs to """ if current_user.has_role("admin"): return True elif current_user.is_authenticated: return current_user.urlsafe_public_id == user_public_id elif request.authorization: if _check_http_auth(): return current_user.urlsafe_public_id == user_public_id return False def abort_if_not_same_user(user_id: int, status_code: int = 403): """ Abort the request and return an HTTP error if the provided user_id is not the same as the Id of the currently authorized user. This is not a decorator as we sometimes need to use it in the view. :param user_id: Id of the user that this resource belongs to :param status_code: Optional status code of the error """ if not is_same_user(user_id): abort(status_code) def is_same_user(user_id: int) -> bool: """ Checks if provided authorization is for same User as user_id. This is not a decorator as we sometimes need to use it in the view. :param user_id: Id of the user that this resource belongs to :type user_id: int """ if current_user.has_role("admin"): return True elif current_user.is_authenticated: return int(current_user.get_id()) == user_id elif request.authorization: if _check_http_auth(): return int(current_user.get_id()) == user_id return False def require_cron_api_key(func): """ Requires that a request contains a valid CRON API KEY. Only use for cron functions that are not security essential. TODO: This should be swapped for a more secure solution. """ @functools.wraps(func) def wrap(*args, **kwargs): cron_key = app.config.get("CRON_API_KEY", "") request_key = request.headers.get("X-Cron-Api-Key", "") if cron_key_valid(cron_key, request_key): return func(*args, **kwargs) else: return make_response("Not authenticated\n", 401) return wrap def cron_key_valid(cron_key: str, request_key: str) -> bool: """ Returns True if the request_key equals the required cron_key. Will always return False if cron_key is empty string. :param cron_key: Required CRON key :param request_key: Provided key from Request :return: Bool """ if not isinstance(cron_key, str): raise TypeError("cron_key must be of type str") if not isinstance(request_key, str): raise TypeError("request_key must be of type str") if cron_key and request_key == cron_key: return True return False
mit
[ 646, 9143, 199, 199, 504, 7209, 492, 1056, 12, 1453, 63, 571, 465, 1145, 12, 1852, 63, 1310, 199, 504, 7209, 63, 4416, 492, 13863, 12, 1453, 63, 751, 199, 504, 7209, 63, 4416, 14, 11582, 492, 485, 1074, 63, 1014, 63, 1178, 199, 504, 7209, 63, 4416, 14, 3351, 492, 481, 1308, 357, 6139, 2821, 12, 11828, 2821, 12, 10217, 714, 11701, 2821, 199, 504, 7209, 63, 87, 3249, 492, 799, 20559, 792, 199, 504, 10380, 14, 3924, 492, 12004, 421, 199, 533, 13706, 7099, 2821, 8, 7099, 2821, 304, 272, 327, 536, 275, 21409, 360, 985, 297, 359, 8030, 9383, 272, 986, 421, 199, 533, 799, 20559, 7099, 2821, 8, 14107, 7099, 2821, 304, 272, 295, 20559, 275, 799, 20559, 792, 342, 421, 199, 533, 799, 20559, 38, 1308, 357, 6139, 2821, 8, 38, 1308, 357, 6139, 2821, 304, 272, 295, 20559, 275, 799, 20559, 792, 342, 421, 199, 533, 799, 20559, 6795, 714, 11701, 2821, 8, 6795, 714, 11701, 2821, 304, 272, 295, 20559, 275, 799, 20559, 792, 342, 421, 199, 318, 7908, 63, 4416, 8, 571, 12, 12007, 304, 272, 2274, 63, 964, 275, 13706, 7099, 2821, 272, 12679, 63, 2683, 63, 964, 275, 13706, 7099, 2821, 272, 367, 7808, 63, 2060, 63, 964, 275, 481, 1308, 357, 6139, 2821, 272, 3222, 63, 20903, 63, 964, 275, 10217, 714, 11701, 2821, 339, 340, 1145, 14, 888, 14, 362, 480, 13554, 63, 907, 28342, 26363, 63, 15704, 2349, 267, 2274, 63, 964, 275, 799, 20559, 7099, 2821, 267, 12679, 63, 2683, 63, 964, 275, 799, 20559, 7099, 2821, 267, 367, 7808, 63, 2060, 63, 964, 275, 799, 20559, 38, 1308, 357, 6139, 2821, 267, 3222, 63, 20903, 63, 964, 275, 799, 20559, 6795, 714, 11701, 2821, 339, 13863, 8, 267, 1145, 29, 571, 12, 267, 12007, 29, 11450, 12, 267, 2274, 63, 964, 29, 2683, 63, 964, 12, 267, 12679, 63, 2683, 63, 964, 29, 9548, 63, 2683, 63, 964, 12, 267, 367, 7808, 63, 2060, 63, 964, 29, 509, 7808, 63, 2060, 63, 964, 12, 267, 3222, 63, 20903, 63, 964, 29, 2254, 63, 20903, 63, 964, 12, 272, 776, 421, 199, 318, 12004, 63, 692, 63, 1397, 63, 7191, 63, 751, 63, 3455, 63, 344, 8, 751, 63, 3455, 63, 344, 26, 620, 12, 2004, 63, 600, 26, 1109, 275, 13269, 304, 272, 408, 272, 31455, 314, 1056, 436, 372, 376, 3101, 1125, 340, 314, 2741, 922, 63, 3455, 63, 344, 272, 365, 440, 314, 2011, 465, 314, 4575, 15418, 402, 314, 5544, 18788, 922, 14, 272, 961, 365, 440, 282, 7531, 465, 781, 15026, 1929, 370, 675, 652, 315, 314, 2455, 14, 339, 520, 635, 922, 63, 3455, 63, 344, 26, 1166, 13, 3489, 4575, 15418, 402, 314, 922, 626, 642, 2073, 15006, 370, 272, 520, 635, 2004, 63, 600, 26, 4879, 2004, 1233, 402, 314, 1125, 272, 408, 272, 340, 440, 365, 63, 7191, 63, 751, 63, 3455, 63, 344, 8, 751, 63, 3455, 63, 344, 304, 267, 12004, 8, 1205, 63, 600, 9, 421, 199, 318, 365, 63, 7191, 63, 751, 63, 3455, 63, 344, 8, 751, 63, 3455, 63, 344, 26, 620, 9, 1035, 2155, 26, 272, 408, 272, 13813, 340, 2741, 13448, 365, 367, 2011, 2876, 465, 922, 63, 3455, 63, 344, 14, 272, 961, 365, 440, 282, 7531, 465, 781, 15026, 1929, 370, 675, 652, 315, 314, 2455, 14, 339, 520, 635, 922, 63, 3455, 63, 344, 26, 15418, 402, 314, 922, 626, 642, 2073, 15006, 370, 272, 408, 272, 340, 1453, 63, 751, 14, 1989, 63, 3756, 480, 2113, 2349, 267, 372, 715, 272, 916, 1453, 63, 751, 14, 374, 63, 12177, 26, 267, 372, 1453, 63, 751, 14, 28201, 63, 3455, 63, 344, 508, 922, 63, 3455, 63, 344, 272, 916, 1056, 14, 15846, 26, 267, 340, 485, 1074, 63, 1014, 63, 1178, 837, 288, 372, 1453, 63, 751, 14, 28201, 63, 3455, 63, 344, 508, 922, 63, 3455, 63, 344, 272, 372, 756, 421, 199, 318, 12004, 63, 692, 63, 1397, 63, 7191, 63, 751, 8, 751, 63, 344, 26, 1109, 12, 2004, 63, 600, 26, 1109, 275, 13269, 304, 272, 408, 272, 31455, 314, 1056, 436, 372, 376, 3101, 1125, 340, 314, 2741, 922, 63, 344, 272, 365, 440, 314, 2011, 465, 314, 15418, 402, 314, 5544, 18788, 922, 14, 272, 961, 365, 440, 282, 7531, 465, 781, 15026, 1929, 370, 675, 652, 315, 314, 2455, 14, 339, 520, 635, 922, 63, 344, 26, 15418, 402, 314, 922, 626, 642, 2073, 15006, 370, 272, 520, 635, 2004, 63, 600, 26, 4879, 2004, 1233, 402, 314, 1125, 272, 408, 272, 340, 440, 365, 63, 7191, 63, 751, 8, 751, 63, 344, 304, 267, 12004, 8, 1205, 63, 600, 9, 421, 199, 318, 365, 63, 7191, 63, 751, 8, 751, 63, 344, 26, 1109, 9, 1035, 2155, 26, 272, 408, 272, 13813, 340, 2741, 13448, 365, 367, 2011, 2876, 465, 922, 63, 344, 14, 272, 961, 365, 440, 282, 7531, 465, 781, 15026, 1929, 370, 675, 652, 315, 314, 2455, 14, 339, 520, 635, 922, 63, 344, 26, 15418, 402, 314, 922, 626, 642, 2073, 15006, 370, 272, 520, 466, 922, 63, 344, 26, 1109, 272, 408, 272, 340, 1453, 63, 751, 14, 1989, 63, 3756, 480, 2113, 2349, 267, 372, 715, 272, 916, 1453, 63, 751, 14, 374, 63, 12177, 26, 267, 372, 1109, 8, 1818, 63, 751, 14, 362, 63, 344, 1012, 508, 922, 63, 344, 272, 916, 1056, 14, 15846, 26, 267, 340, 485, 1074, 63, 1014, 63, 1178, 837, 288, 372, 1109, 8, 1818, 63, 751, 14, 362, 63, 344, 1012, 508, 922, 63, 344, 272, 372, 756, 421, 199, 318, 4409, 63, 14829, 63, 1246, 63, 498, 8, 1532, 304, 272, 408, 272, 15127, 626, 282, 1056, 3509, 282, 1686, 445, 12758, 3261, 9301, 14, 272, 5972, 675, 367, 19818, 3423, 626, 787, 440, 6391, 22829, 1009, 14, 339, 3254, 26, 961, 1077, 506, 25072, 367, 282, 1655, 11153, 8744, 14, 272, 408, 339, 768, 17869, 14, 13582, 8, 1532, 9, 272, 347, 4816, 2031, 589, 12, 1011, 958, 304, 267, 19818, 63, 498, 275, 1145, 14, 888, 14, 362, 480, 2944, 615, 63, 3735, 63 ]
[ 9143, 199, 199, 504, 7209, 492, 1056, 12, 1453, 63, 571, 465, 1145, 12, 1852, 63, 1310, 199, 504, 7209, 63, 4416, 492, 13863, 12, 1453, 63, 751, 199, 504, 7209, 63, 4416, 14, 11582, 492, 485, 1074, 63, 1014, 63, 1178, 199, 504, 7209, 63, 4416, 14, 3351, 492, 481, 1308, 357, 6139, 2821, 12, 11828, 2821, 12, 10217, 714, 11701, 2821, 199, 504, 7209, 63, 87, 3249, 492, 799, 20559, 792, 199, 504, 10380, 14, 3924, 492, 12004, 421, 199, 533, 13706, 7099, 2821, 8, 7099, 2821, 304, 272, 327, 536, 275, 21409, 360, 985, 297, 359, 8030, 9383, 272, 986, 421, 199, 533, 799, 20559, 7099, 2821, 8, 14107, 7099, 2821, 304, 272, 295, 20559, 275, 799, 20559, 792, 342, 421, 199, 533, 799, 20559, 38, 1308, 357, 6139, 2821, 8, 38, 1308, 357, 6139, 2821, 304, 272, 295, 20559, 275, 799, 20559, 792, 342, 421, 199, 533, 799, 20559, 6795, 714, 11701, 2821, 8, 6795, 714, 11701, 2821, 304, 272, 295, 20559, 275, 799, 20559, 792, 342, 421, 199, 318, 7908, 63, 4416, 8, 571, 12, 12007, 304, 272, 2274, 63, 964, 275, 13706, 7099, 2821, 272, 12679, 63, 2683, 63, 964, 275, 13706, 7099, 2821, 272, 367, 7808, 63, 2060, 63, 964, 275, 481, 1308, 357, 6139, 2821, 272, 3222, 63, 20903, 63, 964, 275, 10217, 714, 11701, 2821, 339, 340, 1145, 14, 888, 14, 362, 480, 13554, 63, 907, 28342, 26363, 63, 15704, 2349, 267, 2274, 63, 964, 275, 799, 20559, 7099, 2821, 267, 12679, 63, 2683, 63, 964, 275, 799, 20559, 7099, 2821, 267, 367, 7808, 63, 2060, 63, 964, 275, 799, 20559, 38, 1308, 357, 6139, 2821, 267, 3222, 63, 20903, 63, 964, 275, 799, 20559, 6795, 714, 11701, 2821, 339, 13863, 8, 267, 1145, 29, 571, 12, 267, 12007, 29, 11450, 12, 267, 2274, 63, 964, 29, 2683, 63, 964, 12, 267, 12679, 63, 2683, 63, 964, 29, 9548, 63, 2683, 63, 964, 12, 267, 367, 7808, 63, 2060, 63, 964, 29, 509, 7808, 63, 2060, 63, 964, 12, 267, 3222, 63, 20903, 63, 964, 29, 2254, 63, 20903, 63, 964, 12, 272, 776, 421, 199, 318, 12004, 63, 692, 63, 1397, 63, 7191, 63, 751, 63, 3455, 63, 344, 8, 751, 63, 3455, 63, 344, 26, 620, 12, 2004, 63, 600, 26, 1109, 275, 13269, 304, 272, 408, 272, 31455, 314, 1056, 436, 372, 376, 3101, 1125, 340, 314, 2741, 922, 63, 3455, 63, 344, 272, 365, 440, 314, 2011, 465, 314, 4575, 15418, 402, 314, 5544, 18788, 922, 14, 272, 961, 365, 440, 282, 7531, 465, 781, 15026, 1929, 370, 675, 652, 315, 314, 2455, 14, 339, 520, 635, 922, 63, 3455, 63, 344, 26, 1166, 13, 3489, 4575, 15418, 402, 314, 922, 626, 642, 2073, 15006, 370, 272, 520, 635, 2004, 63, 600, 26, 4879, 2004, 1233, 402, 314, 1125, 272, 408, 272, 340, 440, 365, 63, 7191, 63, 751, 63, 3455, 63, 344, 8, 751, 63, 3455, 63, 344, 304, 267, 12004, 8, 1205, 63, 600, 9, 421, 199, 318, 365, 63, 7191, 63, 751, 63, 3455, 63, 344, 8, 751, 63, 3455, 63, 344, 26, 620, 9, 1035, 2155, 26, 272, 408, 272, 13813, 340, 2741, 13448, 365, 367, 2011, 2876, 465, 922, 63, 3455, 63, 344, 14, 272, 961, 365, 440, 282, 7531, 465, 781, 15026, 1929, 370, 675, 652, 315, 314, 2455, 14, 339, 520, 635, 922, 63, 3455, 63, 344, 26, 15418, 402, 314, 922, 626, 642, 2073, 15006, 370, 272, 408, 272, 340, 1453, 63, 751, 14, 1989, 63, 3756, 480, 2113, 2349, 267, 372, 715, 272, 916, 1453, 63, 751, 14, 374, 63, 12177, 26, 267, 372, 1453, 63, 751, 14, 28201, 63, 3455, 63, 344, 508, 922, 63, 3455, 63, 344, 272, 916, 1056, 14, 15846, 26, 267, 340, 485, 1074, 63, 1014, 63, 1178, 837, 288, 372, 1453, 63, 751, 14, 28201, 63, 3455, 63, 344, 508, 922, 63, 3455, 63, 344, 272, 372, 756, 421, 199, 318, 12004, 63, 692, 63, 1397, 63, 7191, 63, 751, 8, 751, 63, 344, 26, 1109, 12, 2004, 63, 600, 26, 1109, 275, 13269, 304, 272, 408, 272, 31455, 314, 1056, 436, 372, 376, 3101, 1125, 340, 314, 2741, 922, 63, 344, 272, 365, 440, 314, 2011, 465, 314, 15418, 402, 314, 5544, 18788, 922, 14, 272, 961, 365, 440, 282, 7531, 465, 781, 15026, 1929, 370, 675, 652, 315, 314, 2455, 14, 339, 520, 635, 922, 63, 344, 26, 15418, 402, 314, 922, 626, 642, 2073, 15006, 370, 272, 520, 635, 2004, 63, 600, 26, 4879, 2004, 1233, 402, 314, 1125, 272, 408, 272, 340, 440, 365, 63, 7191, 63, 751, 8, 751, 63, 344, 304, 267, 12004, 8, 1205, 63, 600, 9, 421, 199, 318, 365, 63, 7191, 63, 751, 8, 751, 63, 344, 26, 1109, 9, 1035, 2155, 26, 272, 408, 272, 13813, 340, 2741, 13448, 365, 367, 2011, 2876, 465, 922, 63, 344, 14, 272, 961, 365, 440, 282, 7531, 465, 781, 15026, 1929, 370, 675, 652, 315, 314, 2455, 14, 339, 520, 635, 922, 63, 344, 26, 15418, 402, 314, 922, 626, 642, 2073, 15006, 370, 272, 520, 466, 922, 63, 344, 26, 1109, 272, 408, 272, 340, 1453, 63, 751, 14, 1989, 63, 3756, 480, 2113, 2349, 267, 372, 715, 272, 916, 1453, 63, 751, 14, 374, 63, 12177, 26, 267, 372, 1109, 8, 1818, 63, 751, 14, 362, 63, 344, 1012, 508, 922, 63, 344, 272, 916, 1056, 14, 15846, 26, 267, 340, 485, 1074, 63, 1014, 63, 1178, 837, 288, 372, 1109, 8, 1818, 63, 751, 14, 362, 63, 344, 1012, 508, 922, 63, 344, 272, 372, 756, 421, 199, 318, 4409, 63, 14829, 63, 1246, 63, 498, 8, 1532, 304, 272, 408, 272, 15127, 626, 282, 1056, 3509, 282, 1686, 445, 12758, 3261, 9301, 14, 272, 5972, 675, 367, 19818, 3423, 626, 787, 440, 6391, 22829, 1009, 14, 339, 3254, 26, 961, 1077, 506, 25072, 367, 282, 1655, 11153, 8744, 14, 272, 408, 339, 768, 17869, 14, 13582, 8, 1532, 9, 272, 347, 4816, 2031, 589, 12, 1011, 958, 304, 267, 19818, 63, 498, 275, 1145, 14, 888, 14, 362, 480, 2944, 615, 63, 3735, 63, 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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import request from flask_pymongo import PyMongo app = Flask(__name__) # Get mongodb configurations app.config['MONGO_DBNAME'] = os.getenv('MONGO_DBNAME', 'coopdb') app.config['MONGO_URI'] = ('mongodb://%s:%s/restdb', os.getenv('PYTHON_COOP_STORE_DB_SERVICE_HOST', 'localhost'), os.getenv('PYTHON_COOP_STORE_DB_SERVICE_PORT')) mongo = PyMongo(app) @app.route('/star', methods=['GET']) def get_all_stars(): star = mongo.db.stars output = [] for s in star.find(): output.append({'name' : s['name'], 'distance' : s['distance']}) return jsonify({'result' : output}) @app.route('/star/', methods=['GET']) def get_one_star(name): star = mongo.db.stars s = star.find_one({'name' : name}) if s: output = {'name' : s['name'], 'distance' : s['distance']} else: output = "No such name" return jsonify({'result' : output}) @app.route('/star', methods=['POST']) def add_star(): star = mongo.db.stars name = request.json['name'] distance = request.json['distance'] star_id = star.insert({'name': name, 'distance': distance}) new_star = star.find_one({'_id': star_id }) output = {'name' : new_star['name'], 'distance' : new_star['distance']} return jsonify({'result' : output}) if __name__ == '__main__': app.run(host=os.getenv('PYTHON_COOP_STORE_SERVICE_HOST', '0.0.0.0'), port=int(os.getenv('PYTHON_COOP_STORE_SERVICE_PORT_HTTP', 8080)))
mit
[ 3, 512, 411, 63, 13243, 14, 647, 199, 646, 747, 199, 504, 7209, 492, 16704, 199, 504, 7209, 492, 23819, 199, 504, 7209, 492, 1056, 199, 504, 7209, 63, 29380, 492, 1611, 20393, 199, 199, 571, 275, 16704, 3460, 354, 3368, 199, 199, 3, 2372, 32315, 13152, 13422, 199, 571, 14, 888, 459, 45, 26477, 63, 2846, 2339, 418, 275, 747, 14, 12959, 360, 45, 26477, 63, 2846, 2339, 297, 283, 331, 411, 697, 358, 199, 571, 14, 888, 459, 45, 26477, 63, 7639, 418, 275, 661, 22130, 13152, 13827, 83, 2689, 83, 15, 3911, 697, 297, 2574, 747, 14, 12959, 360, 11720, 63, 1439, 1938, 63, 16169, 63, 2846, 63, 10486, 63, 5449, 297, 3660, 283, 5967, 659, 2574, 747, 14, 12959, 360, 11720, 63, 1439, 1938, 63, 16169, 63, 2846, 63, 10486, 63, 3657, 1333, 199, 199, 9217, 275, 1611, 20393, 8, 571, 9, 199, 199, 32, 571, 14, 4449, 2336, 7848, 297, 3102, 2968, 2970, 1105, 199, 318, 664, 63, 452, 63, 270, 4291, 837, 523, 14664, 275, 18006, 14, 697, 14, 270, 4291, 523, 1072, 275, 942, 523, 367, 308, 315, 14664, 14, 1623, 837, 272, 1072, 14, 740, 3252, 354, 7, 520, 308, 459, 354, 995, 283, 5590, 7, 520, 308, 459, 5590, 13678, 523, 372, 23819, 3252, 1099, 7, 520, 1072, 1552, 199, 199, 32, 571, 14, 4449, 2336, 7848, 3678, 3102, 2968, 2970, 1105, 199, 318, 664, 63, 368, 63, 7848, 8, 354, 304, 523, 14664, 275, 18006, 14, 697, 14, 270, 4291, 523, 308, 275, 14664, 14, 1623, 63, 368, 3252, 354, 7, 520, 536, 1552, 523, 340, 308, 26, 272, 1072, 275, 791, 354, 7, 520, 308, 459, 354, 995, 283, 5590, 7, 520, 308, 459, 5590, 12074, 523, 587, 26, 272, 1072, 275, 298, 1944, 4066, 536, 2, 523, 372, 23819, 3252, 1099, 7, 520, 1072, 1552, 199, 199, 32, 571, 14, 4449, 2336, 7848, 297, 3102, 2968, 4030, 1105, 199, 318, 1050, 63, 7848, 837, 523, 14664, 275, 18006, 14, 697, 14, 270, 4291, 523, 536, 275, 1056, 14, 1001, 459, 354, 418, 523, 6033, 275, 1056, 14, 1001, 459, 5590, 418, 523, 14664, 63, 344, 275, 14664, 14, 3176, 3252, 354, 356, 536, 12, 283, 5590, 356, 6033, 1552, 523, 892, 63, 7848, 275, 14664, 14, 1623, 63, 368, 3252, 63, 344, 356, 14664, 63, 344, 3828, 523, 1072, 275, 791, 354, 7, 520, 892, 63, 7848, 459, 354, 995, 283, 5590, 7, 520, 892, 63, 7848, 459, 5590, 12074, 523, 372, 23819, 3252, 1099, 7, 520, 1072, 1552, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 1145, 14, 1065, 8, 1102, 29, 736, 14, 12959, 360, 11720, 63, 1439, 1938, 63, 16169, 63, 10486, 63, 5449, 297, 283, 16, 14, 16, 14, 16, 14, 16, 659, 288, 1844, 29, 442, 8, 736, 14, 12959, 360, 11720, 63, 1439, 1938, 63, 16169, 63, 10486, 63, 3657, 63, 2856, 297, 30220, 1724, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 512, 411, 63, 13243, 14, 647, 199, 646, 747, 199, 504, 7209, 492, 16704, 199, 504, 7209, 492, 23819, 199, 504, 7209, 492, 1056, 199, 504, 7209, 63, 29380, 492, 1611, 20393, 199, 199, 571, 275, 16704, 3460, 354, 3368, 199, 199, 3, 2372, 32315, 13152, 13422, 199, 571, 14, 888, 459, 45, 26477, 63, 2846, 2339, 418, 275, 747, 14, 12959, 360, 45, 26477, 63, 2846, 2339, 297, 283, 331, 411, 697, 358, 199, 571, 14, 888, 459, 45, 26477, 63, 7639, 418, 275, 661, 22130, 13152, 13827, 83, 2689, 83, 15, 3911, 697, 297, 2574, 747, 14, 12959, 360, 11720, 63, 1439, 1938, 63, 16169, 63, 2846, 63, 10486, 63, 5449, 297, 3660, 283, 5967, 659, 2574, 747, 14, 12959, 360, 11720, 63, 1439, 1938, 63, 16169, 63, 2846, 63, 10486, 63, 3657, 1333, 199, 199, 9217, 275, 1611, 20393, 8, 571, 9, 199, 199, 32, 571, 14, 4449, 2336, 7848, 297, 3102, 2968, 2970, 1105, 199, 318, 664, 63, 452, 63, 270, 4291, 837, 523, 14664, 275, 18006, 14, 697, 14, 270, 4291, 523, 1072, 275, 942, 523, 367, 308, 315, 14664, 14, 1623, 837, 272, 1072, 14, 740, 3252, 354, 7, 520, 308, 459, 354, 995, 283, 5590, 7, 520, 308, 459, 5590, 13678, 523, 372, 23819, 3252, 1099, 7, 520, 1072, 1552, 199, 199, 32, 571, 14, 4449, 2336, 7848, 3678, 3102, 2968, 2970, 1105, 199, 318, 664, 63, 368, 63, 7848, 8, 354, 304, 523, 14664, 275, 18006, 14, 697, 14, 270, 4291, 523, 308, 275, 14664, 14, 1623, 63, 368, 3252, 354, 7, 520, 536, 1552, 523, 340, 308, 26, 272, 1072, 275, 791, 354, 7, 520, 308, 459, 354, 995, 283, 5590, 7, 520, 308, 459, 5590, 12074, 523, 587, 26, 272, 1072, 275, 298, 1944, 4066, 536, 2, 523, 372, 23819, 3252, 1099, 7, 520, 1072, 1552, 199, 199, 32, 571, 14, 4449, 2336, 7848, 297, 3102, 2968, 4030, 1105, 199, 318, 1050, 63, 7848, 837, 523, 14664, 275, 18006, 14, 697, 14, 270, 4291, 523, 536, 275, 1056, 14, 1001, 459, 354, 418, 523, 6033, 275, 1056, 14, 1001, 459, 5590, 418, 523, 14664, 63, 344, 275, 14664, 14, 3176, 3252, 354, 356, 536, 12, 283, 5590, 356, 6033, 1552, 523, 892, 63, 7848, 275, 14664, 14, 1623, 63, 368, 3252, 63, 344, 356, 14664, 63, 344, 3828, 523, 1072, 275, 791, 354, 7, 520, 892, 63, 7848, 459, 354, 995, 283, 5590, 7, 520, 892, 63, 7848, 459, 5590, 12074, 523, 372, 23819, 3252, 1099, 7, 520, 1072, 1552, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 1145, 14, 1065, 8, 1102, 29, 736, 14, 12959, 360, 11720, 63, 1439, 1938, 63, 16169, 63, 10486, 63, 5449, 297, 283, 16, 14, 16, 14, 16, 14, 16, 659, 288, 1844, 29, 442, 8, 736, 14, 12959, 360, 11720, 63, 1439, 1938, 63, 16169, 63, 10486, 63, 3657, 63, 2856, 297, 30220, 1724, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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 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, 0 ]
noironetworks/heat
heat/engine/resources/signal_responder.py
1
15471
# # 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 keystoneclient.contrib.ec2 import utils as ec2_utils from oslo_config import cfg from oslo_log import log as logging from oslo_serialization import jsonutils from six.moves.urllib import parse as urlparse from heat.common import exception from heat.common.i18n import _ from heat.common import password_gen from heat.engine.clients.os import swift from heat.engine.resources import stack_user LOG = logging.getLogger(__name__) SIGNAL_TYPES = ( WAITCONDITION, SIGNAL ) = ( '/waitcondition', '/signal' ) SIGNAL_VERB = {WAITCONDITION: 'PUT', SIGNAL: 'POST'} class SignalResponder(stack_user.StackUser): PROPERTIES = ( SIGNAL_TRANSPORT, ) = ( 'signal_transport', ) ATTRIBUTES = ( SIGNAL_ATTR, ) = ( 'signal', ) # Anything which subclasses this may trigger authenticated # API operations as a consequence of handling a signal requires_deferred_auth = True def handle_delete(self): self._delete_signals() return super(SignalResponder, self).handle_delete() def _delete_signals(self): self._delete_ec2_signed_url() self._delete_heat_signal_url() self._delete_swift_signal_url() self._delete_zaqar_signal_queue() @property def password(self): return self.data().get('password') @password.setter def password(self, password): if password is None: self.data_delete('password') else: self.data_set('password', password, True) def _signal_transport_cfn(self): return self.properties[ self.SIGNAL_TRANSPORT] == self.CFN_SIGNAL def _signal_transport_heat(self): return self.properties[ self.SIGNAL_TRANSPORT] == self.HEAT_SIGNAL def _signal_transport_none(self): return self.properties[ self.SIGNAL_TRANSPORT] == self.NO_SIGNAL def _signal_transport_temp_url(self): return self.properties[ self.SIGNAL_TRANSPORT] == self.TEMP_URL_SIGNAL def _signal_transport_zaqar(self): return self.properties.get( self.SIGNAL_TRANSPORT) == self.ZAQAR_SIGNAL def _get_heat_signal_credentials(self): """Return OpenStack credentials that can be used to send a signal. These credentials are for the user associated with this resource in the heat stack user domain. """ if self._get_user_id() is None: if self.password is None: self.password = password_gen.generate_openstack_password() self._create_user() return {'auth_url': self.keystone().v3_endpoint, 'username': self.physical_resource_name(), 'user_id': self._get_user_id(), 'password': self.password, 'project_id': self.stack.stack_user_project_id, 'domain_id': self.keystone().stack_domain_id, 'region_name': (self.context.region_name or cfg.CONF.region_name_for_services)} def _get_ec2_signed_url(self, signal_type=SIGNAL): """Create properly formatted and pre-signed URL. This uses the created user for the credentials. See boto/auth.py::QuerySignatureV2AuthHandler :param signal_type: either WAITCONDITION or SIGNAL. """ stored = self.data().get('ec2_signed_url') if stored is not None: return stored access_key = self.data().get('access_key') secret_key = self.data().get('secret_key') if not access_key or not secret_key: if self.id is None: # it is too early return if self._get_user_id() is None: self._create_user() self._create_keypair() access_key = self.data().get('access_key') secret_key = self.data().get('secret_key') if not access_key or not secret_key: LOG.warning('Cannot generate signed url, ' 'unable to create keypair') return config_url = cfg.CONF.heat_waitcondition_server_url if config_url: signal_url = config_url.replace('/waitcondition', signal_type) else: heat_client_plugin = self.stack.clients.client_plugin('heat') endpoint = heat_client_plugin.get_heat_cfn_url() signal_url = ''.join([endpoint, signal_type]) host_url = urlparse.urlparse(signal_url) path = self.identifier().arn_url_path() # Note the WSGI spec apparently means that the webob request we end up # processing in the CFN API (ec2token.py) has an unquoted path, so we # need to calculate the signature with the path component unquoted, but # ensure the actual URL contains the quoted version... unquoted_path = urlparse.unquote(host_url.path + path) request = {'host': host_url.netloc.lower(), 'verb': SIGNAL_VERB[signal_type], 'path': unquoted_path, 'params': {'SignatureMethod': 'HmacSHA256', 'SignatureVersion': '2', 'AWSAccessKeyId': access_key, 'Timestamp': self.created_time.strftime("%Y-%m-%dT%H:%M:%SZ") }} # Sign the request signer = ec2_utils.Ec2Signer(secret_key) request['params']['Signature'] = signer.generate(request) qs = urlparse.urlencode(request['params']) url = "%s%s?%s" % (signal_url.lower(), path, qs) self.data_set('ec2_signed_url', url) return url def _delete_ec2_signed_url(self): self.data_delete('ec2_signed_url') self._delete_keypair() def _get_heat_signal_url(self, project_id=None): """Return a heat-api signal URL for this resource. This URL is not pre-signed, valid user credentials are required. If a project_id is provided, it is used in place of the original project_id. This is useful to generate a signal URL that uses the heat stack user project instead of the user's. """ stored = self.data().get('heat_signal_url') if stored is not None: return stored if self.id is None: # it is too early return url = self.client_plugin('heat').get_heat_url() path = self.identifier().url_path() if project_id is not None: path = project_id + path[path.find('/'):] url = urlparse.urljoin(url, '%s/signal' % path) self.data_set('heat_signal_url', url) return url def _delete_heat_signal_url(self): self.data_delete('heat_signal_url') def _get_swift_signal_url(self, multiple_signals=False): """Create properly formatted and pre-signed Swift signal URL. This uses a Swift pre-signed temp_url. If multiple_signals is requested, the Swift object referenced by the returned URL will have versioning enabled. """ put_url = self.data().get('swift_signal_url') if put_url: return put_url if self.id is None: # it is too early return container = self.stack.id object_name = self.physical_resource_name() self.client('swift').put_container(container) if multiple_signals: put_url = self.client_plugin('swift').get_signal_url(container, object_name) else: put_url = self.client_plugin('swift').get_temp_url(container, object_name) self.client('swift').put_object(container, object_name, '') self.data_set('swift_signal_url', put_url) self.data_set('swift_signal_object_name', object_name) return put_url def _delete_swift_signal_url(self): object_name = self.data().get('swift_signal_object_name') if not object_name: return with self.client_plugin('swift').ignore_not_found: container_name = self.stack.id swift = self.client('swift') # delete all versions of the object, in case there are some # signals that are waiting to be handled container = swift.get_container(container_name) filtered = [obj for obj in container[1] if object_name in obj['name']] for obj in filtered: # we delete the main object every time, swift takes # care of restoring the previous version after each delete swift.delete_object(container_name, object_name) headers = swift.head_container(container_name) if int(headers['x-container-object-count']) == 0: swift.delete_container(container_name) self.data_delete('swift_signal_object_name') self.data_delete('swift_signal_url') def _get_zaqar_signal_queue_id(self): """Return a zaqar queue_id for signaling this resource. This uses the created user for the credentials. """ queue_id = self.data().get('zaqar_signal_queue_id') if queue_id: return queue_id if self.id is None: # it is too early return if self._get_user_id() is None: if self.password is None: self.password = password_gen.generate_openstack_password() self._create_user() queue_id = self.physical_resource_name() zaqar_plugin = self.client_plugin('zaqar') zaqar = zaqar_plugin.create_for_tenant( self.stack.stack_user_project_id, self._user_token()) queue = zaqar.queue(queue_id) signed_url_data = queue.signed_url( ['messages'], methods=['GET', 'DELETE']) self.data_set('zaqar_queue_signed_url_data', jsonutils.dumps(signed_url_data)) self.data_set('zaqar_signal_queue_id', queue_id) return queue_id def _delete_zaqar_signal_queue(self): queue_id = self.data().get('zaqar_signal_queue_id') if not queue_id: return zaqar_plugin = self.client_plugin('zaqar') zaqar = zaqar_plugin.create_for_tenant( self.stack.stack_user_project_id, self._user_token()) with zaqar_plugin.ignore_not_found: zaqar.queue(queue_id).delete() self.data_delete('zaqar_signal_queue_id') def _get_signal(self, signal_type=SIGNAL, multiple_signals=False): """Return a dictionary with signal details. Subclasses can invoke this method to retrieve information of the resource signal for the specified transport. """ signal = None if self._signal_transport_cfn(): signal = {'alarm_url': self._get_ec2_signed_url( signal_type=signal_type)} elif self._signal_transport_heat(): signal = self._get_heat_signal_credentials() signal['alarm_url'] = self._get_heat_signal_url( project_id=self.stack.stack_user_project_id) elif self._signal_transport_temp_url(): signal = {'alarm_url': self._get_swift_signal_url( multiple_signals=multiple_signals)} elif self._signal_transport_zaqar(): signal = self._get_heat_signal_credentials() signal['queue_id'] = self._get_zaqar_signal_queue_id() elif self._signal_transport_none(): signal = {} return signal def _service_swift_signal(self): swift_client = self.client('swift') try: container = swift_client.get_container(self.stack.id) except Exception as exc: self.client_plugin('swift').ignore_not_found(exc) LOG.debug("Swift container %s was not found", self.stack.id) return index = container[1] if not index: # Swift objects were deleted by user LOG.debug("Swift objects in container %s were not found", self.stack.id) return # Remove objects that are for other resources, given that # multiple swift signals in the same stack share a container object_name = self.physical_resource_name() filtered = [obj for obj in index if object_name in obj['name']] # Fetch objects from Swift and filter results signal_names = [] for obj in filtered: try: signal = swift_client.get_object(self.stack.id, obj['name']) except Exception as exc: self.client_plugin('swift').ignore_not_found(exc) continue body = signal[1] if body == swift.IN_PROGRESS: # Ignore the initial object continue signal_names.append(obj['name']) if body == "": self.signal(details={}) continue try: self.signal(details=jsonutils.loads(body)) except ValueError: raise exception.Error(_("Failed to parse JSON data: %s") % body) # remove the signals that were consumed for signal_name in signal_names: if signal_name != object_name: swift_client.delete_object(self.stack.id, signal_name) if object_name in signal_names: swift_client.delete_object(self.stack.id, object_name) def _service_zaqar_signal(self): zaqar_plugin = self.client_plugin('zaqar') zaqar = zaqar_plugin.create_for_tenant( self.stack.stack_user_project_id, self._user_token()) try: queue = zaqar.queue(self._get_zaqar_signal_queue_id()) except Exception as ex: self.client_plugin('zaqar').ignore_not_found(ex) return messages = list(queue.pop()) for message in messages: self.signal(details=message.body) def _service_signal(self): """Service the signal, when necessary. This method must be called repeatedly by subclasses to update the state of the signals that require polling, which are the ones based on Swift temp URLs and Zaqar queues. The "NO_SIGNAL" case is also handled here by triggering the signal once per call. """ if self._signal_transport_temp_url(): self._service_swift_signal() elif self._signal_transport_zaqar(): self._service_zaqar_signal() elif self._signal_transport_none(): self.signal(details={})
apache-2.0
[ 3, 199, 3, 259, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 259, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 259, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 260, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 259, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 259, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 259, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 259, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 259, 1334, 314, 844, 14, 199, 199, 504, 19395, 1258, 14, 2828, 14, 825, 18, 492, 3778, 465, 7062, 18, 63, 1208, 199, 504, 11258, 63, 888, 492, 4810, 199, 504, 11258, 63, 793, 492, 943, 465, 2050, 199, 504, 11258, 63, 12161, 492, 18705, 199, 504, 3816, 14, 4912, 14, 4078, 492, 2198, 465, 7097, 199, 199, 504, 20408, 14, 2330, 492, 1919, 199, 504, 20408, 14, 2330, 14, 73, 1085, 78, 492, 485, 199, 504, 20408, 14, 2330, 492, 2505, 63, 2268, 199, 504, 20408, 14, 3908, 14, 14555, 14, 736, 492, 16275, 199, 504, 20408, 14, 3908, 14, 4435, 492, 3464, 63, 751, 199, 199, 4947, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 16496, 63, 7893, 275, 334, 272, 644, 33, 649, 1864, 31247, 12, 24360, 199, 9, 275, 334, 272, 1994, 2573, 5394, 297, 1994, 4653, 7, 199, 9, 199, 16496, 63, 2111, 34, 275, 469, 12458, 1864, 31247, 26, 283, 4013, 297, 2049, 24360, 26, 283, 4030, 936, 421, 199, 533, 18288, 1322, 23621, 8, 2340, 63, 751, 14, 4851, 1899, 304, 339, 3611, 4227, 29807, 275, 334, 267, 24360, 63, 12191, 3657, 12, 272, 776, 275, 334, 267, 283, 4653, 63, 5545, 297, 272, 776, 339, 10762, 16883, 275, 334, 267, 24360, 63, 5280, 12, 272, 776, 275, 334, 267, 283, 4653, 297, 272, 776, 339, 327, 6184, 2127, 1314, 9180, 642, 1443, 6804, 15082, 272, 327, 3261, 5331, 465, 282, 406, 4041, 402, 7252, 282, 4673, 272, 5074, 63, 12116, 63, 1178, 275, 715, 339, 347, 2429, 63, 1807, 8, 277, 304, 267, 291, 423, 1807, 63, 10458, 342, 267, 372, 1613, 8, 11274, 1322, 23621, 12, 291, 680, 2479, 63, 1807, 342, 339, 347, 485, 1807, 63, 10458, 8, 277, 304, 267, 291, 423, 1807, 63, 825, 18, 63, 1737, 63, 633, 342, 267, 291, 423, 1807, 63, 16614, 63, 4653, 63, 633, 342, 267, 291, 423, 1807, 63, 13215, 63, 4653, 63, 633, 342, 267, 291, 423, 1807, 63, 8076, 81, 285, 63, 4653, 63, 1825, 342, 339, 768, 1829, 272, 347, 2505, 8, 277, 304, 267, 372, 291, 14, 576, 1252, 362, 360, 2060, 358, 339, 768, 2060, 14, 8345, 272, 347, 2505, 8, 277, 12, 2505, 304, 267, 340, 2505, 365, 488, 26, 288, 291, 14, 576, 63, 1807, 360, 2060, 358, 267, 587, 26, 288, 291, 14, 576, 63, 409, 360, 2060, 297, 2505, 12, 715, 9, 339, 347, 485, 4653, 63, 5545, 63, 2177, 78, 8, 277, 304, 267, 372, 291, 14, 3282, 59, 288, 291, 14, 16496, 63, 12191, 3657, 61, 508, 291, 14, 35, 4963, 63, 16496, 339, 347, 485, 4653, 63, 5545, 63, 16614, 8, 277, 304, 267, 372, 291, 14, 3282, 59, 288, 291, 14, 16496, 63, 12191, 3657, 61, 508, 291, 14, 1645, 619, 63, 16496, 339, 347, 485, 4653, 63, 5545, 63, 3592, 8, 277, 304, 267, 372, 291, 14, 3282, 59, 288, 291, 14, 16496, 63, 12191, 3657, 61, 508, 291, 14, 2826, 63, 16496, 339, 347, 485, 4653, 63, 5545, 63, 808, 63, 633, 8, 277, 304, 267, 372, 291, 14, 3282, 59, 288, 291, 14, 16496, 63, 12191, 3657, 61, 508, 291, 14, 12510, 63, 2632, 63, 16496, 339, 347, 485, 4653, 63, 5545, 63, 8076, 81, 285, 8, 277, 304, 267, 372, 291, 14, 3282, 14, 362, 8, 288, 291, 14, 16496, 63, 12191, 3657, 9, 508, 291, 14, 58, 20152, 689, 63, 16496, 339, 347, 485, 362, 63, 16614, 63, 4653, 63, 6942, 8, 277, 304, 267, 408, 1767, 14260, 6235, 626, 883, 506, 1202, 370, 3222, 282, 4673, 14, 398, 5723, 6235, 787, 367, 314, 922, 4568, 543, 642, 2073, 315, 267, 314, 20408, 3464, 922, 2881, 14, 267, 408, 267, 340, 291, 423, 362, 63, 751, 63, 344, 342, 365, 488, 26, 288, 340, 291, 14, 2060, 365, 488, 26, 355, 291, 14, 2060, 275, 2505, 63, 2268, 14, 4208, 63, 8512, 63, 2060, 342, 288, 291, 423, 981, 63, 751, 342, 267, 372, 791, 1178, 63, 633, 356, 291, 14, 19143, 1252, 86, 19, 63, 6520, 12, 355, 283, 2473, 356, 291, 14, 15020, 63, 1927, 63, 354, 1062, 355, 283, 751, 63, 344, 356, 291, 423, 362, 63, 751, 63, 344, 1062, 355, 283, 2060, 356, 291, 14, 2060, 12, 355, 283, 1715, 63, 344, 356, 291, 14, 2340, 14, 2340, 63, 751, 63, 1715, 63, 344, 12, 355, 283, 2261, 63, 344, 356, 291, 14, 19143, 1252, 2340, 63, 2261, 63, 344, 12, 355, 283, 4551, 63, 354, 356, 334, 277, 14, 1100, 14, 4551, 63, 354, 503, 1816, 4810, 14, 3103, 14, 4551, 63, 354, 63, 509, 63, 5950, 6769, 339, 347, 485, 362, 63, 825, 18, 63, 1737, 63, 633, 8, 277, 12, 4673, 63, 466, 29, 16496, 304, 267, 408, 2499, 7684, 7871, 436, 876, 13, 1737, 2851, 14, 398, 961, 4440, 314, 2737, 922, 367, 314, 6235, 14, 398, 1666, 6055, 15, 1178, 14, 647, 447, 3227, 10014, 54, 18, 21547, 398, 520, 635, 4673, 63, 466, 26, 1902, 644, 33, 649, 1864, 31247, 503, 24360, 14, 267, 408, 267, 5489, 275, 291, 14, 576, 1252, 362, 360, 825, 18, 63, 1737, 63, 633, 358, 267, 340, 5489, 365, 440, 488, 26, 288, 372, 5489, 398, 2879, 63, 498, 275, 291, 14, 576, 1252, 362, 360, 2732, 63, 498, 358, 267, 7565, 63, 498, 275, 291 ]
[ 199, 3, 259, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 259, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 259, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 260, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 259, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 259, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 259, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 259, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 259, 1334, 314, 844, 14, 199, 199, 504, 19395, 1258, 14, 2828, 14, 825, 18, 492, 3778, 465, 7062, 18, 63, 1208, 199, 504, 11258, 63, 888, 492, 4810, 199, 504, 11258, 63, 793, 492, 943, 465, 2050, 199, 504, 11258, 63, 12161, 492, 18705, 199, 504, 3816, 14, 4912, 14, 4078, 492, 2198, 465, 7097, 199, 199, 504, 20408, 14, 2330, 492, 1919, 199, 504, 20408, 14, 2330, 14, 73, 1085, 78, 492, 485, 199, 504, 20408, 14, 2330, 492, 2505, 63, 2268, 199, 504, 20408, 14, 3908, 14, 14555, 14, 736, 492, 16275, 199, 504, 20408, 14, 3908, 14, 4435, 492, 3464, 63, 751, 199, 199, 4947, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 16496, 63, 7893, 275, 334, 272, 644, 33, 649, 1864, 31247, 12, 24360, 199, 9, 275, 334, 272, 1994, 2573, 5394, 297, 1994, 4653, 7, 199, 9, 199, 16496, 63, 2111, 34, 275, 469, 12458, 1864, 31247, 26, 283, 4013, 297, 2049, 24360, 26, 283, 4030, 936, 421, 199, 533, 18288, 1322, 23621, 8, 2340, 63, 751, 14, 4851, 1899, 304, 339, 3611, 4227, 29807, 275, 334, 267, 24360, 63, 12191, 3657, 12, 272, 776, 275, 334, 267, 283, 4653, 63, 5545, 297, 272, 776, 339, 10762, 16883, 275, 334, 267, 24360, 63, 5280, 12, 272, 776, 275, 334, 267, 283, 4653, 297, 272, 776, 339, 327, 6184, 2127, 1314, 9180, 642, 1443, 6804, 15082, 272, 327, 3261, 5331, 465, 282, 406, 4041, 402, 7252, 282, 4673, 272, 5074, 63, 12116, 63, 1178, 275, 715, 339, 347, 2429, 63, 1807, 8, 277, 304, 267, 291, 423, 1807, 63, 10458, 342, 267, 372, 1613, 8, 11274, 1322, 23621, 12, 291, 680, 2479, 63, 1807, 342, 339, 347, 485, 1807, 63, 10458, 8, 277, 304, 267, 291, 423, 1807, 63, 825, 18, 63, 1737, 63, 633, 342, 267, 291, 423, 1807, 63, 16614, 63, 4653, 63, 633, 342, 267, 291, 423, 1807, 63, 13215, 63, 4653, 63, 633, 342, 267, 291, 423, 1807, 63, 8076, 81, 285, 63, 4653, 63, 1825, 342, 339, 768, 1829, 272, 347, 2505, 8, 277, 304, 267, 372, 291, 14, 576, 1252, 362, 360, 2060, 358, 339, 768, 2060, 14, 8345, 272, 347, 2505, 8, 277, 12, 2505, 304, 267, 340, 2505, 365, 488, 26, 288, 291, 14, 576, 63, 1807, 360, 2060, 358, 267, 587, 26, 288, 291, 14, 576, 63, 409, 360, 2060, 297, 2505, 12, 715, 9, 339, 347, 485, 4653, 63, 5545, 63, 2177, 78, 8, 277, 304, 267, 372, 291, 14, 3282, 59, 288, 291, 14, 16496, 63, 12191, 3657, 61, 508, 291, 14, 35, 4963, 63, 16496, 339, 347, 485, 4653, 63, 5545, 63, 16614, 8, 277, 304, 267, 372, 291, 14, 3282, 59, 288, 291, 14, 16496, 63, 12191, 3657, 61, 508, 291, 14, 1645, 619, 63, 16496, 339, 347, 485, 4653, 63, 5545, 63, 3592, 8, 277, 304, 267, 372, 291, 14, 3282, 59, 288, 291, 14, 16496, 63, 12191, 3657, 61, 508, 291, 14, 2826, 63, 16496, 339, 347, 485, 4653, 63, 5545, 63, 808, 63, 633, 8, 277, 304, 267, 372, 291, 14, 3282, 59, 288, 291, 14, 16496, 63, 12191, 3657, 61, 508, 291, 14, 12510, 63, 2632, 63, 16496, 339, 347, 485, 4653, 63, 5545, 63, 8076, 81, 285, 8, 277, 304, 267, 372, 291, 14, 3282, 14, 362, 8, 288, 291, 14, 16496, 63, 12191, 3657, 9, 508, 291, 14, 58, 20152, 689, 63, 16496, 339, 347, 485, 362, 63, 16614, 63, 4653, 63, 6942, 8, 277, 304, 267, 408, 1767, 14260, 6235, 626, 883, 506, 1202, 370, 3222, 282, 4673, 14, 398, 5723, 6235, 787, 367, 314, 922, 4568, 543, 642, 2073, 315, 267, 314, 20408, 3464, 922, 2881, 14, 267, 408, 267, 340, 291, 423, 362, 63, 751, 63, 344, 342, 365, 488, 26, 288, 340, 291, 14, 2060, 365, 488, 26, 355, 291, 14, 2060, 275, 2505, 63, 2268, 14, 4208, 63, 8512, 63, 2060, 342, 288, 291, 423, 981, 63, 751, 342, 267, 372, 791, 1178, 63, 633, 356, 291, 14, 19143, 1252, 86, 19, 63, 6520, 12, 355, 283, 2473, 356, 291, 14, 15020, 63, 1927, 63, 354, 1062, 355, 283, 751, 63, 344, 356, 291, 423, 362, 63, 751, 63, 344, 1062, 355, 283, 2060, 356, 291, 14, 2060, 12, 355, 283, 1715, 63, 344, 356, 291, 14, 2340, 14, 2340, 63, 751, 63, 1715, 63, 344, 12, 355, 283, 2261, 63, 344, 356, 291, 14, 19143, 1252, 2340, 63, 2261, 63, 344, 12, 355, 283, 4551, 63, 354, 356, 334, 277, 14, 1100, 14, 4551, 63, 354, 503, 1816, 4810, 14, 3103, 14, 4551, 63, 354, 63, 509, 63, 5950, 6769, 339, 347, 485, 362, 63, 825, 18, 63, 1737, 63, 633, 8, 277, 12, 4673, 63, 466, 29, 16496, 304, 267, 408, 2499, 7684, 7871, 436, 876, 13, 1737, 2851, 14, 398, 961, 4440, 314, 2737, 922, 367, 314, 6235, 14, 398, 1666, 6055, 15, 1178, 14, 647, 447, 3227, 10014, 54, 18, 21547, 398, 520, 635, 4673, 63, 466, 26, 1902, 644, 33, 649, 1864, 31247, 503, 24360, 14, 267, 408, 267, 5489, 275, 291, 14, 576, 1252, 362, 360, 825, 18, 63, 1737, 63, 633, 358, 267, 340, 5489, 365, 440, 488, 26, 288, 372, 5489, 398, 2879, 63, 498, 275, 291, 14, 576, 1252, 362, 360, 2732, 63, 498, 358, 267, 7565, 63, 498, 275, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
alexanderfefelov/nav
python/nav/web/geomap/coordinates.py
1
10124
# # Copyright (C) 2009, 2010 UNINETT AS # # This file is part of Network Administration Visualized (NAV). # # NAV is free software: you can redistribute it and/or modify it under the # terms of the GNU General Public License version 2 as published by the Free # Software Foundation. # # 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 NAV. If not, see <http://www.gnu.org/licenses/>. # """Coordinate transformation. Functions for converting between UTM and longitude/latitude, and for parsing a string representation of UTM. Derived from code available under GPL from http://pygps.org/ (http://pygps.org/LatLongUTMconversion-1.2.tar.gz) """ from math import pi, sin, cos, tan, sqrt import re _deg2rad = pi / 180.0 _rad2deg = 180.0 / pi _equatorial_radius = 2 _eccentricity_squared = 3 _ellipsoid = [ # id, Ellipsoid name, Equatorial Radius, square of eccentricity # first once is a placeholder only, To allow array indices to match id numbers [ -1, "Placeholder", 0, 0], [ 1, "Airy", 6377563, 0.00667054], [ 2, "Australian National", 6378160, 0.006694542], [ 3, "Bessel 1841", 6377397, 0.006674372], [ 4, "Bessel 1841 (Nambia] ", 6377484, 0.006674372], [ 5, "Clarke 1866", 6378206, 0.006768658], [ 6, "Clarke 1880", 6378249, 0.006803511], [ 7, "Everest", 6377276, 0.006637847], [ 8, "Fischer 1960 (Mercury] ", 6378166, 0.006693422], [ 9, "Fischer 1968", 6378150, 0.006693422], [ 10, "GRS 1967", 6378160, 0.006694605], [ 11, "GRS 1980", 6378137, 0.00669438], [ 12, "Helmert 1906", 6378200, 0.006693422], [ 13, "Hough", 6378270, 0.00672267], [ 14, "International", 6378388, 0.00672267], [ 15, "Krassovsky", 6378245, 0.006693422], [ 16, "Modified Airy", 6377340, 0.00667054], [ 17, "Modified Everest", 6377304, 0.006637847], [ 18, "Modified Fischer 1960", 6378155, 0.006693422], [ 19, "South American 1969", 6378160, 0.006694542], [ 20, "WGS 60", 6378165, 0.006693422], [ 21, "WGS 66", 6378145, 0.006694542], [ 22, "WGS-72", 6378135, 0.006694318], [ 23, "WGS-84", 6378137, 0.00669438] ] #Reference ellipsoids derived from Peter H. Dana's website- #http://www.utexas.edu/depts/grg/gcraft/notes/datum/elist.html #Department of Geography, University of Texas at Austin #Internet: pdana@mail.utexas.edu #3/22/95 #Source #Defense Mapping Agency. 1987b. DMA Technical Report: Supplement to Department of Defense World Geodetic System #1984 Technical Report. Part I and II. Washington, DC: Defense Mapping Agency def ll_to_utm(reference_ellipsoid, lat, lon, zone = None): """converts lat/long to UTM coords. Equations from USGS Bulletin 1532 East Longitudes are positive, West longitudes are negative. North latitudes are positive, South latitudes are negative lat and Long are in decimal degrees Written by Chuck Gantz- chuck.gantz@globalstar.com""" a = _ellipsoid[reference_ellipsoid][_equatorial_radius] ecc_squared = _ellipsoid[reference_ellipsoid][_eccentricity_squared] k0 = 0.9996 #Make sure the longitude is between -180.00 .. 179.9 lon_tmp = (lon+180)-int((lon+180)/360)*360-180 # -180.00 .. 179.9 lat_rad = lat*_deg2rad lon_rad = lon_tmp*_deg2rad if zone is None: zone_number = int((lon_tmp + 180)/6) + 1 else: zone_number = zone if lat >= 56.0 and lat < 64.0 and lon_tmp >= 3.0 and lon_tmp < 12.0: zone_number = 32 # Special zones for Svalbard if lat >= 72.0 and lat < 84.0: if lon_tmp >= 0.0 and lon_tmp < 9.0: zone_number = 31 elif lon_tmp >= 9.0 and lon_tmp < 21.0: zone_number = 33 elif lon_tmp >= 21.0 and lon_tmp < 33.0: zone_number = 35 elif lon_tmp >= 33.0 and lon_tmp < 42.0: zone_number = 37 lon_origin = (zone_number - 1)*6 - 180 + 3 #+3 puts origin in middle of zone lon_origin_rad = lon_origin * _deg2rad #compute the UTM Zone from the latitude and longitude utm_zone = "%d%c" % (zone_number, _utm_letter_designator(lat)) ecc_prime_squared = (ecc_squared)/(1-ecc_squared) N = a/sqrt(1-ecc_squared*sin(lat_rad)*sin(lat_rad)) T = tan(lat_rad)*tan(lat_rad) C = ecc_prime_squared*cos(lat_rad)*cos(lat_rad) A = cos(lat_rad)*(lon_rad-lon_origin_rad) M = a*((1 - ecc_squared/4 - 3*ecc_squared*ecc_squared/64 - 5*ecc_squared*ecc_squared*ecc_squared/256)*lat_rad - (3*ecc_squared/8 + 3*ecc_squared*ecc_squared/32 + 45*ecc_squared*ecc_squared*ecc_squared/1024)*sin(2*lat_rad) + (15*ecc_squared*ecc_squared/256 + 45*ecc_squared*ecc_squared*ecc_squared/1024)*sin(4*lat_rad) - (35*ecc_squared*ecc_squared*ecc_squared/3072)*sin(6*lat_rad)) utm_easting = (k0*N*(A+(1-T+C)*A*A*A/6 + (5-18*T+T*T+72*C-58*ecc_prime_squared)*A*A*A*A*A/120) + 500000.0) utm_northing = (k0*(M+N*tan(lat_rad)*(A*A/2+(5-T+9*C+4*C*C)*A*A*A*A/24 + (61 -58*T +T*T +600*C -330*ecc_prime_squared)*A*A*A*A*A*A/720))) if lat < 0: utm_northing = utm_northing + 10000000.0; #10000000 meter offset for southern hemisphere return (utm_zone, utm_easting, utm_northing) def _utm_letter_designator(lat): """This routine determines the correct UTM letter designator for the given latitude returns 'Z' if latitude is outside the UTM limits of 84N to 80S Written by Chuck Gantz- chuck.gantz@globalstar.com""" if 84 >= lat >= 72: return 'X' elif 72 > lat >= 64: return 'W' elif 64 > lat >= 56: return 'V' elif 56 > lat >= 48: return 'U' elif 48 > lat >= 40: return 'T' elif 40 > lat >= 32: return 'S' elif 32 > lat >= 24: return 'R' elif 24 > lat >= 16: return 'Q' elif 16 > lat >= 8: return 'P' elif 8 > lat >= 0: return 'N' elif 0 > lat >= -8: return 'M' elif -8 > lat >= -16: return 'L' elif -16 > lat >= -24: return 'K' elif -24 > lat >= -32: return 'J' elif -32 > lat >= -40: return 'H' elif -40 > lat >= -48: return 'G' elif -48 > lat >= -56: return 'F' elif -56 > lat >= -64: return 'E' elif -64 > lat >= -72: return 'D' elif -72 > lat >= -80: return 'C' else: return 'Z' # if the Latitude is outside the UTM limits def utm_to_ll(reference_ellipsoid, northing, easting, zone): """converts UTM coords to lat/long. Equations from USGS Bulletin 1532 East Longitudes are positive, West longitudes are negative. North latitudes are positive, South latitudes are negative lat and lon are in decimal degrees. Written by Chuck Gantz- chuck.gantz@globalstar.com Converted to Python by Russ Nelson <nelson@crynwr.com>""" k0 = 0.9996 a = _ellipsoid[reference_ellipsoid][_equatorial_radius] ecc_squared = _ellipsoid[reference_ellipsoid][_eccentricity_squared] e1 = (1-sqrt(1-ecc_squared))/(1+sqrt(1-ecc_squared)) #northern_hemisphere; //1 for northern hemispher, 0 for southern x = easting - 500000.0 #remove 500,000 meter offset for longitude y = northing zone_letter = zone[-1] zone_number = int(zone[:-1]) if zone_letter >= 'N': northern_hemisphere = 1 # point is in northern hemisphere else: northern_hemisphere = 0 # point is in southern hemisphere y -= 10000000.0 # remove 10,000,000 meter offset used for southern hemisphere lon_origin = (zone_number - 1)*6 - 180 + 3 # +3 puts origin in middle of zone ecc_prime_squared = (ecc_squared)/(1-ecc_squared) M = y / k0 mu = M/(a*(1-ecc_squared/4-3*ecc_squared*ecc_squared/64-5*ecc_squared*ecc_squared*ecc_squared/256)) phi1_rad = (mu + (3*e1/2-27*e1*e1*e1/32)*sin(2*mu) + (21*e1*e1/16-55*e1*e1*e1*e1/32)*sin(4*mu) +(151*e1*e1*e1/96)*sin(6*mu)) phi1 = phi1_rad*_rad2deg; N1 = a/sqrt(1-ecc_squared*sin(phi1_rad)*sin(phi1_rad)) T1 = tan(phi1_rad)*tan(phi1_rad) C1 = ecc_prime_squared*cos(phi1_rad)*cos(phi1_rad) R1 = a*(1-ecc_squared)/pow(1-ecc_squared*sin(phi1_rad)*sin(phi1_rad), 1.5) D = x/(N1*k0) lat = phi1_rad - (N1*tan(phi1_rad)/R1)*(D*D/2-(5+3*T1+10*C1-4*C1*C1-9*ecc_prime_squared)*D*D*D*D/24 +(61+90*T1+298*C1+45*T1*T1-252*ecc_prime_squared-3*C1*C1)*D*D*D*D*D*D/720) lat = lat * _rad2deg lon = (D-(1+2*T1+C1)*D*D*D/6+(5-2*C1+28*T1-3*C1*C1+8*ecc_prime_squared+24*T1*T1) *D*D*D*D*D/120)/cos(phi1_rad) lon = lon_origin + lon * _rad2deg return (lat, lon) def parse_utm(utm_str): """Parse UTM coordinates from a string. utm_str should be a string of the form 'zh n e', where z is a zone number, h a hemisphere identifier ('N' or 'S') and n and e the northing and easting. h may be omitted, in which case 'N' is assumed. Return value: dictionary with keys (zone, hemisphere, n, e). """ default_hemisphere = 'N' utm_re = (r'^\W*([0-9][0-9])([NS]?)\W+([0-9]*[.]?[0-9]+)\W+' r'([0-9]*[.]?[0-9]+)\W*$') m = re.match(utm_re, utm_str) if m is None: raise Exception('incorrectly formatted UTM string "' + utm_str) utm = {} utm['zone'] = int(m.group(1)) utm['hemisphere'] = m.group(2) if utm['hemisphere'] == '': utm['hemisphere'] = default_hemisphere utm['n'] = float(m.group(3)) utm['e'] = float(m.group(4)) return utm def utm_str_to_lonlat(utm_str): """Convert UTM coordinates in string form (see parse_utm) to a (longitude,latitude) pair. """ utm = parse_utm(utm_str) (lat, lon) = utm_to_ll(23, utm['n'], utm['e'], '%d%s'%(utm['zone'], utm['hemisphere'])) return (lon, lat)
gpl-2.0
[ 3, 199, 3, 1898, 334, 35, 9, 8937, 12, 7129, 6778, 11367, 52, 4319, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 7220, 9516, 4633, 14702, 1759, 334, 46, 6087, 680, 199, 3, 199, 3, 653, 6087, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 652, 1334, 314, 199, 3, 2895, 402, 314, 1664, 1696, 1684, 844, 1015, 499, 465, 3267, 701, 314, 2868, 199, 3, 2290, 2752, 14, 199, 3, 199, 3, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 2428, 199, 3, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 3169, 503, 199, 3, 3092, 2381, 437, 3115, 3104, 14, 1666, 314, 1664, 1696, 1684, 844, 367, 199, 3, 1655, 2436, 14, 221, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 199, 3, 844, 3180, 543, 653, 6087, 14, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 199, 624, 18017, 13315, 14, 199, 199, 13967, 367, 13806, 3382, 738, 20690, 436, 18154, 15, 13331, 12, 436, 367, 199, 11059, 282, 1059, 6025, 402, 738, 20690, 14, 199, 199, 17793, 12905, 687, 1233, 2808, 1334, 14629, 687, 1455, 921, 647, 25556, 14, 1308, 15, 199, 8, 1014, 921, 647, 25556, 14, 1308, 15, 22510, 9551, 934, 45, 15083, 13, 17, 14, 18, 14, 5369, 14, 6838, 9, 199, 199, 624, 199, 199, 504, 3473, 492, 6682, 12, 9829, 12, 9794, 12, 20162, 12, 7452, 199, 646, 295, 421, 199, 63, 6458, 18, 9525, 275, 6682, 1182, 13576, 14, 16, 199, 63, 9525, 18, 6458, 275, 13576, 14, 16, 1182, 6682, 199, 199, 63, 15788, 707, 2380, 63, 8017, 275, 499, 199, 63, 825, 2946, 322, 3690, 63, 12973, 275, 650, 199, 199, 63, 16514, 29331, 275, 359, 199, 3, 221, 1305, 12, 27761, 29331, 536, 12, 662, 392, 707, 2380, 3898, 5231, 12, 12386, 402, 325, 2055, 484, 322, 3690, 198, 199, 3, 1642, 5403, 365, 282, 10069, 1454, 12, 4005, 2040, 1625, 4918, 370, 1336, 1305, 5579, 199, 198, 59, 446, 17, 12, 298, 20185, 401, 378, 12, 378, 467, 199, 198, 59, 413, 12, 298, 28960, 651, 401, 1227, 7332, 18199, 12, 378, 14, 29327, 2760, 1477, 467, 199, 198, 59, 499, 12, 298, 33, 11409, 25861, 20548, 401, 1227, 12046, 8488, 12, 378, 14, 29327, 2635, 19861, 467, 199, 198, 59, 650, 12, 298, 34, 28817, 413, 19211, 401, 1227, 7332, 13145, 12, 378, 14, 29327, 1342, 15541, 467, 199, 198, 59, 841, 12, 298, 34, 28817, 413, 19211, 334, 46, 455, 4492, 65, 61, 3872, 1227, 7332, 29618, 12, 378, 14, 29327, 1342, 15541, 467, 199, 198, 59, 959, 12, 298, 1968, 285, 415, 413, 13465, 401, 1227, 12046, 11089, 12, 378, 14, 30761, 10253, 2010, 467, 199, 198, 59, 1227, 12, 298, 1968, 285, 415, 6155, 1257, 401, 1227, 12046, 11032, 12, 378, 14, 8010, 1257, 1276, 845, 467, 199, 198, 59, 1520, 12, 298, 37, 432, 3911, 401, 1227, 7332, 13319, 12, 378, 14, 29327, 1401, 15883, 467, 199, 198, 59, 1695, 12, 298, 38, 374, 7641, 5851, 2259, 334, 16797, 895, 89, 61, 3872, 1227, 12046, 10642, 12, 378, 14, 383, 15014, 1082, 1081, 467, 199, 198, 59, 1749, 12, 298, 38, 374, 7641, 5851, 2333, 401, 1227, 12046, 8251, 12, 378, 14, 383, 15014, 1082, 1081, 467, 199, 198, 59, 1616, 12, 298, 3975, 51, 5851, 1822, 401, 1227, 12046, 8488, 12, 378, 14, 383, 15014, 2466, 1717, 467, 199, 198, 59, 4119, 12, 298, 3975, 51, 5851, 1257, 401, 1227, 12046, 7498, 12, 378, 14, 29327, 2635, 1703, 467, 199, 198, 59, 3144, 12, 298, 40, 352, 278, 2591, 5851, 1690, 401, 1227, 12046, 1840, 12, 378, 14, 383, 15014, 1082, 1081, 467, 199, 198, 59, 4944, 12, 298, 40, 4937, 401, 1227, 12046, 13299, 12, 378, 14, 30761, 1081, 1822, 467, 199, 198, 59, 4329, 12, 298, 30886, 401, 1227, 1401, 2658, 1299, 12, 378, 14, 30761, 1081, 1822, 467, 199, 198, 59, 4114, 12, 298, 27399, 405, 8822, 12267, 401, 1227, 12046, 11677, 12, 378, 14, 383, 15014, 1082, 1081, 467, 199, 198, 59, 3193, 12, 298, 11911, 437, 73, 651, 401, 1227, 7332, 13424, 12, 378, 14, 29327, 2760, 1477, 467, 199, 198, 59, 5557, 12, 298, 11911, 662, 432, 3911, 401, 1227, 7332, 8533, 12, 378, 14, 29327, 1401, 15883, 467, 199, 198, 59, 6155, 12, 298, 11911, 481, 374, 7641, 5851, 2259, 401, 1227, 12046, 11520, 12, 378, 14, 383, 15014, 1082, 1081, 467, 199, 198, 59, 5851, 12, 298, 30534, 437, 278, 28775, 5851, 1876, 401, 1227, 12046, 8488, 12, 378, 14, 29327, 2635, 19861, 467, 199, 198, 59, 3388, 12, 298, 24178, 5212, 401, 1227, 12046, 10355, 12, 378, 14, 383, 15014, 1082, 1081, 467, 199, 198, 59, 7829, 12, 298, 24178, 14157, 401, 1227, 12046, 11731, 12, 378, 14, 29327, 2635, 19861, 467, 199, 198, 59, 6928, 12, 298, 24178, 13, 2819, 401, 1227, 12046, 8312, 12, 378, 14, 29327, 2635, 20739, 467, 199, 198, 59, 6546, 12, 298, 24178, 13, 1349, 401, 1227, 12046, 7498, 12, 378, 14, 29327, 2635, 1703, 61, 199, 61, 199, 199, 3, 5083, 16028, 1152, 1580, 7131, 687, 22912, 869, 14, 577, 6738, 1159, 10691, 13, 221, 199, 3, 1014, 921, 1544, 14, 18173, 305, 14, 8654, 15, 271, 8382, 15, 2587, 71, 15, 9493, 4800, 15, 5983, 15, 18945, 15, 69, 513, 14, 1360, 199, 3, 872, 12493, 402, 8875, 9773, 12, 15904, 402, 20566, 305, 737, 437, 833, 262, 199, 3, 29820, 26, 6454, 6738, 32, 1198, 14, 18173, 305, 14, 8654, 199, 3, 19, 15, 1081, 15, 2720, 199, 199, 3, 2980, 199, 3, 6172, 677, 12340, 437, 27798, 14, 5851, 1555, 66, 14, 577, 2054, 5773, 28836, 11774, 26, 29083, 968, 370, 1487, 12493, 402, 11391, 677, 13064, 5346, 32230, 6187, 199, 3, 28607, 5773, 28836, 11774, 14, 14320, 473, 436, 473, 41, 14, 644, 1119, 31673, 12, 30592, 26, 11391, 677, 12340, 437, 27798, 199, 199, 318, 18338, 63, 475, 63, 337, 77, 8, 4443, 63, 16514, 29331, 12, 8396, 12, 6132, 12, 5718, 275, 488, 304, 272, 408, 28392 ]
[ 199, 3, 1898, 334, 35, 9, 8937, 12, 7129, 6778, 11367, 52, 4319, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 7220, 9516, 4633, 14702, 1759, 334, 46, 6087, 680, 199, 3, 199, 3, 653, 6087, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 652, 1334, 314, 199, 3, 2895, 402, 314, 1664, 1696, 1684, 844, 1015, 499, 465, 3267, 701, 314, 2868, 199, 3, 2290, 2752, 14, 199, 3, 199, 3, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 2428, 199, 3, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 3169, 503, 199, 3, 3092, 2381, 437, 3115, 3104, 14, 1666, 314, 1664, 1696, 1684, 844, 367, 199, 3, 1655, 2436, 14, 221, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 199, 3, 844, 3180, 543, 653, 6087, 14, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 199, 624, 18017, 13315, 14, 199, 199, 13967, 367, 13806, 3382, 738, 20690, 436, 18154, 15, 13331, 12, 436, 367, 199, 11059, 282, 1059, 6025, 402, 738, 20690, 14, 199, 199, 17793, 12905, 687, 1233, 2808, 1334, 14629, 687, 1455, 921, 647, 25556, 14, 1308, 15, 199, 8, 1014, 921, 647, 25556, 14, 1308, 15, 22510, 9551, 934, 45, 15083, 13, 17, 14, 18, 14, 5369, 14, 6838, 9, 199, 199, 624, 199, 199, 504, 3473, 492, 6682, 12, 9829, 12, 9794, 12, 20162, 12, 7452, 199, 646, 295, 421, 199, 63, 6458, 18, 9525, 275, 6682, 1182, 13576, 14, 16, 199, 63, 9525, 18, 6458, 275, 13576, 14, 16, 1182, 6682, 199, 199, 63, 15788, 707, 2380, 63, 8017, 275, 499, 199, 63, 825, 2946, 322, 3690, 63, 12973, 275, 650, 199, 199, 63, 16514, 29331, 275, 359, 199, 3, 221, 1305, 12, 27761, 29331, 536, 12, 662, 392, 707, 2380, 3898, 5231, 12, 12386, 402, 325, 2055, 484, 322, 3690, 198, 199, 3, 1642, 5403, 365, 282, 10069, 1454, 12, 4005, 2040, 1625, 4918, 370, 1336, 1305, 5579, 199, 198, 59, 446, 17, 12, 298, 20185, 401, 378, 12, 378, 467, 199, 198, 59, 413, 12, 298, 28960, 651, 401, 1227, 7332, 18199, 12, 378, 14, 29327, 2760, 1477, 467, 199, 198, 59, 499, 12, 298, 33, 11409, 25861, 20548, 401, 1227, 12046, 8488, 12, 378, 14, 29327, 2635, 19861, 467, 199, 198, 59, 650, 12, 298, 34, 28817, 413, 19211, 401, 1227, 7332, 13145, 12, 378, 14, 29327, 1342, 15541, 467, 199, 198, 59, 841, 12, 298, 34, 28817, 413, 19211, 334, 46, 455, 4492, 65, 61, 3872, 1227, 7332, 29618, 12, 378, 14, 29327, 1342, 15541, 467, 199, 198, 59, 959, 12, 298, 1968, 285, 415, 413, 13465, 401, 1227, 12046, 11089, 12, 378, 14, 30761, 10253, 2010, 467, 199, 198, 59, 1227, 12, 298, 1968, 285, 415, 6155, 1257, 401, 1227, 12046, 11032, 12, 378, 14, 8010, 1257, 1276, 845, 467, 199, 198, 59, 1520, 12, 298, 37, 432, 3911, 401, 1227, 7332, 13319, 12, 378, 14, 29327, 1401, 15883, 467, 199, 198, 59, 1695, 12, 298, 38, 374, 7641, 5851, 2259, 334, 16797, 895, 89, 61, 3872, 1227, 12046, 10642, 12, 378, 14, 383, 15014, 1082, 1081, 467, 199, 198, 59, 1749, 12, 298, 38, 374, 7641, 5851, 2333, 401, 1227, 12046, 8251, 12, 378, 14, 383, 15014, 1082, 1081, 467, 199, 198, 59, 1616, 12, 298, 3975, 51, 5851, 1822, 401, 1227, 12046, 8488, 12, 378, 14, 383, 15014, 2466, 1717, 467, 199, 198, 59, 4119, 12, 298, 3975, 51, 5851, 1257, 401, 1227, 12046, 7498, 12, 378, 14, 29327, 2635, 1703, 467, 199, 198, 59, 3144, 12, 298, 40, 352, 278, 2591, 5851, 1690, 401, 1227, 12046, 1840, 12, 378, 14, 383, 15014, 1082, 1081, 467, 199, 198, 59, 4944, 12, 298, 40, 4937, 401, 1227, 12046, 13299, 12, 378, 14, 30761, 1081, 1822, 467, 199, 198, 59, 4329, 12, 298, 30886, 401, 1227, 1401, 2658, 1299, 12, 378, 14, 30761, 1081, 1822, 467, 199, 198, 59, 4114, 12, 298, 27399, 405, 8822, 12267, 401, 1227, 12046, 11677, 12, 378, 14, 383, 15014, 1082, 1081, 467, 199, 198, 59, 3193, 12, 298, 11911, 437, 73, 651, 401, 1227, 7332, 13424, 12, 378, 14, 29327, 2760, 1477, 467, 199, 198, 59, 5557, 12, 298, 11911, 662, 432, 3911, 401, 1227, 7332, 8533, 12, 378, 14, 29327, 1401, 15883, 467, 199, 198, 59, 6155, 12, 298, 11911, 481, 374, 7641, 5851, 2259, 401, 1227, 12046, 11520, 12, 378, 14, 383, 15014, 1082, 1081, 467, 199, 198, 59, 5851, 12, 298, 30534, 437, 278, 28775, 5851, 1876, 401, 1227, 12046, 8488, 12, 378, 14, 29327, 2635, 19861, 467, 199, 198, 59, 3388, 12, 298, 24178, 5212, 401, 1227, 12046, 10355, 12, 378, 14, 383, 15014, 1082, 1081, 467, 199, 198, 59, 7829, 12, 298, 24178, 14157, 401, 1227, 12046, 11731, 12, 378, 14, 29327, 2635, 19861, 467, 199, 198, 59, 6928, 12, 298, 24178, 13, 2819, 401, 1227, 12046, 8312, 12, 378, 14, 29327, 2635, 20739, 467, 199, 198, 59, 6546, 12, 298, 24178, 13, 1349, 401, 1227, 12046, 7498, 12, 378, 14, 29327, 2635, 1703, 61, 199, 61, 199, 199, 3, 5083, 16028, 1152, 1580, 7131, 687, 22912, 869, 14, 577, 6738, 1159, 10691, 13, 221, 199, 3, 1014, 921, 1544, 14, 18173, 305, 14, 8654, 15, 271, 8382, 15, 2587, 71, 15, 9493, 4800, 15, 5983, 15, 18945, 15, 69, 513, 14, 1360, 199, 3, 872, 12493, 402, 8875, 9773, 12, 15904, 402, 20566, 305, 737, 437, 833, 262, 199, 3, 29820, 26, 6454, 6738, 32, 1198, 14, 18173, 305, 14, 8654, 199, 3, 19, 15, 1081, 15, 2720, 199, 199, 3, 2980, 199, 3, 6172, 677, 12340, 437, 27798, 14, 5851, 1555, 66, 14, 577, 2054, 5773, 28836, 11774, 26, 29083, 968, 370, 1487, 12493, 402, 11391, 677, 13064, 5346, 32230, 6187, 199, 3, 28607, 5773, 28836, 11774, 14, 14320, 473, 436, 473, 41, 14, 644, 1119, 31673, 12, 30592, 26, 11391, 677, 12340, 437, 27798, 199, 199, 318, 18338, 63, 475, 63, 337, 77, 8, 4443, 63, 16514, 29331, 12, 8396, 12, 6132, 12, 5718, 275, 488, 304, 272, 408, 28392, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
jpshort/odoo
addons/membership/membership.py
11
27706
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## import time from openerp.osv import fields, osv import openerp.addons.decimal_precision as dp from openerp.tools.translate import _ STATE = [ ('none', 'Non Member'), ('canceled', 'Cancelled Member'), ('old', 'Old Member'), ('waiting', 'Waiting Member'), ('invoiced', 'Invoiced Member'), ('free', 'Free Member'), ('paid', 'Paid Member'), ] STATE_PRIOR = { 'none': 0, 'canceled': 1, 'old': 2, 'waiting': 3, 'invoiced': 4, 'free': 6, 'paid': 7 } class membership_line(osv.osv): '''Member line''' def _get_partners(self, cr, uid, ids, context=None): list_membership_line = [] member_line_obj = self.pool.get('membership.membership_line') for partner in self.pool.get('res.partner').browse(cr, uid, ids, context=context): if partner.member_lines: list_membership_line += member_line_obj.search(cr, uid, [('id', 'in', [ l.id for l in partner.member_lines])], context=context) return list_membership_line def _get_membership_lines(self, cr, uid, ids, context=None): list_membership_line = [] member_line_obj = self.pool.get('membership.membership_line') for invoice in self.pool.get('account.invoice').browse(cr, uid, ids, context=context): if invoice.invoice_line: list_membership_line += member_line_obj.search(cr, uid, [('account_invoice_line', 'in', [ l.id for l in invoice.invoice_line])], context=context) return list_membership_line def _check_membership_date(self, cr, uid, ids, context=None): """Check if membership product is not in the past @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Membership Line IDs @param context: A standard dictionary for contextual values """ cr.execute(''' SELECT MIN(ml.date_to - ai.date_invoice) FROM membership_membership_line ml JOIN account_invoice_line ail ON ( ml.account_invoice_line = ail.id ) JOIN account_invoice ai ON ( ai.id = ail.invoice_id) WHERE ml.id IN %s''', (tuple(ids),)) res = cr.fetchall() for r in res: if r[0] and r[0] < 0: return False return True def _state(self, cr, uid, ids, name, args, context=None): """Compute the state lines @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Membership Line IDs @param name: Field Name @param context: A standard dictionary for contextual values @param return: Dictionary of state Value """ res = {} inv_obj = self.pool.get('account.invoice') for line in self.browse(cr, uid, ids, context=context): cr.execute(''' SELECT i.state, i.id FROM account_invoice i WHERE i.id = ( SELECT l.invoice_id FROM account_invoice_line l WHERE l.id = ( SELECT ml.account_invoice_line FROM membership_membership_line ml WHERE ml.id = %s ) ) ''', (line.id,)) fetched = cr.fetchone() if not fetched: res[line.id] = 'canceled' continue istate = fetched[0] state = 'none' if (istate == 'draft') | (istate == 'proforma'): state = 'waiting' elif istate == 'open': state = 'invoiced' elif istate == 'paid': state = 'paid' inv = inv_obj.browse(cr, uid, fetched[1], context=context) for payment in inv.payment_ids: if payment.invoice and payment.invoice.type == 'out_refund': state = 'canceled' elif istate == 'cancel': state = 'canceled' res[line.id] = state return res _description = __doc__ _name = 'membership.membership_line' _columns = { 'partner': fields.many2one('res.partner', 'Partner', ondelete='cascade', select=1), 'membership_id': fields.many2one('product.product', string="Membership", required=True), 'date_from': fields.date('From', readonly=True), 'date_to': fields.date('To', readonly=True), 'date_cancel': fields.date('Cancel date'), 'date': fields.date('Join Date', help="Date on which member has joined the membership"), 'member_price': fields.float('Membership Fee', digits_compute= dp.get_precision('Product Price'), required=True, help='Amount for the membership'), 'account_invoice_line': fields.many2one('account.invoice.line', 'Account Invoice line', readonly=True), 'account_invoice_id': fields.related('account_invoice_line', 'invoice_id', type='many2one', relation='account.invoice', string='Invoice', readonly=True), 'state': fields.function(_state, string='Membership Status', type='selection', selection=STATE, store = { 'account.invoice': (_get_membership_lines, ['state'], 10), 'res.partner': (_get_partners, ['membership_state'], 12), }, help="""It indicates the membership status. -Non Member: A member who has not applied for any membership. -Cancelled Member: A member who has cancelled his membership. -Old Member: A member whose membership date has expired. -Waiting Member: A member who has applied for the membership and whose invoice is going to be created. -Invoiced Member: A member whose invoice has been created. -Paid Member: A member who has paid the membership amount."""), 'company_id': fields.related('account_invoice_line', 'invoice_id', 'company_id', type="many2one", relation="res.company", string="Company", readonly=True, store=True) } _rec_name = 'partner' _order = 'id desc' _constraints = [ (_check_membership_date, 'Error, this membership product is out of date', []) ] class Partner(osv.osv): '''Partner''' _inherit = 'res.partner' def _get_partner_id(self, cr, uid, ids, context=None): member_line_obj = self.pool.get('membership.membership_line') res_obj = self.pool.get('res.partner') data_inv = member_line_obj.browse(cr, uid, ids, context=context) list_partner = [] for data in data_inv: list_partner.append(data.partner.id) ids2 = list_partner while ids2: ids2 = res_obj.search(cr, uid, [('associate_member', 'in', ids2)], context=context) list_partner += ids2 return list_partner def _get_invoice_partner(self, cr, uid, ids, context=None): inv_obj = self.pool.get('account.invoice') res_obj = self.pool.get('res.partner') data_inv = inv_obj.browse(cr, uid, ids, context=context) list_partner = [] for data in data_inv: list_partner.append(data.partner_id.id) ids2 = list_partner while ids2: ids2 = res_obj.search(cr, uid, [('associate_member', 'in', ids2)], context=context) list_partner += ids2 return list_partner def _membership_state(self, cr, uid, ids, name, args, context=None): """This Function return Membership State For Given Partner. @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Partner IDs @param name: Field Name @param context: A standard dictionary for contextual values @param return: Dictionary of Membership state Value """ res = {} for id in ids: res[id] = 'none' today = time.strftime('%Y-%m-%d') for id in ids: partner_data = self.browse(cr, uid, id, context=context) if partner_data.membership_cancel and today > partner_data.membership_cancel: res[id] = 'free' if partner_data.free_member else 'canceled' continue if partner_data.membership_stop and today > partner_data.membership_stop: res[id] = 'free' if partner_data.free_member else 'old' continue s = 4 if partner_data.member_lines: for mline in partner_data.member_lines: if mline.date_to >= today: if mline.account_invoice_line and mline.account_invoice_line.invoice_id: mstate = mline.account_invoice_line.invoice_id.state if mstate == 'paid': s = 0 inv = mline.account_invoice_line.invoice_id for payment in inv.payment_ids: if payment.invoice.type == 'out_refund': s = 2 break elif mstate == 'open' and s!=0: s = 1 elif mstate == 'cancel' and s!=0 and s!=1: s = 2 elif (mstate == 'draft' or mstate == 'proforma') and s!=0 and s!=1: s = 3 if s==4: for mline in partner_data.member_lines: if mline.date_from < today and mline.date_to < today and mline.date_from <= mline.date_to and (mline.account_invoice_line and mline.account_invoice_line.invoice_id.state) == 'paid': s = 5 else: s = 6 if s==0: res[id] = 'paid' elif s==1: res[id] = 'invoiced' elif s==2: res[id] = 'canceled' elif s==3: res[id] = 'waiting' elif s==5: res[id] = 'old' elif s==6: res[id] = 'none' if partner_data.free_member and s!=0: res[id] = 'free' if partner_data.associate_member: res_state = self._membership_state(cr, uid, [partner_data.associate_member.id], name, args, context=context) res[id] = res_state[partner_data.associate_member.id] return res def _membership_date(self, cr, uid, ids, name, args, context=None): """Return date of membership""" name = name[0] res = {} member_line_obj = self.pool.get('membership.membership_line') for partner in self.browse(cr, uid, ids, context=context): if partner.associate_member: partner_id = partner.associate_member.id else: partner_id = partner.id res[partner.id] = { 'membership_start': False, 'membership_stop': False, 'membership_cancel': False } if name == 'membership_start': line_id = member_line_obj.search(cr, uid, [('partner', '=', partner_id),('date_cancel','=',False)], limit=1, order='date_from', context=context) if line_id: res[partner.id]['membership_start'] = member_line_obj.read(cr, uid, [line_id[0]], ['date_from'], context=context)[0]['date_from'] if name == 'membership_stop': line_id1 = member_line_obj.search(cr, uid, [('partner', '=', partner_id),('date_cancel','=',False)], limit=1, order='date_to desc', context=context) if line_id1: res[partner.id]['membership_stop'] = member_line_obj.read(cr, uid, [line_id1[0]], ['date_to'], context=context)[0]['date_to'] if name == 'membership_cancel': if partner.membership_state == 'canceled': line_id2 = member_line_obj.search(cr, uid, [('partner', '=', partner.id)], limit=1, order='date_cancel', context=context) if line_id2: res[partner.id]['membership_cancel'] = member_line_obj.read(cr, uid, [line_id2[0]], ['date_cancel'], context=context)[0]['date_cancel'] return res def _get_partners(self, cr, uid, ids, context=None): ids2 = ids while ids2: ids2 = self.search(cr, uid, [('associate_member', 'in', ids2)], context=context) ids += ids2 return ids def __get_membership_state(self, *args, **kwargs): return self._membership_state(*args, **kwargs) _columns = { 'associate_member': fields.many2one('res.partner', 'Associate Member',help="A member with whom you want to associate your membership.It will consider the membership state of the associated member."), 'member_lines': fields.one2many('membership.membership_line', 'partner', 'Membership'), 'free_member': fields.boolean('Free Member', help = "Select if you want to give free membership."), 'membership_amount': fields.float( 'Membership Amount', digits=(16, 2), help = 'The price negotiated by the partner'), 'membership_state': fields.function( __get_membership_state, string = 'Current Membership Status', type = 'selection', selection = STATE, store = { 'account.invoice': (_get_invoice_partner, ['state'], 10), 'membership.membership_line': (_get_partner_id, ['state'], 10), 'res.partner': (_get_partners, ['free_member', 'membership_state', 'associate_member'], 10) }, help='It indicates the membership state.\n' '-Non Member: A partner who has not applied for any membership.\n' '-Cancelled Member: A member who has cancelled his membership.\n' '-Old Member: A member whose membership date has expired.\n' '-Waiting Member: A member who has applied for the membership and whose invoice is going to be created.\n' '-Invoiced Member: A member whose invoice has been created.\n' '-Paying member: A member who has paid the membership fee.'), 'membership_start': fields.function( _membership_date, multi = 'membeship_start', string = 'Membership Start Date', type = 'date', store = { 'account.invoice': (_get_invoice_partner, ['state'], 10), 'membership.membership_line': (_get_partner_id, ['state'], 10, ), 'res.partner': (lambda self, cr, uid, ids, c={}: ids, ['free_member'], 10) }, help="Date from which membership becomes active."), 'membership_stop': fields.function( _membership_date, string = 'Membership End Date', type='date', multi='membership_stop', store = { 'account.invoice': (_get_invoice_partner, ['state'], 10), 'membership.membership_line': (_get_partner_id, ['state'], 10), 'res.partner': (lambda self, cr, uid, ids, c={}: ids, ['free_member'], 10) }, help="Date until which membership remains active."), 'membership_cancel': fields.function( _membership_date, string = 'Cancel Membership Date', type='date', multi='membership_cancel', store = { 'account.invoice': (_get_invoice_partner, ['state'], 11), 'membership.membership_line': (_get_partner_id, ['state'], 10), 'res.partner': (lambda self, cr, uid, ids, c={}: ids, ['free_member'], 10) }, help="Date on which membership has been cancelled"), } _defaults = { 'free_member': False, 'membership_cancel': False, } def _check_recursion(self, cr, uid, ids, context=None): """Check Recursive for Associated Members. """ level = 100 while len(ids): cr.execute('SELECT DISTINCT associate_member FROM res_partner WHERE id IN %s', (tuple(ids),)) ids = filter(None, map(lambda x:x[0], cr.fetchall())) if not level: return False level -= 1 return True _constraints = [ (_check_recursion, 'Error ! You cannot create recursive associated members.', ['associate_member']) ] def create_membership_invoice(self, cr, uid, ids, product_id=None, datas=None, context=None): """ Create Customer Invoice of Membership for partners. @param datas: datas has dictionary value which consist Id of Membership product and Cost Amount of Membership. datas = {'membership_product_id': None, 'amount': None} """ invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') invoice_tax_obj = self.pool.get('account.invoice.tax') product_id = product_id or datas.get('membership_product_id', False) amount = datas.get('amount', 0.0) invoice_list = [] if type(ids) in (int, long,): ids = [ids] for partner in self.browse(cr, uid, ids, context=context): account_id = partner.property_account_receivable and partner.property_account_receivable.id or False fpos_id = partner.property_account_position and partner.property_account_position.id or False addr = self.address_get(cr, uid, [partner.id], ['invoice']) if partner.free_member: raise osv.except_osv(_('Error!'), _("Partner is a free Member.")) if not addr.get('invoice', False): raise osv.except_osv(_('Error!'), _("Partner doesn't have an address to make the invoice.")) quantity = 1 line_value = { 'product_id': product_id, } line_dict = invoice_line_obj.product_id_change(cr, uid, {}, product_id, False, quantity, '', 'out_invoice', partner.id, fpos_id, price_unit=amount, context=context) line_value.update(line_dict['value']) line_value['price_unit'] = amount if line_value.get('invoice_line_tax_id', False): tax_tab = [(6, 0, line_value['invoice_line_tax_id'])] line_value['invoice_line_tax_id'] = tax_tab invoice_id = invoice_obj.create(cr, uid, { 'partner_id': partner.id, 'account_id': account_id, 'fiscal_position': fpos_id or False }, context=context) line_value['invoice_id'] = invoice_id invoice_line_id = invoice_line_obj.create(cr, uid, line_value, context=context) invoice_obj.write(cr, uid, invoice_id, {'invoice_line': [(6, 0, [invoice_line_id])]}, context=context) invoice_list.append(invoice_id) if line_value['invoice_line_tax_id']: tax_value = invoice_tax_obj.compute(cr, uid, invoice_id).values() for tax in tax_value: invoice_tax_obj.create(cr, uid, tax, context=context) #recompute the membership_state of those partners self.pool.get('res.partner').write(cr, uid, ids, {}) return invoice_list class Product(osv.osv): def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): model_obj = self.pool.get('ir.model.data') if context is None: context = {} if ('product' in context) and (context['product']=='membership_product'): model_data_ids_form = model_obj.search(cr, user, [('model','=','ir.ui.view'), ('name', 'in', ['membership_products_form', 'membership_products_tree'])], context=context) resource_id_form = model_obj.read(cr, user, model_data_ids_form, fields=['res_id', 'name'], context=context) dict_model = {} for i in resource_id_form: dict_model[i['name']] = i['res_id'] if view_type == 'form': view_id = dict_model['membership_products_form'] else: view_id = dict_model['membership_products_tree'] return super(Product,self).fields_view_get(cr, user, view_id, view_type, context, toolbar, submenu) '''Product''' _inherit = 'product.template' _columns = { 'membership': fields.boolean('Membership', help='Check if the product is eligible for membership.'), 'membership_date_from': fields.date('Membership Start Date', help='Date from which membership becomes active.'), 'membership_date_to': fields.date('Membership End Date', help='Date until which membership remains active.'), } _sql_constraints = [('membership_date_greater','check(membership_date_to >= membership_date_from)','Error ! Ending Date cannot be set before Beginning Date.')] _defaults = { 'membership': False, } class Invoice(osv.osv): '''Invoice''' _inherit = 'account.invoice' def action_cancel(self, cr, uid, ids, context=None): '''Create a 'date_cancel' on the membership_line object''' member_line_obj = self.pool.get('membership.membership_line') today = time.strftime('%Y-%m-%d') for invoice in self.browse(cr, uid, ids, context=context): mlines = member_line_obj.search(cr, uid, [('account_invoice_line', 'in', [l.id for l in invoice.invoice_line])]) member_line_obj.write(cr, uid, mlines, {'date_cancel': today}) return super(Invoice, self).action_cancel(cr, uid, ids, context=context) class account_invoice_line(osv.osv): _inherit='account.invoice.line' def write(self, cr, uid, ids, vals, context=None): """Overrides orm write method """ member_line_obj = self.pool.get('membership.membership_line') res = super(account_invoice_line, self).write(cr, uid, ids, vals, context=context) for line in self.browse(cr, uid, ids, context=context): if line.invoice_id.type == 'out_invoice': ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line', '=', line.id)], context=context) if line.product_id and line.product_id.membership and not ml_ids: # Product line has changed to a membership product date_from = line.product_id.membership_date_from date_to = line.product_id.membership_date_to if line.invoice_id.date_invoice > date_from and line.invoice_id.date_invoice < date_to: date_from = line.invoice_id.date_invoice member_line_obj.create(cr, uid, { 'partner': line.invoice_id.partner_id.id, 'membership_id': line.product_id.id, 'member_price': line.price_unit, 'date': time.strftime('%Y-%m-%d'), 'date_from': date_from, 'date_to': date_to, 'account_invoice_line': line.id, }, context=context) if line.product_id and not line.product_id.membership and ml_ids: # Product line has changed to a non membership product member_line_obj.unlink(cr, uid, ml_ids, context=context) return res def unlink(self, cr, uid, ids, context=None): """Remove Membership Line Record for Account Invoice Line """ member_line_obj = self.pool.get('membership.membership_line') for id in ids: ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line', '=', id)], context=context) member_line_obj.unlink(cr, uid, ml_ids, context=context) return super(account_invoice_line, self).unlink(cr, uid, ids, context=context) def create(self, cr, uid, vals, context=None): """Overrides orm create method """ member_line_obj = self.pool.get('membership.membership_line') result = super(account_invoice_line, self).create(cr, uid, vals, context=context) line = self.browse(cr, uid, result, context=context) if line.invoice_id.type == 'out_invoice': ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line', '=', line.id)], context=context) if line.product_id and line.product_id.membership and not ml_ids: # Product line is a membership product date_from = line.product_id.membership_date_from date_to = line.product_id.membership_date_to if line.invoice_id.date_invoice > date_from and line.invoice_id.date_invoice < date_to: date_from = line.invoice_id.date_invoice member_line_obj.create(cr, uid, { 'partner': line.invoice_id.partner_id and line.invoice_id.partner_id.id or False, 'membership_id': line.product_id.id, 'member_price': line.price_unit, 'date': time.strftime('%Y-%m-%d'), 'date_from': date_from, 'date_to': date_to, 'account_invoice_line': line.id, }, context=context) return result # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
agpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 259, 7653, 12, 3232, 5800, 8259, 9274, 199, 3, 259, 1898, 334, 35, 9, 8353, 13, 6542, 11947, 12361, 8642, 1014, 921, 9864, 14, 1235, 10121, 199, 3, 199, 3, 259, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 259, 652, 1334, 314, 2895, 402, 314, 1664, 4265, 1696, 1684, 844, 465, 199, 3, 259, 3267, 701, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 199, 3, 259, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 4265, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 4265, 1696, 1684, 844, 199, 3, 259, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 4605, 199, 199, 646, 900, 199, 199, 504, 5166, 14, 4795, 492, 1504, 12, 9506, 199, 646, 5166, 14, 10788, 14, 6355, 63, 6833, 465, 12392, 199, 504, 5166, 14, 2537, 14, 5275, 492, 485, 199, 199, 6689, 275, 359, 272, 661, 3592, 297, 283, 6932, 14409, 659, 272, 661, 67, 18959, 297, 283, 22127, 14409, 659, 272, 661, 1753, 297, 283, 16411, 14409, 659, 272, 661, 14093, 297, 283, 19189, 14409, 659, 272, 661, 25614, 297, 283, 21092, 68, 14409, 659, 272, 661, 4624, 297, 283, 10146, 14409, 659, 272, 661, 16555, 297, 283, 4232, 344, 14409, 659, 199, 61, 199, 199, 6689, 63, 20076, 726, 275, 469, 272, 283, 3592, 356, 378, 12, 272, 283, 67, 18959, 356, 413, 12, 272, 283, 1753, 356, 499, 12, 272, 283, 14093, 356, 650, 12, 272, 283, 25614, 356, 841, 12, 272, 283, 4624, 356, 1227, 12, 272, 283, 16555, 356, 1520, 199, 93, 199, 199, 533, 14616, 63, 604, 8, 4795, 14, 4795, 304, 272, 1449, 7021, 1004, 2344, 339, 347, 485, 362, 63, 23385, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 1067, 29, 403, 304, 267, 769, 63, 13105, 63, 604, 275, 942, 267, 3653, 63, 604, 63, 1113, 275, 291, 14, 2293, 14, 362, 360, 13105, 14, 13105, 63, 604, 358, 267, 367, 5854, 315, 291, 14, 2293, 14, 362, 360, 470, 14, 3899, 1959, 4570, 8, 1556, 12, 1747, 12, 2762, 12, 1067, 29, 1100, 304, 288, 340, 5854, 14, 1114, 63, 1278, 26, 355, 769, 63, 13105, 63, 604, 847, 3653, 63, 604, 63, 1113, 14, 1733, 8, 1556, 12, 1747, 12, 4274, 344, 297, 283, 262, 297, 359, 634, 14, 344, 367, 634, 315, 5854, 14, 1114, 63, 1278, 27520, 1067, 29, 1100, 9, 267, 372, 769, 63, 13105, 63, 604, 339, 347, 485, 362, 63, 13105, 63, 1278, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 1067, 29, 403, 304, 267, 769, 63, 13105, 63, 604, 275, 942, 267, 3653, 63, 604, 63, 1113, 275, 291, 14, 2293, 14, 362, 360, 13105, 14, 13105, 63, 604, 358, 267, 367, 8485, 315, 291, 14, 2293, 14, 362, 360, 2048, 14, 5404, 1959, 4570, 8, 1556, 12, 1747, 12, 2762, 12, 1067, 29, 1100, 304, 288, 340, 8485, 14, 5404, 63, 604, 26, 355, 769, 63, 13105, 63, 604, 847, 3653, 63, 604, 63, 1113, 14, 1733, 8, 1556, 12, 1747, 12, 4274, 2048, 63, 5404, 63, 604, 297, 283, 262, 297, 359, 634, 14, 344, 367, 634, 315, 8485, 14, 5404, 63, 604, 27520, 1067, 29, 1100, 9, 267, 372, 769, 63, 13105, 63, 604, 339, 347, 485, 1074, 63, 13105, 63, 602, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 1067, 29, 403, 304, 267, 408, 1799, 340, 14616, 3336, 365, 440, 315, 314, 13541, 267, 768, 635, 291, 26, 710, 909, 7849, 267, 768, 635, 2467, 26, 314, 1453, 1962, 12, 687, 314, 3050, 3920, 12, 267, 768, 635, 1747, 26, 314, 1453, 922, 21045, 83, 2870, 367, 6391, 5920, 12, 267, 768, 635, 2762, 26, 3820, 402, 24326, 7030, 11449, 267, 768, 635, 1067, 26, 437, 4465, 2600, 367, 1067, 1061, 1338, 267, 408, 398, 2467, 14, 2526, 10505, 268, 10468, 15861, 8, 757, 14, 602, 63, 475, 446, 15933, 14, 602, 63, 5404, 9, 1467, 4442, 14616, 63, 13105, 63, 604, 19184, 1467, 10593, 2933, 63, 5404, 63, 604, 282, 382, 5258, 334, 355, 19184, 14, 2048, 63, 5404, 63, 604, 275, 282, 382, 14, 344, 355, 776, 288, 10593, 2933, 63, 5404, 15933, 5258, 334, 288, 15933, 14, 344, 275, 282, 382, 14, 5404, 63, 344, 9, 288, 6038, 19184, 14, 344, 1621, 450, 83, 18108, 334, 2960, 8, 1580, 18399, 267, 522, 275, 2467, 14, 10174, 342, 267, 367, 519, 315, 522, 26, 288, 340, 519, 59, 16, 61, 436, 519, 59, 16, 61, 665, 378, 26, 355, 372, 756, 267, 372, 715, 339, 347, 485, 929, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 536, 12, 1249, 12, 1067, 29, 403, 304, 267, 408, 8564, 314, 1174, 2385, 267, 768, 635, 291, 26, 710, 909, 7849, 267, 768, 635, 2467, 26, 314, 1453, 1962, 12, 687, 314, 3050, 3920, 12, 267, 768, 635, 1747, 26, 314, 1453, 922, 21045, 83, 2870, 367, 6391, 5920, 12, 267, 768, 635, 2762, 26, 3820, 402, 24326, 7030, 11449, 267, 768, 635, 536, 26, 5024, 2812, 267, 768, 635, 1067, 26, 437, 4465, 2600, 367, 1067, 1061, 1338, 267, 768, 635, 372, 26, 11932, 402, 1174, 1594, 267, 408, 267, 522, 275, 1052, 267, 4572, 63, 1113, 275, 291, 14, 2293, 14, 362, 360, 2048, 14, 5404, 358, 267, 367, 1004, 315, 291, 14, 4570, 8, 1556, 12, 1747, 12, 2762, 12, 1067, 29, 1100, 304, 288, 2467, 14, 2526, 10505, 288, 10468, 284, 14, 929, 12, 284, 14, 344, 4442, 288, 2933, 63, 5404, 284, 288, 6038, 288, 284, 14, 344, 275, 334 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 259, 7653, 12, 3232, 5800, 8259, 9274, 199, 3, 259, 1898, 334, 35, 9, 8353, 13, 6542, 11947, 12361, 8642, 1014, 921, 9864, 14, 1235, 10121, 199, 3, 199, 3, 259, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 259, 652, 1334, 314, 2895, 402, 314, 1664, 4265, 1696, 1684, 844, 465, 199, 3, 259, 3267, 701, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 199, 3, 259, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 4265, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 4265, 1696, 1684, 844, 199, 3, 259, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 4605, 199, 199, 646, 900, 199, 199, 504, 5166, 14, 4795, 492, 1504, 12, 9506, 199, 646, 5166, 14, 10788, 14, 6355, 63, 6833, 465, 12392, 199, 504, 5166, 14, 2537, 14, 5275, 492, 485, 199, 199, 6689, 275, 359, 272, 661, 3592, 297, 283, 6932, 14409, 659, 272, 661, 67, 18959, 297, 283, 22127, 14409, 659, 272, 661, 1753, 297, 283, 16411, 14409, 659, 272, 661, 14093, 297, 283, 19189, 14409, 659, 272, 661, 25614, 297, 283, 21092, 68, 14409, 659, 272, 661, 4624, 297, 283, 10146, 14409, 659, 272, 661, 16555, 297, 283, 4232, 344, 14409, 659, 199, 61, 199, 199, 6689, 63, 20076, 726, 275, 469, 272, 283, 3592, 356, 378, 12, 272, 283, 67, 18959, 356, 413, 12, 272, 283, 1753, 356, 499, 12, 272, 283, 14093, 356, 650, 12, 272, 283, 25614, 356, 841, 12, 272, 283, 4624, 356, 1227, 12, 272, 283, 16555, 356, 1520, 199, 93, 199, 199, 533, 14616, 63, 604, 8, 4795, 14, 4795, 304, 272, 1449, 7021, 1004, 2344, 339, 347, 485, 362, 63, 23385, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 1067, 29, 403, 304, 267, 769, 63, 13105, 63, 604, 275, 942, 267, 3653, 63, 604, 63, 1113, 275, 291, 14, 2293, 14, 362, 360, 13105, 14, 13105, 63, 604, 358, 267, 367, 5854, 315, 291, 14, 2293, 14, 362, 360, 470, 14, 3899, 1959, 4570, 8, 1556, 12, 1747, 12, 2762, 12, 1067, 29, 1100, 304, 288, 340, 5854, 14, 1114, 63, 1278, 26, 355, 769, 63, 13105, 63, 604, 847, 3653, 63, 604, 63, 1113, 14, 1733, 8, 1556, 12, 1747, 12, 4274, 344, 297, 283, 262, 297, 359, 634, 14, 344, 367, 634, 315, 5854, 14, 1114, 63, 1278, 27520, 1067, 29, 1100, 9, 267, 372, 769, 63, 13105, 63, 604, 339, 347, 485, 362, 63, 13105, 63, 1278, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 1067, 29, 403, 304, 267, 769, 63, 13105, 63, 604, 275, 942, 267, 3653, 63, 604, 63, 1113, 275, 291, 14, 2293, 14, 362, 360, 13105, 14, 13105, 63, 604, 358, 267, 367, 8485, 315, 291, 14, 2293, 14, 362, 360, 2048, 14, 5404, 1959, 4570, 8, 1556, 12, 1747, 12, 2762, 12, 1067, 29, 1100, 304, 288, 340, 8485, 14, 5404, 63, 604, 26, 355, 769, 63, 13105, 63, 604, 847, 3653, 63, 604, 63, 1113, 14, 1733, 8, 1556, 12, 1747, 12, 4274, 2048, 63, 5404, 63, 604, 297, 283, 262, 297, 359, 634, 14, 344, 367, 634, 315, 8485, 14, 5404, 63, 604, 27520, 1067, 29, 1100, 9, 267, 372, 769, 63, 13105, 63, 604, 339, 347, 485, 1074, 63, 13105, 63, 602, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 1067, 29, 403, 304, 267, 408, 1799, 340, 14616, 3336, 365, 440, 315, 314, 13541, 267, 768, 635, 291, 26, 710, 909, 7849, 267, 768, 635, 2467, 26, 314, 1453, 1962, 12, 687, 314, 3050, 3920, 12, 267, 768, 635, 1747, 26, 314, 1453, 922, 21045, 83, 2870, 367, 6391, 5920, 12, 267, 768, 635, 2762, 26, 3820, 402, 24326, 7030, 11449, 267, 768, 635, 1067, 26, 437, 4465, 2600, 367, 1067, 1061, 1338, 267, 408, 398, 2467, 14, 2526, 10505, 268, 10468, 15861, 8, 757, 14, 602, 63, 475, 446, 15933, 14, 602, 63, 5404, 9, 1467, 4442, 14616, 63, 13105, 63, 604, 19184, 1467, 10593, 2933, 63, 5404, 63, 604, 282, 382, 5258, 334, 355, 19184, 14, 2048, 63, 5404, 63, 604, 275, 282, 382, 14, 344, 355, 776, 288, 10593, 2933, 63, 5404, 15933, 5258, 334, 288, 15933, 14, 344, 275, 282, 382, 14, 5404, 63, 344, 9, 288, 6038, 19184, 14, 344, 1621, 450, 83, 18108, 334, 2960, 8, 1580, 18399, 267, 522, 275, 2467, 14, 10174, 342, 267, 367, 519, 315, 522, 26, 288, 340, 519, 59, 16, 61, 436, 519, 59, 16, 61, 665, 378, 26, 355, 372, 756, 267, 372, 715, 339, 347, 485, 929, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 536, 12, 1249, 12, 1067, 29, 403, 304, 267, 408, 8564, 314, 1174, 2385, 267, 768, 635, 291, 26, 710, 909, 7849, 267, 768, 635, 2467, 26, 314, 1453, 1962, 12, 687, 314, 3050, 3920, 12, 267, 768, 635, 1747, 26, 314, 1453, 922, 21045, 83, 2870, 367, 6391, 5920, 12, 267, 768, 635, 2762, 26, 3820, 402, 24326, 7030, 11449, 267, 768, 635, 536, 26, 5024, 2812, 267, 768, 635, 1067, 26, 437, 4465, 2600, 367, 1067, 1061, 1338, 267, 768, 635, 372, 26, 11932, 402, 1174, 1594, 267, 408, 267, 522, 275, 1052, 267, 4572, 63, 1113, 275, 291, 14, 2293, 14, 362, 360, 2048, 14, 5404, 358, 267, 367, 1004, 315, 291, 14, 4570, 8, 1556, 12, 1747, 12, 2762, 12, 1067, 29, 1100, 304, 288, 2467, 14, 2526, 10505, 288, 10468, 284, 14, 929, 12, 284, 14, 344, 4442, 288, 2933, 63, 5404, 284, 288, 6038, 288, 284, 14, 344, 275, 334, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
kbrebanov/ansible
lib/ansible/modules/remote_management/manageiq/manageiq_policies.py
23
11922
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2017, Daniel Korn <korndaniel1@gmail.com> # (c) 2017, Yaacov Zamir <yzamir@redhat.com> # 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 ANSIBLE_METADATA = { 'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community' } DOCUMENTATION = ''' module: manageiq_policies short_description: Management of resource policy_profiles in ManageIQ. extends_documentation_fragment: manageiq version_added: '2.5' author: Daniel Korn (@dkorn) description: - The manageiq_policies module supports adding and deleting policy_profiles in ManageIQ. options: state: description: - absent - policy_profiles should not exist, - present - policy_profiles should exist, - list - list current policy_profiles and policies. required: False choices: ['absent', 'present', 'list'] default: 'present' policy_profiles: description: - list of dictionaries, each includes the policy_profile 'name' key. - required if state is present or absent. required: false default: null resource_type: description: - the type of the resource to which the profile should be [un]assigned required: true choices: ['provider', 'host', 'vm', 'blueprint', 'category', 'cluster', 'data store', 'group', 'resource pool', 'service', 'service template', 'template', 'tenant', 'user'] default: null resource_name: description: - the name of the resource to which the profile should be [un]assigned required: true default: null ''' EXAMPLES = ''' - name: Assign new policy_profile for a provider in ManageIQ manageiq_policies: resource_name: 'EngLab' resource_type: 'provider' policy_profiles: - name: openscap profile manageiq_connection: url: 'http://127.0.0.1:3000' username: 'admin' password: 'smartvm' verify_ssl: False - name: Unassign a policy_profile for a provider in ManageIQ manageiq_policies: state: absent resource_name: 'EngLab' resource_type: 'provider' policy_profiles: - name: openscap profile manageiq_connection: url: 'http://127.0.0.1:3000' username: 'admin' password: 'smartvm' verify_ssl: False - name: List current policy_profile and policies for a provider in ManageIQ manageiq_policies: state: list resource_name: 'EngLab' resource_type: 'provider' manageiq_connection: url: 'http://127.0.0.1:3000' username: 'admin' password: 'smartvm' verify_ssl: False ''' RETURN = ''' manageiq_policies: description: - List current policy_profile and policies for a provider in ManageIQ returned: always type: dict sample: '{ "changed": false, "profiles": [ { "policies": [ { "active": true, "description": "OpenSCAP", "name": "openscap policy" }, { "active": true, "description": "Analyse incoming container images", "name": "analyse incoming container images" }, { "active": true, "description": "Schedule compliance after smart state analysis", "name": "schedule compliance after smart state analysis" } ], "profile_description": "OpenSCAP profile", "profile_name": "openscap profile" } ] }' ''' from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.manageiq import ManageIQ, manageiq_argument_spec, manageiq_entities class ManageIQPolicies(object): """ Object to execute policies management operations of manageiq resources. """ def __init__(self, manageiq, resource_type, resource_id): self.manageiq = manageiq self.module = self.manageiq.module self.api_url = self.manageiq.api_url self.client = self.manageiq.client self.resource_type = resource_type self.resource_id = resource_id self.resource_url = '{api_url}/{resource_type}/{resource_id}'.format( api_url=self.api_url, resource_type=resource_type, resource_id=resource_id) def query_profile_href(self, profile): """ Add or Update the policy_profile href field Example: {name: STR, ...} => {name: STR, href: STR} """ resource = self.manageiq.find_collection_resource_or_fail( "policy_profiles", **profile) return dict(name=profile['name'], href=resource['href']) def query_resource_profiles(self): """ Returns a set of the profile objects objects assigned to the resource """ url = '{resource_url}/policy_profiles?expand=resources' try: response = self.client.get(url.format(resource_url=self.resource_url)) except Exception as e: msg = "Failed to query {resource_type} policies: {error}".format( resource_type=self.resource_type, error=e) self.module.fail_json(msg=msg) resources = response.get('resources', []) # clean the returned rest api profile object to look like: # {profile_name: STR, profile_description: STR, policies: ARR<POLICIES>} profiles = [self.clean_profile_object(profile) for profile in resources] return profiles def query_profile_policies(self, profile_id): """ Returns a set of the policy objects assigned to the resource """ url = '{api_url}/policy_profiles/{profile_id}?expand=policies' try: response = self.client.get(url.format(api_url=self.api_url, profile_id=profile_id)) except Exception as e: msg = "Failed to query {resource_type} policies: {error}".format( resource_type=self.resource_type, error=e) self.module.fail_json(msg=msg) resources = response.get('policies', []) # clean the returned rest api policy object to look like: # {name: STR, description: STR, active: BOOL} policies = [self.clean_policy_object(policy) for policy in resources] return policies def clean_policy_object(self, policy): """ Clean a policy object to have human readable form of: { name: STR, description: STR, active: BOOL } """ name = policy.get('name') description = policy.get('description') active = policy.get('active') return dict( name=name, description=description, active=active) def clean_profile_object(self, profile): """ Clean a profile object to have human readable form of: { profile_name: STR, profile_description: STR, policies: ARR<POLICIES> } """ profile_id = profile['id'] name = profile.get('name') description = profile.get('description') policies = self.query_profile_policies(profile_id) return dict( profile_name=name, profile_description=description, policies=policies) def profiles_to_update(self, profiles, action): """ Create a list of policies we need to update in ManageIQ. Returns: Whether or not a change took place and a message describing the operation executed. """ profiles_to_post = [] assigned_profiles = self.query_resource_profiles() # make a list of assigned full profile names strings # e.g. ['openscap profile', ...] assigned_profiles_set = set([profile['profile_name'] for profile in assigned_profiles]) for profile in profiles: assigned = profile.get('name') in assigned_profiles_set if (action == 'unassign' and assigned) or (action == 'assign' and not assigned): # add/update the policy profile href field # {name: STR, ...} => {name: STR, href: STR} profile = self.query_profile_href(profile) profiles_to_post.append(profile) return profiles_to_post def assign_or_unassign_profiles(self, profiles, action): """ Perform assign/unassign action """ # get a list of profiles needed to be changed profiles_to_post = self.profiles_to_update(profiles, action) if not profiles_to_post: return dict( changed=False, msg="Profiles {profiles} already {action}ed, nothing to do".format( action=action, profiles=profiles)) # try to assign or unassign profiles to resource url = '{resource_url}/policy_profiles'.format(resource_url=self.resource_url) try: response = self.client.post(url, action=action, resources=profiles_to_post) except Exception as e: msg = "Failed to {action} profile: {error}".format( action=action, error=e) self.module.fail_json(msg=msg) # check all entities in result to be successfull for result in response['results']: if not result['success']: msg = "Failed to {action}: {message}".format( action=action, message=result['message']) self.module.fail_json(msg=msg) # successfully changed all needed profiles return dict( changed=True, msg="Successfully {action}ed profiles: {profiles}".format( action=action, profiles=profiles)) def main(): actions = {'present': 'assign', 'absent': 'unassign', 'list': 'list'} argument_spec = dict( policy_profiles=dict(type='list'), resource_name=dict(required=True, type='str'), resource_type=dict(required=True, type='str', choices=manageiq_entities().keys()), state=dict(required=False, type='str', choices=['present', 'absent', 'list'], default='present'), ) # add the manageiq connection arguments to the arguments argument_spec.update(manageiq_argument_spec()) module = AnsibleModule( argument_spec=argument_spec, required_if=[ ('state', 'present', ['policy_profiles']), ('state', 'absent', ['policy_profiles']) ], ) policy_profiles = module.params['policy_profiles'] resource_type_key = module.params['resource_type'] resource_name = module.params['resource_name'] state = module.params['state'] # get the action and resource type action = actions[state] resource_type = manageiq_entities()[resource_type_key] manageiq = ManageIQ(module) # query resource id, fail if resource does not exist resource_id = manageiq.find_collection_resource_or_fail(resource_type, name=resource_name)['id'] manageiq_policies = ManageIQPolicies(manageiq, resource_type, resource_id) if action == 'list': # return a list of current profiles for this object current_profiles = manageiq_policies.query_resource_profiles() res_args = dict(changed=False, profiles=current_profiles) else: # assign or unassign the profiles res_args = manageiq_policies.assign_or_unassign_profiles(policy_profiles, action) module.exit_json(**res_args) if __name__ == "__main__": main()
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 334, 67, 9, 9708, 12, 24747, 14769, 1804, 6161, 665, 75, 269, 977, 290, 14769, 17, 32, 6799, 14, 957, 30, 199, 3, 334, 67, 9, 9708, 12, 1488, 2158, 8695, 3107, 455, 723, 665, 19873, 455, 723, 32, 17164, 14, 957, 30, 199, 3, 1664, 1696, 1684, 844, 373, 19, 14, 16, 11, 334, 3239, 9685, 503, 4178, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 15, 11692, 13, 19, 14, 16, 14, 2424, 9, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 870, 63, 1593, 199, 363, 6577, 363, 275, 730, 421, 199, 8490, 63, 8314, 275, 469, 272, 283, 2343, 63, 1023, 356, 283, 17, 14, 17, 297, 272, 283, 1205, 356, 788, 7780, 995, 272, 283, 4946, 63, 991, 356, 283, 9387, 7, 199, 93, 421, 199, 8948, 275, 1449, 199, 199, 578, 26, 9635, 9962, 63, 11767, 199, 199, 3612, 63, 1802, 26, 8259, 402, 2073, 4592, 63, 11225, 315, 14944, 23559, 14, 199, 11036, 63, 9970, 63, 7677, 26, 9635, 9962, 199, 1023, 63, 3270, 26, 283, 18, 14, 21, 7, 199, 2502, 26, 24747, 14769, 1804, 6161, 8593, 6341, 6161, 9, 199, 1802, 26, 523, 446, 710, 9635, 9962, 63, 11767, 859, 5171, 7791, 436, 13794, 4592, 63, 11225, 315, 14944, 23559, 14, 199, 199, 1419, 26, 523, 1174, 26, 272, 1369, 26, 489, 446, 9552, 446, 4592, 63, 11225, 1077, 440, 2187, 12, 489, 446, 3451, 446, 4592, 63, 11225, 1077, 2187, 12, 489, 446, 769, 446, 769, 1453, 4592, 63, 11225, 436, 14118, 14, 272, 1415, 26, 756, 272, 3415, 26, 788, 5575, 297, 283, 1881, 297, 283, 513, 418, 272, 849, 26, 283, 1881, 7, 523, 4592, 63, 11225, 26, 272, 1369, 26, 489, 446, 769, 402, 11196, 12, 1924, 6952, 314, 4592, 63, 2913, 283, 354, 7, 790, 14, 489, 446, 1415, 340, 1174, 365, 3451, 503, 9552, 14, 272, 1415, 26, 3055, 272, 849, 26, 2973, 523, 2073, 63, 466, 26, 272, 1369, 26, 489, 446, 314, 730, 402, 314, 2073, 370, 1314, 314, 4690, 1077, 506, 359, 324, 61, 12941, 272, 1415, 26, 2549, 272, 3415, 26, 788, 3780, 297, 283, 1102, 297, 283, 2611, 297, 283, 15918, 297, 283, 3710, 297, 283, 4201, 297, 267, 283, 576, 3877, 297, 283, 923, 297, 283, 1927, 4203, 297, 283, 1364, 297, 283, 1364, 1978, 297, 267, 283, 1160, 297, 283, 4647, 297, 283, 751, 418, 272, 849, 26, 2973, 523, 2073, 63, 354, 26, 272, 1369, 26, 489, 446, 314, 536, 402, 314, 2073, 370, 1314, 314, 4690, 1077, 506, 359, 324, 61, 12941, 272, 1415, 26, 2549, 272, 849, 26, 2973, 199, 2344, 199, 199, 8918, 275, 1449, 199, 13, 536, 26, 16927, 892, 4592, 63, 2913, 367, 282, 5022, 315, 14944, 23559, 523, 9635, 9962, 63, 11767, 26, 272, 2073, 63, 354, 26, 283, 16197, 22511, 7, 272, 2073, 63, 466, 26, 283, 3780, 7, 272, 4592, 63, 11225, 26, 489, 446, 536, 26, 1551, 551, 439, 4690, 272, 9635, 9962, 63, 2105, 26, 489, 1166, 26, 283, 1014, 921, 4195, 14, 16, 14, 16, 14, 17, 26, 19962, 7, 489, 3434, 26, 283, 2113, 7, 489, 2505, 26, 283, 7853, 2611, 7, 489, 4911, 63, 4266, 26, 756, 199, 199, 13, 536, 26, 1910, 5038, 282, 4592, 63, 2913, 367, 282, 5022, 315, 14944, 23559, 523, 9635, 9962, 63, 11767, 26, 272, 1174, 26, 9552, 272, 2073, 63, 354, 26, 283, 16197, 22511, 7, 272, 2073, 63, 466, 26, 283, 3780, 7, 272, 4592, 63, 11225, 26, 489, 446, 536, 26, 1551, 551, 439, 4690, 272, 9635, 9962, 63, 2105, 26, 489, 1166, 26, 283, 1014, 921, 4195, 14, 16, 14, 16, 14, 17, 26, 19962, 7, 489, 3434, 26, 283, 2113, 7, 489, 2505, 26, 283, 7853, 2611, 7, 489, 4911, 63, 4266, 26, 756, 199, 199, 13, 536, 26, 3820, 1453, 4592, 63, 2913, 436, 14118, 367, 282, 5022, 315, 14944, 23559, 523, 9635, 9962, 63, 11767, 26, 272, 1174, 26, 769, 272, 2073, 63, 354, 26, 283, 16197, 22511, 7, 272, 2073, 63, 466, 26, 283, 3780, 7, 272, 9635, 9962, 63, 2105, 26, 489, 1166, 26, 283, 1014, 921, 4195, 14, 16, 14, 16, 14, 17, 26, 19962, 7, 489, 3434, 26, 283, 2113, 7, 489, 2505, 26, 283, 7853, 2611, 7, 489, 4911, 63, 4266, 26, 756, 199, 2344, 199, 199, 9677, 275, 1449, 199, 9053, 9962, 63, 11767, 26, 272, 1369, 26, 489, 446, 3820, 1453, 4592, 63, 2913, 436, 14118, 367, 282, 5022, 315, 14944, 23559, 272, 2138, 26, 3544, 272, 730, 26, 1211, 272, 2690, 26, 5041, 267, 298, 2489, 582, 3055, 12, 267, 298, 11225, 582, 359, 288, 469, 355, 298, 11767, 582, 359, 490, 469, 717, 298, 2682, 582, 2549, 12, 717, 298, 1802, 582, 298, 4299, 5153, 1282, 401, 717, 298, 354, 582, 298, 1490, 551, 439, 4592, 2, 490, 1660, 490, 469, 717, 298, 2682, 582, 2549, 12, 717, 298, 1802, 582, 298, 8014, 261, 12467, 3970, 5935, 401, 717, 298, 354, 582, 298, 26943, 12467, 3970, 5935, 2, 490, 1660, 490, 469, 717, 298, 2682, 582, 2549, 12, 717, 298, 1802, 582, 298, 15535, 4151, 2410, 11179, 1174, 11284, 401, 717, 298, 354, 582, 298, 7211, 4151, 2410, 11179, 1174, 11284, 2, 490, 789, 355, 2156, 355, 298, 2913, 63, 1802, 582, 298, 4299, 5153, 1282, 4690, 401, 355, 298, 2913, 63, 354, 582, 298, 1490, 551, 439, 4690, 2, 288, 789, 267, 1622, 272, 789, 7, 199, 2344, 199, 199, 504, 3242, 14, 578, 63, 1208, 14, 4316, 492, 6953, 199, 504, 3242, 14, 578, 63, 1208, 14, 9053, 9962, 492, 14944, 23559, 12, 9635, 9962, 63, 2094, 63, 1650, 12, 9635, 9962, 63, 8327, 421, 199, 533, 14944, 23559, 27079, 8, 785, 304, 272, 408, 267, 6935, 370, 5341, 14118, 10041, 5331, 402, 9635, 9962, 5944, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 9635, 9962, 12, 2073, 63, 466, 12, 2073, 63, 344, 304, 267, 291, 14, 9053, 9962, 275, 9635, 9962, 398, 291, 14, 578, 275, 291, 14 ]
[ 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 334, 67, 9, 9708, 12, 24747, 14769, 1804, 6161, 665, 75, 269, 977, 290, 14769, 17, 32, 6799, 14, 957, 30, 199, 3, 334, 67, 9, 9708, 12, 1488, 2158, 8695, 3107, 455, 723, 665, 19873, 455, 723, 32, 17164, 14, 957, 30, 199, 3, 1664, 1696, 1684, 844, 373, 19, 14, 16, 11, 334, 3239, 9685, 503, 4178, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 15, 11692, 13, 19, 14, 16, 14, 2424, 9, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 870, 63, 1593, 199, 363, 6577, 363, 275, 730, 421, 199, 8490, 63, 8314, 275, 469, 272, 283, 2343, 63, 1023, 356, 283, 17, 14, 17, 297, 272, 283, 1205, 356, 788, 7780, 995, 272, 283, 4946, 63, 991, 356, 283, 9387, 7, 199, 93, 421, 199, 8948, 275, 1449, 199, 199, 578, 26, 9635, 9962, 63, 11767, 199, 199, 3612, 63, 1802, 26, 8259, 402, 2073, 4592, 63, 11225, 315, 14944, 23559, 14, 199, 11036, 63, 9970, 63, 7677, 26, 9635, 9962, 199, 1023, 63, 3270, 26, 283, 18, 14, 21, 7, 199, 2502, 26, 24747, 14769, 1804, 6161, 8593, 6341, 6161, 9, 199, 1802, 26, 523, 446, 710, 9635, 9962, 63, 11767, 859, 5171, 7791, 436, 13794, 4592, 63, 11225, 315, 14944, 23559, 14, 199, 199, 1419, 26, 523, 1174, 26, 272, 1369, 26, 489, 446, 9552, 446, 4592, 63, 11225, 1077, 440, 2187, 12, 489, 446, 3451, 446, 4592, 63, 11225, 1077, 2187, 12, 489, 446, 769, 446, 769, 1453, 4592, 63, 11225, 436, 14118, 14, 272, 1415, 26, 756, 272, 3415, 26, 788, 5575, 297, 283, 1881, 297, 283, 513, 418, 272, 849, 26, 283, 1881, 7, 523, 4592, 63, 11225, 26, 272, 1369, 26, 489, 446, 769, 402, 11196, 12, 1924, 6952, 314, 4592, 63, 2913, 283, 354, 7, 790, 14, 489, 446, 1415, 340, 1174, 365, 3451, 503, 9552, 14, 272, 1415, 26, 3055, 272, 849, 26, 2973, 523, 2073, 63, 466, 26, 272, 1369, 26, 489, 446, 314, 730, 402, 314, 2073, 370, 1314, 314, 4690, 1077, 506, 359, 324, 61, 12941, 272, 1415, 26, 2549, 272, 3415, 26, 788, 3780, 297, 283, 1102, 297, 283, 2611, 297, 283, 15918, 297, 283, 3710, 297, 283, 4201, 297, 267, 283, 576, 3877, 297, 283, 923, 297, 283, 1927, 4203, 297, 283, 1364, 297, 283, 1364, 1978, 297, 267, 283, 1160, 297, 283, 4647, 297, 283, 751, 418, 272, 849, 26, 2973, 523, 2073, 63, 354, 26, 272, 1369, 26, 489, 446, 314, 536, 402, 314, 2073, 370, 1314, 314, 4690, 1077, 506, 359, 324, 61, 12941, 272, 1415, 26, 2549, 272, 849, 26, 2973, 199, 2344, 199, 199, 8918, 275, 1449, 199, 13, 536, 26, 16927, 892, 4592, 63, 2913, 367, 282, 5022, 315, 14944, 23559, 523, 9635, 9962, 63, 11767, 26, 272, 2073, 63, 354, 26, 283, 16197, 22511, 7, 272, 2073, 63, 466, 26, 283, 3780, 7, 272, 4592, 63, 11225, 26, 489, 446, 536, 26, 1551, 551, 439, 4690, 272, 9635, 9962, 63, 2105, 26, 489, 1166, 26, 283, 1014, 921, 4195, 14, 16, 14, 16, 14, 17, 26, 19962, 7, 489, 3434, 26, 283, 2113, 7, 489, 2505, 26, 283, 7853, 2611, 7, 489, 4911, 63, 4266, 26, 756, 199, 199, 13, 536, 26, 1910, 5038, 282, 4592, 63, 2913, 367, 282, 5022, 315, 14944, 23559, 523, 9635, 9962, 63, 11767, 26, 272, 1174, 26, 9552, 272, 2073, 63, 354, 26, 283, 16197, 22511, 7, 272, 2073, 63, 466, 26, 283, 3780, 7, 272, 4592, 63, 11225, 26, 489, 446, 536, 26, 1551, 551, 439, 4690, 272, 9635, 9962, 63, 2105, 26, 489, 1166, 26, 283, 1014, 921, 4195, 14, 16, 14, 16, 14, 17, 26, 19962, 7, 489, 3434, 26, 283, 2113, 7, 489, 2505, 26, 283, 7853, 2611, 7, 489, 4911, 63, 4266, 26, 756, 199, 199, 13, 536, 26, 3820, 1453, 4592, 63, 2913, 436, 14118, 367, 282, 5022, 315, 14944, 23559, 523, 9635, 9962, 63, 11767, 26, 272, 1174, 26, 769, 272, 2073, 63, 354, 26, 283, 16197, 22511, 7, 272, 2073, 63, 466, 26, 283, 3780, 7, 272, 9635, 9962, 63, 2105, 26, 489, 1166, 26, 283, 1014, 921, 4195, 14, 16, 14, 16, 14, 17, 26, 19962, 7, 489, 3434, 26, 283, 2113, 7, 489, 2505, 26, 283, 7853, 2611, 7, 489, 4911, 63, 4266, 26, 756, 199, 2344, 199, 199, 9677, 275, 1449, 199, 9053, 9962, 63, 11767, 26, 272, 1369, 26, 489, 446, 3820, 1453, 4592, 63, 2913, 436, 14118, 367, 282, 5022, 315, 14944, 23559, 272, 2138, 26, 3544, 272, 730, 26, 1211, 272, 2690, 26, 5041, 267, 298, 2489, 582, 3055, 12, 267, 298, 11225, 582, 359, 288, 469, 355, 298, 11767, 582, 359, 490, 469, 717, 298, 2682, 582, 2549, 12, 717, 298, 1802, 582, 298, 4299, 5153, 1282, 401, 717, 298, 354, 582, 298, 1490, 551, 439, 4592, 2, 490, 1660, 490, 469, 717, 298, 2682, 582, 2549, 12, 717, 298, 1802, 582, 298, 8014, 261, 12467, 3970, 5935, 401, 717, 298, 354, 582, 298, 26943, 12467, 3970, 5935, 2, 490, 1660, 490, 469, 717, 298, 2682, 582, 2549, 12, 717, 298, 1802, 582, 298, 15535, 4151, 2410, 11179, 1174, 11284, 401, 717, 298, 354, 582, 298, 7211, 4151, 2410, 11179, 1174, 11284, 2, 490, 789, 355, 2156, 355, 298, 2913, 63, 1802, 582, 298, 4299, 5153, 1282, 4690, 401, 355, 298, 2913, 63, 354, 582, 298, 1490, 551, 439, 4690, 2, 288, 789, 267, 1622, 272, 789, 7, 199, 2344, 199, 199, 504, 3242, 14, 578, 63, 1208, 14, 4316, 492, 6953, 199, 504, 3242, 14, 578, 63, 1208, 14, 9053, 9962, 492, 14944, 23559, 12, 9635, 9962, 63, 2094, 63, 1650, 12, 9635, 9962, 63, 8327, 421, 199, 533, 14944, 23559, 27079, 8, 785, 304, 272, 408, 267, 6935, 370, 5341, 14118, 10041, 5331, 402, 9635, 9962, 5944, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 9635, 9962, 12, 2073, 63, 466, 12, 2073, 63, 344, 304, 267, 291, 14, 9053, 9962, 275, 9635, 9962, 398, 291, 14, 578, 275, 291, 14, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
timoschwarzer/blendworks
BlendWorks Server/python/Lib/site-packages/pip/_vendor/requests/packages/charade/charsetgroupprober.py
2929
3791
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client 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 . import constants import sys from .charsetprober import CharSetProber class CharSetGroupProber(CharSetProber): def __init__(self): CharSetProber.__init__(self) self._mActiveNum = 0 self._mProbers = [] self._mBestGuessProber = None def reset(self): CharSetProber.reset(self) self._mActiveNum = 0 for prober in self._mProbers: if prober: prober.reset() prober.active = True self._mActiveNum += 1 self._mBestGuessProber = None def get_charset_name(self): if not self._mBestGuessProber: self.get_confidence() if not self._mBestGuessProber: return None # self._mBestGuessProber = self._mProbers[0] return self._mBestGuessProber.get_charset_name() def feed(self, aBuf): for prober in self._mProbers: if not prober: continue if not prober.active: continue st = prober.feed(aBuf) if not st: continue if st == constants.eFoundIt: self._mBestGuessProber = prober return self.get_state() elif st == constants.eNotMe: prober.active = False self._mActiveNum -= 1 if self._mActiveNum <= 0: self._mState = constants.eNotMe return self.get_state() return self.get_state() def get_confidence(self): st = self.get_state() if st == constants.eFoundIt: return 0.99 elif st == constants.eNotMe: return 0.01 bestConf = 0.0 self._mBestGuessProber = None for prober in self._mProbers: if not prober: continue if not prober.active: if constants._debug: sys.stderr.write(prober.get_charset_name() + ' not active\n') continue cf = prober.get_confidence() if constants._debug: sys.stderr.write('%s confidence = %s\n' % (prober.get_charset_name(), cf)) if bestConf < cf: bestConf = cf self._mBestGuessProber = prober if not self._mBestGuessProber: return 0.0 return bestConf # else: # self._mBestGuessProber = self._mProbers[0] # return self._mBestGuessProber.get_confidence()
gpl-2.0
[ 6565, 16427, 5113, 8068, 11945, 199, 3, 710, 12769, 5495, 365, 17728, 13338, 707, 1890, 1233, 14, 199, 3, 221, 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, 221, 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, 221, 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, 221, 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, 492, 5262, 199, 646, 984, 199, 504, 1275, 6043, 19903, 492, 31727, 421, 199, 533, 6659, 1084, 2448, 8029, 8, 15159, 304, 272, 347, 636, 826, 721, 277, 304, 267, 31727, 855, 826, 721, 277, 9, 267, 291, 423, 77, 7472, 5667, 275, 378, 267, 291, 423, 77, 8029, 83, 275, 942, 267, 291, 423, 77, 19478, 25541, 8029, 275, 488, 339, 347, 5305, 8, 277, 304, 267, 31727, 14, 3958, 8, 277, 9, 267, 291, 423, 77, 7472, 5667, 275, 378, 267, 367, 16118, 315, 291, 423, 77, 8029, 83, 26, 288, 340, 16118, 26, 355, 16118, 14, 3958, 342, 355, 16118, 14, 2682, 275, 715, 355, 291, 423, 77, 7472, 5667, 847, 413, 267, 291, 423, 77, 19478, 25541, 8029, 275, 488, 339, 347, 664, 63, 6043, 63, 354, 8, 277, 304, 267, 340, 440, 291, 423, 77, 19478, 25541, 8029, 26, 288, 291, 14, 362, 63, 13969, 342, 288, 340, 440, 291, 423, 77, 19478, 25541, 8029, 26, 355, 372, 488, 199, 3, 4483, 291, 423, 77, 19478, 25541, 8029, 275, 291, 423, 77, 8029, 83, 59, 16, 61, 267, 372, 291, 423, 77, 19478, 25541, 8029, 14, 362, 63, 6043, 63, 354, 342, 339, 347, 4733, 8, 277, 12, 17407, 304, 267, 367, 16118, 315, 291, 423, 77, 8029, 83, 26, 288, 340, 440, 16118, 26, 355, 1980, 288, 340, 440, 16118, 14, 2682, 26, 355, 1980, 288, 410, 275, 16118, 14, 3871, 8, 22353, 9, 288, 340, 440, 410, 26, 355, 1980, 288, 340, 410, 508, 5262, 14, 69, 3601, 7940, 26, 355, 291, 423, 77, 19478, 25541, 8029, 275, 16118, 355, 372, 291, 14, 362, 63, 929, 342, 288, 916, 410, 508, 5262, 14, 69, 1763, 1352, 26, 355, 16118, 14, 2682, 275, 756, 355, 291, 423, 77, 7472, 5667, 4862, 413, 355, 340, 291, 423, 77, 7472, 5667, 2695, 378, 26, 490, 291, 423, 31984, 275, 5262, 14, 69, 1763, 1352, 490, 372, 291, 14, 362, 63, 929, 342, 267, 372, 291, 14, 362, 63, 929, 342, 339, 347, 664, 63, 13969, 8, 277, 304, 267, 410, 275, 291, 14, 362, 63, 929, 342, 267, 340, 410, 508, 5262, 14, 69, 3601, 7940, 26, 288, 372, 378, 14, 1020, 267, 916, 410, 508, 5262, 14, 69, 1763, 1352, 26, 288, 372, 378, 14, 614, 267, 5526, 8930, 275, 378, 14, 16, 267, 291, 423, 77, 19478, 25541, 8029, 275, 488, 267, 367, 16118, 315, 291, 423, 77, 8029, 83, 26, 288, 340, 440, 16118, 26, 355, 1980, 288, 340, 440, 16118, 14, 2682, 26, 355, 340, 5262, 423, 1757, 26, 490, 984, 14, 3083, 14, 952, 8, 19903, 14, 362, 63, 6043, 63, 354, 342, 3660, 435, 283, 440, 4702, 60, 78, 358, 355, 1980, 288, 3980, 275, 16118, 14, 362, 63, 13969, 342, 288, 340, 5262, 423, 1757, 26, 355, 984, 14, 3083, 14, 952, 3508, 83, 15197, 275, 450, 83, 60, 78, 7, 450, 639, 334, 19903, 14, 362, 63, 6043, 63, 354, 1062, 3980, 430, 288, 340, 5526, 8930, 665, 3980, 26, 355, 5526, 8930, 275, 3980, 355, 291, 423, 77, 19478, 25541, 8029, 275, 16118, 267, 340, 440, 291, 423, 77, 19478, 25541, 8029, 26, 288, 372, 378, 14, 16, 267, 372, 5526, 8930, 199, 3, 263, 587, 26, 199, 3, 3322, 291, 423, 77, 19478, 25541, 8029, 275, 291, 423, 77, 8029, 83, 59, 16, 61, 199, 3, 3322, 372, 291, 423, 77, 19478, 25541, 8029, 14, 362, 63, 13969, 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 ]
[ 16427, 5113, 8068, 11945, 199, 3, 710, 12769, 5495, 365, 17728, 13338, 707, 1890, 1233, 14, 199, 3, 221, 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, 221, 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, 221, 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, 221, 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, 492, 5262, 199, 646, 984, 199, 504, 1275, 6043, 19903, 492, 31727, 421, 199, 533, 6659, 1084, 2448, 8029, 8, 15159, 304, 272, 347, 636, 826, 721, 277, 304, 267, 31727, 855, 826, 721, 277, 9, 267, 291, 423, 77, 7472, 5667, 275, 378, 267, 291, 423, 77, 8029, 83, 275, 942, 267, 291, 423, 77, 19478, 25541, 8029, 275, 488, 339, 347, 5305, 8, 277, 304, 267, 31727, 14, 3958, 8, 277, 9, 267, 291, 423, 77, 7472, 5667, 275, 378, 267, 367, 16118, 315, 291, 423, 77, 8029, 83, 26, 288, 340, 16118, 26, 355, 16118, 14, 3958, 342, 355, 16118, 14, 2682, 275, 715, 355, 291, 423, 77, 7472, 5667, 847, 413, 267, 291, 423, 77, 19478, 25541, 8029, 275, 488, 339, 347, 664, 63, 6043, 63, 354, 8, 277, 304, 267, 340, 440, 291, 423, 77, 19478, 25541, 8029, 26, 288, 291, 14, 362, 63, 13969, 342, 288, 340, 440, 291, 423, 77, 19478, 25541, 8029, 26, 355, 372, 488, 199, 3, 4483, 291, 423, 77, 19478, 25541, 8029, 275, 291, 423, 77, 8029, 83, 59, 16, 61, 267, 372, 291, 423, 77, 19478, 25541, 8029, 14, 362, 63, 6043, 63, 354, 342, 339, 347, 4733, 8, 277, 12, 17407, 304, 267, 367, 16118, 315, 291, 423, 77, 8029, 83, 26, 288, 340, 440, 16118, 26, 355, 1980, 288, 340, 440, 16118, 14, 2682, 26, 355, 1980, 288, 410, 275, 16118, 14, 3871, 8, 22353, 9, 288, 340, 440, 410, 26, 355, 1980, 288, 340, 410, 508, 5262, 14, 69, 3601, 7940, 26, 355, 291, 423, 77, 19478, 25541, 8029, 275, 16118, 355, 372, 291, 14, 362, 63, 929, 342, 288, 916, 410, 508, 5262, 14, 69, 1763, 1352, 26, 355, 16118, 14, 2682, 275, 756, 355, 291, 423, 77, 7472, 5667, 4862, 413, 355, 340, 291, 423, 77, 7472, 5667, 2695, 378, 26, 490, 291, 423, 31984, 275, 5262, 14, 69, 1763, 1352, 490, 372, 291, 14, 362, 63, 929, 342, 267, 372, 291, 14, 362, 63, 929, 342, 339, 347, 664, 63, 13969, 8, 277, 304, 267, 410, 275, 291, 14, 362, 63, 929, 342, 267, 340, 410, 508, 5262, 14, 69, 3601, 7940, 26, 288, 372, 378, 14, 1020, 267, 916, 410, 508, 5262, 14, 69, 1763, 1352, 26, 288, 372, 378, 14, 614, 267, 5526, 8930, 275, 378, 14, 16, 267, 291, 423, 77, 19478, 25541, 8029, 275, 488, 267, 367, 16118, 315, 291, 423, 77, 8029, 83, 26, 288, 340, 440, 16118, 26, 355, 1980, 288, 340, 440, 16118, 14, 2682, 26, 355, 340, 5262, 423, 1757, 26, 490, 984, 14, 3083, 14, 952, 8, 19903, 14, 362, 63, 6043, 63, 354, 342, 3660, 435, 283, 440, 4702, 60, 78, 358, 355, 1980, 288, 3980, 275, 16118, 14, 362, 63, 13969, 342, 288, 340, 5262, 423, 1757, 26, 355, 984, 14, 3083, 14, 952, 3508, 83, 15197, 275, 450, 83, 60, 78, 7, 450, 639, 334, 19903, 14, 362, 63, 6043, 63, 354, 1062, 3980, 430, 288, 340, 5526, 8930, 665, 3980, 26, 355, 5526, 8930, 275, 3980, 355, 291, 423, 77, 19478, 25541, 8029, 275, 16118, 267, 340, 440, 291, 423, 77, 19478, 25541, 8029, 26, 288, 372, 378, 14, 16, 267, 372, 5526, 8930, 199, 3, 263, 587, 26, 199, 3, 3322, 291, 423, 77, 19478, 25541, 8029, 275, 291, 423, 77, 8029, 83, 59, 16, 61, 199, 3, 3322, 372, 291, 423, 77, 19478, 25541, 8029, 14, 362, 63, 13969, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
tklaus/ansible
lib/ansible/errors/yaml_strings.py
264
3419
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # Make coding more python3-ish from __future__ import (absolute_import, division, print_function) __metaclass__ = type __all__ = [ 'YAML_SYNTAX_ERROR', 'YAML_POSITION_DETAILS', 'YAML_COMMON_DICT_ERROR', 'YAML_COMMON_UNQUOTED_VARIABLE_ERROR', 'YAML_COMMON_UNQUOTED_COLON_ERROR', 'YAML_COMMON_PARTIALLY_QUOTED_LINE_ERROR', 'YAML_COMMON_UNBALANCED_QUOTES_ERROR', ] YAML_SYNTAX_ERROR = """\ Syntax Error while loading YAML. """ YAML_POSITION_DETAILS = """\ The error appears to have been in '%s': line %s, column %s, but may be elsewhere in the file depending on the exact syntax problem. """ YAML_COMMON_DICT_ERROR = """\ This one looks easy to fix. YAML thought it was looking for the start of a hash/dictionary and was confused to see a second "{". Most likely this was meant to be an ansible template evaluation instead, so we have to give the parser a small hint that we wanted a string instead. The solution here is to just quote the entire value. For instance, if the original line was: app_path: {{ base_path }}/foo It should be written as: app_path: "{{ base_path }}/foo" """ YAML_COMMON_UNQUOTED_VARIABLE_ERROR = """\ We could be wrong, but this one looks like it might be an issue with missing quotes. Always quote template expression brackets when they start a value. For instance: with_items: - {{ foo }} Should be written as: with_items: - "{{ foo }}" """ YAML_COMMON_UNQUOTED_COLON_ERROR = """\ This one looks easy to fix. There seems to be an extra unquoted colon in the line and this is confusing the parser. It was only expecting to find one free colon. The solution is just add some quotes around the colon, or quote the entire line after the first colon. For instance, if the original line was: copy: src=file.txt dest=/path/filename:with_colon.txt It can be written as: copy: src=file.txt dest='/path/filename:with_colon.txt' Or: copy: 'src=file.txt dest=/path/filename:with_colon.txt' """ YAML_COMMON_PARTIALLY_QUOTED_LINE_ERROR = """\ This one looks easy to fix. It seems that there is a value started with a quote, and the YAML parser is expecting to see the line ended with the same kind of quote. For instance: when: "ok" in result.stdout Could be written as: when: '"ok" in result.stdout' Or equivalently: when: "'ok' in result.stdout" """ YAML_COMMON_UNBALANCED_QUOTES_ERROR = """\ We could be wrong, but this one looks like it might be an issue with unbalanced quotes. If starting a value with a quote, make sure the line ends with the same set of quotes. For instance this arbitrary example: foo: "bad" "wolf" Could be written as: foo: '"bad" "wolf"' """
gpl-3.0
[ 3, 334, 67, 9, 6029, 13, 7280, 12, 16922, 22453, 665, 22333, 14, 24247, 32, 6799, 14, 957, 30, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 2622, 199, 3, 199, 3, 2622, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 2622, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 2622, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 3, 4155, 2803, 1655, 2366, 19, 13, 2453, 199, 504, 636, 2443, 363, 492, 334, 6116, 63, 646, 12, 4629, 12, 870, 63, 1593, 9, 199, 363, 6577, 363, 275, 730, 199, 199, 363, 452, 363, 275, 359, 272, 283, 23103, 63, 20763, 63, 3170, 297, 272, 283, 23103, 63, 15717, 63, 25081, 51, 297, 272, 283, 23103, 63, 21637, 63, 12511, 63, 3170, 297, 272, 283, 23103, 63, 21637, 63, 1734, 18654, 1149, 63, 23129, 63, 3170, 297, 272, 283, 23103, 63, 21637, 63, 1734, 18654, 1149, 63, 3978, 615, 63, 3170, 297, 272, 283, 23103, 63, 21637, 63, 14848, 41, 28292, 63, 18654, 1149, 63, 6174, 63, 3170, 297, 272, 283, 23103, 63, 21637, 63, 1734, 31232, 879, 25927, 63, 18654, 654, 63, 3170, 297, 199, 61, 199, 199, 23103, 63, 20763, 63, 3170, 275, 9638, 199, 16626, 4520, 1830, 8697, 18916, 14, 199, 624, 199, 199, 23103, 63, 15717, 63, 25081, 51, 275, 9638, 199, 1918, 1125, 11337, 370, 1172, 2757, 315, 1543, 83, 356, 1004, 450, 83, 12, 2763, 450, 83, 12, 1325, 1443, 199, 1235, 25320, 315, 314, 570, 10298, 641, 314, 5835, 6302, 5160, 14, 199, 624, 199, 199, 23103, 63, 21637, 63, 12511, 63, 3170, 275, 9638, 199, 2765, 1373, 10734, 8837, 370, 5325, 14, 221, 18916, 32463, 652, 1990, 10023, 367, 314, 1343, 402, 282, 199, 2227, 15, 9086, 436, 1990, 3743, 2972, 370, 1937, 282, 3499, 5310, 1674, 221, 17536, 12060, 642, 1990, 199, 278, 867, 370, 506, 376, 3242, 1978, 11735, 3140, 12, 880, 781, 1172, 370, 8120, 314, 199, 2087, 282, 7425, 8328, 626, 781, 13632, 282, 1059, 3140, 14, 710, 8744, 2348, 365, 370, 199, 4764, 6313, 314, 8039, 574, 14, 199, 199, 1858, 1256, 12, 340, 314, 3379, 1004, 1990, 26, 339, 1145, 63, 515, 26, 8448, 1300, 63, 515, 3586, 15, 1421, 199, 199, 7940, 1077, 506, 5313, 465, 26, 339, 1145, 63, 515, 26, 7370, 1300, 63, 515, 3586, 15, 1421, 2, 199, 624, 199, 199, 23103, 63, 21637, 63, 1734, 18654, 1149, 63, 23129, 63, 3170, 275, 9638, 199, 6004, 4293, 506, 6835, 12, 1325, 642, 1373, 10734, 2839, 652, 5594, 506, 376, 4976, 543, 199, 4752, 9344, 14, 221, 16763, 6313, 1978, 3965, 21873, 1380, 2985, 199, 928, 282, 574, 14, 2104, 1256, 26, 339, 543, 63, 1744, 26, 489, 446, 8448, 3925, 3586, 199, 199, 11408, 506, 5313, 465, 26, 339, 543, 63, 1744, 26, 489, 446, 7370, 3925, 7820, 199, 624, 199, 199, 23103, 63, 21637, 63, 1734, 18654, 1149, 63, 3978, 615, 63, 3170, 275, 9638, 199, 2765, 1373, 10734, 8837, 370, 5325, 14, 221, 6006, 12237, 370, 506, 376, 2402, 31791, 18307, 315, 314, 1004, 199, 460, 642, 365, 3743, 4941, 314, 1798, 14, 2779, 1990, 1454, 21055, 370, 2342, 1373, 2867, 199, 12167, 14, 710, 8744, 365, 2951, 1050, 2005, 9344, 6818, 314, 18307, 12, 503, 6313, 314, 199, 287, 7261, 1004, 2410, 314, 1642, 18307, 14, 199, 199, 1858, 1256, 12, 340, 314, 3379, 1004, 1990, 26, 339, 1331, 26, 2928, 29, 493, 14, 2424, 2053, 13043, 515, 15, 1501, 26, 1045, 63, 12167, 14, 2424, 199, 199, 7940, 883, 506, 5313, 465, 26, 339, 1331, 26, 2928, 29, 493, 14, 2424, 2053, 8805, 515, 15, 1501, 26, 1045, 63, 12167, 14, 2424, 7, 199, 199, 2844, 26, 339, 1331, 26, 283, 2164, 29, 493, 14, 2424, 2053, 13043, 515, 15, 1501, 26, 1045, 63, 12167, 14, 2424, 7, 199, 624, 199, 199, 23103, 63, 21637, 63, 14848, 41, 28292, 63, 18654, 1149, 63, 6174, 63, 3170, 275, 9638, 199, 2765, 1373, 10734, 8837, 370, 5325, 14, 221, 2779, 12237, 626, 2337, 365, 282, 574, 8239, 199, 1045, 282, 6313, 12, 436, 314, 18916, 1798, 365, 21055, 370, 1937, 314, 1004, 22480, 199, 1045, 314, 2011, 4928, 402, 6313, 14, 221, 2104, 1256, 26, 339, 1380, 26, 298, 745, 2, 315, 754, 14, 2703, 199, 199, 6531, 506, 5313, 465, 26, 8410, 1380, 26, 5522, 745, 2, 315, 754, 14, 2703, 7, 199, 199, 2844, 7353, 590, 26, 8410, 1380, 26, 3546, 745, 7, 315, 754, 14, 2703, 2, 199, 624, 199, 199, 23103, 63, 21637, 63, 1734, 31232, 879, 25927, 63, 18654, 654, 63, 3170, 275, 9638, 199, 6004, 4293, 506, 6835, 12, 1325, 642, 1373, 10734, 2839, 652, 5594, 506, 376, 4976, 543, 199, 324, 18923, 9344, 14, 221, 982, 6617, 282, 574, 543, 282, 6313, 12, 1852, 3238, 314, 199, 604, 11187, 543, 314, 2011, 663, 402, 9344, 14, 221, 2104, 1256, 642, 9697, 199, 2694, 26, 339, 3925, 26, 298, 4087, 2, 298, 28070, 2, 199, 199, 6531, 506, 5313, 465, 26, 339, 3925, 26, 5522, 4087, 2, 298, 28070, 4507, 199, 624, 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 ]
[ 334, 67, 9, 6029, 13, 7280, 12, 16922, 22453, 665, 22333, 14, 24247, 32, 6799, 14, 957, 30, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 2622, 199, 3, 199, 3, 2622, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 2622, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 2622, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 3, 4155, 2803, 1655, 2366, 19, 13, 2453, 199, 504, 636, 2443, 363, 492, 334, 6116, 63, 646, 12, 4629, 12, 870, 63, 1593, 9, 199, 363, 6577, 363, 275, 730, 199, 199, 363, 452, 363, 275, 359, 272, 283, 23103, 63, 20763, 63, 3170, 297, 272, 283, 23103, 63, 15717, 63, 25081, 51, 297, 272, 283, 23103, 63, 21637, 63, 12511, 63, 3170, 297, 272, 283, 23103, 63, 21637, 63, 1734, 18654, 1149, 63, 23129, 63, 3170, 297, 272, 283, 23103, 63, 21637, 63, 1734, 18654, 1149, 63, 3978, 615, 63, 3170, 297, 272, 283, 23103, 63, 21637, 63, 14848, 41, 28292, 63, 18654, 1149, 63, 6174, 63, 3170, 297, 272, 283, 23103, 63, 21637, 63, 1734, 31232, 879, 25927, 63, 18654, 654, 63, 3170, 297, 199, 61, 199, 199, 23103, 63, 20763, 63, 3170, 275, 9638, 199, 16626, 4520, 1830, 8697, 18916, 14, 199, 624, 199, 199, 23103, 63, 15717, 63, 25081, 51, 275, 9638, 199, 1918, 1125, 11337, 370, 1172, 2757, 315, 1543, 83, 356, 1004, 450, 83, 12, 2763, 450, 83, 12, 1325, 1443, 199, 1235, 25320, 315, 314, 570, 10298, 641, 314, 5835, 6302, 5160, 14, 199, 624, 199, 199, 23103, 63, 21637, 63, 12511, 63, 3170, 275, 9638, 199, 2765, 1373, 10734, 8837, 370, 5325, 14, 221, 18916, 32463, 652, 1990, 10023, 367, 314, 1343, 402, 282, 199, 2227, 15, 9086, 436, 1990, 3743, 2972, 370, 1937, 282, 3499, 5310, 1674, 221, 17536, 12060, 642, 1990, 199, 278, 867, 370, 506, 376, 3242, 1978, 11735, 3140, 12, 880, 781, 1172, 370, 8120, 314, 199, 2087, 282, 7425, 8328, 626, 781, 13632, 282, 1059, 3140, 14, 710, 8744, 2348, 365, 370, 199, 4764, 6313, 314, 8039, 574, 14, 199, 199, 1858, 1256, 12, 340, 314, 3379, 1004, 1990, 26, 339, 1145, 63, 515, 26, 8448, 1300, 63, 515, 3586, 15, 1421, 199, 199, 7940, 1077, 506, 5313, 465, 26, 339, 1145, 63, 515, 26, 7370, 1300, 63, 515, 3586, 15, 1421, 2, 199, 624, 199, 199, 23103, 63, 21637, 63, 1734, 18654, 1149, 63, 23129, 63, 3170, 275, 9638, 199, 6004, 4293, 506, 6835, 12, 1325, 642, 1373, 10734, 2839, 652, 5594, 506, 376, 4976, 543, 199, 4752, 9344, 14, 221, 16763, 6313, 1978, 3965, 21873, 1380, 2985, 199, 928, 282, 574, 14, 2104, 1256, 26, 339, 543, 63, 1744, 26, 489, 446, 8448, 3925, 3586, 199, 199, 11408, 506, 5313, 465, 26, 339, 543, 63, 1744, 26, 489, 446, 7370, 3925, 7820, 199, 624, 199, 199, 23103, 63, 21637, 63, 1734, 18654, 1149, 63, 3978, 615, 63, 3170, 275, 9638, 199, 2765, 1373, 10734, 8837, 370, 5325, 14, 221, 6006, 12237, 370, 506, 376, 2402, 31791, 18307, 315, 314, 1004, 199, 460, 642, 365, 3743, 4941, 314, 1798, 14, 2779, 1990, 1454, 21055, 370, 2342, 1373, 2867, 199, 12167, 14, 710, 8744, 365, 2951, 1050, 2005, 9344, 6818, 314, 18307, 12, 503, 6313, 314, 199, 287, 7261, 1004, 2410, 314, 1642, 18307, 14, 199, 199, 1858, 1256, 12, 340, 314, 3379, 1004, 1990, 26, 339, 1331, 26, 2928, 29, 493, 14, 2424, 2053, 13043, 515, 15, 1501, 26, 1045, 63, 12167, 14, 2424, 199, 199, 7940, 883, 506, 5313, 465, 26, 339, 1331, 26, 2928, 29, 493, 14, 2424, 2053, 8805, 515, 15, 1501, 26, 1045, 63, 12167, 14, 2424, 7, 199, 199, 2844, 26, 339, 1331, 26, 283, 2164, 29, 493, 14, 2424, 2053, 13043, 515, 15, 1501, 26, 1045, 63, 12167, 14, 2424, 7, 199, 624, 199, 199, 23103, 63, 21637, 63, 14848, 41, 28292, 63, 18654, 1149, 63, 6174, 63, 3170, 275, 9638, 199, 2765, 1373, 10734, 8837, 370, 5325, 14, 221, 2779, 12237, 626, 2337, 365, 282, 574, 8239, 199, 1045, 282, 6313, 12, 436, 314, 18916, 1798, 365, 21055, 370, 1937, 314, 1004, 22480, 199, 1045, 314, 2011, 4928, 402, 6313, 14, 221, 2104, 1256, 26, 339, 1380, 26, 298, 745, 2, 315, 754, 14, 2703, 199, 199, 6531, 506, 5313, 465, 26, 8410, 1380, 26, 5522, 745, 2, 315, 754, 14, 2703, 7, 199, 199, 2844, 7353, 590, 26, 8410, 1380, 26, 3546, 745, 7, 315, 754, 14, 2703, 2, 199, 624, 199, 199, 23103, 63, 21637, 63, 1734, 31232, 879, 25927, 63, 18654, 654, 63, 3170, 275, 9638, 199, 6004, 4293, 506, 6835, 12, 1325, 642, 1373, 10734, 2839, 652, 5594, 506, 376, 4976, 543, 199, 324, 18923, 9344, 14, 221, 982, 6617, 282, 574, 543, 282, 6313, 12, 1852, 3238, 314, 199, 604, 11187, 543, 314, 2011, 663, 402, 9344, 14, 221, 2104, 1256, 642, 9697, 199, 2694, 26, 339, 3925, 26, 298, 4087, 2, 298, 28070, 2, 199, 199, 6531, 506, 5313, 465, 26, 339, 3925, 26, 5522, 4087, 2, 298, 28070, 4507, 199, 624, 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,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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 ]
NullNoname/dolphin
Externals/scons-local/scons-local-2.0.1/SCons/Tool/rpm.py
61
4549
"""SCons.Tool.rpm Tool-specific initialization for rpm. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. The rpm tool calls the rpmbuild command. The first and only argument should a tar.gz consisting of the source file and a specfile. """ # # 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/Tool/rpm.py 5134 2010/08/16 23:02:40 bdeegan" import os import re import shutil import subprocess import SCons.Builder import SCons.Node.FS import SCons.Util import SCons.Action import SCons.Defaults def get_cmd(source, env): tar_file_with_included_specfile = source if SCons.Util.is_List(source): tar_file_with_included_specfile = source[0] return "%s %s %s"%(env['RPM'], env['RPMFLAGS'], tar_file_with_included_specfile.abspath ) def build_rpm(target, source, env): # create a temporary rpm build root. tmpdir = os.path.join( os.path.dirname( target[0].abspath ), 'rpmtemp' ) if os.path.exists(tmpdir): shutil.rmtree(tmpdir) # now create the mandatory rpm directory structure. for d in ['RPMS', 'SRPMS', 'SPECS', 'BUILD']: os.makedirs( os.path.join( tmpdir, d ) ) # set the topdir as an rpmflag. env.Prepend( RPMFLAGS = '--define \'_topdir %s\'' % tmpdir ) # now call rpmbuild to create the rpm package. handle = subprocess.Popen(get_cmd(source, env), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) output = handle.stdout.read() status = handle.wait() if status: raise SCons.Errors.BuildError( node=target[0], errstr=output, filename=str(target[0]) ) else: # XXX: assume that LC_ALL=c is set while running rpmbuild output_files = re.compile( 'Wrote: (.*)' ).findall( output ) for output, input in zip( output_files, target ): rpm_output = os.path.basename(output) expected = os.path.basename(input.get_path()) assert expected == rpm_output, "got %s but expected %s" % (rpm_output, expected) shutil.copy( output, input.abspath ) # cleanup before leaving. shutil.rmtree(tmpdir) return status def string_rpm(target, source, env): try: return env['RPMCOMSTR'] except KeyError: return get_cmd(source, env) rpmAction = SCons.Action.Action(build_rpm, string_rpm) RpmBuilder = SCons.Builder.Builder(action = SCons.Action.Action('$RPMCOM', '$RPMCOMSTR'), source_scanner = SCons.Defaults.DirScanner, suffix = '$RPMSUFFIX') def generate(env): """Add Builders and construction variables for rpm to an Environment.""" try: bld = env['BUILDERS']['Rpm'] except KeyError: bld = RpmBuilder env['BUILDERS']['Rpm'] = bld env.SetDefault(RPM = 'LC_ALL=c rpmbuild') env.SetDefault(RPMFLAGS = SCons.Util.CLVar('-ta')) env.SetDefault(RPMCOM = rpmAction) env.SetDefault(RPMSUFFIX = '.rpm') def exists(env): return env.Detect('rpmbuild') # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
gpl-2.0
[ 624, 18521, 14, 5157, 14, 14191, 199, 199, 5157, 13, 6100, 11097, 367, 21980, 14, 199, 199, 10924, 12252, 9296, 1133, 506, 1263, 1929, 370, 492, 642, 859, 5370, 14, 199, 7940, 911, 9987, 506, 8439, 4012, 314, 7809, 8218, 14, 5157, 14, 5157, 342, 199, 5592, 1083, 14, 199, 199, 1918, 21980, 4744, 4882, 314, 21980, 1506, 1414, 14, 710, 1642, 436, 1454, 1423, 1077, 282, 199, 5369, 14, 6838, 22581, 402, 314, 1350, 570, 436, 282, 3158, 493, 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, 5157, 15, 14191, 14, 647, 959, 7582, 7129, 15, 2036, 15, 975, 6546, 26, 996, 26, 2167, 330, 271, 5902, 290, 2, 199, 199, 646, 747, 199, 646, 295, 199, 646, 5145, 199, 646, 3873, 199, 199, 646, 8218, 14, 6437, 199, 646, 8218, 14, 1716, 14, 7079, 199, 646, 8218, 14, 9562, 199, 646, 8218, 14, 3310, 199, 646, 8218, 14, 16986, 199, 199, 318, 664, 63, 1760, 8, 1365, 12, 2589, 304, 272, 5330, 63, 493, 63, 1045, 63, 12409, 63, 1650, 493, 275, 1350, 272, 340, 8218, 14, 9562, 14, 374, 63, 1296, 8, 1365, 304, 267, 5330, 63, 493, 63, 1045, 63, 12409, 63, 1650, 493, 275, 1350, 59, 16, 61, 272, 372, 2071, 83, 450, 83, 450, 83, 14007, 1813, 459, 32067, 995, 2589, 459, 32067, 4831, 995, 2432, 5330, 63, 493, 63, 1045, 63, 12409, 63, 1650, 493, 14, 4832, 776, 199, 199, 318, 1900, 63, 14191, 8, 1375, 12, 1350, 12, 2589, 304, 272, 327, 1218, 282, 7937, 21980, 1900, 1738, 14, 272, 12885, 275, 747, 14, 515, 14, 904, 8, 747, 14, 515, 14, 3475, 8, 1347, 59, 16, 1055, 4832, 2318, 283, 14191, 808, 7, 776, 272, 340, 747, 14, 515, 14, 2444, 8, 8616, 304, 267, 5145, 14, 9242, 8, 8616, 9, 339, 327, 3063, 1218, 314, 15230, 21980, 2082, 5523, 14, 272, 367, 366, 315, 788, 18612, 3053, 297, 283, 32527, 3053, 297, 283, 14179, 3298, 297, 283, 8248, 2565, 267, 747, 14, 8347, 8, 747, 14, 515, 14, 904, 8, 12885, 12, 366, 776, 776, 339, 327, 663, 314, 2746, 694, 465, 376, 21980, 4173, 14, 272, 2589, 14, 24001, 500, 8, 820, 10793, 4831, 275, 2850, 4640, 8891, 63, 2119, 694, 450, 83, 60, 891, 450, 12885, 776, 339, 327, 3063, 1240, 21980, 1506, 370, 1218, 314, 21980, 2559, 14, 272, 2429, 221, 275, 3873, 14, 7942, 8, 362, 63, 1760, 8, 1365, 12, 2589, 395, 3044, 3839, 29, 5781, 14, 6089, 12, 3044, 4635, 29, 5781, 14, 13850, 12, 3044, 5218, 29, 549, 9, 272, 1072, 275, 2429, 14, 2703, 14, 739, 342, 272, 2004, 275, 2429, 14, 2573, 342, 339, 340, 2004, 26, 267, 746, 8218, 14, 9298, 14, 3425, 547, 8, 1031, 29, 1375, 59, 16, 467, 4318, 2329, 495, 29, 1199, 12, 4318, 1788, 29, 495, 8, 1375, 59, 16, 566, 776, 272, 587, 26, 267, 327, 5787, 26, 5534, 626, 26703, 63, 1761, 29, 67, 365, 663, 1830, 3879, 21980, 1506, 267, 1072, 63, 1725, 275, 295, 14, 2014, 8, 283, 55, 22665, 26, 334, 2795, 3171, 7092, 6452, 8, 1072, 776, 398, 367, 1072, 12, 1324, 315, 3482, 8, 1072, 63, 1725, 12, 1347, 3461, 288, 21980, 63, 1199, 275, 747, 14, 515, 14, 4846, 8, 1199, 9, 288, 1420, 257, 275, 747, 14, 515, 14, 4846, 8, 1210, 14, 362, 63, 515, 1012, 953, 702, 1420, 508, 21980, 63, 1199, 12, 298, 7808, 450, 83, 1325, 1420, 450, 83, 2, 450, 334, 14191, 63, 1199, 12, 1420, 9, 288, 5145, 14, 1574, 8, 1072, 12, 1324, 14, 4832, 776, 2378, 327, 9058, 2544, 23188, 14, 272, 5145, 14, 9242, 8, 8616, 9, 339, 372, 2004, 199, 199, 318, 1059, 63, 14191, 8, 1375, 12, 1350, 12, 2589, 304, 272, 862, 26, 267, 372, 2589, 459, 32067, 11265, 3027, 418, 272, 871, 4067, 26, 267, 372, 664, 63, 1760, 8, 1365, 12, 2589, 9, 199, 199, 14191, 3310, 275, 8218, 14, 3310, 14, 3310, 8, 1506, 63, 14191, 12, 1059, 63, 14191, 9, 199, 199, 50, 7073, 6437, 275, 8218, 14, 6437, 14, 6437, 8, 1287, 275, 8218, 14, 3310, 14, 3310, 14676, 32067, 11265, 297, 4505, 32067, 11265, 3027, 659, 3521, 1350, 63, 16378, 275, 8218, 14, 16986, 14, 3567, 20843, 12, 3521, 4739, 275, 4505, 18612, 3053, 8158, 3867, 358, 4388, 199, 318, 3550, 8, 1813, 304, 272, 408, 1123, 19286, 83, 436, 14538, 2860, 367, 21980, 370, 376, 9711, 1041, 272, 862, 26, 267, 27971, 275, 2589, 459, 8248, 3960, 2545, 50 ]
[ 18521, 14, 5157, 14, 14191, 199, 199, 5157, 13, 6100, 11097, 367, 21980, 14, 199, 199, 10924, 12252, 9296, 1133, 506, 1263, 1929, 370, 492, 642, 859, 5370, 14, 199, 7940, 911, 9987, 506, 8439, 4012, 314, 7809, 8218, 14, 5157, 14, 5157, 342, 199, 5592, 1083, 14, 199, 199, 1918, 21980, 4744, 4882, 314, 21980, 1506, 1414, 14, 710, 1642, 436, 1454, 1423, 1077, 282, 199, 5369, 14, 6838, 22581, 402, 314, 1350, 570, 436, 282, 3158, 493, 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, 5157, 15, 14191, 14, 647, 959, 7582, 7129, 15, 2036, 15, 975, 6546, 26, 996, 26, 2167, 330, 271, 5902, 290, 2, 199, 199, 646, 747, 199, 646, 295, 199, 646, 5145, 199, 646, 3873, 199, 199, 646, 8218, 14, 6437, 199, 646, 8218, 14, 1716, 14, 7079, 199, 646, 8218, 14, 9562, 199, 646, 8218, 14, 3310, 199, 646, 8218, 14, 16986, 199, 199, 318, 664, 63, 1760, 8, 1365, 12, 2589, 304, 272, 5330, 63, 493, 63, 1045, 63, 12409, 63, 1650, 493, 275, 1350, 272, 340, 8218, 14, 9562, 14, 374, 63, 1296, 8, 1365, 304, 267, 5330, 63, 493, 63, 1045, 63, 12409, 63, 1650, 493, 275, 1350, 59, 16, 61, 272, 372, 2071, 83, 450, 83, 450, 83, 14007, 1813, 459, 32067, 995, 2589, 459, 32067, 4831, 995, 2432, 5330, 63, 493, 63, 1045, 63, 12409, 63, 1650, 493, 14, 4832, 776, 199, 199, 318, 1900, 63, 14191, 8, 1375, 12, 1350, 12, 2589, 304, 272, 327, 1218, 282, 7937, 21980, 1900, 1738, 14, 272, 12885, 275, 747, 14, 515, 14, 904, 8, 747, 14, 515, 14, 3475, 8, 1347, 59, 16, 1055, 4832, 2318, 283, 14191, 808, 7, 776, 272, 340, 747, 14, 515, 14, 2444, 8, 8616, 304, 267, 5145, 14, 9242, 8, 8616, 9, 339, 327, 3063, 1218, 314, 15230, 21980, 2082, 5523, 14, 272, 367, 366, 315, 788, 18612, 3053, 297, 283, 32527, 3053, 297, 283, 14179, 3298, 297, 283, 8248, 2565, 267, 747, 14, 8347, 8, 747, 14, 515, 14, 904, 8, 12885, 12, 366, 776, 776, 339, 327, 663, 314, 2746, 694, 465, 376, 21980, 4173, 14, 272, 2589, 14, 24001, 500, 8, 820, 10793, 4831, 275, 2850, 4640, 8891, 63, 2119, 694, 450, 83, 60, 891, 450, 12885, 776, 339, 327, 3063, 1240, 21980, 1506, 370, 1218, 314, 21980, 2559, 14, 272, 2429, 221, 275, 3873, 14, 7942, 8, 362, 63, 1760, 8, 1365, 12, 2589, 395, 3044, 3839, 29, 5781, 14, 6089, 12, 3044, 4635, 29, 5781, 14, 13850, 12, 3044, 5218, 29, 549, 9, 272, 1072, 275, 2429, 14, 2703, 14, 739, 342, 272, 2004, 275, 2429, 14, 2573, 342, 339, 340, 2004, 26, 267, 746, 8218, 14, 9298, 14, 3425, 547, 8, 1031, 29, 1375, 59, 16, 467, 4318, 2329, 495, 29, 1199, 12, 4318, 1788, 29, 495, 8, 1375, 59, 16, 566, 776, 272, 587, 26, 267, 327, 5787, 26, 5534, 626, 26703, 63, 1761, 29, 67, 365, 663, 1830, 3879, 21980, 1506, 267, 1072, 63, 1725, 275, 295, 14, 2014, 8, 283, 55, 22665, 26, 334, 2795, 3171, 7092, 6452, 8, 1072, 776, 398, 367, 1072, 12, 1324, 315, 3482, 8, 1072, 63, 1725, 12, 1347, 3461, 288, 21980, 63, 1199, 275, 747, 14, 515, 14, 4846, 8, 1199, 9, 288, 1420, 257, 275, 747, 14, 515, 14, 4846, 8, 1210, 14, 362, 63, 515, 1012, 953, 702, 1420, 508, 21980, 63, 1199, 12, 298, 7808, 450, 83, 1325, 1420, 450, 83, 2, 450, 334, 14191, 63, 1199, 12, 1420, 9, 288, 5145, 14, 1574, 8, 1072, 12, 1324, 14, 4832, 776, 2378, 327, 9058, 2544, 23188, 14, 272, 5145, 14, 9242, 8, 8616, 9, 339, 372, 2004, 199, 199, 318, 1059, 63, 14191, 8, 1375, 12, 1350, 12, 2589, 304, 272, 862, 26, 267, 372, 2589, 459, 32067, 11265, 3027, 418, 272, 871, 4067, 26, 267, 372, 664, 63, 1760, 8, 1365, 12, 2589, 9, 199, 199, 14191, 3310, 275, 8218, 14, 3310, 14, 3310, 8, 1506, 63, 14191, 12, 1059, 63, 14191, 9, 199, 199, 50, 7073, 6437, 275, 8218, 14, 6437, 14, 6437, 8, 1287, 275, 8218, 14, 3310, 14, 3310, 14676, 32067, 11265, 297, 4505, 32067, 11265, 3027, 659, 3521, 1350, 63, 16378, 275, 8218, 14, 16986, 14, 3567, 20843, 12, 3521, 4739, 275, 4505, 18612, 3053, 8158, 3867, 358, 4388, 199, 318, 3550, 8, 1813, 304, 272, 408, 1123, 19286, 83, 436, 14538, 2860, 367, 21980, 370, 376, 9711, 1041, 272, 862, 26, 267, 27971, 275, 2589, 459, 8248, 3960, 2545, 50, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
madmax983/h2o-3
h2o-py/tests/testdir_munging/unop/pyunit_frame_reducers.py
1
1280
import sys sys.path.insert(1,"../../../") import h2o from tests import pyunit_utils import numpy as np import random def frame_reducers(): data = [[random.uniform(-10000,10000) for r in range(10)] for c in range(10)] h2o_data = h2o.H2OFrame(zip(*data)) np_data = np.array(data) h2o_val = h2o_data.min() num_val = np.min(np_data) assert abs(h2o_val - num_val) < 1e-06, \ "check unsuccessful! h2o computed {0} and numpy computed {1}. expected equal min values between h2o and " \ "numpy".format(h2o_val,num_val) h2o_val = h2o_data.max() num_val = np.max(np_data) assert abs(h2o_val - num_val) < 1e-06, \ "check unsuccessful! h2o computed {0} and numpy computed {1}. expected equal max values between h2o and " \ "numpy".format(h2o_val,num_val) h2o_val = h2o_data.sum() num_val = np.sum(np_data) assert abs(h2o_val - num_val) < 1e-06, \ "check unsuccessful! h2o computed {0} and numpy computed {1}. expected equal sum values between h2o and " \ "numpy".format(h2o_val,num_val) #pyunit_utils.np_comparison_check(h2o.var(h2o_data), np.cov(np_data, rowvar=0, ddof=1), 10) if __name__ == "__main__": pyunit_utils.standalone_test(frame_reducers) else: frame_reducers()
apache-2.0
[ 646, 984, 199, 1274, 14, 515, 14, 3176, 8, 17, 4589, 29866, 531, 199, 646, 394, 18, 79, 199, 504, 2295, 492, 1134, 3248, 63, 1208, 4388, 199, 646, 2680, 465, 980, 199, 646, 2196, 199, 199, 318, 2787, 63, 581, 947, 1192, 837, 16478, 666, 275, 3474, 2355, 14, 8830, 2801, 9943, 12, 9943, 9, 367, 519, 315, 1425, 8, 709, 1874, 367, 286, 315, 1425, 8, 709, 1874, 272, 394, 18, 79, 63, 576, 275, 394, 18, 79, 14, 40, 18, 47, 3160, 8, 3065, 2031, 576, 430, 272, 980, 63, 576, 275, 980, 14, 1144, 8, 576, 9, 339, 394, 18, 79, 63, 637, 275, 394, 18, 79, 63, 576, 14, 827, 342, 272, 1967, 63, 637, 275, 980, 14, 827, 8, 1590, 63, 576, 9, 272, 702, 2853, 8, 72, 18, 79, 63, 637, 446, 1967, 63, 637, 9, 665, 413, 69, 13, 1690, 12, 971, 267, 298, 1074, 625, 18157, 1, 394, 18, 79, 9235, 469, 16, 93, 436, 2680, 9235, 469, 17, 5565, 1420, 4472, 1748, 1338, 3382, 394, 18, 79, 436, 298, 971, 267, 298, 4714, 1674, 908, 8, 72, 18, 79, 63, 637, 12, 1507, 63, 637, 9, 272, 394, 18, 79, 63, 637, 275, 394, 18, 79, 63, 576, 14, 988, 342, 272, 1967, 63, 637, 275, 980, 14, 988, 8, 1590, 63, 576, 9, 272, 702, 2853, 8, 72, 18, 79, 63, 637, 446, 1967, 63, 637, 9, 665, 413, 69, 13, 1690, 12, 971, 267, 298, 1074, 625, 18157, 1, 394, 18, 79, 9235, 469, 16, 93, 436, 2680, 9235, 469, 17, 5565, 1420, 4472, 1390, 1338, 3382, 394, 18, 79, 436, 298, 971, 267, 298, 4714, 1674, 908, 8, 72, 18, 79, 63, 637, 12, 1507, 63, 637, 9, 272, 394, 18, 79, 63, 637, 275, 394, 18, 79, 63, 576, 14, 1838, 342, 272, 1967, 63, 637, 275, 980, 14, 1838, 8, 1590, 63, 576, 9, 272, 702, 2853, 8, 72, 18, 79, 63, 637, 446, 1967, 63, 637, 9, 665, 413, 69, 13, 1690, 12, 971, 267, 298, 1074, 625, 18157, 1, 394, 18, 79, 9235, 469, 16, 93, 436, 2680, 9235, 469, 17, 5565, 1420, 4472, 3089, 1338, 3382, 394, 18, 79, 436, 298, 971, 267, 298, 4714, 1674, 908, 8, 72, 18, 79, 63, 637, 12, 1507, 63, 637, 9, 272, 327, 647, 3248, 63, 1208, 14, 1590, 63, 8547, 63, 1074, 8, 72, 18, 79, 14, 1391, 8, 72, 18, 79, 63, 576, 395, 980, 14, 8695, 8, 1590, 63, 576, 12, 1962, 1391, 29, 16, 12, 29180, 29, 17, 395, 1616, 9, 4388, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 272, 1134, 3248, 63, 1208, 14, 20323, 63, 396, 8, 1943, 63, 581, 947, 1192, 9, 199, 2836, 26, 272, 2787, 63, 581, 947, 1192, 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 ]
[ 984, 199, 1274, 14, 515, 14, 3176, 8, 17, 4589, 29866, 531, 199, 646, 394, 18, 79, 199, 504, 2295, 492, 1134, 3248, 63, 1208, 4388, 199, 646, 2680, 465, 980, 199, 646, 2196, 199, 199, 318, 2787, 63, 581, 947, 1192, 837, 16478, 666, 275, 3474, 2355, 14, 8830, 2801, 9943, 12, 9943, 9, 367, 519, 315, 1425, 8, 709, 1874, 367, 286, 315, 1425, 8, 709, 1874, 272, 394, 18, 79, 63, 576, 275, 394, 18, 79, 14, 40, 18, 47, 3160, 8, 3065, 2031, 576, 430, 272, 980, 63, 576, 275, 980, 14, 1144, 8, 576, 9, 339, 394, 18, 79, 63, 637, 275, 394, 18, 79, 63, 576, 14, 827, 342, 272, 1967, 63, 637, 275, 980, 14, 827, 8, 1590, 63, 576, 9, 272, 702, 2853, 8, 72, 18, 79, 63, 637, 446, 1967, 63, 637, 9, 665, 413, 69, 13, 1690, 12, 971, 267, 298, 1074, 625, 18157, 1, 394, 18, 79, 9235, 469, 16, 93, 436, 2680, 9235, 469, 17, 5565, 1420, 4472, 1748, 1338, 3382, 394, 18, 79, 436, 298, 971, 267, 298, 4714, 1674, 908, 8, 72, 18, 79, 63, 637, 12, 1507, 63, 637, 9, 272, 394, 18, 79, 63, 637, 275, 394, 18, 79, 63, 576, 14, 988, 342, 272, 1967, 63, 637, 275, 980, 14, 988, 8, 1590, 63, 576, 9, 272, 702, 2853, 8, 72, 18, 79, 63, 637, 446, 1967, 63, 637, 9, 665, 413, 69, 13, 1690, 12, 971, 267, 298, 1074, 625, 18157, 1, 394, 18, 79, 9235, 469, 16, 93, 436, 2680, 9235, 469, 17, 5565, 1420, 4472, 1390, 1338, 3382, 394, 18, 79, 436, 298, 971, 267, 298, 4714, 1674, 908, 8, 72, 18, 79, 63, 637, 12, 1507, 63, 637, 9, 272, 394, 18, 79, 63, 637, 275, 394, 18, 79, 63, 576, 14, 1838, 342, 272, 1967, 63, 637, 275, 980, 14, 1838, 8, 1590, 63, 576, 9, 272, 702, 2853, 8, 72, 18, 79, 63, 637, 446, 1967, 63, 637, 9, 665, 413, 69, 13, 1690, 12, 971, 267, 298, 1074, 625, 18157, 1, 394, 18, 79, 9235, 469, 16, 93, 436, 2680, 9235, 469, 17, 5565, 1420, 4472, 3089, 1338, 3382, 394, 18, 79, 436, 298, 971, 267, 298, 4714, 1674, 908, 8, 72, 18, 79, 63, 637, 12, 1507, 63, 637, 9, 272, 327, 647, 3248, 63, 1208, 14, 1590, 63, 8547, 63, 1074, 8, 72, 18, 79, 14, 1391, 8, 72, 18, 79, 63, 576, 395, 980, 14, 8695, 8, 1590, 63, 576, 12, 1962, 1391, 29, 16, 12, 29180, 29, 17, 395, 1616, 9, 4388, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 272, 1134, 3248, 63, 1208, 14, 20323, 63, 396, 8, 1943, 63, 581, 947, 1192, 9, 199, 2836, 26, 272, 2787, 63, 581, 947, 1192, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
GbalsaC/bitnamiP
venv/lib/python2.7/site-packages/kombu/exceptions.py
27
1860
""" kombu.exceptions ================ Exceptions. """ from __future__ import absolute_import import socket from amqp import ChannelError, ConnectionError, ResourceError __all__ = ['NotBoundError', 'MessageStateError', 'TimeoutError', 'LimitExceeded', 'ConnectionLimitExceeded', 'ChannelLimitExceeded', 'ConnectionError', 'ChannelError', 'VersionMismatch', 'SerializerNotInstalled', 'ResourceError', 'SerializationError', 'EncodeError', 'DecodeError'] TimeoutError = socket.timeout class KombuError(Exception): """Common subclass for all Kombu exceptions.""" pass class SerializationError(KombuError): """Failed to serialize/deserialize content.""" class EncodeError(SerializationError): """Cannot encode object.""" pass class DecodeError(SerializationError): """Cannot decode object.""" class NotBoundError(KombuError): """Trying to call channel dependent method on unbound entity.""" pass class MessageStateError(KombuError): """The message has already been acknowledged.""" pass class LimitExceeded(KombuError): """Limit exceeded.""" pass class ConnectionLimitExceeded(LimitExceeded): """Maximum number of simultaneous connections exceeded.""" pass class ChannelLimitExceeded(LimitExceeded): """Maximum number of simultaneous channels exceeded.""" pass class VersionMismatch(KombuError): pass class SerializerNotInstalled(KombuError): """Support for the requested serialization type is not installed""" pass class ContentDisallowed(SerializerNotInstalled): """Consumer does not allow this content-type.""" pass class InconsistencyError(ConnectionError): """Data or environment has been found to be inconsistent, depending on the cause it may be possible to retry the operation.""" pass
agpl-3.0
[ 624, 199, 75, 676, 464, 14, 3924, 199, 1280, 199, 199, 16836, 14, 199, 199, 624, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 199, 646, 2838, 199, 199, 504, 8140, 15202, 492, 17270, 547, 12, 25417, 12, 7337, 547, 199, 199, 363, 452, 363, 275, 788, 1763, 8934, 547, 297, 283, 2209, 2223, 547, 297, 283, 19382, 297, 1779, 283, 8407, 24748, 297, 283, 3225, 8407, 24748, 297, 1779, 283, 5358, 8407, 24748, 297, 283, 20349, 297, 283, 5358, 547, 297, 1779, 283, 3353, 23055, 297, 283, 7299, 1763, 21268, 297, 283, 4031, 547, 297, 1779, 283, 3571, 2072, 547, 297, 283, 19994, 297, 283, 12620, 418, 199, 199, 19382, 275, 2838, 14, 2593, 421, 199, 533, 1804, 676, 464, 547, 8, 1726, 304, 272, 408, 7844, 5516, 367, 1006, 1804, 676, 464, 4967, 1041, 272, 986, 421, 199, 533, 11973, 2072, 547, 8, 43, 676, 464, 547, 304, 272, 408, 4276, 370, 8437, 15, 11143, 1564, 1041, 421, 199, 533, 19244, 547, 8, 3571, 2072, 547, 304, 272, 408, 6612, 3752, 909, 1041, 272, 986, 421, 199, 533, 22462, 547, 8, 3571, 2072, 547, 304, 272, 408, 6612, 4849, 909, 1041, 421, 199, 533, 2832, 8934, 547, 8, 43, 676, 464, 547, 304, 272, 408, 27693, 370, 1240, 3623, 11410, 1083, 641, 22334, 4642, 1041, 272, 986, 421, 199, 533, 6430, 2223, 547, 8, 43, 676, 464, 547, 304, 272, 408, 1918, 1245, 965, 2575, 2757, 19807, 28609, 3046, 1041, 272, 986, 421, 199, 533, 22672, 24748, 8, 43, 676, 464, 547, 304, 272, 408, 8407, 22007, 1041, 272, 986, 421, 199, 533, 8113, 8407, 24748, 8, 8407, 24748, 304, 272, 408, 10915, 1329, 402, 27008, 6947, 22007, 1041, 272, 986, 421, 199, 533, 17270, 8407, 24748, 8, 8407, 24748, 304, 272, 408, 10915, 1329, 402, 27008, 9245, 22007, 1041, 272, 986, 421, 199, 533, 3394, 23055, 8, 43, 676, 464, 547, 304, 272, 986, 421, 199, 533, 25555, 1763, 21268, 8, 43, 676, 464, 547, 304, 272, 408, 11532, 367, 314, 5839, 16953, 730, 365, 440, 4903, 624, 272, 986, 421, 199, 533, 6646, 2825, 6541, 8, 7299, 1763, 21268, 304, 272, 408, 18186, 1630, 440, 2040, 642, 1564, 13, 466, 1041, 272, 986, 421, 199, 533, 1010, 20249, 547, 8, 20349, 304, 272, 408, 1451, 503, 3734, 965, 2757, 1911, 370, 506, 27253, 12, 272, 10298, 641, 314, 7675, 652, 1443, 506, 3962, 370, 7269, 314, 3439, 1041, 272, 986, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 199, 75, 676, 464, 14, 3924, 199, 1280, 199, 199, 16836, 14, 199, 199, 624, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 199, 646, 2838, 199, 199, 504, 8140, 15202, 492, 17270, 547, 12, 25417, 12, 7337, 547, 199, 199, 363, 452, 363, 275, 788, 1763, 8934, 547, 297, 283, 2209, 2223, 547, 297, 283, 19382, 297, 1779, 283, 8407, 24748, 297, 283, 3225, 8407, 24748, 297, 1779, 283, 5358, 8407, 24748, 297, 283, 20349, 297, 283, 5358, 547, 297, 1779, 283, 3353, 23055, 297, 283, 7299, 1763, 21268, 297, 283, 4031, 547, 297, 1779, 283, 3571, 2072, 547, 297, 283, 19994, 297, 283, 12620, 418, 199, 199, 19382, 275, 2838, 14, 2593, 421, 199, 533, 1804, 676, 464, 547, 8, 1726, 304, 272, 408, 7844, 5516, 367, 1006, 1804, 676, 464, 4967, 1041, 272, 986, 421, 199, 533, 11973, 2072, 547, 8, 43, 676, 464, 547, 304, 272, 408, 4276, 370, 8437, 15, 11143, 1564, 1041, 421, 199, 533, 19244, 547, 8, 3571, 2072, 547, 304, 272, 408, 6612, 3752, 909, 1041, 272, 986, 421, 199, 533, 22462, 547, 8, 3571, 2072, 547, 304, 272, 408, 6612, 4849, 909, 1041, 421, 199, 533, 2832, 8934, 547, 8, 43, 676, 464, 547, 304, 272, 408, 27693, 370, 1240, 3623, 11410, 1083, 641, 22334, 4642, 1041, 272, 986, 421, 199, 533, 6430, 2223, 547, 8, 43, 676, 464, 547, 304, 272, 408, 1918, 1245, 965, 2575, 2757, 19807, 28609, 3046, 1041, 272, 986, 421, 199, 533, 22672, 24748, 8, 43, 676, 464, 547, 304, 272, 408, 8407, 22007, 1041, 272, 986, 421, 199, 533, 8113, 8407, 24748, 8, 8407, 24748, 304, 272, 408, 10915, 1329, 402, 27008, 6947, 22007, 1041, 272, 986, 421, 199, 533, 17270, 8407, 24748, 8, 8407, 24748, 304, 272, 408, 10915, 1329, 402, 27008, 9245, 22007, 1041, 272, 986, 421, 199, 533, 3394, 23055, 8, 43, 676, 464, 547, 304, 272, 986, 421, 199, 533, 25555, 1763, 21268, 8, 43, 676, 464, 547, 304, 272, 408, 11532, 367, 314, 5839, 16953, 730, 365, 440, 4903, 624, 272, 986, 421, 199, 533, 6646, 2825, 6541, 8, 7299, 1763, 21268, 304, 272, 408, 18186, 1630, 440, 2040, 642, 1564, 13, 466, 1041, 272, 986, 421, 199, 533, 1010, 20249, 547, 8, 20349, 304, 272, 408, 1451, 503, 3734, 965, 2757, 1911, 370, 506, 27253, 12, 272, 10298, 641, 314, 7675, 652, 1443, 506, 3962, 370, 7269, 314, 3439, 1041, 272, 986, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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 This module provides internally used helpers and constants. :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import inspect from weakref import WeakKeyDictionary from cStringIO import StringIO from Cookie import SimpleCookie, Morsel, CookieError from time import gmtime from datetime import datetime, date _logger = None _empty_stream = StringIO('') _signature_cache = WeakKeyDictionary() _epoch_ord = date(1970, 1, 1).toordinal() HTTP_STATUS_CODES = { 100: 'Continue', 101: 'Switching Protocols', 102: 'Processing', 200: 'OK', 201: 'Created', 202: 'Accepted', 203: 'Non Authoritative Information', 204: 'No Content', 205: 'Reset Content', 206: 'Partial Content', 207: 'Multi Status', 226: 'IM Used', # see RFC 3229 300: 'Multiple Choices', 301: 'Moved Permanently', 302: 'Found', 303: 'See Other', 304: 'Not Modified', 305: 'Use Proxy', 307: 'Temporary Redirect', 400: 'Bad Request', 401: 'Unauthorized', 402: 'Payment Required', # unused 403: 'Forbidden', 404: 'Not Found', 405: 'Method Not Allowed', 406: 'Not Acceptable', 407: 'Proxy Authentication Required', 408: 'Request Timeout', 409: 'Conflict', 410: 'Gone', 411: 'Length Required', 412: 'Precondition Failed', 413: 'Request Entity Too Large', 414: 'Request URI Too Long', 415: 'Unsupported Media Type', 416: 'Requested Range Not Satisfiable', 417: 'Expectation Failed', 418: 'I\'m a teapot', # see RFC 2324 422: 'Unprocessable Entity', 423: 'Locked', 424: 'Failed Dependency', 426: 'Upgrade Required', 449: 'Retry With', # proprietary MS extension 500: 'Internal Server Error', 501: 'Not Implemented', 502: 'Bad Gateway', 503: 'Service Unavailable', 504: 'Gateway Timeout', 505: 'HTTP Version Not Supported', 507: 'Insufficient Storage', 510: 'Not Extended' } class _Missing(object): def __repr__(self): return 'no value' def __reduce__(self): return '_missing' _missing = _Missing() def _proxy_repr(cls): def proxy_repr(self): return '%s(%s)' % (self.__class__.__name__, cls.__repr__(self)) return proxy_repr def _get_environ(obj): env = getattr(obj, 'environ', obj) assert isinstance(env, dict), \ '%r is not a WSGI environment (has to be a dict)' % type(obj).__name__ return env def _log(type, message, *args, **kwargs): """Log into the internal werkzeug logger.""" global _logger if _logger is None: import logging _logger = logging.getLogger('werkzeug') # Only set up a default log handler if the # end-user application didn't set anything up. if not logging.root.handlers and _logger.level == logging.NOTSET: _logger.setLevel(logging.INFO) handler = logging.StreamHandler() _logger.addHandler(handler) getattr(_logger, type)(message.rstrip(), *args, **kwargs) def _parse_signature(func): """Return a signature object for the function.""" if hasattr(func, 'im_func'): func = func.im_func # if we have a cached validator for this function, return it parse = _signature_cache.get(func) if parse is not None: return parse # inspect the function signature and collect all the information positional, vararg_var, kwarg_var, defaults = inspect.getargspec(func) defaults = defaults or () arg_count = len(positional) arguments = [] for idx, name in enumerate(positional): if isinstance(name, list): raise TypeError('cannot parse functions that unpack tuples ' 'in the function signature') try: default = defaults[idx - arg_count] except IndexError: param = (name, False, None) else: param = (name, True, default) arguments.append(param) arguments = tuple(arguments) def parse(args, kwargs): new_args = [] missing = [] extra = {} # consume as many arguments as positional as possible for idx, (name, has_default, default) in enumerate(arguments): try: new_args.append(args[idx]) except IndexError: try: new_args.append(kwargs.pop(name)) except KeyError: if has_default: new_args.append(default) else: missing.append(name) else: if name in kwargs: extra[name] = kwargs.pop(name) # handle extra arguments extra_positional = args[arg_count:] if vararg_var is not None: new_args.extend(extra_positional) extra_positional = () if kwargs and not kwarg_var is not None: extra.update(kwargs) kwargs = {} return new_args, kwargs, missing, extra, extra_positional, \ arguments, vararg_var, kwarg_var _signature_cache[func] = parse return parse def _patch_wrapper(old, new): """Helper function that forwards all the function details to the decorated function.""" try: new.__name__ = old.__name__ new.__module__ = old.__module__ new.__doc__ = old.__doc__ new.__dict__ = old.__dict__ except Exception: pass return new def _decode_unicode(value, charset, errors): """Like the regular decode function but this one raises an `HTTPUnicodeError` if errors is `strict`.""" fallback = None if errors.startswith('fallback:'): fallback = errors[9:] errors = 'strict' try: return value.decode(charset, errors) except UnicodeError, e: if fallback is not None: return value.decode(fallback, 'replace') from werkzeug.exceptions import HTTPUnicodeError raise HTTPUnicodeError(str(e)) def _iter_modules(path): """Iterate over all modules in a package.""" import os import pkgutil if hasattr(pkgutil, 'iter_modules'): for importer, modname, ispkg in pkgutil.iter_modules(path): yield modname, ispkg return from inspect import getmodulename from pydoc import ispackage found = set() for path in path: for filename in os.listdir(path): p = os.path.join(path, filename) modname = getmodulename(filename) if modname and modname != '__init__': if modname not in found: found.add(modname) yield modname, ispackage(modname) def _dump_date(d, delim): """Used for `http_date` and `cookie_date`.""" if d is None: d = gmtime() elif isinstance(d, datetime): d = d.utctimetuple() elif isinstance(d, (int, long, float)): d = gmtime(d) return '%s, %02d%s%s%s%s %02d:%02d:%02d GMT' % ( ('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun')[d.tm_wday], d.tm_mday, delim, ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')[d.tm_mon - 1], delim, str(d.tm_year), d.tm_hour, d.tm_min, d.tm_sec ) def _date_to_unix(arg): """Converts a timetuple, integer or datetime object into the seconds from epoch in utc. """ if isinstance(arg, datetime): arg = arg.utctimetuple() elif isinstance(arg, (int, long, float)): return int(arg) year, month, day, hour, minute, second = arg[:6] days = date(year, month, 1).toordinal() - _epoch_ord + day - 1 hours = days * 24 + hour minutes = hours * 60 + minute seconds = minutes * 60 + second return seconds class _ExtendedMorsel(Morsel): _reserved = {'httponly': 'HttpOnly'} _reserved.update(Morsel._reserved) def __init__(self, name=None, value=None): Morsel.__init__(self) if name is not None: self.set(name, value, value) def OutputString(self, attrs=None): httponly = self.pop('httponly', False) result = Morsel.OutputString(self, attrs).rstrip('\t ;') if httponly: result += '; HttpOnly' return result class _ExtendedCookie(SimpleCookie): """Form of the base cookie that doesn't raise a `CookieError` for malformed keys. This has the advantage that broken cookies submitted by nonstandard browsers don't cause the cookie to be empty. """ def _BaseCookie__set(self, key, real_value, coded_value): morsel = self.get(key, _ExtendedMorsel()) try: morsel.set(key, real_value, coded_value) except CookieError: pass dict.__setitem__(self, key, morsel) class _DictAccessorProperty(object): """Baseclass for `environ_property` and `header_property`.""" read_only = False def __init__(self, name, default=None, load_func=None, dump_func=None, read_only=None, doc=None): self.name = name self.default = default self.load_func = load_func self.dump_func = dump_func if read_only is not None: self.read_only = read_only self.__doc__ = doc def __get__(self, obj, type=None): if obj is None: return self storage = self.lookup(obj) if self.name not in storage: return self.default rv = storage[self.name] if self.load_func is not None: try: rv = self.load_func(rv) except (ValueError, TypeError): rv = self.default return rv def __set__(self, obj, value): if self.read_only: raise AttributeError('read only property') if self.dump_func is not None: value = self.dump_func(value) self.lookup(obj)[self.name] = value def __delete__(self, obj): if self.read_only: raise AttributeError('read only property') self.lookup(obj).pop(self.name, None) def __repr__(self): return '<%s %s>' % ( self.__class__.__name__, self.name ) def _easteregg(app): """Like the name says. But who knows how it works?""" gyver = '\n'.join([x + (77 - len(x)) * ' ' for x in ''' eJyFlzuOJDkMRP06xRjymKgDJCDQStBYT8BCgK4gTwfQ2fcFs2a2FzvZk+hvlcRvRJD148efHt9m 9Xz94dRY5hGt1nrYcXx7us9qlcP9HHNh28rz8dZj+q4rynVFFPdlY4zH873NKCexrDM6zxxRymzz 4QIxzK4bth1PV7+uHn6WXZ5C4ka/+prFzx3zWLMHAVZb8RRUxtFXI5DTQ2n3Hi2sNI+HK43AOWSY jmEzE4naFp58PdzhPMdslLVWHTGUVpSxImw+pS/D+JhzLfdS1j7PzUMxij+mc2U0I9zcbZ/HcZxc q1QjvvcThMYFnp93agEx392ZdLJWXbi/Ca4Oivl4h/Y1ErEqP+lrg7Xa4qnUKu5UE9UUA4xeqLJ5 jWlPKJvR2yhRI7xFPdzPuc6adXu6ovwXwRPXXnZHxlPtkSkqWHilsOrGrvcVWXgGP3daXomCj317 8P2UOw/NnA0OOikZyFf3zZ76eN9QXNwYdD8f8/LdBRFg0BO3bB+Pe/+G8er8tDJv83XTkj7WeMBJ v/rnAfdO51d6sFglfi8U7zbnr0u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SGtjAw7RDwaM1roESC8HWiPxkoOy0lLTRFG39kvbLZbU9gFKFRvixDZBJmpi Xyq3RE5lW00EJjaqwp/v3EByMSpVZYsEIJ4APaHmVtpGSieV5CALOtNUAzTBiw81GLgC0quyzf6c NlWknzJeCsJ5fup2R4d8CYGN77mu5vnO1UqbfElZ9E6cR6zbHjgsr9ly18fXjZoPeDjPuzlWbFwS pdvPkhntFvkc13qb9094LL5NrA3NIq3r9eNnop9DizWOqCEbyRBFJTHn6Tt3CG1o8a4HevYh0XiJ sR0AVVHuGuMOIfbuQ/OKBkGRC6NJ4u7sbPX8bG/n5sNIOQ6/Y/BX3IwRlTSabtZpYLB85lYtkkgm p1qXK3Du2mnr5INXmT/78KI12n11EFBkJHHp0wJyLe9MvPNUGYsf+170maayRoy2lURGHAIapSpQ krEDuNoJCHNlZYhKpvw4mspVWxqo415n8cD62N9+EfHrAvqQnINStetek7RY2Urv8nxsnGaZfRr/ nhXbJ6m/yl1LzYqscDZA9QHLNbdaSTTr+kFg3bC0iYbX/eQy0Bv3h4B50/SGYzKAXkCeOLI3bcAt mj2Z/FM1vQWgDynsRwNvrWnJHlespkrp8+vO1jNaibm+PhqXPPv30YwDZ6jApe3wUjFQobghvW9p 7f2zLkGNv8b191cD/3vs9Q833z8t'''.decode('base64').decode('zlib').splitlines()]) def easteregged(environ, start_response): def injecting_start_response(status, headers, exc_info=None): headers.append(('X-Powered-By', 'Werkzeug')) return start_response(status, headers, exc_info) if environ.get('QUERY_STRING') != 'macgybarchakku': return app(environ, injecting_start_response) injecting_start_response('200 OK', [('Content-Type', 'text/html')]) return [''' <!DOCTYPE html> <html> <head> <title>About Werkzeug</title> <style type="text/css"> body { font: 15px Georgia, serif; text-align: center; } a { color: #333; text-decoration: none; } h1 { font-size: 30px; margin: 20px 0 10px 0; } p { margin: 0 0 30px 0; } pre { font: 11px 'Consolas', 'Monaco', monospace; line-height: 0.95; } </style> </head> <body> <h1><a href="http://werkzeug.pocoo.org/">Werkzeug</a></h1> <p>the Swiss Army knife of Python web development.</p> <pre>%s\n\n\n</pre> </body> </html>''' % gyver] return easteregged
mit
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 624, 272, 10380, 423, 4672, 272, 18294, 1714, 339, 961, 859, 6571, 14448, 1202, 10897, 436, 5262, 14, 339, 520, 7307, 26, 334, 67, 9, 7760, 701, 314, 22798, 11682, 12, 1937, 10610, 367, 1655, 2436, 14, 272, 520, 1682, 26, 6289, 12, 1937, 5113, 367, 1655, 2436, 14, 199, 624, 199, 646, 6485, 199, 504, 13852, 492, 28224, 1197, 11728, 199, 504, 15073, 492, 5228, 199, 504, 14798, 492, 5870, 7810, 12, 603, 269, 5891, 12, 14798, 547, 199, 504, 900, 492, 486, 8180, 199, 504, 2197, 492, 2197, 12, 1434, 421, 199, 63, 2921, 275, 488, 199, 63, 1667, 63, 1745, 275, 5228, 8355, 199, 63, 5233, 63, 1637, 275, 28224, 1197, 11728, 342, 199, 63, 7367, 63, 2181, 275, 1434, 8, 21740, 12, 413, 12, 413, 680, 475, 17460, 342, 421, 199, 2856, 63, 6305, 63, 15639, 275, 469, 272, 2948, 26, 259, 283, 24055, 297, 272, 14313, 26, 259, 283, 10167, 316, 2165, 475, 4574, 297, 272, 12996, 26, 259, 283, 9589, 297, 272, 1926, 26, 259, 283, 3593, 297, 272, 1784, 26, 259, 283, 10502, 297, 272, 19328, 26, 259, 283, 1945, 7203, 297, 272, 29202, 26, 259, 283, 6932, 6529, 390, 1905, 17064, 297, 272, 14785, 26, 259, 283, 1944, 6646, 297, 272, 24005, 26, 259, 283, 9637, 6646, 297, 272, 26761, 26, 259, 283, 18192, 6646, 297, 272, 31533, 26, 259, 283, 3947, 9795, 297, 272, 32584, 26, 259, 283, 1469, 8051, 297, 4519, 327, 1937, 7329, 650, 11182, 272, 9601, 26, 259, 283, 8433, 8802, 2370, 297, 272, 19660, 26, 259, 283, 20774, 3492, 11433, 590, 297, 272, 11485, 26, 259, 283, 3601, 297, 272, 25989, 26, 259, 283, 9295, 5439, 297, 272, 20398, 26, 259, 283, 1763, 22016, 297, 272, 650, 1717, 26, 259, 283, 6119, 12373, 297, 272, 26959, 26, 259, 283, 11360, 18532, 297, 272, 8290, 26, 259, 283, 5725, 4784, 297, 272, 13952, 26, 259, 283, 28290, 297, 272, 841, 996, 26, 259, 283, 22374, 11105, 297, 258, 327, 9563, 272, 13269, 26, 259, 283, 17454, 297, 272, 7901, 26, 259, 283, 1763, 2643, 297, 272, 25766, 26, 259, 283, 3767, 2832, 27301, 297, 272, 841, 1690, 26, 259, 283, 1763, 15506, 461, 297, 272, 841, 1780, 26, 259, 283, 4936, 15995, 11105, 297, 272, 841, 2036, 26, 259, 283, 2017, 12878, 297, 272, 21292, 26, 259, 283, 15919, 297, 272, 32321, 26, 259, 283, 39, 368, 297, 272, 841, 845, 26, 259, 283, 4625, 11105, 297, 272, 841, 713, 26, 259, 283, 2398, 5394, 16277, 297, 272, 841, 969, 26, 259, 283, 2017, 17680, 22893, 29095, 297, 272, 841, 1079, 26, 259, 283, 2017, 9022, 22893, 19944, 297, 272, 841, 1046, 26, 259, 283, 12647, 12300, 2434, 297, 272, 841, 975, 26, 259, 283, 17935, 13114, 2832, 428, 9369, 24183, 297, 272, 841, 1196, 26, 259, 283, 13495, 425, 16277, 297, 272, 841, 1085, 26, 259, 283, 41, 3985, 77, 282, 1565, 439, 357, 297, 263, 327, 1937, 7329, 499, 12744, 272, 841, 1081, 26, 259, 283, 1358, 1412, 461, 17680, 297, 272, 841, 1789, 26, 259, 283, 22408, 297, 272, 841, 1194, 26, 259, 283, 4276, 22922, 297, 272, 841, 1479, 26, 259, 283, 19217, 11105, 297, 272, 841, 1887, 26, 259, 283, 12989, 8777, 297, 3698, 327, 557, 1359, 386, 695, 14282, 3329, 272, 6891, 26, 259, 283, 8405, 7146, 4520, 297, 272, 28606, 26, 259, 283, 1763, 11794, 2509, 297, 272, 959, 996, 26, 259, 283, 5725, 27166, 297, 272, 24046, 26, 259, 283, 3167, 1910, 4561, 297, 272, 959, 966, 26, 259, 283, 12455, 12878, 297, 272, 959, 1717, 26, 259, 283, 2856, 3394, 2832, 26167, 297, 272, 959, 1780, 26, 259, 283, 13962, 12983, 10533, 297, 272, 959, 709, 26, 259, 283, 1763, 13706, 7, 199, 93, 421, 199, 533, 485, 7718, 8, 785, 304, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 283, 889, 574, 7, 339, 347, 636, 5270, 721, 277, 304, 267, 372, 2513, 4752, 7, 199, 199, 63, 4752, 275, 485, 7718, 342, 421, 199, 318, 485, 3280, 63, 2722, 8, 1886, 304, 272, 347, 4566, 63, 2722, 8, 277, 304, 267, 372, 1543, 83, 4042, 83, 3171, 450, 334, 277, 855, 533, 4914, 354, 3108, 843, 855, 2722, 721, 277, 430, 272, 372, 4566, 63, 2722, 421, 199, 318, 485, 362, 63, 2314, 8, 1113, 304, 272, 2589, 275, 2519, 8, 1113, 12, 283, 2314, 297, 1559, 9, 272, 702, 1228, 8, 1813, 12, 1211, 395, 971, 267, 1543, 82, 365, 440, 282, 9279, 3734, 334, 1989, 370, 506, 282, 1211, 3171, 450, 730, 8, 1113, 2843, 354, 363, 272, 372, 2589, 421, 199, 318, 485, 793, 8, 466, 12, 1245, 12, 627, 589, 12, 1011, 958, 304, 272, 408, 2445, 1901, 314, 5007, 10380, 2512, 1041, 272, 2288, 485, 2921, 272, 340, 485, 2921, 365, 488, 26, 267, 492, 2050, 267, 485, 2921, 275, 2050, 14, 5572, 360, 17719, 358, 267, 327, 5972, 663, 1536, 282, 849, 943, 3016, 340, 314, 267, 327, 1284, 13, 751, 4223, 9980, 1133, 663, 7003, 1536, 14, 267, 340, 440, 2050, 14, 1231, 14, 5586, 436, 485, 2921, 14, 1896, 508, 2050, 14, 4609, 3597, 26, 288, 485, 2921, 14, 13548, 8, 4806, 14, 4531, 9, 288, 3016, 275, 2050, 14, 22482, 342, 288, 485, 2921, 14, 18826, 8, 2232, 9, 272, 2519, 1547, 2921, 12, 730, 5130, 1188, 14, 6735, 1062, 627, 589, 12, 1011, 958, 9, 421, 199, 318, 485, 1122, 63, 5233, 8, 1532, 304, 272, 408, 1767, 282, 4955, 909, 367, 314, 805, 1041, 272, 340, 2688, 8, 1532, 12, 283, 1017, 63, 1532, 735, 267, 2562, 275, 2562, 14, 1017, 63, 1532, 339, 327, 340, 781, 1172, 282, 6328, 11822, 367, 642, 805, 12, 372, 652, 272, 2198, 275, 485, 5233, 63, 1637, 14, 362, 8, 1532, 9, 272, 340, 2198, 365, 440, 488, 26, 267, 372, 2198, 339, 327, 6485, 314, 805, 4955, 436, 8775, 1006, 314, 2556, 272, 11333, 12, 2729, 1273, 63, 1391, 12, 17582, 63, 1391, 12, 4243, 275, 6485, 14, 29836, 8, 1532, 9, 272, 4243, 275, 4243, 503, 6248, 272, 1680, 63, 835 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 624, 272, 10380, 423, 4672, 272, 18294, 1714, 339, 961, 859, 6571, 14448, 1202, 10897, 436, 5262, 14, 339, 520, 7307, 26, 334, 67, 9, 7760, 701, 314, 22798, 11682, 12, 1937, 10610, 367, 1655, 2436, 14, 272, 520, 1682, 26, 6289, 12, 1937, 5113, 367, 1655, 2436, 14, 199, 624, 199, 646, 6485, 199, 504, 13852, 492, 28224, 1197, 11728, 199, 504, 15073, 492, 5228, 199, 504, 14798, 492, 5870, 7810, 12, 603, 269, 5891, 12, 14798, 547, 199, 504, 900, 492, 486, 8180, 199, 504, 2197, 492, 2197, 12, 1434, 421, 199, 63, 2921, 275, 488, 199, 63, 1667, 63, 1745, 275, 5228, 8355, 199, 63, 5233, 63, 1637, 275, 28224, 1197, 11728, 342, 199, 63, 7367, 63, 2181, 275, 1434, 8, 21740, 12, 413, 12, 413, 680, 475, 17460, 342, 421, 199, 2856, 63, 6305, 63, 15639, 275, 469, 272, 2948, 26, 259, 283, 24055, 297, 272, 14313, 26, 259, 283, 10167, 316, 2165, 475, 4574, 297, 272, 12996, 26, 259, 283, 9589, 297, 272, 1926, 26, 259, 283, 3593, 297, 272, 1784, 26, 259, 283, 10502, 297, 272, 19328, 26, 259, 283, 1945, 7203, 297, 272, 29202, 26, 259, 283, 6932, 6529, 390, 1905, 17064, 297, 272, 14785, 26, 259, 283, 1944, 6646, 297, 272, 24005, 26, 259, 283, 9637, 6646, 297, 272, 26761, 26, 259, 283, 18192, 6646, 297, 272, 31533, 26, 259, 283, 3947, 9795, 297, 272, 32584, 26, 259, 283, 1469, 8051, 297, 4519, 327, 1937, 7329, 650, 11182, 272, 9601, 26, 259, 283, 8433, 8802, 2370, 297, 272, 19660, 26, 259, 283, 20774, 3492, 11433, 590, 297, 272, 11485, 26, 259, 283, 3601, 297, 272, 25989, 26, 259, 283, 9295, 5439, 297, 272, 20398, 26, 259, 283, 1763, 22016, 297, 272, 650, 1717, 26, 259, 283, 6119, 12373, 297, 272, 26959, 26, 259, 283, 11360, 18532, 297, 272, 8290, 26, 259, 283, 5725, 4784, 297, 272, 13952, 26, 259, 283, 28290, 297, 272, 841, 996, 26, 259, 283, 22374, 11105, 297, 258, 327, 9563, 272, 13269, 26, 259, 283, 17454, 297, 272, 7901, 26, 259, 283, 1763, 2643, 297, 272, 25766, 26, 259, 283, 3767, 2832, 27301, 297, 272, 841, 1690, 26, 259, 283, 1763, 15506, 461, 297, 272, 841, 1780, 26, 259, 283, 4936, 15995, 11105, 297, 272, 841, 2036, 26, 259, 283, 2017, 12878, 297, 272, 21292, 26, 259, 283, 15919, 297, 272, 32321, 26, 259, 283, 39, 368, 297, 272, 841, 845, 26, 259, 283, 4625, 11105, 297, 272, 841, 713, 26, 259, 283, 2398, 5394, 16277, 297, 272, 841, 969, 26, 259, 283, 2017, 17680, 22893, 29095, 297, 272, 841, 1079, 26, 259, 283, 2017, 9022, 22893, 19944, 297, 272, 841, 1046, 26, 259, 283, 12647, 12300, 2434, 297, 272, 841, 975, 26, 259, 283, 17935, 13114, 2832, 428, 9369, 24183, 297, 272, 841, 1196, 26, 259, 283, 13495, 425, 16277, 297, 272, 841, 1085, 26, 259, 283, 41, 3985, 77, 282, 1565, 439, 357, 297, 263, 327, 1937, 7329, 499, 12744, 272, 841, 1081, 26, 259, 283, 1358, 1412, 461, 17680, 297, 272, 841, 1789, 26, 259, 283, 22408, 297, 272, 841, 1194, 26, 259, 283, 4276, 22922, 297, 272, 841, 1479, 26, 259, 283, 19217, 11105, 297, 272, 841, 1887, 26, 259, 283, 12989, 8777, 297, 3698, 327, 557, 1359, 386, 695, 14282, 3329, 272, 6891, 26, 259, 283, 8405, 7146, 4520, 297, 272, 28606, 26, 259, 283, 1763, 11794, 2509, 297, 272, 959, 996, 26, 259, 283, 5725, 27166, 297, 272, 24046, 26, 259, 283, 3167, 1910, 4561, 297, 272, 959, 966, 26, 259, 283, 12455, 12878, 297, 272, 959, 1717, 26, 259, 283, 2856, 3394, 2832, 26167, 297, 272, 959, 1780, 26, 259, 283, 13962, 12983, 10533, 297, 272, 959, 709, 26, 259, 283, 1763, 13706, 7, 199, 93, 421, 199, 533, 485, 7718, 8, 785, 304, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 283, 889, 574, 7, 339, 347, 636, 5270, 721, 277, 304, 267, 372, 2513, 4752, 7, 199, 199, 63, 4752, 275, 485, 7718, 342, 421, 199, 318, 485, 3280, 63, 2722, 8, 1886, 304, 272, 347, 4566, 63, 2722, 8, 277, 304, 267, 372, 1543, 83, 4042, 83, 3171, 450, 334, 277, 855, 533, 4914, 354, 3108, 843, 855, 2722, 721, 277, 430, 272, 372, 4566, 63, 2722, 421, 199, 318, 485, 362, 63, 2314, 8, 1113, 304, 272, 2589, 275, 2519, 8, 1113, 12, 283, 2314, 297, 1559, 9, 272, 702, 1228, 8, 1813, 12, 1211, 395, 971, 267, 1543, 82, 365, 440, 282, 9279, 3734, 334, 1989, 370, 506, 282, 1211, 3171, 450, 730, 8, 1113, 2843, 354, 363, 272, 372, 2589, 421, 199, 318, 485, 793, 8, 466, 12, 1245, 12, 627, 589, 12, 1011, 958, 304, 272, 408, 2445, 1901, 314, 5007, 10380, 2512, 1041, 272, 2288, 485, 2921, 272, 340, 485, 2921, 365, 488, 26, 267, 492, 2050, 267, 485, 2921, 275, 2050, 14, 5572, 360, 17719, 358, 267, 327, 5972, 663, 1536, 282, 849, 943, 3016, 340, 314, 267, 327, 1284, 13, 751, 4223, 9980, 1133, 663, 7003, 1536, 14, 267, 340, 440, 2050, 14, 1231, 14, 5586, 436, 485, 2921, 14, 1896, 508, 2050, 14, 4609, 3597, 26, 288, 485, 2921, 14, 13548, 8, 4806, 14, 4531, 9, 288, 3016, 275, 2050, 14, 22482, 342, 288, 485, 2921, 14, 18826, 8, 2232, 9, 272, 2519, 1547, 2921, 12, 730, 5130, 1188, 14, 6735, 1062, 627, 589, 12, 1011, 958, 9, 421, 199, 318, 485, 1122, 63, 5233, 8, 1532, 304, 272, 408, 1767, 282, 4955, 909, 367, 314, 805, 1041, 272, 340, 2688, 8, 1532, 12, 283, 1017, 63, 1532, 735, 267, 2562, 275, 2562, 14, 1017, 63, 1532, 339, 327, 340, 781, 1172, 282, 6328, 11822, 367, 642, 805, 12, 372, 652, 272, 2198, 275, 485, 5233, 63, 1637, 14, 362, 8, 1532, 9, 272, 340, 2198, 365, 440, 488, 26, 267, 372, 2198, 339, 327, 6485, 314, 805, 4955, 436, 8775, 1006, 314, 2556, 272, 11333, 12, 2729, 1273, 63, 1391, 12, 17582, 63, 1391, 12, 4243, 275, 6485, 14, 29836, 8, 1532, 9, 272, 4243, 275, 4243, 503, 6248, 272, 1680, 63, 835, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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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 ]
lukeiwanski/tensorflow-opencl
tensorflow/contrib/distributions/python/ops/categorical.py
5
8801
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """The Categorical distribution class.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.contrib.distributions.python.ops import distribution from tensorflow.contrib.distributions.python.ops import distribution_util from tensorflow.contrib.distributions.python.ops import kullback_leibler from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.framework import tensor_shape from tensorflow.python.ops import array_ops from tensorflow.python.ops import math_ops from tensorflow.python.ops import nn_ops from tensorflow.python.ops import random_ops class Categorical(distribution.Distribution): """Categorical distribution. The categorical distribution is parameterized by the log-probabilities of a set of classes. #### Examples Creates a 3-class distiribution, with the 2nd class, the most likely to be drawn from. ```python p = [0.1, 0.5, 0.4] dist = Categorical(probs=p) ``` Creates a 3-class distiribution, with the 2nd class the most likely to be drawn from, using logits. ```python logits = [-50, 400, 40] dist = Categorical(logits=logits) ``` Creates a 3-class distribution, with the 3rd class is most likely to be drawn. The distribution functions can be evaluated on counts. ```python # counts is a scalar. p = [0.1, 0.4, 0.5] dist = Categorical(probs=p) dist.prob(0) # Shape [] # p will be broadcast to [[0.1, 0.4, 0.5], [0.1, 0.4, 0.5]] to match counts. counts = [1, 0] dist.prob(counts) # Shape [2] # p will be broadcast to shape [3, 5, 7, 3] to match counts. counts = [[...]] # Shape [5, 7, 3] dist.prob(counts) # Shape [5, 7, 3] ``` """ def __init__( self, logits=None, probs=None, dtype=dtypes.int32, validate_args=False, allow_nan_stats=True, name="Categorical"): """Initialize Categorical distributions using class log-probabilities. Args: logits: An N-D `Tensor`, `N >= 1`, representing the log probabilities of a set of Categorical distributions. The first `N - 1` dimensions index into a batch of independent distributions and the last dimension represents a vector of logits for each class. Only one of `logits` or `probs` should be passed in. probs: An N-D `Tensor`, `N >= 1`, representing the probabilities of a set of Categorical distributions. The first `N - 1` dimensions index into a batch of independent distributions and the last dimension represents a vector of probabilities for each class. Only one of `logits` or `probs` should be passed in. dtype: The type of the event samples (default: int32). validate_args: Python `bool`, default `False`. When `True` distribution parameters are checked for validity despite possibly degrading runtime performance. When `False` invalid inputs may silently render incorrect outputs. allow_nan_stats: Python `bool`, default `True`. When `True`, statistics (e.g., mean, mode, variance) use the value "`NaN`" to indicate the result is undefined. When `False`, an exception is raised if one or more of the statistic's batch members are undefined. name: Python `str` name prefixed to Ops created by this class. """ parameters = locals() with ops.name_scope(name, values=[logits, probs]) as ns: self._logits, self._probs = distribution_util.get_logits_and_probs( logits=logits, probs=probs, validate_args=validate_args, multidimensional=True, name=name) logits_shape_static = self._logits.get_shape().with_rank_at_least(1) if logits_shape_static.ndims is not None: self._batch_rank = ops.convert_to_tensor( logits_shape_static.ndims - 1, dtype=dtypes.int32, name="batch_rank") else: with ops.name_scope(name="batch_rank"): self._batch_rank = array_ops.rank(self._logits) - 1 logits_shape = array_ops.shape(self._logits, name="logits_shape") if logits_shape_static[-1].value is not None: self._event_size = ops.convert_to_tensor( logits_shape_static[-1].value, dtype=dtypes.int32, name="event_size") else: with ops.name_scope(name="event_size"): self._event_size = logits_shape[self._batch_rank] if logits_shape_static[:-1].is_fully_defined(): self._batch_shape_val = constant_op.constant( logits_shape_static[:-1].as_list(), dtype=dtypes.int32, name="batch_shape") else: with ops.name_scope(name="batch_shape"): self._batch_shape_val = logits_shape[:-1] super(Categorical, self).__init__( dtype=dtype, is_continuous=False, reparameterization_type=distribution.NOT_REPARAMETERIZED, validate_args=validate_args, allow_nan_stats=allow_nan_stats, parameters=parameters, graph_parents=[self._logits, self._probs], name=ns) @property def event_size(self): """Scalar `int32` tensor: the number of classes.""" return self._event_size @property def logits(self): """Vector of coordinatewise logits.""" return self._logits @property def probs(self): """Vector of coordinatewise probabilities.""" return self._probs def _batch_shape_tensor(self): return array_ops.identity(self._batch_shape_val) def _batch_shape(self): return self.logits.get_shape()[:-1] def _event_shape_tensor(self): return constant_op.constant([], dtype=dtypes.int32) def _event_shape(self): return tensor_shape.scalar() def _sample_n(self, n, seed=None): if self.logits.get_shape().ndims == 2: logits_2d = self.logits else: logits_2d = array_ops.reshape(self.logits, [-1, self.event_size]) samples = random_ops.multinomial(logits_2d, n, seed=seed) samples = math_ops.cast(samples, self.dtype) ret = array_ops.reshape( array_ops.transpose(samples), array_ops.concat([[n], self.batch_shape_tensor()], 0)) return ret def _log_prob(self, k): k = ops.convert_to_tensor(k, name="k") if self.logits.get_shape()[:-1] == k.get_shape(): logits = self.logits else: logits = self.logits * array_ops.ones_like( array_ops.expand_dims(k, -1), dtype=self.logits.dtype) logits_shape = array_ops.shape(logits)[:-1] k *= array_ops.ones(logits_shape, dtype=k.dtype) k.set_shape(tensor_shape.TensorShape(logits.get_shape()[:-1])) return -nn_ops.sparse_softmax_cross_entropy_with_logits(labels=k, logits=logits) def _prob(self, k): return math_ops.exp(self._log_prob(k)) def _entropy(self): return -math_ops.reduce_sum( nn_ops.log_softmax(self.logits) * self.probs, axis=-1) def _mode(self): ret = math_ops.argmax(self.logits, dimension=self._batch_rank) ret = math_ops.cast(ret, self.dtype) ret.set_shape(self.batch_shape) return ret @kullback_leibler.RegisterKL(Categorical, Categorical) def _kl_categorical_categorical(a, b, name=None): """Calculate the batched KL divergence KL(a || b) with a and b Categorical. Args: a: instance of a Categorical distribution object. b: instance of a Categorical distribution object. name: (optional) Name to use for created operations. default is "kl_categorical_categorical". Returns: Batchwise KL(a || b) """ with ops.name_scope(name, "kl_categorical_categorical", values=[a.logits, b.logits]): # sum(probs log(probs / (1 - probs))) delta_log_probs1 = (nn_ops.log_softmax(a.logits) - nn_ops.log_softmax(b.logits)) return math_ops.reduce_sum(nn_ops.softmax(a.logits) * delta_log_probs1, axis=-1)
apache-2.0
[ 3, 1898, 7800, 710, 9134, 6642, 14, 2900, 5924, 5702, 14, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 11148, 199, 624, 1918, 31227, 4084, 1021, 1041, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 504, 636, 2443, 363, 492, 4629, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 504, 3228, 14, 2828, 14, 5613, 14, 1548, 14, 1483, 492, 4084, 199, 504, 3228, 14, 2828, 14, 5613, 14, 1548, 14, 1483, 492, 4084, 63, 1974, 199, 504, 3228, 14, 2828, 14, 5613, 14, 1548, 14, 1483, 492, 1022, 979, 894, 63, 274, 7247, 82, 199, 504, 3228, 14, 1548, 14, 4857, 492, 4413, 63, 411, 199, 504, 3228, 14, 1548, 14, 4857, 492, 6674, 199, 504, 3228, 14, 1548, 14, 4857, 492, 4156, 199, 504, 3228, 14, 1548, 14, 4857, 492, 2345, 63, 1392, 199, 504, 3228, 14, 1548, 14, 1483, 492, 1625, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 3473, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 11542, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 2196, 63, 1483, 421, 199, 533, 31227, 8, 4972, 14, 8580, 304, 523, 408, 23306, 4084, 14, 819, 710, 22138, 4084, 365, 29526, 701, 314, 943, 13, 27583, 523, 402, 282, 663, 402, 3992, 14, 819, 14055, 6058, 819, 10560, 282, 650, 13, 533, 2917, 19081, 464, 296, 12, 543, 314, 499, 977, 1021, 12, 314, 4750, 12060, 370, 506, 523, 19341, 687, 14, 819, 10841, 1548, 523, 299, 275, 359, 16, 14, 17, 12, 378, 14, 21, 12, 378, 14, 20, 61, 523, 2917, 275, 31227, 8, 15349, 29, 80, 9, 523, 10841, 819, 10560, 282, 650, 13, 533, 2917, 19081, 464, 296, 12, 543, 314, 499, 977, 1021, 314, 4750, 12060, 370, 506, 523, 19341, 687, 12, 1808, 11051, 14, 819, 10841, 1548, 523, 11051, 275, 5243, 1400, 12, 8290, 12, 6335, 61, 523, 2917, 275, 31227, 8, 10492, 29, 10492, 9, 523, 10841, 819, 10560, 282, 650, 13, 533, 4084, 12, 543, 314, 650, 6883, 1021, 365, 4750, 12060, 370, 506, 19341, 14, 523, 710, 4084, 3423, 883, 506, 13006, 641, 8242, 14, 819, 10841, 1548, 523, 327, 8242, 365, 282, 6917, 14, 523, 299, 275, 359, 16, 14, 17, 12, 378, 14, 20, 12, 378, 14, 21, 61, 523, 2917, 275, 31227, 8, 15349, 29, 80, 9, 523, 2917, 14, 6101, 8, 16, 9, 221, 327, 16528, 942, 819, 327, 299, 911, 506, 11180, 370, 3474, 16, 14, 17, 12, 378, 14, 20, 12, 378, 14, 21, 467, 359, 16, 14, 17, 12, 378, 14, 20, 12, 378, 14, 21, 2677, 370, 1336, 8242, 14, 523, 8242, 275, 359, 17, 12, 378, 61, 523, 2917, 14, 6101, 8, 6851, 9, 221, 327, 16528, 359, 18, 61, 819, 327, 299, 911, 506, 11180, 370, 2215, 359, 19, 12, 959, 12, 1520, 12, 650, 61, 370, 1336, 8242, 14, 523, 8242, 275, 3474, 1396, 2677, 327, 16528, 359, 21, 12, 1520, 12, 650, 61, 523, 2917, 14, 6101, 8, 6851, 9, 221, 327, 16528, 359, 21, 12, 1520, 12, 650, 61, 523, 10841, 819, 408, 819, 347, 636, 826, 721, 489, 291, 12, 489, 11051, 29, 403, 12, 489, 24329, 29, 403, 12, 489, 2152, 29, 5717, 14, 442, 708, 12, 489, 4107, 63, 589, 29, 797, 12, 489, 2040, 63, 4304, 63, 3200, 29, 549, 12, 489, 536, 628, 23306, 2349, 272, 408, 9345, 31227, 10208, 1808, 1021, 943, 13, 27583, 14, 339, 3033, 26, 489, 11051, 26, 1626, 653, 13, 36, 658, 3861, 3559, 658, 46, 2356, 413, 3559, 6144, 314, 943, 19555, 267, 402, 282, 663, 402, 31227, 10208, 14, 710, 1642, 658, 46, 446, 413, 64, 7365, 267, 1478, 1901, 282, 3522, 402, 12717, 10208, 436, 314, 2061, 6240, 267, 8469, 282, 5477, 402, 11051, 367, 1924, 1021, 14, 5972, 1373, 402, 658, 10492, 64, 503, 267, 658, 15349, 64, 1077, 506, 3032, 315, 14, 489, 24329, 26, 1626, 653, 13, 36, 658, 3861, 3559, 658, 46, 2356, 413, 3559, 6144, 314, 19555, 267, 402, 282, 663, 402, 31227, 10208, 14, 710, 1642, 658, 46, 446, 413, 64, 7365, 267, 1478, 1901, 282, 3522, 402, 12717, 10208, 436, 314, 2061, 6240, 267, 8469, 282, 5477, 402, 19555, 367, 1924, 1021, 14, 5972, 1373, 402, 267, 658, 10492, 64, 503, 658, 15349, 64, 1077, 506, 3032, 315, 14, 489, 2152, 26, 710, 730, 402, 314, 1566, 5845, 334, 885, 26, 1109, 708, 680, 489, 4107, 63, 589, 26, 2018, 658, 2245, 3559, 849, 658, 797, 2313, 3979, 658, 549, 64, 4084, 267, 2633, 787, 7923, 367, 25667, 477, 681, 1175, 12570, 477, 16050, 8836, 267, 10238, 14, 3979, 658, 797, 64, 3866, 4153, 1443, 18030, 3795, 8927, 267, 4704, 14, 489, 2040, 63, 4304, 63, 3200, 26, 2018, 658, 2245, 3559, 849, 658, 549, 2313, 3979, 658, 549, 3559, 11076, 267, 334, 69, 14, 71, 2020, 4615, 12, 818, 12, 11773, 9, 675, 314, 574, 24505, 14300, 64, 2, 370, 6623, 314, 267, 754, 365, 10942, 14, 3979, 658, 797, 3559, 376, 1919, 365, 4915, 340, 1373, 503, 267, 1655, 402, 314, 22394, 1159, 3522, 7556, 787, 10942, 14, 489, 536, 26, 2018, 658, 495, 64, 536, 18239, 370, 593, 1190, 2737, 701, 642, 1021, 14, 272, 408, 272, 2633, 275, 9480, 342, 272, 543, 4156, 14, 354, 63, 2645, 8, 354, 12, 1338, 1524, 10492, 12, 24329, 566, 465, 700, 26 ]
[ 1898, 7800, 710, 9134, 6642, 14, 2900, 5924, 5702, 14, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 11148, 199, 624, 1918, 31227, 4084, 1021, 1041, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 504, 636, 2443, 363, 492, 4629, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 504, 3228, 14, 2828, 14, 5613, 14, 1548, 14, 1483, 492, 4084, 199, 504, 3228, 14, 2828, 14, 5613, 14, 1548, 14, 1483, 492, 4084, 63, 1974, 199, 504, 3228, 14, 2828, 14, 5613, 14, 1548, 14, 1483, 492, 1022, 979, 894, 63, 274, 7247, 82, 199, 504, 3228, 14, 1548, 14, 4857, 492, 4413, 63, 411, 199, 504, 3228, 14, 1548, 14, 4857, 492, 6674, 199, 504, 3228, 14, 1548, 14, 4857, 492, 4156, 199, 504, 3228, 14, 1548, 14, 4857, 492, 2345, 63, 1392, 199, 504, 3228, 14, 1548, 14, 1483, 492, 1625, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 3473, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 11542, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 2196, 63, 1483, 421, 199, 533, 31227, 8, 4972, 14, 8580, 304, 523, 408, 23306, 4084, 14, 819, 710, 22138, 4084, 365, 29526, 701, 314, 943, 13, 27583, 523, 402, 282, 663, 402, 3992, 14, 819, 14055, 6058, 819, 10560, 282, 650, 13, 533, 2917, 19081, 464, 296, 12, 543, 314, 499, 977, 1021, 12, 314, 4750, 12060, 370, 506, 523, 19341, 687, 14, 819, 10841, 1548, 523, 299, 275, 359, 16, 14, 17, 12, 378, 14, 21, 12, 378, 14, 20, 61, 523, 2917, 275, 31227, 8, 15349, 29, 80, 9, 523, 10841, 819, 10560, 282, 650, 13, 533, 2917, 19081, 464, 296, 12, 543, 314, 499, 977, 1021, 314, 4750, 12060, 370, 506, 523, 19341, 687, 12, 1808, 11051, 14, 819, 10841, 1548, 523, 11051, 275, 5243, 1400, 12, 8290, 12, 6335, 61, 523, 2917, 275, 31227, 8, 10492, 29, 10492, 9, 523, 10841, 819, 10560, 282, 650, 13, 533, 4084, 12, 543, 314, 650, 6883, 1021, 365, 4750, 12060, 370, 506, 19341, 14, 523, 710, 4084, 3423, 883, 506, 13006, 641, 8242, 14, 819, 10841, 1548, 523, 327, 8242, 365, 282, 6917, 14, 523, 299, 275, 359, 16, 14, 17, 12, 378, 14, 20, 12, 378, 14, 21, 61, 523, 2917, 275, 31227, 8, 15349, 29, 80, 9, 523, 2917, 14, 6101, 8, 16, 9, 221, 327, 16528, 942, 819, 327, 299, 911, 506, 11180, 370, 3474, 16, 14, 17, 12, 378, 14, 20, 12, 378, 14, 21, 467, 359, 16, 14, 17, 12, 378, 14, 20, 12, 378, 14, 21, 2677, 370, 1336, 8242, 14, 523, 8242, 275, 359, 17, 12, 378, 61, 523, 2917, 14, 6101, 8, 6851, 9, 221, 327, 16528, 359, 18, 61, 819, 327, 299, 911, 506, 11180, 370, 2215, 359, 19, 12, 959, 12, 1520, 12, 650, 61, 370, 1336, 8242, 14, 523, 8242, 275, 3474, 1396, 2677, 327, 16528, 359, 21, 12, 1520, 12, 650, 61, 523, 2917, 14, 6101, 8, 6851, 9, 221, 327, 16528, 359, 21, 12, 1520, 12, 650, 61, 523, 10841, 819, 408, 819, 347, 636, 826, 721, 489, 291, 12, 489, 11051, 29, 403, 12, 489, 24329, 29, 403, 12, 489, 2152, 29, 5717, 14, 442, 708, 12, 489, 4107, 63, 589, 29, 797, 12, 489, 2040, 63, 4304, 63, 3200, 29, 549, 12, 489, 536, 628, 23306, 2349, 272, 408, 9345, 31227, 10208, 1808, 1021, 943, 13, 27583, 14, 339, 3033, 26, 489, 11051, 26, 1626, 653, 13, 36, 658, 3861, 3559, 658, 46, 2356, 413, 3559, 6144, 314, 943, 19555, 267, 402, 282, 663, 402, 31227, 10208, 14, 710, 1642, 658, 46, 446, 413, 64, 7365, 267, 1478, 1901, 282, 3522, 402, 12717, 10208, 436, 314, 2061, 6240, 267, 8469, 282, 5477, 402, 11051, 367, 1924, 1021, 14, 5972, 1373, 402, 658, 10492, 64, 503, 267, 658, 15349, 64, 1077, 506, 3032, 315, 14, 489, 24329, 26, 1626, 653, 13, 36, 658, 3861, 3559, 658, 46, 2356, 413, 3559, 6144, 314, 19555, 267, 402, 282, 663, 402, 31227, 10208, 14, 710, 1642, 658, 46, 446, 413, 64, 7365, 267, 1478, 1901, 282, 3522, 402, 12717, 10208, 436, 314, 2061, 6240, 267, 8469, 282, 5477, 402, 19555, 367, 1924, 1021, 14, 5972, 1373, 402, 267, 658, 10492, 64, 503, 658, 15349, 64, 1077, 506, 3032, 315, 14, 489, 2152, 26, 710, 730, 402, 314, 1566, 5845, 334, 885, 26, 1109, 708, 680, 489, 4107, 63, 589, 26, 2018, 658, 2245, 3559, 849, 658, 797, 2313, 3979, 658, 549, 64, 4084, 267, 2633, 787, 7923, 367, 25667, 477, 681, 1175, 12570, 477, 16050, 8836, 267, 10238, 14, 3979, 658, 797, 64, 3866, 4153, 1443, 18030, 3795, 8927, 267, 4704, 14, 489, 2040, 63, 4304, 63, 3200, 26, 2018, 658, 2245, 3559, 849, 658, 549, 2313, 3979, 658, 549, 3559, 11076, 267, 334, 69, 14, 71, 2020, 4615, 12, 818, 12, 11773, 9, 675, 314, 574, 24505, 14300, 64, 2, 370, 6623, 314, 267, 754, 365, 10942, 14, 3979, 658, 797, 3559, 376, 1919, 365, 4915, 340, 1373, 503, 267, 1655, 402, 314, 22394, 1159, 3522, 7556, 787, 10942, 14, 489, 536, 26, 2018, 658, 495, 64, 536, 18239, 370, 593, 1190, 2737, 701, 642, 1021, 14, 272, 408, 272, 2633, 275, 9480, 342, 272, 543, 4156, 14, 354, 63, 2645, 8, 354, 12, 1338, 1524, 10492, 12, 24329, 566, 465, 700, 26, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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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 ]
andreamerello/linux-stm32
scripts/gdb/linux/dmesg.py
249
2059
# # gdb helper commands and functions for Linux kernel debugging # # kernel log buffer dump # # Copyright (c) Siemens AG, 2011, 2012 # # Authors: # Jan Kiszka <jan.kiszka@siemens.com> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb from linux import utils class LxDmesg(gdb.Command): """Print Linux kernel log buffer.""" def __init__(self): super(LxDmesg, self).__init__("lx-dmesg", gdb.COMMAND_DATA) def invoke(self, arg, from_tty): log_buf_addr = int(str(gdb.parse_and_eval("log_buf")).split()[0], 16) log_first_idx = int(gdb.parse_and_eval("log_first_idx")) log_next_idx = int(gdb.parse_and_eval("log_next_idx")) log_buf_len = int(gdb.parse_and_eval("log_buf_len")) inf = gdb.inferiors()[0] start = log_buf_addr + log_first_idx if log_first_idx < log_next_idx: log_buf_2nd_half = -1 length = log_next_idx - log_first_idx log_buf = utils.read_memoryview(inf, start, length).tobytes() else: log_buf_2nd_half = log_buf_len - log_first_idx a = utils.read_memoryview(inf, start, log_buf_2nd_half) b = utils.read_memoryview(inf, log_buf_addr, log_next_idx) log_buf = a.tobytes() + b.tobytes() pos = 0 while pos < log_buf.__len__(): length = utils.read_u16(log_buf[pos + 8:pos + 10]) if length == 0: if log_buf_2nd_half == -1: gdb.write("Corrupted log buffer!\n") break pos = log_buf_2nd_half continue text_len = utils.read_u16(log_buf[pos + 10:pos + 12]) text = log_buf[pos + 16:pos + 16 + text_len].decode() time_stamp = utils.read_u64(log_buf[pos:pos + 8]) for line in text.splitlines(): gdb.write("[{time:12.6f}] {line}\n".format( time=time_stamp / 1000000000.0, line=line)) pos += length LxDmesg()
gpl-2.0
[ 3, 199, 3, 12124, 5922, 3718, 436, 3423, 367, 10130, 5114, 10201, 199, 3, 199, 3, 221, 5114, 943, 3335, 5461, 199, 3, 199, 3, 1898, 334, 67, 9, 428, 1873, 278, 561, 26787, 12, 7760, 12, 6029, 199, 3, 199, 3, 6642, 26, 199, 3, 221, 17474, 1804, 374, 90, 7351, 665, 24418, 14, 75, 374, 90, 7351, 32, 23994, 278, 561, 14, 957, 30, 199, 3, 199, 3, 961, 1736, 365, 18233, 1334, 314, 2895, 402, 314, 1664, 14629, 1015, 499, 14, 199, 3, 199, 199, 646, 12124, 199, 199, 504, 18369, 492, 3778, 421, 199, 533, 491, 8313, 10528, 8, 17119, 14, 3110, 304, 272, 408, 5375, 10130, 5114, 943, 3335, 1041, 339, 347, 636, 826, 721, 277, 304, 267, 1613, 8, 44, 8313, 10528, 12, 291, 2843, 826, 29093, 23605, 13, 12673, 401, 12124, 14, 10761, 63, 3998, 9, 339, 347, 12677, 8, 277, 12, 1680, 12, 687, 63, 4707, 304, 267, 943, 63, 1436, 63, 2697, 275, 1109, 8, 495, 8, 17119, 14, 1122, 63, 460, 63, 2579, 480, 793, 63, 1436, 21688, 1294, 3430, 16, 467, 3193, 9, 267, 943, 63, 2246, 63, 2996, 275, 1109, 8, 17119, 14, 1122, 63, 460, 63, 2579, 480, 793, 63, 2246, 63, 2996, 2237, 267, 943, 63, 2184, 63, 2996, 275, 1109, 8, 17119, 14, 1122, 63, 460, 63, 2579, 480, 793, 63, 2184, 63, 2996, 2237, 267, 943, 63, 1436, 63, 552, 275, 1109, 8, 17119, 14, 1122, 63, 460, 63, 2579, 480, 793, 63, 1436, 63, 552, 2237, 398, 10739, 275, 12124, 14, 14578, 73, 1384, 3430, 16, 61, 267, 1343, 275, 943, 63, 1436, 63, 2697, 435, 943, 63, 2246, 63, 2996, 267, 340, 943, 63, 2246, 63, 2996, 665, 943, 63, 2184, 63, 2996, 26, 288, 943, 63, 1436, 63, 18, 977, 63, 10220, 275, 446, 17, 288, 2582, 275, 943, 63, 2184, 63, 2996, 446, 943, 63, 2246, 63, 2996, 288, 943, 63, 1436, 275, 3778, 14, 739, 63, 31519, 8, 4904, 12, 1343, 12, 2582, 680, 32557, 342, 267, 587, 26, 288, 943, 63, 1436, 63, 18, 977, 63, 10220, 275, 943, 63, 1436, 63, 552, 446, 943, 63, 2246, 63, 2996, 288, 282, 275, 3778, 14, 739, 63, 31519, 8, 4904, 12, 1343, 12, 943, 63, 1436, 63, 18, 977, 63, 10220, 9, 288, 330, 275, 3778, 14, 739, 63, 31519, 8, 4904, 12, 943, 63, 1436, 63, 2697, 12, 943, 63, 2184, 63, 2996, 9, 288, 943, 63, 1436, 275, 282, 14, 32557, 342, 435, 330, 14, 32557, 342, 398, 2086, 275, 378, 267, 1830, 2086, 665, 943, 63, 1436, 855, 552, 721, 304, 288, 2582, 275, 3778, 14, 739, 63, 85, 975, 8, 793, 63, 1436, 59, 1712, 435, 1695, 26, 1712, 435, 1616, 566, 288, 340, 2582, 508, 378, 26, 355, 340, 943, 63, 1436, 63, 18, 977, 63, 10220, 508, 446, 17, 26, 490, 12124, 14, 952, 480, 8380, 15692, 943, 3335, 12525, 78, 531, 490, 2059, 355, 2086, 275, 943, 63, 1436, 63, 18, 977, 63, 10220, 355, 1980, 953, 1318, 63, 552, 275, 3778, 14, 739, 63, 85, 975, 8, 793, 63, 1436, 59, 1712, 435, 1616, 26, 1712, 435, 3144, 566, 288, 1318, 275, 943, 63, 1436, 59, 1712, 435, 3193, 26, 1712, 435, 3193, 435, 1318, 63, 552, 1055, 2708, 342, 288, 900, 63, 2359, 275, 3778, 14, 739, 63, 85, 772, 8, 793, 63, 1436, 59, 1712, 26, 1712, 435, 1695, 566, 953, 367, 1004, 315, 1318, 14, 7644, 837, 355, 12124, 14, 952, 10994, 91, 521, 26, 713, 14, 22, 70, 11049, 469, 604, 4988, 78, 1674, 908, 8, 490, 900, 29, 521, 63, 2359, 1182, 413, 25464, 14, 16, 12, 490, 1004, 29, 604, 430, 953, 2086, 847, 2582, 421, 199, 44, 8313, 10528, 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 ]
[ 199, 3, 12124, 5922, 3718, 436, 3423, 367, 10130, 5114, 10201, 199, 3, 199, 3, 221, 5114, 943, 3335, 5461, 199, 3, 199, 3, 1898, 334, 67, 9, 428, 1873, 278, 561, 26787, 12, 7760, 12, 6029, 199, 3, 199, 3, 6642, 26, 199, 3, 221, 17474, 1804, 374, 90, 7351, 665, 24418, 14, 75, 374, 90, 7351, 32, 23994, 278, 561, 14, 957, 30, 199, 3, 199, 3, 961, 1736, 365, 18233, 1334, 314, 2895, 402, 314, 1664, 14629, 1015, 499, 14, 199, 3, 199, 199, 646, 12124, 199, 199, 504, 18369, 492, 3778, 421, 199, 533, 491, 8313, 10528, 8, 17119, 14, 3110, 304, 272, 408, 5375, 10130, 5114, 943, 3335, 1041, 339, 347, 636, 826, 721, 277, 304, 267, 1613, 8, 44, 8313, 10528, 12, 291, 2843, 826, 29093, 23605, 13, 12673, 401, 12124, 14, 10761, 63, 3998, 9, 339, 347, 12677, 8, 277, 12, 1680, 12, 687, 63, 4707, 304, 267, 943, 63, 1436, 63, 2697, 275, 1109, 8, 495, 8, 17119, 14, 1122, 63, 460, 63, 2579, 480, 793, 63, 1436, 21688, 1294, 3430, 16, 467, 3193, 9, 267, 943, 63, 2246, 63, 2996, 275, 1109, 8, 17119, 14, 1122, 63, 460, 63, 2579, 480, 793, 63, 2246, 63, 2996, 2237, 267, 943, 63, 2184, 63, 2996, 275, 1109, 8, 17119, 14, 1122, 63, 460, 63, 2579, 480, 793, 63, 2184, 63, 2996, 2237, 267, 943, 63, 1436, 63, 552, 275, 1109, 8, 17119, 14, 1122, 63, 460, 63, 2579, 480, 793, 63, 1436, 63, 552, 2237, 398, 10739, 275, 12124, 14, 14578, 73, 1384, 3430, 16, 61, 267, 1343, 275, 943, 63, 1436, 63, 2697, 435, 943, 63, 2246, 63, 2996, 267, 340, 943, 63, 2246, 63, 2996, 665, 943, 63, 2184, 63, 2996, 26, 288, 943, 63, 1436, 63, 18, 977, 63, 10220, 275, 446, 17, 288, 2582, 275, 943, 63, 2184, 63, 2996, 446, 943, 63, 2246, 63, 2996, 288, 943, 63, 1436, 275, 3778, 14, 739, 63, 31519, 8, 4904, 12, 1343, 12, 2582, 680, 32557, 342, 267, 587, 26, 288, 943, 63, 1436, 63, 18, 977, 63, 10220, 275, 943, 63, 1436, 63, 552, 446, 943, 63, 2246, 63, 2996, 288, 282, 275, 3778, 14, 739, 63, 31519, 8, 4904, 12, 1343, 12, 943, 63, 1436, 63, 18, 977, 63, 10220, 9, 288, 330, 275, 3778, 14, 739, 63, 31519, 8, 4904, 12, 943, 63, 1436, 63, 2697, 12, 943, 63, 2184, 63, 2996, 9, 288, 943, 63, 1436, 275, 282, 14, 32557, 342, 435, 330, 14, 32557, 342, 398, 2086, 275, 378, 267, 1830, 2086, 665, 943, 63, 1436, 855, 552, 721, 304, 288, 2582, 275, 3778, 14, 739, 63, 85, 975, 8, 793, 63, 1436, 59, 1712, 435, 1695, 26, 1712, 435, 1616, 566, 288, 340, 2582, 508, 378, 26, 355, 340, 943, 63, 1436, 63, 18, 977, 63, 10220, 508, 446, 17, 26, 490, 12124, 14, 952, 480, 8380, 15692, 943, 3335, 12525, 78, 531, 490, 2059, 355, 2086, 275, 943, 63, 1436, 63, 18, 977, 63, 10220, 355, 1980, 953, 1318, 63, 552, 275, 3778, 14, 739, 63, 85, 975, 8, 793, 63, 1436, 59, 1712, 435, 1616, 26, 1712, 435, 3144, 566, 288, 1318, 275, 943, 63, 1436, 59, 1712, 435, 3193, 26, 1712, 435, 3193, 435, 1318, 63, 552, 1055, 2708, 342, 288, 900, 63, 2359, 275, 3778, 14, 739, 63, 85, 772, 8, 793, 63, 1436, 59, 1712, 26, 1712, 435, 1695, 566, 953, 367, 1004, 315, 1318, 14, 7644, 837, 355, 12124, 14, 952, 10994, 91, 521, 26, 713, 14, 22, 70, 11049, 469, 604, 4988, 78, 1674, 908, 8, 490, 900, 29, 521, 63, 2359, 1182, 413, 25464, 14, 16, 12, 490, 1004, 29, 604, 430, 953, 2086, 847, 2582, 421, 199, 44, 8313, 10528, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
inesaloulou21/arisgames
zxing-master/cpp/scons/scons-local-2.0.0.final.0/SCons/Tool/Subversion.py
34
2708
"""SCons.Tool.Subversion.py Tool-specific initialization for Subversion. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # 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/Tool/Subversion.py 5023 2010/06/14 22:05:46 scons" import os.path import SCons.Action import SCons.Builder import SCons.Util def generate(env): """Add a Builder factory function and construction variables for Subversion to an Environment.""" def SubversionFactory(repos, module='', env=env): """ """ # fail if repos is not an absolute path name? import SCons.Warnings as W W.warn(W.DeprecatedSourceCodeWarning, """The Subversion() factory is deprecated and there is no replacement.""") if module != '': module = os.path.join(module, '') act = SCons.Action.Action('$SVNCOM', '$SVNCOMSTR') return SCons.Builder.Builder(action = act, env = env, SVNREPOSITORY = repos, SVNMODULE = module) #setattr(env, 'Subversion', SubversionFactory) env.Subversion = SubversionFactory env['SVN'] = 'svn' env['SVNFLAGS'] = SCons.Util.CLVar('') env['SVNCOM'] = '$SVN $SVNFLAGS cat $SVNREPOSITORY/$SVNMODULE$TARGET > $TARGET' def exists(env): return env.Detect('svn') # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
mit
[ 624, 18521, 14, 5157, 14, 2610, 1023, 14, 647, 199, 199, 5157, 13, 6100, 11097, 367, 31098, 14, 199, 199, 10924, 12252, 9296, 1133, 506, 1263, 1929, 370, 492, 642, 859, 5370, 14, 199, 7940, 911, 9987, 506, 8439, 4012, 314, 7809, 8218, 14, 5157, 14, 5157, 342, 199, 5592, 1083, 14, 199, 199, 624, 199, 199, 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, 199, 363, 5792, 363, 275, 298, 2164, 15, 3908, 15, 18521, 15, 5157, 15, 2610, 1023, 14, 647, 959, 16771, 7129, 15, 1690, 15, 1079, 6928, 26, 1717, 26, 2466, 31551, 2, 199, 199, 646, 747, 14, 515, 199, 199, 646, 8218, 14, 3310, 199, 646, 8218, 14, 6437, 199, 646, 8218, 14, 9562, 199, 199, 318, 3550, 8, 1813, 304, 272, 408, 1123, 282, 19286, 6434, 805, 436, 14538, 2860, 367, 272, 31098, 370, 376, 9711, 1041, 339, 347, 31098, 2927, 8, 11857, 12, 859, 4581, 2589, 29, 1813, 304, 267, 408, 408, 267, 327, 2449, 340, 20416, 365, 440, 376, 3679, 931, 536, 31, 267, 492, 8218, 14, 15921, 465, 644, 267, 644, 14, 4050, 8, 55, 14, 19727, 2980, 3034, 3849, 12, 408, 1918, 31098, 342, 6434, 365, 5906, 436, 2337, 365, 949, 8343, 24887, 267, 340, 859, 1137, 8061, 288, 859, 275, 747, 14, 515, 14, 904, 8, 578, 12, 4074, 267, 2454, 275, 8218, 14, 3310, 14, 3310, 14676, 31222, 11265, 297, 4505, 31222, 11265, 3027, 358, 267, 372, 8218, 14, 6437, 14, 6437, 8, 1287, 275, 2454, 12, 3660, 2589, 275, 2589, 12, 3660, 24639, 907, 27998, 5347, 275, 20416, 12, 3660, 24639, 10001, 275, 859, 9, 339, 327, 10202, 8, 1813, 12, 283, 2610, 1023, 297, 31098, 2927, 9, 272, 2589, 14, 2610, 1023, 275, 31098, 2927, 339, 2589, 459, 31222, 418, 420, 275, 283, 6836, 7, 272, 2589, 459, 31222, 4831, 418, 275, 8218, 14, 9562, 14, 1981, 5894, 8355, 272, 2589, 459, 31222, 11265, 418, 257, 275, 4505, 31222, 2672, 31222, 4831, 6230, 2672, 31222, 907, 27998, 5347, 21792, 31222, 10001, 4, 9268, 690, 2672, 9268, 7, 199, 199, 318, 3495, 8, 1813, 304, 272, 372, 2589, 14, 20064, 360, 6836, 358, 199, 199, 3, 10111, 17198, 26, 199, 3, 5174, 13, 2063, 26, 20, 199, 3, 4363, 13, 8741, 13, 632, 26, 20613, 199, 3, 9599, 26, 199, 3, 6695, 26, 663, 26414, 20849, 29, 20, 20105, 29, 20, 26, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 18521, 14, 5157, 14, 2610, 1023, 14, 647, 199, 199, 5157, 13, 6100, 11097, 367, 31098, 14, 199, 199, 10924, 12252, 9296, 1133, 506, 1263, 1929, 370, 492, 642, 859, 5370, 14, 199, 7940, 911, 9987, 506, 8439, 4012, 314, 7809, 8218, 14, 5157, 14, 5157, 342, 199, 5592, 1083, 14, 199, 199, 624, 199, 199, 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, 199, 363, 5792, 363, 275, 298, 2164, 15, 3908, 15, 18521, 15, 5157, 15, 2610, 1023, 14, 647, 959, 16771, 7129, 15, 1690, 15, 1079, 6928, 26, 1717, 26, 2466, 31551, 2, 199, 199, 646, 747, 14, 515, 199, 199, 646, 8218, 14, 3310, 199, 646, 8218, 14, 6437, 199, 646, 8218, 14, 9562, 199, 199, 318, 3550, 8, 1813, 304, 272, 408, 1123, 282, 19286, 6434, 805, 436, 14538, 2860, 367, 272, 31098, 370, 376, 9711, 1041, 339, 347, 31098, 2927, 8, 11857, 12, 859, 4581, 2589, 29, 1813, 304, 267, 408, 408, 267, 327, 2449, 340, 20416, 365, 440, 376, 3679, 931, 536, 31, 267, 492, 8218, 14, 15921, 465, 644, 267, 644, 14, 4050, 8, 55, 14, 19727, 2980, 3034, 3849, 12, 408, 1918, 31098, 342, 6434, 365, 5906, 436, 2337, 365, 949, 8343, 24887, 267, 340, 859, 1137, 8061, 288, 859, 275, 747, 14, 515, 14, 904, 8, 578, 12, 4074, 267, 2454, 275, 8218, 14, 3310, 14, 3310, 14676, 31222, 11265, 297, 4505, 31222, 11265, 3027, 358, 267, 372, 8218, 14, 6437, 14, 6437, 8, 1287, 275, 2454, 12, 3660, 2589, 275, 2589, 12, 3660, 24639, 907, 27998, 5347, 275, 20416, 12, 3660, 24639, 10001, 275, 859, 9, 339, 327, 10202, 8, 1813, 12, 283, 2610, 1023, 297, 31098, 2927, 9, 272, 2589, 14, 2610, 1023, 275, 31098, 2927, 339, 2589, 459, 31222, 418, 420, 275, 283, 6836, 7, 272, 2589, 459, 31222, 4831, 418, 275, 8218, 14, 9562, 14, 1981, 5894, 8355, 272, 2589, 459, 31222, 11265, 418, 257, 275, 4505, 31222, 2672, 31222, 4831, 6230, 2672, 31222, 907, 27998, 5347, 21792, 31222, 10001, 4, 9268, 690, 2672, 9268, 7, 199, 199, 318, 3495, 8, 1813, 304, 272, 372, 2589, 14, 20064, 360, 6836, 358, 199, 199, 3, 10111, 17198, 26, 199, 3, 5174, 13, 2063, 26, 20, 199, 3, 4363, 13, 8741, 13, 632, 26, 20613, 199, 3, 9599, 26, 199, 3, 6695, 26, 663, 26414, 20849, 29, 20, 20105, 29, 20, 26, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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 ]
jefffohl/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backend_bases.py
69
69740
""" Abstract base classes define the primitives that renderers and graphics contexts must implement to serve as a matplotlib backend :class:`RendererBase` An abstract base class to handle drawing/rendering operations. :class:`FigureCanvasBase` The abstraction layer that separates the :class:`matplotlib.figure.Figure` from the backend specific details like a user interface drawing area :class:`GraphicsContextBase` An abstract base class that provides color, line styles, etc... :class:`Event` The base class for all of the matplotlib event handling. Derived classes suh as :class:`KeyEvent` and :class:`MouseEvent` store the meta data like keys and buttons pressed, x and y locations in pixel and :class:`~matplotlib.axes.Axes` coordinates. """ from __future__ import division import os, warnings, time import numpy as np import matplotlib.cbook as cbook import matplotlib.colors as colors import matplotlib.transforms as transforms import matplotlib.widgets as widgets from matplotlib import rcParams class RendererBase: """An abstract base class to handle drawing/rendering operations. The following methods *must* be implemented in the backend: * :meth:`draw_path` * :meth:`draw_image` * :meth:`draw_text` * :meth:`get_text_width_height_descent` The following methods *should* be implemented in the backend for optimization reasons: * :meth:`draw_markers` * :meth:`draw_path_collection` * :meth:`draw_quad_mesh` """ def __init__(self): self._texmanager = None def open_group(self, s): """ Open a grouping element with label *s*. Is only currently used by :mod:`~matplotlib.backends.backend_svg` """ pass def close_group(self, s): """ Close a grouping element with label *s* Is only currently used by :mod:`~matplotlib.backends.backend_svg` """ pass def draw_path(self, gc, path, transform, rgbFace=None): """ Draws a :class:`~matplotlib.path.Path` instance using the given affine transform. """ raise NotImplementedError def draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace=None): """ Draws a marker at each of the vertices in path. This includes all vertices, including control points on curves. To avoid that behavior, those vertices should be removed before calling this function. *gc* the :class:`GraphicsContextBase` instance *marker_trans* is an affine transform applied to the marker. *trans* is an affine transform applied to the path. This provides a fallback implementation of draw_markers that makes multiple calls to :meth:`draw_path`. Some backends may want to override this method in order to draw the marker only once and reuse it multiple times. """ tpath = trans.transform_path(path) for vertices, codes in tpath.iter_segments(): if len(vertices): x,y = vertices[-2:] self.draw_path(gc, marker_path, marker_trans + transforms.Affine2D().translate(x, y), rgbFace) def draw_path_collection(self, master_transform, cliprect, clippath, clippath_trans, paths, all_transforms, offsets, offsetTrans, facecolors, edgecolors, linewidths, linestyles, antialiaseds, urls): """ Draws a collection of paths, selecting drawing properties from the lists *facecolors*, *edgecolors*, *linewidths*, *linestyles* and *antialiaseds*. *offsets* is a list of offsets to apply to each of the paths. The offsets in *offsets* are first transformed by *offsetTrans* before being applied. This provides a fallback implementation of :meth:`draw_path_collection` that makes multiple calls to draw_path. Some backends may want to override this in order to render each set of path data only once, and then reference that path multiple times with the different offsets, colors, styles etc. The generator methods :meth:`_iter_collection_raw_paths` and :meth:`_iter_collection` are provided to help with (and standardize) the implementation across backends. It is highly recommended to use those generators, so that changes to the behavior of :meth:`draw_path_collection` can be made globally. """ path_ids = [] for path, transform in self._iter_collection_raw_paths( master_transform, paths, all_transforms): path_ids.append((path, transform)) for xo, yo, path_id, gc, rgbFace in self._iter_collection( path_ids, cliprect, clippath, clippath_trans, offsets, offsetTrans, facecolors, edgecolors, linewidths, linestyles, antialiaseds, urls): path, transform = path_id transform = transforms.Affine2D(transform.get_matrix()).translate(xo, yo) self.draw_path(gc, path, transform, rgbFace) def draw_quad_mesh(self, master_transform, cliprect, clippath, clippath_trans, meshWidth, meshHeight, coordinates, offsets, offsetTrans, facecolors, antialiased, showedges): """ This provides a fallback implementation of :meth:`draw_quad_mesh` that generates paths and then calls :meth:`draw_path_collection`. """ from matplotlib.collections import QuadMesh paths = QuadMesh.convert_mesh_to_paths( meshWidth, meshHeight, coordinates) if showedges: edgecolors = np.array([[0.0, 0.0, 0.0, 1.0]], np.float_) linewidths = np.array([1.0], np.float_) else: edgecolors = facecolors linewidths = np.array([0.0], np.float_) return self.draw_path_collection( master_transform, cliprect, clippath, clippath_trans, paths, [], offsets, offsetTrans, facecolors, edgecolors, linewidths, [], [antialiased], [None]) def _iter_collection_raw_paths(self, master_transform, paths, all_transforms): """ This is a helper method (along with :meth:`_iter_collection`) to make it easier to write a space-efficent :meth:`draw_path_collection` implementation in a backend. This method yields all of the base path/transform combinations, given a master transform, a list of paths and list of transforms. The arguments should be exactly what is passed in to :meth:`draw_path_collection`. The backend should take each yielded path and transform and create an object that can be referenced (reused) later. """ Npaths = len(paths) Ntransforms = len(all_transforms) N = max(Npaths, Ntransforms) if Npaths == 0: return transform = transforms.IdentityTransform() for i in xrange(N): path = paths[i % Npaths] if Ntransforms: transform = all_transforms[i % Ntransforms] yield path, transform + master_transform def _iter_collection(self, path_ids, cliprect, clippath, clippath_trans, offsets, offsetTrans, facecolors, edgecolors, linewidths, linestyles, antialiaseds, urls): """ This is a helper method (along with :meth:`_iter_collection_raw_paths`) to make it easier to write a space-efficent :meth:`draw_path_collection` implementation in a backend. This method yields all of the path, offset and graphics context combinations to draw the path collection. The caller should already have looped over the results of :meth:`_iter_collection_raw_paths` to draw this collection. The arguments should be the same as that passed into :meth:`draw_path_collection`, with the exception of *path_ids*, which is a list of arbitrary objects that the backend will use to reference one of the paths created in the :meth:`_iter_collection_raw_paths` stage. Each yielded result is of the form:: xo, yo, path_id, gc, rgbFace where *xo*, *yo* is an offset; *path_id* is one of the elements of *path_ids*; *gc* is a graphics context and *rgbFace* is a color to use for filling the path. """ Npaths = len(path_ids) Noffsets = len(offsets) N = max(Npaths, Noffsets) Nfacecolors = len(facecolors) Nedgecolors = len(edgecolors) Nlinewidths = len(linewidths) Nlinestyles = len(linestyles) Naa = len(antialiaseds) Nurls = len(urls) if (Nfacecolors == 0 and Nedgecolors == 0) or Npaths == 0: return if Noffsets: toffsets = offsetTrans.transform(offsets) gc = self.new_gc() gc.set_clip_rectangle(cliprect) if clippath is not None: clippath = transforms.TransformedPath(clippath, clippath_trans) gc.set_clip_path(clippath) if Nfacecolors == 0: rgbFace = None if Nedgecolors == 0: gc.set_linewidth(0.0) xo, yo = 0, 0 for i in xrange(N): path_id = path_ids[i % Npaths] if Noffsets: xo, yo = toffsets[i % Noffsets] if Nfacecolors: rgbFace = facecolors[i % Nfacecolors] if Nedgecolors: gc.set_foreground(edgecolors[i % Nedgecolors]) if Nlinewidths: gc.set_linewidth(linewidths[i % Nlinewidths]) if Nlinestyles: gc.set_dashes(*linestyles[i % Nlinestyles]) if rgbFace is not None and len(rgbFace)==4: gc.set_alpha(rgbFace[-1]) rgbFace = rgbFace[:3] gc.set_antialiased(antialiaseds[i % Naa]) if Nurls: gc.set_url(urls[i % Nurls]) yield xo, yo, path_id, gc, rgbFace def get_image_magnification(self): """ Get the factor by which to magnify images passed to :meth:`draw_image`. Allows a backend to have images at a different resolution to other artists. """ return 1.0 def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None): """ Draw the image instance into the current axes; *x* is the distance in pixels from the left hand side of the canvas. *y* the distance from the origin. That is, if origin is upper, y is the distance from top. If origin is lower, y is the distance from bottom *im* the :class:`matplotlib._image.Image` instance *bbox* a :class:`matplotlib.transforms.Bbox` instance for clipping, or None """ raise NotImplementedError def option_image_nocomposite(self): """ overwrite this method for renderers that do not necessarily want to rescale and composite raster images. (like SVG) """ return False def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!'): raise NotImplementedError def draw_text(self, gc, x, y, s, prop, angle, ismath=False): """ Draw the text instance *gc* the :class:`GraphicsContextBase` instance *x* the x location of the text in display coords *y* the y location of the text in display coords *s* a :class:`matplotlib.text.Text` instance *prop* a :class:`matplotlib.font_manager.FontProperties` instance *angle* the rotation angle in degrees **backend implementers note** When you are trying to determine if you have gotten your bounding box right (which is what enables the text layout/alignment to work properly), it helps to change the line in text.py:: if 0: bbox_artist(self, renderer) to if 1, and then the actual bounding box will be blotted along with your text. """ raise NotImplementedError def flipy(self): """ Return true if y small numbers are top for renderer Is used for drawing text (:mod:`matplotlib.text`) and images (:mod:`matplotlib.image`) only """ return True def get_canvas_width_height(self): 'return the canvas width and height in display coords' return 1, 1 def get_texmanager(self): """ return the :class:`matplotlib.texmanager.TexManager` instance """ if self._texmanager is None: from matplotlib.texmanager import TexManager self._texmanager = TexManager() return self._texmanager def get_text_width_height_descent(self, s, prop, ismath): """ get the width and height, and the offset from the bottom to the baseline (descent), in display coords of the string s with :class:`~matplotlib.font_manager.FontProperties` prop """ raise NotImplementedError def new_gc(self): """ Return an instance of a :class:`GraphicsContextBase` """ return GraphicsContextBase() def points_to_pixels(self, points): """ Convert points to display units *points* a float or a numpy array of float return points converted to pixels You need to override this function (unless your backend doesn't have a dpi, eg, postscript or svg). Some imaging systems assume some value for pixels per inch:: points to pixels = points * pixels_per_inch/72.0 * dpi/72.0 """ return points def strip_math(self, s): return cbook.strip_math(s) def start_rasterizing(self): pass def stop_rasterizing(self): pass class GraphicsContextBase: """ An abstract base class that provides color, line styles, etc... """ # a mapping from dash styles to suggested offset, dash pairs dashd = { 'solid' : (None, None), 'dashed' : (0, (6.0, 6.0)), 'dashdot' : (0, (3.0, 5.0, 1.0, 5.0)), 'dotted' : (0, (1.0, 3.0)), } def __init__(self): self._alpha = 1.0 self._antialiased = 1 # use 0,1 not True, False for extension code self._capstyle = 'butt' self._cliprect = None self._clippath = None self._dashes = None, None self._joinstyle = 'miter' self._linestyle = 'solid' self._linewidth = 1 self._rgb = (0.0, 0.0, 0.0) self._hatch = None self._url = None self._snap = None def copy_properties(self, gc): 'Copy properties from gc to self' self._alpha = gc._alpha self._antialiased = gc._antialiased self._capstyle = gc._capstyle self._cliprect = gc._cliprect self._clippath = gc._clippath self._dashes = gc._dashes self._joinstyle = gc._joinstyle self._linestyle = gc._linestyle self._linewidth = gc._linewidth self._rgb = gc._rgb self._hatch = gc._hatch self._url = gc._url self._snap = gc._snap def get_alpha(self): """ Return the alpha value used for blending - not supported on all backends """ return self._alpha def get_antialiased(self): "Return true if the object should try to do antialiased rendering" return self._antialiased def get_capstyle(self): """ Return the capstyle as a string in ('butt', 'round', 'projecting') """ return self._capstyle def get_clip_rectangle(self): """ Return the clip rectangle as a :class:`~matplotlib.transforms.Bbox` instance """ return self._cliprect def get_clip_path(self): """ Return the clip path in the form (path, transform), where path is a :class:`~matplotlib.path.Path` instance, and transform is an affine transform to apply to the path before clipping. """ if self._clippath is not None: return self._clippath.get_transformed_path_and_affine() return None, None def get_dashes(self): """ Return the dash information as an offset dashlist tuple. The dash list is a even size list that gives the ink on, ink off in pixels. See p107 of to PostScript `BLUEBOOK <http://www-cdf.fnal.gov/offline/PostScript/BLUEBOOK.PDF>`_ for more info. Default value is None """ return self._dashes def get_joinstyle(self): """ Return the line join style as one of ('miter', 'round', 'bevel') """ return self._joinstyle def get_linestyle(self, style): """ Return the linestyle: one of ('solid', 'dashed', 'dashdot', 'dotted'). """ return self._linestyle def get_linewidth(self): """ Return the line width in points as a scalar """ return self._linewidth def get_rgb(self): """ returns a tuple of three floats from 0-1. color can be a matlab format string, a html hex color string, or a rgb tuple """ return self._rgb def get_url(self): """ returns a url if one is set, None otherwise """ return self._url def get_snap(self): """ returns the snap setting which may be: * True: snap vertices to the nearest pixel center * False: leave vertices as-is * None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center """ return self._snap def set_alpha(self, alpha): """ Set the alpha value used for blending - not supported on all backends """ self._alpha = alpha def set_antialiased(self, b): """ True if object should be drawn with antialiased rendering """ # use 0, 1 to make life easier on extension code trying to read the gc if b: self._antialiased = 1 else: self._antialiased = 0 def set_capstyle(self, cs): """ Set the capstyle as a string in ('butt', 'round', 'projecting') """ if cs in ('butt', 'round', 'projecting'): self._capstyle = cs else: raise ValueError('Unrecognized cap style. Found %s' % cs) def set_clip_rectangle(self, rectangle): """ Set the clip rectangle with sequence (left, bottom, width, height) """ self._cliprect = rectangle def set_clip_path(self, path): """ Set the clip path and transformation. Path should be a :class:`~matplotlib.transforms.TransformedPath` instance. """ assert path is None or isinstance(path, transforms.TransformedPath) self._clippath = path def set_dashes(self, dash_offset, dash_list): """ Set the dash style for the gc. *dash_offset* is the offset (usually 0). *dash_list* specifies the on-off sequence as points. ``(None, None)`` specifies a solid line """ self._dashes = dash_offset, dash_list def set_foreground(self, fg, isRGB=False): """ Set the foreground color. fg can be a matlab format string, a html hex color string, an rgb unit tuple, or a float between 0 and 1. In the latter case, grayscale is used. The :class:`GraphicsContextBase` converts colors to rgb internally. If you know the color is rgb already, you can set ``isRGB=True`` to avoid the performace hit of the conversion """ if isRGB: self._rgb = fg else: self._rgb = colors.colorConverter.to_rgba(fg) def set_graylevel(self, frac): """ Set the foreground color to be a gray level with *frac* """ self._rgb = (frac, frac, frac) def set_joinstyle(self, js): """ Set the join style to be one of ('miter', 'round', 'bevel') """ if js in ('miter', 'round', 'bevel'): self._joinstyle = js else: raise ValueError('Unrecognized join style. Found %s' % js) def set_linewidth(self, w): """ Set the linewidth in points """ self._linewidth = w def set_linestyle(self, style): """ Set the linestyle to be one of ('solid', 'dashed', 'dashdot', 'dotted'). """ try: offset, dashes = self.dashd[style] except: raise ValueError('Unrecognized linestyle: %s' % style) self._linestyle = style self.set_dashes(offset, dashes) def set_url(self, url): """ Sets the url for links in compatible backends """ self._url = url def set_snap(self, snap): """ Sets the snap setting which may be: * True: snap vertices to the nearest pixel center * False: leave vertices as-is * None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center """ self._snap = snap def set_hatch(self, hatch): """ Sets the hatch style for filling """ self._hatch = hatch def get_hatch(self): """ Gets the current hatch style """ return self._hatch class Event: """ A matplotlib event. Attach additional attributes as defined in :meth:`FigureCanvasBase.mpl_connect`. The following attributes are defined and shown with their default values *name* the event name *canvas* the FigureCanvas instance generating the event *guiEvent* the GUI event that triggered the matplotlib event """ def __init__(self, name, canvas,guiEvent=None): self.name = name self.canvas = canvas self.guiEvent = guiEvent class IdleEvent(Event): """ An event triggered by the GUI backend when it is idle -- useful for passive animation """ pass class DrawEvent(Event): """ An event triggered by a draw operation on the canvas In addition to the :class:`Event` attributes, the following event attributes are defined: *renderer* the :class:`RendererBase` instance for the draw event """ def __init__(self, name, canvas, renderer): Event.__init__(self, name, canvas) self.renderer = renderer class ResizeEvent(Event): """ An event triggered by a canvas resize In addition to the :class:`Event` attributes, the following event attributes are defined: *width* width of the canvas in pixels *height* height of the canvas in pixels """ def __init__(self, name, canvas): Event.__init__(self, name, canvas) self.width, self.height = canvas.get_width_height() class LocationEvent(Event): """ A event that has a screen location The following additional attributes are defined and shown with their default values In addition to the :class:`Event` attributes, the following event attributes are defined: *x* x position - pixels from left of canvas *y* y position - pixels from bottom of canvas *inaxes* the :class:`~matplotlib.axes.Axes` instance if mouse is over axes *xdata* x coord of mouse in data coords *ydata* y coord of mouse in data coords """ x = None # x position - pixels from left of canvas y = None # y position - pixels from right of canvas inaxes = None # the Axes instance if mouse us over axes xdata = None # x coord of mouse in data coords ydata = None # y coord of mouse in data coords # the last event that was triggered before this one lastevent = None def __init__(self, name, canvas, x, y,guiEvent=None): """ *x*, *y* in figure coords, 0,0 = bottom, left """ Event.__init__(self, name, canvas,guiEvent=guiEvent) self.x = x self.y = y if x is None or y is None: # cannot check if event was in axes if no x,y info self.inaxes = None self._update_enter_leave() return # Find all axes containing the mouse axes_list = [a for a in self.canvas.figure.get_axes() if a.in_axes(self)] if len(axes_list) == 0: # None found self.inaxes = None self._update_enter_leave() return elif (len(axes_list) > 1): # Overlap, get the highest zorder axCmp = lambda _x,_y: cmp(_x.zorder, _y.zorder) axes_list.sort(axCmp) self.inaxes = axes_list[-1] # Use the highest zorder else: # Just found one hit self.inaxes = axes_list[0] try: xdata, ydata = self.inaxes.transData.inverted().transform_point((x, y)) except ValueError: self.xdata = None self.ydata = None else: self.xdata = xdata self.ydata = ydata self._update_enter_leave() def _update_enter_leave(self): 'process the figure/axes enter leave events' if LocationEvent.lastevent is not None: last = LocationEvent.lastevent if last.inaxes!=self.inaxes: # process axes enter/leave events if last.inaxes is not None: last.canvas.callbacks.process('axes_leave_event', last) if self.inaxes is not None: self.canvas.callbacks.process('axes_enter_event', self) else: # process a figure enter event if self.inaxes is not None: self.canvas.callbacks.process('axes_enter_event', self) LocationEvent.lastevent = self class MouseEvent(LocationEvent): """ A mouse event ('button_press_event', 'button_release_event', 'scroll_event', 'motion_notify_event'). In addition to the :class:`Event` and :class:`LocationEvent` attributes, the following attributes are defined: *button* button pressed None, 1, 2, 3, 'up', 'down' (up and down are used for scroll events) *key* the key pressed: None, chr(range(255), 'shift', 'win', or 'control' *step* number of scroll steps (positive for 'up', negative for 'down') Example usage:: def on_press(event): print 'you pressed', event.button, event.xdata, event.ydata cid = fig.canvas.mpl_connect('button_press_event', on_press) """ x = None # x position - pixels from left of canvas y = None # y position - pixels from right of canvas button = None # button pressed None, 1, 2, 3 inaxes = None # the Axes instance if mouse us over axes xdata = None # x coord of mouse in data coords ydata = None # y coord of mouse in data coords step = None # scroll steps for scroll events def __init__(self, name, canvas, x, y, button=None, key=None, step=0, guiEvent=None): """ x, y in figure coords, 0,0 = bottom, left button pressed None, 1, 2, 3, 'up', 'down' """ LocationEvent.__init__(self, name, canvas, x, y, guiEvent=guiEvent) self.button = button self.key = key self.step = step class PickEvent(Event): """ a pick event, fired when the user picks a location on the canvas sufficiently close to an artist. Attrs: all the :class:`Event` attributes plus *mouseevent* the :class:`MouseEvent` that generated the pick *artist* the :class:`~matplotlib.artist.Artist` picked other extra class dependent attrs -- eg a :class:`~matplotlib.lines.Line2D` pick may define different extra attributes than a :class:`~matplotlib.collections.PatchCollection` pick event Example usage:: line, = ax.plot(rand(100), 'o', picker=5) # 5 points tolerance def on_pick(event): thisline = event.artist xdata, ydata = thisline.get_data() ind = event.ind print 'on pick line:', zip(xdata[ind], ydata[ind]) cid = fig.canvas.mpl_connect('pick_event', on_pick) """ def __init__(self, name, canvas, mouseevent, artist, guiEvent=None, **kwargs): Event.__init__(self, name, canvas, guiEvent) self.mouseevent = mouseevent self.artist = artist self.__dict__.update(kwargs) class KeyEvent(LocationEvent): """ A key event (key press, key release). Attach additional attributes as defined in :meth:`FigureCanvasBase.mpl_connect`. In addition to the :class:`Event` and :class:`LocationEvent` attributes, the following attributes are defined: *key* the key pressed: None, chr(range(255), shift, win, or control This interface may change slightly when better support for modifier keys is included. Example usage:: def on_key(event): print 'you pressed', event.key, event.xdata, event.ydata cid = fig.canvas.mpl_connect('key_press_event', on_key) """ def __init__(self, name, canvas, key, x=0, y=0, guiEvent=None): LocationEvent.__init__(self, name, canvas, x, y, guiEvent=guiEvent) self.key = key class FigureCanvasBase: """ The canvas the figure renders into. Public attributes *figure* A :class:`matplotlib.figure.Figure` instance """ events = [ 'resize_event', 'draw_event', 'key_press_event', 'key_release_event', 'button_press_event', 'button_release_event', 'scroll_event', 'motion_notify_event', 'pick_event', 'idle_event', 'figure_enter_event', 'figure_leave_event', 'axes_enter_event', 'axes_leave_event' ] def __init__(self, figure): figure.set_canvas(self) self.figure = figure # a dictionary from event name to a dictionary that maps cid->func self.callbacks = cbook.CallbackRegistry(self.events) self.widgetlock = widgets.LockDraw() self._button = None # the button pressed self._key = None # the key pressed self._lastx, self._lasty = None, None self.button_pick_id = self.mpl_connect('button_press_event',self.pick) self.scroll_pick_id = self.mpl_connect('scroll_event',self.pick) if False: ## highlight the artists that are hit self.mpl_connect('motion_notify_event',self.onHilite) ## delete the artists that are clicked on #self.mpl_disconnect(self.button_pick_id) #self.mpl_connect('button_press_event',self.onRemove) def onRemove(self, ev): """ Mouse event processor which removes the top artist under the cursor. Connect this to the 'mouse_press_event' using:: canvas.mpl_connect('mouse_press_event',canvas.onRemove) """ def sort_artists(artists): # This depends on stable sort and artists returned # from get_children in z order. L = [ (h.zorder, h) for h in artists ] L.sort() return [ h for zorder, h in L ] # Find the top artist under the cursor under = sort_artists(self.figure.hitlist(ev)) h = None if under: h = under[-1] # Try deleting that artist, or its parent if you # can't delete the artist while h: print "Removing",h if h.remove(): self.draw_idle() break parent = None for p in under: if h in p.get_children(): parent = p break h = parent def onHilite(self, ev): """ Mouse event processor which highlights the artists under the cursor. Connect this to the 'motion_notify_event' using:: canvas.mpl_connect('motion_notify_event',canvas.onHilite) """ if not hasattr(self,'_active'): self._active = dict() under = self.figure.hitlist(ev) enter = [a for a in under if a not in self._active] leave = [a for a in self._active if a not in under] print "within:"," ".join([str(x) for x in under]) #print "entering:",[str(a) for a in enter] #print "leaving:",[str(a) for a in leave] # On leave restore the captured colour for a in leave: if hasattr(a,'get_color'): a.set_color(self._active[a]) elif hasattr(a,'get_edgecolor'): a.set_edgecolor(self._active[a][0]) a.set_facecolor(self._active[a][1]) del self._active[a] # On enter, capture the color and repaint the artist # with the highlight colour. Capturing colour has to # be done first in case the parent recolouring affects # the child. for a in enter: if hasattr(a,'get_color'): self._active[a] = a.get_color() elif hasattr(a,'get_edgecolor'): self._active[a] = (a.get_edgecolor(),a.get_facecolor()) else: self._active[a] = None for a in enter: if hasattr(a,'get_color'): a.set_color('red') elif hasattr(a,'get_edgecolor'): a.set_edgecolor('red') a.set_facecolor('lightblue') else: self._active[a] = None self.draw_idle() def pick(self, mouseevent): if not self.widgetlock.locked(): self.figure.pick(mouseevent) def blit(self, bbox=None): """ blit the canvas in bbox (default entire canvas) """ pass def resize(self, w, h): """ set the canvas size in pixels """ pass def draw_event(self, renderer): """ This method will be call all functions connected to the 'draw_event' with a :class:`DrawEvent` """ s = 'draw_event' event = DrawEvent(s, self, renderer) self.callbacks.process(s, event) def resize_event(self): """ This method will be call all functions connected to the 'resize_event' with a :class:`ResizeEvent` """ s = 'resize_event' event = ResizeEvent(s, self) self.callbacks.process(s, event) def key_press_event(self, key, guiEvent=None): """ This method will be call all functions connected to the 'key_press_event' with a :class:`KeyEvent` """ self._key = key s = 'key_press_event' event = KeyEvent(s, self, key, self._lastx, self._lasty, guiEvent=guiEvent) self.callbacks.process(s, event) def key_release_event(self, key, guiEvent=None): """ This method will be call all functions connected to the 'key_release_event' with a :class:`KeyEvent` """ s = 'key_release_event' event = KeyEvent(s, self, key, self._lastx, self._lasty, guiEvent=guiEvent) self.callbacks.process(s, event) self._key = None def pick_event(self, mouseevent, artist, **kwargs): """ This method will be called by artists who are picked and will fire off :class:`PickEvent` callbacks registered listeners """ s = 'pick_event' event = PickEvent(s, self, mouseevent, artist, **kwargs) self.callbacks.process(s, event) def scroll_event(self, x, y, step, guiEvent=None): """ Backend derived classes should call this function on any scroll wheel event. x,y are the canvas coords: 0,0 is lower, left. button and key are as defined in MouseEvent. This method will be call all functions connected to the 'scroll_event' with a :class:`MouseEvent` instance. """ if step >= 0: self._button = 'up' else: self._button = 'down' s = 'scroll_event' mouseevent = MouseEvent(s, self, x, y, self._button, self._key, step=step, guiEvent=guiEvent) self.callbacks.process(s, mouseevent) def button_press_event(self, x, y, button, guiEvent=None): """ Backend derived classes should call this function on any mouse button press. x,y are the canvas coords: 0,0 is lower, left. button and key are as defined in :class:`MouseEvent`. This method will be call all functions connected to the 'button_press_event' with a :class:`MouseEvent` instance. """ self._button = button s = 'button_press_event' mouseevent = MouseEvent(s, self, x, y, button, self._key, guiEvent=guiEvent) self.callbacks.process(s, mouseevent) def button_release_event(self, x, y, button, guiEvent=None): """ Backend derived classes should call this function on any mouse button release. *x* the canvas coordinates where 0=left *y* the canvas coordinates where 0=bottom *guiEvent* the native UI event that generated the mpl event This method will be call all functions connected to the 'button_release_event' with a :class:`MouseEvent` instance. """ s = 'button_release_event' event = MouseEvent(s, self, x, y, button, self._key, guiEvent=guiEvent) self.callbacks.process(s, event) self._button = None def motion_notify_event(self, x, y, guiEvent=None): """ Backend derived classes should call this function on any motion-notify-event. *x* the canvas coordinates where 0=left *y* the canvas coordinates where 0=bottom *guiEvent* the native UI event that generated the mpl event This method will be call all functions connected to the 'motion_notify_event' with a :class:`MouseEvent` instance. """ self._lastx, self._lasty = x, y s = 'motion_notify_event' event = MouseEvent(s, self, x, y, self._button, self._key, guiEvent=guiEvent) self.callbacks.process(s, event) def leave_notify_event(self, guiEvent=None): """ Backend derived classes should call this function when leaving canvas *guiEvent* the native UI event that generated the mpl event """ self.callbacks.process('figure_leave_event', LocationEvent.lastevent) LocationEvent.lastevent = None def enter_notify_event(self, guiEvent=None): """ Backend derived classes should call this function when entering canvas *guiEvent* the native UI event that generated the mpl event """ event = Event('figure_enter_event', self, guiEvent) self.callbacks.process('figure_enter_event', event) def idle_event(self, guiEvent=None): 'call when GUI is idle' s = 'idle_event' event = IdleEvent(s, self, guiEvent=guiEvent) self.callbacks.process(s, event) def draw(self, *args, **kwargs): """ Render the :class:`~matplotlib.figure.Figure` """ pass def draw_idle(self, *args, **kwargs): """ :meth:`draw` only if idle; defaults to draw but backends can overrride """ self.draw(*args, **kwargs) def draw_cursor(self, event): """ Draw a cursor in the event.axes if inaxes is not None. Use native GUI drawing for efficiency if possible """ pass def get_width_height(self): """ return the figure width and height in points or pixels (depending on the backend), truncated to integers """ return int(self.figure.bbox.width), int(self.figure.bbox.height) filetypes = { 'emf': 'Enhanced Metafile', 'eps': 'Encapsulated Postscript', 'pdf': 'Portable Document Format', 'png': 'Portable Network Graphics', 'ps' : 'Postscript', 'raw': 'Raw RGBA bitmap', 'rgba': 'Raw RGBA bitmap', 'svg': 'Scalable Vector Graphics', 'svgz': 'Scalable Vector Graphics' } # All of these print_* functions do a lazy import because # a) otherwise we'd have cyclical imports, since all of these # classes inherit from FigureCanvasBase # b) so we don't import a bunch of stuff the user may never use def print_emf(self, *args, **kwargs): from backends.backend_emf import FigureCanvasEMF # lazy import emf = self.switch_backends(FigureCanvasEMF) return emf.print_emf(*args, **kwargs) def print_eps(self, *args, **kwargs): from backends.backend_ps import FigureCanvasPS # lazy import ps = self.switch_backends(FigureCanvasPS) return ps.print_eps(*args, **kwargs) def print_pdf(self, *args, **kwargs): from backends.backend_pdf import FigureCanvasPdf # lazy import pdf = self.switch_backends(FigureCanvasPdf) return pdf.print_pdf(*args, **kwargs) def print_png(self, *args, **kwargs): from backends.backend_agg import FigureCanvasAgg # lazy import agg = self.switch_backends(FigureCanvasAgg) return agg.print_png(*args, **kwargs) def print_ps(self, *args, **kwargs): from backends.backend_ps import FigureCanvasPS # lazy import ps = self.switch_backends(FigureCanvasPS) return ps.print_ps(*args, **kwargs) def print_raw(self, *args, **kwargs): from backends.backend_agg import FigureCanvasAgg # lazy import agg = self.switch_backends(FigureCanvasAgg) return agg.print_raw(*args, **kwargs) print_bmp = print_rgb = print_raw def print_svg(self, *args, **kwargs): from backends.backend_svg import FigureCanvasSVG # lazy import svg = self.switch_backends(FigureCanvasSVG) return svg.print_svg(*args, **kwargs) def print_svgz(self, *args, **kwargs): from backends.backend_svg import FigureCanvasSVG # lazy import svg = self.switch_backends(FigureCanvasSVG) return svg.print_svgz(*args, **kwargs) def get_supported_filetypes(self): return self.filetypes def get_supported_filetypes_grouped(self): groupings = {} for ext, name in self.filetypes.items(): groupings.setdefault(name, []).append(ext) groupings[name].sort() return groupings def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w', orientation='portrait', format=None, **kwargs): """ Render the figure to hardcopy. Set the figure patch face and edge colors. This is useful because some of the GUIs have a gray figure face color background and you'll probably want to override this on hardcopy. Arguments are: *filename* can also be a file object on image backends *orientation* only currently applies to PostScript printing. *dpi* the dots per inch to save the figure in; if None, use savefig.dpi *facecolor* the facecolor of the figure *edgecolor* the edgecolor of the figure *orientation* ' landscape' | 'portrait' (not supported on all backends) *format* when set, forcibly set the file format to save to """ if format is None: if cbook.is_string_like(filename): format = os.path.splitext(filename)[1][1:] if format is None or format == '': format = self.get_default_filetype() if cbook.is_string_like(filename): filename = filename.rstrip('.') + '.' + format format = format.lower() method_name = 'print_%s' % format if (format not in self.filetypes or not hasattr(self, method_name)): formats = self.filetypes.keys() formats.sort() raise ValueError( 'Format "%s" is not supported.\n' 'Supported formats: ' '%s.' % (format, ', '.join(formats))) if dpi is None: dpi = rcParams['savefig.dpi'] origDPI = self.figure.dpi origfacecolor = self.figure.get_facecolor() origedgecolor = self.figure.get_edgecolor() self.figure.dpi = dpi self.figure.set_facecolor(facecolor) self.figure.set_edgecolor(edgecolor) try: result = getattr(self, method_name)( filename, dpi=dpi, facecolor=facecolor, edgecolor=edgecolor, orientation=orientation, **kwargs) finally: self.figure.dpi = origDPI self.figure.set_facecolor(origfacecolor) self.figure.set_edgecolor(origedgecolor) self.figure.set_canvas(self) #self.figure.canvas.draw() ## seems superfluous return result def get_default_filetype(self): raise NotImplementedError def set_window_title(self, title): """ Set the title text of the window containing the figure. Note that this has no effect if there is no window (eg, a PS backend). """ if hasattr(self, "manager"): self.manager.set_window_title(title) def switch_backends(self, FigureCanvasClass): """ instantiate an instance of FigureCanvasClass This is used for backend switching, eg, to instantiate a FigureCanvasPS from a FigureCanvasGTK. Note, deep copying is not done, so any changes to one of the instances (eg, setting figure size or line props), will be reflected in the other """ newCanvas = FigureCanvasClass(self.figure) return newCanvas def mpl_connect(self, s, func): """ Connect event with string *s* to *func*. The signature of *func* is:: def func(event) where event is a :class:`matplotlib.backend_bases.Event`. The following events are recognized - 'button_press_event' - 'button_release_event' - 'draw_event' - 'key_press_event' - 'key_release_event' - 'motion_notify_event' - 'pick_event' - 'resize_event' - 'scroll_event' For the location events (button and key press/release), if the mouse is over the axes, the variable ``event.inaxes`` will be set to the :class:`~matplotlib.axes.Axes` the event occurs is over, and additionally, the variables ``event.xdata`` and ``event.ydata`` will be defined. This is the mouse location in data coords. See :class:`~matplotlib.backend_bases.KeyEvent` and :class:`~matplotlib.backend_bases.MouseEvent` for more info. Return value is a connection id that can be used with :meth:`~matplotlib.backend_bases.Event.mpl_disconnect`. Example usage:: def on_press(event): print 'you pressed', event.button, event.xdata, event.ydata cid = canvas.mpl_connect('button_press_event', on_press) """ return self.callbacks.connect(s, func) def mpl_disconnect(self, cid): """ disconnect callback id cid Example usage:: cid = canvas.mpl_connect('button_press_event', on_press) #...later canvas.mpl_disconnect(cid) """ return self.callbacks.disconnect(cid) def flush_events(self): """ Flush the GUI events for the figure. Implemented only for backends with GUIs. """ raise NotImplementedError def start_event_loop(self,timeout): """ Start an event loop. This is used to start a blocking event loop so that interactive functions, such as ginput and waitforbuttonpress, can wait for events. This should not be confused with the main GUI event loop, which is always running and has nothing to do with this. This is implemented only for backends with GUIs. """ raise NotImplementedError def stop_event_loop(self): """ Stop an event loop. This is used to stop a blocking event loop so that interactive functions, such as ginput and waitforbuttonpress, can wait for events. This is implemented only for backends with GUIs. """ raise NotImplementedError def start_event_loop_default(self,timeout=0): """ Start an event loop. This is used to start a blocking event loop so that interactive functions, such as ginput and waitforbuttonpress, can wait for events. This should not be confused with the main GUI event loop, which is always running and has nothing to do with this. This function provides default event loop functionality based on time.sleep that is meant to be used until event loop functions for each of the GUI backends can be written. As such, it throws a deprecated warning. Call signature:: start_event_loop_default(self,timeout=0) This call blocks until a callback function triggers stop_event_loop() or *timeout* is reached. If *timeout* is <=0, never timeout. """ str = "Using default event loop until function specific" str += " to this GUI is implemented" warnings.warn(str,DeprecationWarning) if timeout <= 0: timeout = np.inf timestep = 0.01 counter = 0 self._looping = True while self._looping and counter*timestep < timeout: self.flush_events() time.sleep(timestep) counter += 1 def stop_event_loop_default(self): """ Stop an event loop. This is used to stop a blocking event loop so that interactive functions, such as ginput and waitforbuttonpress, can wait for events. Call signature:: stop_event_loop_default(self) """ self._looping = False class FigureManagerBase: """ Helper class for matlab mode, wraps everything up into a neat bundle Public attibutes: *canvas* A :class:`FigureCanvasBase` instance *num* The figure nuamber """ def __init__(self, canvas, num): self.canvas = canvas canvas.manager = self # store a pointer to parent self.num = num self.canvas.mpl_connect('key_press_event', self.key_press) def destroy(self): pass def full_screen_toggle (self): pass def resize(self, w, h): 'For gui backends: resize window in pixels' pass def key_press(self, event): # these bindings happen whether you are over an axes or not #if event.key == 'q': # self.destroy() # how cruel to have to destroy oneself! # return if event.key == 'f': self.full_screen_toggle() # *h*ome or *r*eset mnemonic elif event.key == 'h' or event.key == 'r' or event.key == "home": self.canvas.toolbar.home() # c and v to enable left handed quick navigation elif event.key == 'left' or event.key == 'c' or event.key == 'backspace': self.canvas.toolbar.back() elif event.key == 'right' or event.key == 'v': self.canvas.toolbar.forward() # *p*an mnemonic elif event.key == 'p': self.canvas.toolbar.pan() # z*o*om mnemonic elif event.key == 'o': self.canvas.toolbar.zoom() elif event.key == 's': self.canvas.toolbar.save_figure(self.canvas.toolbar) if event.inaxes is None: return # the mouse has to be over an axes to trigger these if event.key == 'g': event.inaxes.grid() self.canvas.draw() elif event.key == 'l': ax = event.inaxes scale = ax.get_yscale() if scale=='log': ax.set_yscale('linear') ax.figure.canvas.draw() elif scale=='linear': ax.set_yscale('log') ax.figure.canvas.draw() elif event.key is not None and (event.key.isdigit() and event.key!='0') or event.key=='a': # 'a' enables all axes if event.key!='a': n=int(event.key)-1 for i, a in enumerate(self.canvas.figure.get_axes()): if event.x is not None and event.y is not None and a.in_axes(event): if event.key=='a': a.set_navigate(True) else: a.set_navigate(i==n) def show_popup(self, msg): """ Display message in a popup -- GUI only """ pass def set_window_title(self, title): """ Set the title text of the window containing the figure. Note that this has no effect if there is no window (eg, a PS backend). """ pass # cursors class Cursors: #namespace HAND, POINTER, SELECT_REGION, MOVE = range(4) cursors = Cursors() class NavigationToolbar2: """ Base class for the navigation cursor, version 2 backends must implement a canvas that handles connections for 'button_press_event' and 'button_release_event'. See :meth:`FigureCanvasBase.mpl_connect` for more information They must also define :meth:`save_figure` save the current figure :meth:`set_cursor` if you want the pointer icon to change :meth:`_init_toolbar` create your toolbar widget :meth:`draw_rubberband` (optional) draw the zoom to rect "rubberband" rectangle :meth:`press` (optional) whenever a mouse button is pressed, you'll be notified with the event :meth:`release` (optional) whenever a mouse button is released, you'll be notified with the event :meth:`dynamic_update` (optional) dynamically update the window while navigating :meth:`set_message` (optional) display message :meth:`set_history_buttons` (optional) you can change the history back / forward buttons to indicate disabled / enabled state. That's it, we'll do the rest! """ def __init__(self, canvas): self.canvas = canvas canvas.toolbar = self # a dict from axes index to a list of view limits self._views = cbook.Stack() self._positions = cbook.Stack() # stack of subplot positions self._xypress = None # the location and axis info at the time of the press self._idPress = None self._idRelease = None self._active = None self._lastCursor = None self._init_toolbar() self._idDrag=self.canvas.mpl_connect('motion_notify_event', self.mouse_move) self._button_pressed = None # determined by the button pressed at start self.mode = '' # a mode string for the status bar self.set_history_buttons() def set_message(self, s): 'display a message on toolbar or in status bar' pass def back(self, *args): 'move back up the view lim stack' self._views.back() self._positions.back() self.set_history_buttons() self._update_view() def dynamic_update(self): pass def draw_rubberband(self, event, x0, y0, x1, y1): 'draw a rectangle rubberband to indicate zoom limits' pass def forward(self, *args): 'move forward in the view lim stack' self._views.forward() self._positions.forward() self.set_history_buttons() self._update_view() def home(self, *args): 'restore the original view' self._views.home() self._positions.home() self.set_history_buttons() self._update_view() def _init_toolbar(self): """ This is where you actually build the GUI widgets (called by __init__). The icons ``home.xpm``, ``back.xpm``, ``forward.xpm``, ``hand.xpm``, ``zoom_to_rect.xpm`` and ``filesave.xpm`` are standard across backends (there are ppm versions in CVS also). You just need to set the callbacks home : self.home back : self.back forward : self.forward hand : self.pan zoom_to_rect : self.zoom filesave : self.save_figure You only need to define the last one - the others are in the base class implementation. """ raise NotImplementedError def mouse_move(self, event): #print 'mouse_move', event.button if not event.inaxes or not self._active: if self._lastCursor != cursors.POINTER: self.set_cursor(cursors.POINTER) self._lastCursor = cursors.POINTER else: if self._active=='ZOOM': if self._lastCursor != cursors.SELECT_REGION: self.set_cursor(cursors.SELECT_REGION) self._lastCursor = cursors.SELECT_REGION if self._xypress: x, y = event.x, event.y lastx, lasty, a, ind, lim, trans = self._xypress[0] self.draw_rubberband(event, x, y, lastx, lasty) elif (self._active=='PAN' and self._lastCursor != cursors.MOVE): self.set_cursor(cursors.MOVE) self._lastCursor = cursors.MOVE if event.inaxes and event.inaxes.get_navigate(): try: s = event.inaxes.format_coord(event.xdata, event.ydata) except ValueError: pass except OverflowError: pass else: if len(self.mode): self.set_message('%s : %s' % (self.mode, s)) else: self.set_message(s) else: self.set_message(self.mode) def pan(self,*args): 'Activate the pan/zoom tool. pan with left button, zoom with right' # set the pointer icon and button press funcs to the # appropriate callbacks if self._active == 'PAN': self._active = None else: self._active = 'PAN' if self._idPress is not None: self._idPress = self.canvas.mpl_disconnect(self._idPress) self.mode = '' if self._idRelease is not None: self._idRelease = self.canvas.mpl_disconnect(self._idRelease) self.mode = '' if self._active: self._idPress = self.canvas.mpl_connect( 'button_press_event', self.press_pan) self._idRelease = self.canvas.mpl_connect( 'button_release_event', self.release_pan) self.mode = 'pan/zoom mode' self.canvas.widgetlock(self) else: self.canvas.widgetlock.release(self) for a in self.canvas.figure.get_axes(): a.set_navigate_mode(self._active) self.set_message(self.mode) def press(self, event): 'this will be called whenver a mouse button is pressed' pass def press_pan(self, event): 'the press mouse button in pan/zoom mode callback' if event.button == 1: self._button_pressed=1 elif event.button == 3: self._button_pressed=3 else: self._button_pressed=None return x, y = event.x, event.y # push the current view to define home if stack is empty if self._views.empty(): self.push_current() self._xypress=[] for i, a in enumerate(self.canvas.figure.get_axes()): if x is not None and y is not None and a.in_axes(event) and a.get_navigate(): a.start_pan(x, y, event.button) self._xypress.append((a, i)) self.canvas.mpl_disconnect(self._idDrag) self._idDrag=self.canvas.mpl_connect('motion_notify_event', self.drag_pan) self.press(event) def press_zoom(self, event): 'the press mouse button in zoom to rect mode callback' if event.button == 1: self._button_pressed=1 elif event.button == 3: self._button_pressed=3 else: self._button_pressed=None return x, y = event.x, event.y # push the current view to define home if stack is empty if self._views.empty(): self.push_current() self._xypress=[] for i, a in enumerate(self.canvas.figure.get_axes()): if x is not None and y is not None and a.in_axes(event) \ and a.get_navigate() and a.can_zoom(): self._xypress.append(( x, y, a, i, a.viewLim.frozen(), a.transData.frozen())) self.press(event) def push_current(self): 'push the current view limits and position onto the stack' lims = []; pos = [] for a in self.canvas.figure.get_axes(): xmin, xmax = a.get_xlim() ymin, ymax = a.get_ylim() lims.append( (xmin, xmax, ymin, ymax) ) # Store both the original and modified positions pos.append( ( a.get_position(True).frozen(), a.get_position().frozen() ) ) self._views.push(lims) self._positions.push(pos) self.set_history_buttons() def release(self, event): 'this will be called whenever mouse button is released' pass def release_pan(self, event): 'the release mouse button callback in pan/zoom mode' self.canvas.mpl_disconnect(self._idDrag) self._idDrag=self.canvas.mpl_connect('motion_notify_event', self.mouse_move) for a, ind in self._xypress: a.end_pan() if not self._xypress: return self._xypress = [] self._button_pressed=None self.push_current() self.release(event) self.draw() def drag_pan(self, event): 'the drag callback in pan/zoom mode' for a, ind in self._xypress: #safer to use the recorded button at the press than current button: #multiple button can get pressed during motion... a.drag_pan(self._button_pressed, event.key, event.x, event.y) self.dynamic_update() def release_zoom(self, event): 'the release mouse button callback in zoom to rect mode' if not self._xypress: return last_a = [] for cur_xypress in self._xypress: x, y = event.x, event.y lastx, lasty, a, ind, lim, trans = cur_xypress # ignore singular clicks - 5 pixels is a threshold if abs(x-lastx)<5 or abs(y-lasty)<5: self._xypress = None self.release(event) self.draw() return x0, y0, x1, y1 = lim.extents # zoom to rect inverse = a.transData.inverted() lastx, lasty = inverse.transform_point( (lastx, lasty) ) x, y = inverse.transform_point( (x, y) ) Xmin,Xmax=a.get_xlim() Ymin,Ymax=a.get_ylim() # detect twinx,y axes and avoid double zooming twinx, twiny = False, False if last_a: for la in last_a: if a.get_shared_x_axes().joined(a,la): twinx=True if a.get_shared_y_axes().joined(a,la): twiny=True last_a.append(a) if twinx: x0, x1 = Xmin, Xmax else: if Xmin < Xmax: if x<lastx: x0, x1 = x, lastx else: x0, x1 = lastx, x if x0 < Xmin: x0=Xmin if x1 > Xmax: x1=Xmax else: if x>lastx: x0, x1 = x, lastx else: x0, x1 = lastx, x if x0 > Xmin: x0=Xmin if x1 < Xmax: x1=Xmax if twiny: y0, y1 = Ymin, Ymax else: if Ymin < Ymax: if y<lasty: y0, y1 = y, lasty else: y0, y1 = lasty, y if y0 < Ymin: y0=Ymin if y1 > Ymax: y1=Ymax else: if y>lasty: y0, y1 = y, lasty else: y0, y1 = lasty, y if y0 > Ymin: y0=Ymin if y1 < Ymax: y1=Ymax if self._button_pressed == 1: a.set_xlim((x0, x1)) a.set_ylim((y0, y1)) elif self._button_pressed == 3: if a.get_xscale()=='log': alpha=np.log(Xmax/Xmin)/np.log(x1/x0) rx1=pow(Xmin/x0,alpha)*Xmin rx2=pow(Xmax/x0,alpha)*Xmin else: alpha=(Xmax-Xmin)/(x1-x0) rx1=alpha*(Xmin-x0)+Xmin rx2=alpha*(Xmax-x0)+Xmin if a.get_yscale()=='log': alpha=np.log(Ymax/Ymin)/np.log(y1/y0) ry1=pow(Ymin/y0,alpha)*Ymin ry2=pow(Ymax/y0,alpha)*Ymin else: alpha=(Ymax-Ymin)/(y1-y0) ry1=alpha*(Ymin-y0)+Ymin ry2=alpha*(Ymax-y0)+Ymin a.set_xlim((rx1, rx2)) a.set_ylim((ry1, ry2)) self.draw() self._xypress = None self._button_pressed = None self.push_current() self.release(event) def draw(self): 'redraw the canvases, update the locators' for a in self.canvas.figure.get_axes(): xaxis = getattr(a, 'xaxis', None) yaxis = getattr(a, 'yaxis', None) locators = [] if xaxis is not None: locators.append(xaxis.get_major_locator()) locators.append(xaxis.get_minor_locator()) if yaxis is not None: locators.append(yaxis.get_major_locator()) locators.append(yaxis.get_minor_locator()) for loc in locators: loc.refresh() self.canvas.draw() def _update_view(self): '''update the viewlim and position from the view and position stack for each axes ''' lims = self._views() if lims is None: return pos = self._positions() if pos is None: return for i, a in enumerate(self.canvas.figure.get_axes()): xmin, xmax, ymin, ymax = lims[i] a.set_xlim((xmin, xmax)) a.set_ylim((ymin, ymax)) # Restore both the original and modified positions a.set_position( pos[i][0], 'original' ) a.set_position( pos[i][1], 'active' ) self.draw() def save_figure(self, *args): 'save the current figure' raise NotImplementedError def set_cursor(self, cursor): """ Set the current cursor to one of the :class:`Cursors` enums values """ pass def update(self): 'reset the axes stack' self._views.clear() self._positions.clear() self.set_history_buttons() def zoom(self, *args): 'activate zoom to rect mode' if self._active == 'ZOOM': self._active = None else: self._active = 'ZOOM' if self._idPress is not None: self._idPress=self.canvas.mpl_disconnect(self._idPress) self.mode = '' if self._idRelease is not None: self._idRelease=self.canvas.mpl_disconnect(self._idRelease) self.mode = '' if self._active: self._idPress = self.canvas.mpl_connect('button_press_event', self.press_zoom) self._idRelease = self.canvas.mpl_connect('button_release_event', self.release_zoom) self.mode = 'Zoom to rect mode' self.canvas.widgetlock(self) else: self.canvas.widgetlock.release(self) for a in self.canvas.figure.get_axes(): a.set_navigate_mode(self._active) self.set_message(self.mode) def set_history_buttons(self): 'enable or disable back/forward button' pass
gpl-3.0
[ 624, 199, 8458, 1300, 3992, 5627, 314, 1979, 22337, 626, 2903, 26529, 436, 199, 15707, 18191, 1471, 5669, 370, 14062, 465, 282, 8027, 4865, 199, 199, 26, 533, 1705, 11355, 1563, 64, 272, 1626, 9006, 1300, 1021, 370, 2429, 17455, 15, 28228, 5331, 14, 199, 199, 26, 533, 1705, 25590, 15174, 1563, 64, 272, 710, 2236, 29639, 4045, 626, 4216, 2335, 314, 272, 520, 533, 1705, 16440, 14, 8941, 14, 25590, 64, 687, 314, 4865, 2488, 272, 2436, 2839, 282, 922, 3217, 17455, 9150, 199, 199, 26, 533, 1705, 18859, 2998, 1563, 64, 272, 1626, 9006, 1300, 1021, 626, 6571, 3164, 12, 1004, 15725, 12, 5423, 1396, 199, 199, 26, 533, 1705, 2390, 64, 272, 710, 1300, 1021, 367, 1006, 402, 314, 8027, 1566, 272, 7252, 14, 221, 27731, 3992, 18741, 72, 465, 520, 533, 1705, 1197, 2390, 64, 436, 272, 520, 533, 1705, 17141, 2390, 64, 3877, 314, 3404, 666, 2839, 2883, 436, 15766, 272, 25167, 12, 671, 436, 612, 9918, 315, 7148, 436, 272, 520, 533, 6054, 16440, 14, 6402, 14, 20386, 64, 8983, 14, 199, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 4629, 199, 646, 747, 12, 3598, 12, 900, 199, 199, 646, 2680, 465, 980, 199, 646, 8027, 14, 67, 2706, 465, 286, 2706, 199, 646, 8027, 14, 7120, 465, 9229, 199, 646, 8027, 14, 15133, 465, 18501, 199, 646, 8027, 14, 8583, 465, 11114, 199, 504, 8027, 492, 4819, 6007, 199, 199, 533, 10055, 5813, 1563, 26, 272, 408, 2493, 9006, 1300, 1021, 370, 2429, 17455, 15, 28228, 5331, 14, 339, 710, 2569, 3102, 627, 7790, 10, 506, 6366, 315, 314, 4865, 26, 339, 627, 520, 5247, 1705, 5485, 63, 515, 64, 272, 627, 520, 5247, 1705, 5485, 63, 1569, 64, 272, 627, 520, 5247, 1705, 5485, 63, 505, 64, 272, 627, 520, 5247, 1705, 362, 63, 505, 63, 2063, 63, 3333, 63, 26269, 64, 339, 710, 2569, 3102, 627, 5626, 10, 506, 6366, 315, 314, 4865, 367, 272, 13712, 14872, 26, 339, 627, 520, 5247, 1705, 5485, 63, 16835, 64, 272, 627, 520, 5247, 1705, 5485, 63, 515, 63, 3627, 64, 272, 627, 520, 5247, 1705, 5485, 63, 14567, 63, 6480, 64, 272, 408, 272, 347, 636, 826, 721, 277, 304, 267, 291, 423, 3858, 2609, 275, 488, 339, 347, 1551, 63, 923, 8, 277, 12, 308, 304, 267, 408, 267, 3232, 282, 17786, 1819, 543, 1768, 627, 83, 4856, 6596, 1454, 5544, 1202, 701, 267, 520, 1494, 6054, 16440, 14, 7765, 14, 4620, 63, 10273, 64, 267, 408, 267, 986, 339, 347, 4002, 63, 923, 8, 277, 12, 308, 304, 267, 408, 267, 15524, 282, 17786, 1819, 543, 1768, 627, 83, 10, 267, 6596, 1454, 5544, 1202, 701, 520, 1494, 6054, 16440, 14, 7765, 14, 4620, 63, 10273, 64, 267, 408, 267, 986, 339, 347, 5954, 63, 515, 8, 277, 12, 9486, 12, 931, 12, 5793, 12, 15180, 13414, 29, 403, 304, 267, 408, 267, 17813, 83, 282, 520, 533, 6054, 16440, 14, 515, 14, 2042, 64, 1256, 1808, 314, 267, 1627, 31435, 5793, 14, 267, 408, 267, 746, 4279, 339, 347, 5954, 63, 16835, 8, 277, 12, 9486, 12, 3608, 63, 515, 12, 3608, 63, 1515, 12, 931, 12, 1752, 12, 15180, 13414, 29, 403, 304, 267, 408, 267, 17813, 83, 282, 3608, 737, 1924, 402, 314, 14971, 315, 931, 14, 221, 961, 6952, 267, 1006, 14971, 12, 5893, 3304, 4501, 641, 1094, 2310, 14, 221, 4005, 5126, 267, 626, 5953, 12, 5204, 14971, 1077, 506, 4829, 2544, 6358, 267, 642, 805, 14, 398, 627, 9493, 10, 288, 314, 520, 533, 1705, 18859, 2998, 1563, 64, 1256, 398, 627, 4211, 63, 1515, 10, 288, 365, 376, 31435, 5793, 6781, 370, 314, 3608, 14, 398, 627, 1515, 10, 1467, 365, 376, 31435, 5793, 6781, 370, 314, 931, 14, 398, 961, 6571, 282, 9567, 4514, 402, 5954, 63, 16835, 626, 267, 7704, 3663, 4882, 370, 520, 5247, 1705, 5485, 63, 515, 2313, 221, 6601, 14745, 1443, 267, 2934, 370, 4278, 642, 1083, 315, 1865, 370, 5954, 314, 3608, 1454, 267, 5403, 436, 12598, 652, 3663, 5431, 14, 267, 408, 267, 307, 515, 275, 1752, 14, 4711, 63, 515, 8, 515, 9, 267, 367, 14971, 12, 9479, 315, 307, 515, 14, 1661, 63, 13879, 837, 288, 340, 822, 8, 12637, 304, 355, 671, 12, 89, 275, 14971, 1988, 18, 2938, 355, 291, 14, 5485, 63, 515, 8, 9493, 12, 3608, 63, 515, 12, 3044, 3608, 63, 1515, 435, 18501, 14, 19256, 1132, 18, 36, 1252, 5275, 8, 88, 12, 612, 395, 3044, 15180, 13414, 9, 339, 347, 5954, 63, 515, 63, 3627, 8, 277, 12, 5288, 63, 4711, 12, 5053, 657, 319, 12, 11353, 515, 12, 2490, 11353, 515, 63, 1515, 12, 3792, 12, 1006, 63, 15133, 12, 15340, 12, 2490, 3268, 3188, 12, 8870, 7120, 12, 6275, 7120, 12, 21213, 83, 12, 2490, 27880, 83, 12, 376, 1009, 73, 482, 795, 12, 8187, 304, 267, 408, 267, 17813, 83, 282, 3245, 402, 3792, 12, 30090, 17455, 4382, 687, 267, 314, 5548, 627, 1409, 7120, 10381, 627, 5173, 7120, 10381, 627, 24643, 83, 10381, 267, 627, 472, 20953, 83, 10, 436, 627, 290, 1009, 73, 482, 795, 4856, 627, 14253, 10, 365, 282, 769, 402, 267, 15340, 370, 4838, 370, 1924, 402, 314, 3792, 14, 221, 710, 15340, 315, 267, 627, 14253, 10, 787, 1642, 14834, 701, 627, 2743, 3188, 10, 2544, 267, 3769, 6781, 14, 398, 961, 6571, 282, 9567, 4514, 402, 267, 520, 5247, 1705, 5485, 63, 515, 63, 3627, 64, 626, 7704, 3663, 4882, 370, 267, 5954, 63, 515, 14, 221, 6601, 14745, 1443, 2934, 370, 4278, 642, 315, 1865, 267, 370, 3795, 1924, 663, 402, 931, 666, 1454, 5403, 12, 436, 2066, 3659, 267, 626, 931, 3663, 5431, 543, 314, 3365, 15340, 12, 9229, 12, 267, 15725, 5423, 14, 221, 710, 4306, 3102, 267, 520, 5247, 28417, 1661, 63, 3627, 63, 1773, 63, 3771, 64, 436, 267, 520, 5247, 28417, 1661, 63, 3627, 64, 787, 2741, 370, 1720, 543, 334, 460, 267, 28974, 806, 9, 314, 4514, 9371, 14745, 14, 221, 2779, 365, 4721, 590, 267, 14318, 370, 675, 5204, 16952, 12, 880, 626, 4493, 370, 314, 267, 5953, 402, 520, 5247, 1705 ]
[ 199, 8458, 1300, 3992, 5627, 314, 1979, 22337, 626, 2903, 26529, 436, 199, 15707, 18191, 1471, 5669, 370, 14062, 465, 282, 8027, 4865, 199, 199, 26, 533, 1705, 11355, 1563, 64, 272, 1626, 9006, 1300, 1021, 370, 2429, 17455, 15, 28228, 5331, 14, 199, 199, 26, 533, 1705, 25590, 15174, 1563, 64, 272, 710, 2236, 29639, 4045, 626, 4216, 2335, 314, 272, 520, 533, 1705, 16440, 14, 8941, 14, 25590, 64, 687, 314, 4865, 2488, 272, 2436, 2839, 282, 922, 3217, 17455, 9150, 199, 199, 26, 533, 1705, 18859, 2998, 1563, 64, 272, 1626, 9006, 1300, 1021, 626, 6571, 3164, 12, 1004, 15725, 12, 5423, 1396, 199, 199, 26, 533, 1705, 2390, 64, 272, 710, 1300, 1021, 367, 1006, 402, 314, 8027, 1566, 272, 7252, 14, 221, 27731, 3992, 18741, 72, 465, 520, 533, 1705, 1197, 2390, 64, 436, 272, 520, 533, 1705, 17141, 2390, 64, 3877, 314, 3404, 666, 2839, 2883, 436, 15766, 272, 25167, 12, 671, 436, 612, 9918, 315, 7148, 436, 272, 520, 533, 6054, 16440, 14, 6402, 14, 20386, 64, 8983, 14, 199, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 4629, 199, 646, 747, 12, 3598, 12, 900, 199, 199, 646, 2680, 465, 980, 199, 646, 8027, 14, 67, 2706, 465, 286, 2706, 199, 646, 8027, 14, 7120, 465, 9229, 199, 646, 8027, 14, 15133, 465, 18501, 199, 646, 8027, 14, 8583, 465, 11114, 199, 504, 8027, 492, 4819, 6007, 199, 199, 533, 10055, 5813, 1563, 26, 272, 408, 2493, 9006, 1300, 1021, 370, 2429, 17455, 15, 28228, 5331, 14, 339, 710, 2569, 3102, 627, 7790, 10, 506, 6366, 315, 314, 4865, 26, 339, 627, 520, 5247, 1705, 5485, 63, 515, 64, 272, 627, 520, 5247, 1705, 5485, 63, 1569, 64, 272, 627, 520, 5247, 1705, 5485, 63, 505, 64, 272, 627, 520, 5247, 1705, 362, 63, 505, 63, 2063, 63, 3333, 63, 26269, 64, 339, 710, 2569, 3102, 627, 5626, 10, 506, 6366, 315, 314, 4865, 367, 272, 13712, 14872, 26, 339, 627, 520, 5247, 1705, 5485, 63, 16835, 64, 272, 627, 520, 5247, 1705, 5485, 63, 515, 63, 3627, 64, 272, 627, 520, 5247, 1705, 5485, 63, 14567, 63, 6480, 64, 272, 408, 272, 347, 636, 826, 721, 277, 304, 267, 291, 423, 3858, 2609, 275, 488, 339, 347, 1551, 63, 923, 8, 277, 12, 308, 304, 267, 408, 267, 3232, 282, 17786, 1819, 543, 1768, 627, 83, 4856, 6596, 1454, 5544, 1202, 701, 267, 520, 1494, 6054, 16440, 14, 7765, 14, 4620, 63, 10273, 64, 267, 408, 267, 986, 339, 347, 4002, 63, 923, 8, 277, 12, 308, 304, 267, 408, 267, 15524, 282, 17786, 1819, 543, 1768, 627, 83, 10, 267, 6596, 1454, 5544, 1202, 701, 520, 1494, 6054, 16440, 14, 7765, 14, 4620, 63, 10273, 64, 267, 408, 267, 986, 339, 347, 5954, 63, 515, 8, 277, 12, 9486, 12, 931, 12, 5793, 12, 15180, 13414, 29, 403, 304, 267, 408, 267, 17813, 83, 282, 520, 533, 6054, 16440, 14, 515, 14, 2042, 64, 1256, 1808, 314, 267, 1627, 31435, 5793, 14, 267, 408, 267, 746, 4279, 339, 347, 5954, 63, 16835, 8, 277, 12, 9486, 12, 3608, 63, 515, 12, 3608, 63, 1515, 12, 931, 12, 1752, 12, 15180, 13414, 29, 403, 304, 267, 408, 267, 17813, 83, 282, 3608, 737, 1924, 402, 314, 14971, 315, 931, 14, 221, 961, 6952, 267, 1006, 14971, 12, 5893, 3304, 4501, 641, 1094, 2310, 14, 221, 4005, 5126, 267, 626, 5953, 12, 5204, 14971, 1077, 506, 4829, 2544, 6358, 267, 642, 805, 14, 398, 627, 9493, 10, 288, 314, 520, 533, 1705, 18859, 2998, 1563, 64, 1256, 398, 627, 4211, 63, 1515, 10, 288, 365, 376, 31435, 5793, 6781, 370, 314, 3608, 14, 398, 627, 1515, 10, 1467, 365, 376, 31435, 5793, 6781, 370, 314, 931, 14, 398, 961, 6571, 282, 9567, 4514, 402, 5954, 63, 16835, 626, 267, 7704, 3663, 4882, 370, 520, 5247, 1705, 5485, 63, 515, 2313, 221, 6601, 14745, 1443, 267, 2934, 370, 4278, 642, 1083, 315, 1865, 370, 5954, 314, 3608, 1454, 267, 5403, 436, 12598, 652, 3663, 5431, 14, 267, 408, 267, 307, 515, 275, 1752, 14, 4711, 63, 515, 8, 515, 9, 267, 367, 14971, 12, 9479, 315, 307, 515, 14, 1661, 63, 13879, 837, 288, 340, 822, 8, 12637, 304, 355, 671, 12, 89, 275, 14971, 1988, 18, 2938, 355, 291, 14, 5485, 63, 515, 8, 9493, 12, 3608, 63, 515, 12, 3044, 3608, 63, 1515, 435, 18501, 14, 19256, 1132, 18, 36, 1252, 5275, 8, 88, 12, 612, 395, 3044, 15180, 13414, 9, 339, 347, 5954, 63, 515, 63, 3627, 8, 277, 12, 5288, 63, 4711, 12, 5053, 657, 319, 12, 11353, 515, 12, 2490, 11353, 515, 63, 1515, 12, 3792, 12, 1006, 63, 15133, 12, 15340, 12, 2490, 3268, 3188, 12, 8870, 7120, 12, 6275, 7120, 12, 21213, 83, 12, 2490, 27880, 83, 12, 376, 1009, 73, 482, 795, 12, 8187, 304, 267, 408, 267, 17813, 83, 282, 3245, 402, 3792, 12, 30090, 17455, 4382, 687, 267, 314, 5548, 627, 1409, 7120, 10381, 627, 5173, 7120, 10381, 627, 24643, 83, 10381, 267, 627, 472, 20953, 83, 10, 436, 627, 290, 1009, 73, 482, 795, 4856, 627, 14253, 10, 365, 282, 769, 402, 267, 15340, 370, 4838, 370, 1924, 402, 314, 3792, 14, 221, 710, 15340, 315, 267, 627, 14253, 10, 787, 1642, 14834, 701, 627, 2743, 3188, 10, 2544, 267, 3769, 6781, 14, 398, 961, 6571, 282, 9567, 4514, 402, 267, 520, 5247, 1705, 5485, 63, 515, 63, 3627, 64, 626, 7704, 3663, 4882, 370, 267, 5954, 63, 515, 14, 221, 6601, 14745, 1443, 2934, 370, 4278, 642, 315, 1865, 267, 370, 3795, 1924, 663, 402, 931, 666, 1454, 5403, 12, 436, 2066, 3659, 267, 626, 931, 3663, 5431, 543, 314, 3365, 15340, 12, 9229, 12, 267, 15725, 5423, 14, 221, 710, 4306, 3102, 267, 520, 5247, 28417, 1661, 63, 3627, 63, 1773, 63, 3771, 64, 436, 267, 520, 5247, 28417, 1661, 63, 3627, 64, 787, 2741, 370, 1720, 543, 334, 460, 267, 28974, 806, 9, 314, 4514, 9371, 14745, 14, 221, 2779, 365, 4721, 590, 267, 14318, 370, 675, 5204, 16952, 12, 880, 626, 4493, 370, 314, 267, 5953, 402, 520, 5247, 1705, 0 ]
[ 1, 1, 1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ibre
src/calibre/ebooks/lrf/__init__.py
22
4485
__license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>' """ This package contains logic to read and write LRF files. The LRF file format is documented at U{http://www.sven.de/librie/Librie/LrfFormat}. """ from calibre.ebooks.lrf.pylrs.pylrs import Book as _Book from calibre.ebooks.lrf.pylrs.pylrs import TextBlock, Header, \ TextStyle, BlockStyle from calibre.ebooks.lrf.fonts import FONT_FILE_MAP from calibre.ebooks import ConversionError __docformat__ = "epytext" class LRFParseError(Exception): pass class PRS500_PROFILE(object): screen_width = 600 screen_height = 775 dpi = 166 # Number of pixels to subtract from screen_height when calculating height of text area fudge = 0 font_size = 10 #: Default (in pt) parindent = 10 #: Default (in pt) line_space = 1.2 #: Default (in pt) header_font_size = 6 #: In pt header_height = 30 #: In px default_fonts = { 'sans': "Swis721 BT Roman", 'mono': "Courier10 BT Roman", 'serif': "Dutch801 Rm BT Roman"} name = 'prs500' def find_custom_fonts(options, logger): from calibre.utils.fonts.scanner import font_scanner fonts = {'serif' : None, 'sans' : None, 'mono' : None} def family(cmd): return cmd.split(',')[-1].strip() if options.serif_family: f = family(options.serif_family) fonts['serif'] = font_scanner.legacy_fonts_for_family(f) if not fonts['serif']: logger.warn('Unable to find serif family %s'%f) if options.sans_family: f = family(options.sans_family) fonts['sans'] = font_scanner.legacy_fonts_for_family(f) if not fonts['sans']: logger.warn('Unable to find sans family %s'%f) if options.mono_family: f = family(options.mono_family) fonts['mono'] = font_scanner.legacy_fonts_for_family(f) if not fonts['mono']: logger.warn('Unable to find mono family %s'%f) return fonts def Book(options, logger, font_delta=0, header=None, profile=PRS500_PROFILE, **settings): from uuid import uuid4 ps = {} ps['topmargin'] = options.top_margin ps['evensidemargin'] = options.left_margin ps['oddsidemargin'] = options.left_margin ps['textwidth'] = profile.screen_width - (options.left_margin + options.right_margin) ps['textheight'] = profile.screen_height - (options.top_margin + options.bottom_margin) \ - profile.fudge if header: hdr = Header() hb = TextBlock(textStyle=TextStyle(align='foot', fontsize=int(profile.header_font_size*10)), blockStyle=BlockStyle(blockwidth=ps['textwidth'])) hb.append(header) hdr.PutObj(hb) ps['headheight'] = profile.header_height ps['headsep'] = options.header_separation ps['header'] = hdr ps['topmargin'] = 0 ps['textheight'] = profile.screen_height - (options.bottom_margin + ps['topmargin']) \ - ps['headheight'] - ps['headsep'] - profile.fudge fontsize = int(10*profile.font_size+font_delta*20) baselineskip = fontsize + 20 fonts = find_custom_fonts(options, logger) tsd = dict(fontsize=fontsize, parindent=int(10*profile.parindent), linespace=int(10*profile.line_space), baselineskip=baselineskip, wordspace=10*options.wordspace) if fonts['serif'] and fonts['serif'].has_key('normal'): tsd['fontfacename'] = fonts['serif']['normal'][1] book = _Book(textstyledefault=tsd, pagestyledefault=ps, blockstyledefault=dict(blockwidth=ps['textwidth']), bookid=uuid4().hex, **settings) for family in fonts.keys(): if fonts[family]: for font in fonts[family].values(): book.embed_font(*font) FONT_FILE_MAP[font[1]] = font[0] for family in ['serif', 'sans', 'mono']: if not fonts[family]: fonts[family] = { 'normal' : (None, profile.default_fonts[family]) } elif not fonts[family].has_key('normal'): raise ConversionError, 'Could not find the normal version of the ' + family + ' font' return book, fonts
gpl-3.0
[ 363, 1682, 363, 257, 275, 283, 12006, 373, 19, 7, 199, 363, 7307, 363, 275, 283, 9300, 12, 1804, 79, 5017, 3971, 31876, 665, 7697, 5017, 737, 20817, 5017, 1939, 31876, 14, 846, 3524, 199, 624, 199, 2765, 2559, 3509, 9661, 370, 1586, 436, 2218, 491, 11778, 1584, 14, 199, 1918, 491, 11778, 570, 1475, 365, 22751, 737, 738, 91, 1014, 921, 1544, 14, 83, 1856, 14, 271, 15, 773, 11317, 15, 4728, 11317, 15, 44, 3941, 3484, 5565, 199, 624, 199, 199, 504, 19238, 14, 69, 8858, 14, 76, 3941, 14, 647, 76, 2393, 14, 647, 76, 2393, 492, 8944, 465, 485, 8696, 199, 504, 19238, 14, 69, 8858, 14, 76, 3941, 14, 647, 76, 2393, 14, 647, 76, 2393, 492, 4516, 3142, 12, 10240, 12, 971, 6163, 4516, 6609, 12, 8651, 6609, 199, 504, 19238, 14, 69, 8858, 14, 76, 3941, 14, 19864, 492, 481, 5994, 63, 3817, 63, 5443, 199, 504, 19238, 14, 69, 8858, 492, 1448, 1023, 547, 199, 199, 363, 21841, 363, 275, 298, 69, 647, 505, 2, 199, 199, 533, 491, 11778, 9123, 8, 1726, 304, 272, 986, 421, 199, 533, 12218, 51, 5783, 63, 16632, 8, 785, 304, 272, 6426, 63, 2063, 221, 275, 11624, 272, 6426, 63, 3333, 275, 8375, 21, 272, 26910, 3698, 275, 29923, 272, 327, 4860, 402, 11094, 370, 24129, 687, 6426, 63, 3333, 1380, 26079, 4569, 402, 1318, 9150, 272, 289, 16603, 260, 275, 378, 272, 5023, 63, 890, 258, 275, 1616, 221, 6079, 3758, 334, 262, 10063, 9, 272, 623, 3724, 258, 275, 1616, 221, 6079, 3758, 334, 262, 10063, 9, 272, 1004, 63, 2638, 259, 275, 413, 14, 18, 6079, 3758, 334, 262, 10063, 9, 272, 1406, 63, 4246, 63, 890, 275, 1227, 221, 6079, 1010, 10063, 272, 1406, 63, 3333, 259, 275, 4233, 6079, 1010, 21162, 272, 849, 63, 19864, 259, 275, 469, 283, 26052, 356, 298, 10941, 374, 23, 2025, 699, 52, 820, 21604, 401, 283, 19758, 356, 298, 35, 567, 4446, 709, 699, 52, 820, 21604, 401, 586, 283, 24977, 356, 298, 36, 337, 335, 26172, 820, 77, 699, 52, 820, 21604, 3570, 339, 536, 275, 283, 80, 2393, 5783, 7, 199, 199, 318, 2342, 63, 4229, 63, 19864, 8, 1419, 12, 2512, 304, 272, 687, 19238, 14, 1208, 14, 19864, 14, 16378, 492, 5023, 63, 16378, 272, 26219, 275, 791, 24977, 7, 520, 488, 12, 283, 26052, 7, 520, 488, 12, 283, 19758, 7, 520, 488, 93, 272, 347, 9614, 8, 1760, 304, 267, 372, 2088, 14, 1294, 11917, 1988, 17, 1055, 1913, 342, 272, 340, 1511, 14, 24977, 63, 6606, 26, 267, 289, 275, 9614, 8, 1419, 14, 24977, 63, 6606, 9, 267, 26219, 459, 24977, 418, 275, 5023, 63, 16378, 14, 10000, 63, 19864, 63, 509, 63, 6606, 8, 70, 9, 267, 340, 440, 26219, 459, 24977, 2565, 288, 2512, 14, 4050, 360, 6005, 370, 2342, 542, 20546, 9614, 450, 83, 5956, 70, 9, 272, 340, 1511, 14, 26052, 63, 6606, 26, 267, 289, 275, 9614, 8, 1419, 14, 26052, 63, 6606, 9, 267, 26219, 459, 26052, 418, 275, 5023, 63, 16378, 14, 10000, 63, 19864, 63, 509, 63, 6606, 8, 70, 9, 267, 340, 440, 26219, 459, 26052, 2565, 288, 2512, 14, 4050, 360, 6005, 370, 2342, 308, 796, 9614, 450, 83, 5956, 70, 9, 272, 340, 1511, 14, 19758, 63, 6606, 26, 267, 289, 275, 9614, 8, 1419, 14, 19758, 63, 6606, 9, 267, 26219, 459, 19758, 418, 275, 5023, 63, 16378, 14, 10000, 63, 19864, 63, 509, 63, 6606, 8, 70, 9, 267, 340, 440, 26219, 459, 19758, 2565, 288, 2512, 14, 4050, 360, 6005, 370, 2342, 3485, 79, 9614, 450, 83, 5956, 70, 9, 272, 372, 26219, 421, 199, 318, 8944, 8, 1419, 12, 2512, 12, 5023, 63, 3136, 29, 16, 12, 1406, 29, 403, 12, 268, 4690, 29, 3311, 51, 5783, 63, 16632, 12, 1011, 1751, 304, 272, 687, 5377, 492, 5377, 20, 272, 7347, 275, 1052, 272, 7347, 459, 2119, 9650, 418, 420, 275, 1511, 14, 2119, 63, 9650, 272, 7347, 459, 12056, 2441, 9650, 418, 275, 1511, 14, 3039, 63, 9650, 272, 7347, 459, 16216, 2441, 9650, 418, 221, 275, 1511, 14, 3039, 63, 9650, 272, 7347, 459, 505, 2063, 418, 420, 275, 4690, 14, 5410, 63, 2063, 446, 334, 1419, 14, 3039, 63, 9650, 435, 1511, 14, 1019, 63, 9650, 9, 272, 7347, 459, 3858, 1589, 1070, 418, 258, 275, 4690, 14, 5410, 63, 3333, 446, 334, 1419, 14, 2119, 63, 9650, 435, 1511, 14, 8305, 63, 9650, 9, 971, 1740, 446, 4690, 14, 70, 16603, 272, 340, 1406, 26, 267, 15260, 275, 10240, 342, 267, 394, 66, 275, 4516, 3142, 8, 505, 6609, 29, 1872, 6609, 8, 5743, 534, 11407, 297, 5644, 19740, 29, 442, 8, 2913, 14, 1291, 63, 4246, 63, 890, 10, 709, 1826, 2432, 1853, 6609, 29, 3142, 6609, 8, 1457, 2063, 29, 1190, 459, 505, 2063, 5156, 267, 394, 66, 14, 740, 8, 1291, 9, 267, 15260, 14, 18989, 5665, 8, 16168, 9, 267, 7347, 459, 2993, 3333, 418, 275, 4690, 14, 1291, 63, 3333, 267, 7347, 459, 2993, 4127, 418, 259, 275, 1511, 14, 1291, 63, 6175, 425, 267, 7347, 459, 1291, 418, 258, 275, 15260, 267, 7347, 459, 2119, 9650, 418, 221, 275, 378, 267, 7347, 459, 3858, 1589, 1070, 418, 275, 4690, 14, 5410, 63, 3333, 446, 334, 1419, 14, 8305, 63, 9650, 435, 7347, 459, 2119, 9650, 1105, 971, 1740, 446, 7347, 459, 2993, 3333, 418, 446, 7347, 459, 2993, 4127, 418, 446, 4690, 14, 70, 16603, 339, 19740, 275, 1109, 8, 709, 10, 2913, 14, 4246, 63, 890, 11, 4246, 63, 3136, 10, 1165, 9, 272, 1300, 1278, 5194, 275, 19740, 435, 3388, 272, 26219, 275, 2342, 63, 4229, 63, 19864, 8, 1419, 12, 2512, 9, 272, 307, 3893, 275, 1211, 8, 22124, 29, 22124, 12, 2049, 623, 3724, 29, 442, 8, 709, 10, 2913, 14, 462, 3724, 395, 2049, 2385, 1142, 29, 442, 8, 709, 10, 2913, 14, 604, 63, 2638, 395, 2049, 1300, 1278, 5194, 29, 1095, 1278, 5194, 12, 2049, 5932, 1142, 29, 709, 10, 1419, 14, 3148, 1142, 9, 272, 340, 26219, 459, 24977, 418, 436, 26219, 459, 24977, 2278, 1989, 63 ]
[ 1682, 363, 257, 275, 283, 12006, 373, 19, 7, 199, 363, 7307, 363, 275, 283, 9300, 12, 1804, 79, 5017, 3971, 31876, 665, 7697, 5017, 737, 20817, 5017, 1939, 31876, 14, 846, 3524, 199, 624, 199, 2765, 2559, 3509, 9661, 370, 1586, 436, 2218, 491, 11778, 1584, 14, 199, 1918, 491, 11778, 570, 1475, 365, 22751, 737, 738, 91, 1014, 921, 1544, 14, 83, 1856, 14, 271, 15, 773, 11317, 15, 4728, 11317, 15, 44, 3941, 3484, 5565, 199, 624, 199, 199, 504, 19238, 14, 69, 8858, 14, 76, 3941, 14, 647, 76, 2393, 14, 647, 76, 2393, 492, 8944, 465, 485, 8696, 199, 504, 19238, 14, 69, 8858, 14, 76, 3941, 14, 647, 76, 2393, 14, 647, 76, 2393, 492, 4516, 3142, 12, 10240, 12, 971, 6163, 4516, 6609, 12, 8651, 6609, 199, 504, 19238, 14, 69, 8858, 14, 76, 3941, 14, 19864, 492, 481, 5994, 63, 3817, 63, 5443, 199, 504, 19238, 14, 69, 8858, 492, 1448, 1023, 547, 199, 199, 363, 21841, 363, 275, 298, 69, 647, 505, 2, 199, 199, 533, 491, 11778, 9123, 8, 1726, 304, 272, 986, 421, 199, 533, 12218, 51, 5783, 63, 16632, 8, 785, 304, 272, 6426, 63, 2063, 221, 275, 11624, 272, 6426, 63, 3333, 275, 8375, 21, 272, 26910, 3698, 275, 29923, 272, 327, 4860, 402, 11094, 370, 24129, 687, 6426, 63, 3333, 1380, 26079, 4569, 402, 1318, 9150, 272, 289, 16603, 260, 275, 378, 272, 5023, 63, 890, 258, 275, 1616, 221, 6079, 3758, 334, 262, 10063, 9, 272, 623, 3724, 258, 275, 1616, 221, 6079, 3758, 334, 262, 10063, 9, 272, 1004, 63, 2638, 259, 275, 413, 14, 18, 6079, 3758, 334, 262, 10063, 9, 272, 1406, 63, 4246, 63, 890, 275, 1227, 221, 6079, 1010, 10063, 272, 1406, 63, 3333, 259, 275, 4233, 6079, 1010, 21162, 272, 849, 63, 19864, 259, 275, 469, 283, 26052, 356, 298, 10941, 374, 23, 2025, 699, 52, 820, 21604, 401, 283, 19758, 356, 298, 35, 567, 4446, 709, 699, 52, 820, 21604, 401, 586, 283, 24977, 356, 298, 36, 337, 335, 26172, 820, 77, 699, 52, 820, 21604, 3570, 339, 536, 275, 283, 80, 2393, 5783, 7, 199, 199, 318, 2342, 63, 4229, 63, 19864, 8, 1419, 12, 2512, 304, 272, 687, 19238, 14, 1208, 14, 19864, 14, 16378, 492, 5023, 63, 16378, 272, 26219, 275, 791, 24977, 7, 520, 488, 12, 283, 26052, 7, 520, 488, 12, 283, 19758, 7, 520, 488, 93, 272, 347, 9614, 8, 1760, 304, 267, 372, 2088, 14, 1294, 11917, 1988, 17, 1055, 1913, 342, 272, 340, 1511, 14, 24977, 63, 6606, 26, 267, 289, 275, 9614, 8, 1419, 14, 24977, 63, 6606, 9, 267, 26219, 459, 24977, 418, 275, 5023, 63, 16378, 14, 10000, 63, 19864, 63, 509, 63, 6606, 8, 70, 9, 267, 340, 440, 26219, 459, 24977, 2565, 288, 2512, 14, 4050, 360, 6005, 370, 2342, 542, 20546, 9614, 450, 83, 5956, 70, 9, 272, 340, 1511, 14, 26052, 63, 6606, 26, 267, 289, 275, 9614, 8, 1419, 14, 26052, 63, 6606, 9, 267, 26219, 459, 26052, 418, 275, 5023, 63, 16378, 14, 10000, 63, 19864, 63, 509, 63, 6606, 8, 70, 9, 267, 340, 440, 26219, 459, 26052, 2565, 288, 2512, 14, 4050, 360, 6005, 370, 2342, 308, 796, 9614, 450, 83, 5956, 70, 9, 272, 340, 1511, 14, 19758, 63, 6606, 26, 267, 289, 275, 9614, 8, 1419, 14, 19758, 63, 6606, 9, 267, 26219, 459, 19758, 418, 275, 5023, 63, 16378, 14, 10000, 63, 19864, 63, 509, 63, 6606, 8, 70, 9, 267, 340, 440, 26219, 459, 19758, 2565, 288, 2512, 14, 4050, 360, 6005, 370, 2342, 3485, 79, 9614, 450, 83, 5956, 70, 9, 272, 372, 26219, 421, 199, 318, 8944, 8, 1419, 12, 2512, 12, 5023, 63, 3136, 29, 16, 12, 1406, 29, 403, 12, 268, 4690, 29, 3311, 51, 5783, 63, 16632, 12, 1011, 1751, 304, 272, 687, 5377, 492, 5377, 20, 272, 7347, 275, 1052, 272, 7347, 459, 2119, 9650, 418, 420, 275, 1511, 14, 2119, 63, 9650, 272, 7347, 459, 12056, 2441, 9650, 418, 275, 1511, 14, 3039, 63, 9650, 272, 7347, 459, 16216, 2441, 9650, 418, 221, 275, 1511, 14, 3039, 63, 9650, 272, 7347, 459, 505, 2063, 418, 420, 275, 4690, 14, 5410, 63, 2063, 446, 334, 1419, 14, 3039, 63, 9650, 435, 1511, 14, 1019, 63, 9650, 9, 272, 7347, 459, 3858, 1589, 1070, 418, 258, 275, 4690, 14, 5410, 63, 3333, 446, 334, 1419, 14, 2119, 63, 9650, 435, 1511, 14, 8305, 63, 9650, 9, 971, 1740, 446, 4690, 14, 70, 16603, 272, 340, 1406, 26, 267, 15260, 275, 10240, 342, 267, 394, 66, 275, 4516, 3142, 8, 505, 6609, 29, 1872, 6609, 8, 5743, 534, 11407, 297, 5644, 19740, 29, 442, 8, 2913, 14, 1291, 63, 4246, 63, 890, 10, 709, 1826, 2432, 1853, 6609, 29, 3142, 6609, 8, 1457, 2063, 29, 1190, 459, 505, 2063, 5156, 267, 394, 66, 14, 740, 8, 1291, 9, 267, 15260, 14, 18989, 5665, 8, 16168, 9, 267, 7347, 459, 2993, 3333, 418, 275, 4690, 14, 1291, 63, 3333, 267, 7347, 459, 2993, 4127, 418, 259, 275, 1511, 14, 1291, 63, 6175, 425, 267, 7347, 459, 1291, 418, 258, 275, 15260, 267, 7347, 459, 2119, 9650, 418, 221, 275, 378, 267, 7347, 459, 3858, 1589, 1070, 418, 275, 4690, 14, 5410, 63, 3333, 446, 334, 1419, 14, 8305, 63, 9650, 435, 7347, 459, 2119, 9650, 1105, 971, 1740, 446, 7347, 459, 2993, 3333, 418, 446, 7347, 459, 2993, 4127, 418, 446, 4690, 14, 70, 16603, 339, 19740, 275, 1109, 8, 709, 10, 2913, 14, 4246, 63, 890, 11, 4246, 63, 3136, 10, 1165, 9, 272, 1300, 1278, 5194, 275, 19740, 435, 3388, 272, 26219, 275, 2342, 63, 4229, 63, 19864, 8, 1419, 12, 2512, 9, 272, 307, 3893, 275, 1211, 8, 22124, 29, 22124, 12, 2049, 623, 3724, 29, 442, 8, 709, 10, 2913, 14, 462, 3724, 395, 2049, 2385, 1142, 29, 442, 8, 709, 10, 2913, 14, 604, 63, 2638, 395, 2049, 1300, 1278, 5194, 29, 1095, 1278, 5194, 12, 2049, 5932, 1142, 29, 709, 10, 1419, 14, 3148, 1142, 9, 272, 340, 26219, 459, 24977, 418, 436, 26219, 459, 24977, 2278, 1989, 63, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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 ]
gltn/stdm
stdm/third_party/migrate/changeset/databases/postgres.py
140
1129
""" `PostgreSQL`_ database specific implementations of changeset classes. .. _`PostgreSQL`: http://www.postgresql.org/ """ from migrate.changeset import ansisql from sqlalchemy.databases import postgresql as sa_base PGSchemaGenerator = sa_base.PGDDLCompiler class PGColumnGenerator(PGSchemaGenerator, ansisql.ANSIColumnGenerator): """PostgreSQL column generator implementation.""" pass class PGColumnDropper(ansisql.ANSIColumnDropper): """PostgreSQL column dropper implementation.""" pass class PGSchemaChanger(ansisql.ANSISchemaChanger): """PostgreSQL schema changer implementation.""" pass class PGConstraintGenerator(ansisql.ANSIConstraintGenerator): """PostgreSQL constraint generator implementation.""" pass class PGConstraintDropper(ansisql.ANSIConstraintDropper): """PostgreSQL constaint dropper implementation.""" pass class PGDialect(ansisql.ANSIDialect): columngenerator = PGColumnGenerator columndropper = PGColumnDropper schemachanger = PGSchemaChanger constraintgenerator = PGConstraintGenerator constraintdropper = PGConstraintDropper
gpl-2.0
[ 624, 2043, 658, 31433, 18417, 3050, 2488, 12591, 402, 23316, 3992, 14, 8410, 2508, 485, 64, 31433, 8340, 1455, 921, 1544, 14, 15437, 14, 1308, 15, 199, 624, 199, 504, 12810, 14, 26027, 492, 376, 2316, 1710, 199, 199, 504, 8335, 14, 17439, 492, 25951, 465, 2937, 63, 1095, 199, 11115, 6700, 7599, 275, 2937, 63, 1095, 14, 11115, 31868, 9131, 421, 199, 533, 26595, 4547, 7599, 8, 11115, 6700, 7599, 12, 376, 2316, 1710, 14, 5622, 948, 393, 1307, 7599, 304, 272, 408, 31433, 2763, 4306, 4514, 1041, 272, 986, 421, 199, 533, 26595, 4547, 11070, 529, 8, 290, 2316, 1710, 14, 5622, 948, 393, 1307, 11070, 529, 304, 272, 408, 31433, 2763, 5978, 529, 4514, 1041, 272, 986, 421, 199, 533, 26595, 6700, 1049, 12974, 8, 290, 2316, 1710, 14, 5622, 1311, 2095, 1049, 12974, 304, 272, 408, 31433, 4177, 682, 12974, 4514, 1041, 272, 986, 421, 199, 533, 26595, 8463, 7599, 8, 290, 2316, 1710, 14, 879, 2684, 8463, 7599, 304, 272, 408, 31433, 5828, 4306, 4514, 1041, 272, 986, 421, 199, 533, 26595, 8463, 11070, 529, 8, 290, 2316, 1710, 14, 879, 2684, 8463, 11070, 529, 304, 272, 408, 31433, 950, 65, 442, 5978, 529, 4514, 1041, 272, 986, 421, 199, 533, 26595, 22080, 8, 290, 2316, 1710, 14, 5622, 998, 4674, 1264, 304, 272, 2763, 4679, 275, 26595, 4547, 7599, 272, 1048, 453, 977, 2675, 529, 275, 26595, 4547, 11070, 529, 272, 4177, 335, 12974, 275, 26595, 6700, 1049, 12974, 272, 5828, 4679, 275, 26595, 8463, 7599, 272, 5828, 4824, 529, 275, 26595, 8463, 11070, 529, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2043, 658, 31433, 18417, 3050, 2488, 12591, 402, 23316, 3992, 14, 8410, 2508, 485, 64, 31433, 8340, 1455, 921, 1544, 14, 15437, 14, 1308, 15, 199, 624, 199, 504, 12810, 14, 26027, 492, 376, 2316, 1710, 199, 199, 504, 8335, 14, 17439, 492, 25951, 465, 2937, 63, 1095, 199, 11115, 6700, 7599, 275, 2937, 63, 1095, 14, 11115, 31868, 9131, 421, 199, 533, 26595, 4547, 7599, 8, 11115, 6700, 7599, 12, 376, 2316, 1710, 14, 5622, 948, 393, 1307, 7599, 304, 272, 408, 31433, 2763, 4306, 4514, 1041, 272, 986, 421, 199, 533, 26595, 4547, 11070, 529, 8, 290, 2316, 1710, 14, 5622, 948, 393, 1307, 11070, 529, 304, 272, 408, 31433, 2763, 5978, 529, 4514, 1041, 272, 986, 421, 199, 533, 26595, 6700, 1049, 12974, 8, 290, 2316, 1710, 14, 5622, 1311, 2095, 1049, 12974, 304, 272, 408, 31433, 4177, 682, 12974, 4514, 1041, 272, 986, 421, 199, 533, 26595, 8463, 7599, 8, 290, 2316, 1710, 14, 879, 2684, 8463, 7599, 304, 272, 408, 31433, 5828, 4306, 4514, 1041, 272, 986, 421, 199, 533, 26595, 8463, 11070, 529, 8, 290, 2316, 1710, 14, 879, 2684, 8463, 11070, 529, 304, 272, 408, 31433, 950, 65, 442, 5978, 529, 4514, 1041, 272, 986, 421, 199, 533, 26595, 22080, 8, 290, 2316, 1710, 14, 5622, 998, 4674, 1264, 304, 272, 2763, 4679, 275, 26595, 4547, 7599, 272, 1048, 453, 977, 2675, 529, 275, 26595, 4547, 11070, 529, 272, 4177, 335, 12974, 275, 26595, 6700, 1049, 12974, 272, 5828, 4679, 275, 26595, 8463, 7599, 272, 5828, 4824, 529, 275, 26595, 8463, 11070, 529, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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,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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 ]
Numel2020/NUMEL-Transitions
node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py
1835
12124
# Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """New implementation of Visual Studio project generation.""" import os import random import gyp.common # hashlib is supplied as of Python 2.5 as the replacement interface for md5 # and other secure hashes. In 2.6, md5 is deprecated. Import hashlib if # available, avoiding a deprecation warning under 2.6. Import md5 otherwise, # preserving 2.4 compatibility. try: import hashlib _new_md5 = hashlib.md5 except ImportError: import md5 _new_md5 = md5.new # Initialize random number generator random.seed() # GUIDs for project types ENTRY_TYPE_GUIDS = { 'project': '{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}', 'folder': '{2150E333-8FDC-42A3-9474-1A3956D46DE8}', } #------------------------------------------------------------------------------ # Helper functions def MakeGuid(name, seed='msvs_new'): """Returns a GUID for the specified target name. Args: name: Target name. seed: Seed for MD5 hash. Returns: A GUID-line string calculated from the name and seed. This generates something which looks like a GUID, but depends only on the name and seed. This means the same name/seed will always generate the same GUID, so that projects and solutions which refer to each other can explicitly determine the GUID to refer to explicitly. It also means that the GUID will not change when the project for a target is rebuilt. """ # Calculate a MD5 signature for the seed and name. d = _new_md5(str(seed) + str(name)).hexdigest().upper() # Convert most of the signature to GUID form (discard the rest) guid = ('{' + d[:8] + '-' + d[8:12] + '-' + d[12:16] + '-' + d[16:20] + '-' + d[20:32] + '}') return guid #------------------------------------------------------------------------------ class MSVSSolutionEntry(object): def __cmp__(self, other): # Sort by name then guid (so things are in order on vs2008). return cmp((self.name, self.get_guid()), (other.name, other.get_guid())) class MSVSFolder(MSVSSolutionEntry): """Folder in a Visual Studio project or solution.""" def __init__(self, path, name = None, entries = None, guid = None, items = None): """Initializes the folder. Args: path: Full path to the folder. name: Name of the folder. entries: List of folder entries to nest inside this folder. May contain Folder or Project objects. May be None, if the folder is empty. guid: GUID to use for folder, if not None. items: List of solution items to include in the folder project. May be None, if the folder does not directly contain items. """ if name: self.name = name else: # Use last layer. self.name = os.path.basename(path) self.path = path self.guid = guid # Copy passed lists (or set to empty lists) self.entries = sorted(list(entries or [])) self.items = list(items or []) self.entry_type_guid = ENTRY_TYPE_GUIDS['folder'] def get_guid(self): if self.guid is None: # Use consistent guids for folders (so things don't regenerate). self.guid = MakeGuid(self.path, seed='msvs_folder') return self.guid #------------------------------------------------------------------------------ class MSVSProject(MSVSSolutionEntry): """Visual Studio project.""" def __init__(self, path, name = None, dependencies = None, guid = None, spec = None, build_file = None, config_platform_overrides = None, fixpath_prefix = None): """Initializes the project. Args: path: Absolute path to the project file. name: Name of project. If None, the name will be the same as the base name of the project file. dependencies: List of other Project objects this project is dependent upon, if not None. guid: GUID to use for project, if not None. spec: Dictionary specifying how to build this project. build_file: Filename of the .gyp file that the vcproj file comes from. config_platform_overrides: optional dict of configuration platforms to used in place of the default for this target. fixpath_prefix: the path used to adjust the behavior of _fixpath """ self.path = path self.guid = guid self.spec = spec self.build_file = build_file # Use project filename if name not specified self.name = name or os.path.splitext(os.path.basename(path))[0] # Copy passed lists (or set to empty lists) self.dependencies = list(dependencies or []) self.entry_type_guid = ENTRY_TYPE_GUIDS['project'] if config_platform_overrides: self.config_platform_overrides = config_platform_overrides else: self.config_platform_overrides = {} self.fixpath_prefix = fixpath_prefix self.msbuild_toolset = None def set_dependencies(self, dependencies): self.dependencies = list(dependencies or []) def get_guid(self): if self.guid is None: # Set GUID from path # TODO(rspangler): This is fragile. # 1. We can't just use the project filename sans path, since there could # be multiple projects with the same base name (for example, # foo/unittest.vcproj and bar/unittest.vcproj). # 2. The path needs to be relative to $SOURCE_ROOT, so that the project # GUID is the same whether it's included from base/base.sln or # foo/bar/baz/baz.sln. # 3. The GUID needs to be the same each time this builder is invoked, so # that we don't need to rebuild the solution when the project changes. # 4. We should be able to handle pre-built project files by reading the # GUID from the files. self.guid = MakeGuid(self.name) return self.guid def set_msbuild_toolset(self, msbuild_toolset): self.msbuild_toolset = msbuild_toolset #------------------------------------------------------------------------------ class MSVSSolution(object): """Visual Studio solution.""" def __init__(self, path, version, entries=None, variants=None, websiteProperties=True): """Initializes the solution. Args: path: Path to solution file. version: Format version to emit. entries: List of entries in solution. May contain Folder or Project objects. May be None, if the folder is empty. variants: List of build variant strings. If none, a default list will be used. websiteProperties: Flag to decide if the website properties section is generated. """ self.path = path self.websiteProperties = websiteProperties self.version = version # Copy passed lists (or set to empty lists) self.entries = list(entries or []) if variants: # Copy passed list self.variants = variants[:] else: # Use default self.variants = ['Debug|Win32', 'Release|Win32'] # TODO(rspangler): Need to be able to handle a mapping of solution config # to project config. Should we be able to handle variants being a dict, # or add a separate variant_map variable? If it's a dict, we can't # guarantee the order of variants since dict keys aren't ordered. # TODO(rspangler): Automatically write to disk for now; should delay until # node-evaluation time. self.Write() def Write(self, writer=gyp.common.WriteOnDiff): """Writes the solution file to disk. Raises: IndexError: An entry appears multiple times. """ # Walk the entry tree and collect all the folders and projects. all_entries = set() entries_to_check = self.entries[:] while entries_to_check: e = entries_to_check.pop(0) # If this entry has been visited, nothing to do. if e in all_entries: continue all_entries.add(e) # If this is a folder, check its entries too. if isinstance(e, MSVSFolder): entries_to_check += e.entries all_entries = sorted(all_entries) # Open file and print header f = writer(self.path) f.write('Microsoft Visual Studio Solution File, ' 'Format Version %s\r\n' % self.version.SolutionVersion()) f.write('# %s\r\n' % self.version.Description()) # Project entries sln_root = os.path.split(self.path)[0] for e in all_entries: relative_path = gyp.common.RelativePath(e.path, sln_root) # msbuild does not accept an empty folder_name. # use '.' in case relative_path is empty. folder_name = relative_path.replace('/', '\\') or '.' f.write('Project("%s") = "%s", "%s", "%s"\r\n' % ( e.entry_type_guid, # Entry type GUID e.name, # Folder name folder_name, # Folder name (again) e.get_guid(), # Entry GUID )) # TODO(rspangler): Need a way to configure this stuff if self.websiteProperties: f.write('\tProjectSection(WebsiteProperties) = preProject\r\n' '\t\tDebug.AspNetCompiler.Debug = "True"\r\n' '\t\tRelease.AspNetCompiler.Debug = "False"\r\n' '\tEndProjectSection\r\n') if isinstance(e, MSVSFolder): if e.items: f.write('\tProjectSection(SolutionItems) = preProject\r\n') for i in e.items: f.write('\t\t%s = %s\r\n' % (i, i)) f.write('\tEndProjectSection\r\n') if isinstance(e, MSVSProject): if e.dependencies: f.write('\tProjectSection(ProjectDependencies) = postProject\r\n') for d in e.dependencies: f.write('\t\t%s = %s\r\n' % (d.get_guid(), d.get_guid())) f.write('\tEndProjectSection\r\n') f.write('EndProject\r\n') # Global section f.write('Global\r\n') # Configurations (variants) f.write('\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n') for v in self.variants: f.write('\t\t%s = %s\r\n' % (v, v)) f.write('\tEndGlobalSection\r\n') # Sort config guids for easier diffing of solution changes. config_guids = [] config_guids_overrides = {} for e in all_entries: if isinstance(e, MSVSProject): config_guids.append(e.get_guid()) config_guids_overrides[e.get_guid()] = e.config_platform_overrides config_guids.sort() f.write('\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n') for g in config_guids: for v in self.variants: nv = config_guids_overrides[g].get(v, v) # Pick which project configuration to build for this solution # configuration. f.write('\t\t%s.%s.ActiveCfg = %s\r\n' % ( g, # Project GUID v, # Solution build configuration nv, # Project build config for that solution config )) # Enable project in this solution configuration. f.write('\t\t%s.%s.Build.0 = %s\r\n' % ( g, # Project GUID v, # Solution build configuration nv, # Project build config for that solution config )) f.write('\tEndGlobalSection\r\n') # TODO(rspangler): Should be able to configure this stuff too (though I've # never seen this be any different) f.write('\tGlobalSection(SolutionProperties) = preSolution\r\n') f.write('\t\tHideSolutionNode = FALSE\r\n') f.write('\tEndGlobalSection\r\n') # Folder mappings # Omit this section if there are no folders if any([e.entries for e in all_entries if isinstance(e, MSVSFolder)]): f.write('\tGlobalSection(NestedProjects) = preSolution\r\n') for e in all_entries: if not isinstance(e, MSVSFolder): continue # Does not apply to projects, only folders for subentry in e.entries: f.write('\t\t%s = %s\r\n' % (subentry.get_guid(), e.get_guid())) f.write('\tEndGlobalSection\r\n') f.write('EndGlobal\r\n') f.close()
mit
[ 3, 1898, 334, 67, 9, 6029, 4475, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 3645, 402, 642, 1350, 1233, 365, 10413, 701, 282, 6289, 13, 2487, 4190, 626, 883, 506, 199, 3, 1911, 315, 314, 5113, 570, 14, 199, 199, 624, 4665, 4514, 402, 14702, 13225, 2199, 10152, 1041, 199, 199, 646, 747, 199, 646, 2196, 199, 199, 646, 4902, 14, 2330, 199, 199, 3, 8337, 365, 6841, 465, 402, 2018, 499, 14, 21, 465, 314, 8343, 3217, 367, 6128, 21, 199, 3, 436, 1163, 11153, 14647, 14, 221, 1010, 499, 14, 22, 12, 6128, 21, 365, 5906, 14, 221, 3161, 8337, 340, 199, 3, 2808, 12, 5126, 316, 282, 17831, 5721, 1334, 499, 14, 22, 14, 221, 3161, 6128, 21, 4257, 12, 199, 3, 876, 14717, 499, 14, 20, 7163, 14, 199, 893, 26, 523, 492, 8337, 523, 485, 1222, 63, 1064, 21, 275, 8337, 14, 1064, 21, 199, 2590, 3545, 26, 523, 492, 6128, 21, 523, 485, 1222, 63, 1064, 21, 275, 6128, 21, 14, 1222, 421, 199, 3, 11578, 2196, 1329, 4306, 199, 2355, 14, 5176, 342, 199, 199, 3, 21645, 83, 367, 2199, 2943, 199, 7285, 63, 2711, 63, 17856, 51, 275, 469, 272, 283, 1715, 356, 5041, 24, 6265, 25, 2089, 34, 24, 13, 24, 34, 20, 33, 13, 845, 36, 16, 13, 24, 36, 845, 13, 383, 33, 16, 35, 3328, 6265, 25, 2260, 7293, 272, 283, 3741, 356, 5041, 7842, 16, 37, 11769, 13, 24, 38, 5196, 13, 2260, 33, 19, 13, 2635, 1342, 13, 17, 33, 1355, 1367, 36, 2466, 1093, 24, 7293, 199, 93, 199, 199, 20974, 199, 3, 11642, 3423, 421, 199, 318, 4155, 18834, 8, 354, 12, 6347, 534, 8338, 63, 1222, 735, 523, 408, 3407, 282, 21645, 367, 314, 2013, 1347, 536, 14, 819, 3033, 26, 272, 536, 26, 10256, 536, 14, 272, 6347, 26, 3240, 379, 367, 15830, 21, 2631, 14, 523, 1803, 26, 272, 437, 21645, 13, 604, 1059, 12950, 687, 314, 536, 436, 6347, 14, 819, 961, 12821, 6020, 1314, 10734, 2839, 282, 21645, 12, 1325, 8350, 1454, 641, 314, 523, 536, 436, 6347, 14, 221, 961, 4910, 314, 2011, 536, 15, 5176, 911, 3544, 3550, 314, 2011, 523, 21645, 12, 880, 626, 11336, 436, 24886, 1314, 10618, 370, 1924, 1163, 883, 7662, 523, 6705, 314, 21645, 370, 10618, 370, 7662, 14, 221, 2779, 2597, 4910, 626, 314, 21645, 911, 523, 440, 1570, 1380, 314, 2199, 367, 282, 1347, 365, 295, 11730, 14, 523, 408, 523, 327, 12707, 282, 15830, 21, 4955, 367, 314, 6347, 436, 536, 14, 523, 366, 275, 485, 1222, 63, 1064, 21, 8, 495, 8, 5176, 9, 435, 620, 8, 354, 4992, 11453, 1252, 4142, 342, 523, 327, 7905, 4750, 402, 314, 4955, 370, 21645, 1824, 334, 14394, 314, 4618, 9, 523, 15593, 275, 661, 1445, 435, 366, 1491, 24, 61, 435, 10791, 435, 366, 59, 24, 26, 713, 61, 435, 10791, 435, 366, 59, 713, 26, 975, 61, 435, 10791, 435, 366, 59, 975, 26, 1165, 61, 881, 435, 10791, 435, 366, 59, 1165, 26, 708, 61, 435, 283, 12216, 523, 372, 15593, 199, 199, 20974, 421, 199, 533, 11694, 2300, 3347, 3900, 8, 785, 304, 523, 347, 636, 5730, 721, 277, 12, 1163, 304, 272, 327, 16722, 701, 536, 2066, 15593, 334, 1152, 7645, 787, 315, 1865, 641, 8118, 9300, 680, 272, 372, 10467, 1332, 277, 14, 354, 12, 291, 14, 362, 63, 9473, 4000, 334, 1848, 14, 354, 12, 1163, 14, 362, 63, 9473, 4059, 421, 199, 533, 13828, 7850, 8, 3053, 54, 2300, 3347, 3900, 304, 523, 408, 7850, 315, 282, 14702, 13225, 2199, 503, 8744, 1041, 819, 347, 636, 826, 721, 277, 12, 931, 12, 536, 275, 488, 12, 4811, 275, 488, 12, 2049, 15593, 275, 488, 12, 2974, 275, 488, 304, 272, 408, 23489, 314, 4922, 14, 339, 3033, 26, 489, 931, 26, 16579, 931, 370, 314, 4922, 14, 489, 536, 26, 2812, 402, 314, 4922, 14, 489, 4811, 26, 3820, 402, 4922, 4811, 370, 10715, 6272, 642, 4922, 14, 221, 10162, 1395, 881, 29121, 503, 7290, 2251, 14, 221, 10162, 506, 488, 12, 340, 314, 4922, 365, 2701, 14, 489, 15593, 26, 21645, 370, 675, 367, 4922, 12, 340, 440, 488, 14, 489, 2974, 26, 3820, 402, 8744, 2974, 370, 2387, 315, 314, 4922, 2199, 14, 221, 10162, 506, 881, 488, 12, 340, 314, 4922, 1630, 440, 5370, 1395, 2974, 14, 272, 408, 272, 340, 536, 26, 489, 291, 14, 354, 275, 536, 272, 587, 26, 489, 327, 3645, 2061, 4045, 14, 489, 291, 14, 354, 275, 747, 14, 515, 14, 4846, 8, 515, 9, 339, 291, 14, 515, 275, 931, 272, 291, 14, 9473, 275, 15593, 339, 327, 11247, 3032, 5548, 334, 269, 663, 370, 2701, 5548, 9, 272, 291, 14, 3189, 275, 3355, 8, 513, 8, 3189, 503, 15927, 272, 291, 14, 1744, 275, 769, 8, 1744, 503, 3073, 339, 291, 14, 2373, 63, 466, 63, 9473, 275, 5070, 21177, 63, 2711, 63, 17856, 51, 459, 3741, 418, 819, 347, 664, 63, 9473, 8, 277, 304, 272, 340, 291, 14, 9473, 365, 488, 26, 489, 327, 3645, 12137, 15593, 83, 367, 16533, 334, 1152, 7645, 2793, 1133, 30943, 680, 489, 291, 14, 9473, 275, 4155, 18834, 8, 277, 14, 515, 12, 6347, 534, 8338, 63, 3741, 358, 272, 372, 291, 14, 9473, 421, 199, 20974, 421, 199, 533, 13828, 4761, 8, 3053, 54, 2300, 3347, 3900, 304, 523, 408, 15039, 13225, 2199, 1041, 819, 347, 636, 826, 721, 277, 12, 931, 12, 536, 275, 488, 12, 5124, 275, 488, 12, 15593, 275, 488, 12, 2049, 3158, 275, 488, 12, 1900, 63, 493, 275, 488, 12, 1101, 63, 3246, 63, 12867, 275, 488, 12, 2049, 5325, 515, 63, 1861, 275, 488, 304, 272, 408, 23489, 314, 2199, 14, 339, 3033, 26, 489, 931, 26, 24964, 931, 370, 314, 2199, 570, 14, 489, 536, 26, 2812, 402, 2199, 14, 221, 982, 488, 12, 314, 536, 911, 506, 314, 2011, 465, 314, 1300, 881, 536, 402, 314, 2199, 570, 14, 489, 5124, 26, 3820, 402, 1163, 7290, 2251, 642, 2199, 365, 11410, 881, 12188, 12, 340, 440, 488, 14, 489, 15593, 26, 21645, 370, 675, 367, 2199, 12 ]
[ 1898, 334, 67, 9, 6029, 4475, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 3645, 402, 642, 1350, 1233, 365, 10413, 701, 282, 6289, 13, 2487, 4190, 626, 883, 506, 199, 3, 1911, 315, 314, 5113, 570, 14, 199, 199, 624, 4665, 4514, 402, 14702, 13225, 2199, 10152, 1041, 199, 199, 646, 747, 199, 646, 2196, 199, 199, 646, 4902, 14, 2330, 199, 199, 3, 8337, 365, 6841, 465, 402, 2018, 499, 14, 21, 465, 314, 8343, 3217, 367, 6128, 21, 199, 3, 436, 1163, 11153, 14647, 14, 221, 1010, 499, 14, 22, 12, 6128, 21, 365, 5906, 14, 221, 3161, 8337, 340, 199, 3, 2808, 12, 5126, 316, 282, 17831, 5721, 1334, 499, 14, 22, 14, 221, 3161, 6128, 21, 4257, 12, 199, 3, 876, 14717, 499, 14, 20, 7163, 14, 199, 893, 26, 523, 492, 8337, 523, 485, 1222, 63, 1064, 21, 275, 8337, 14, 1064, 21, 199, 2590, 3545, 26, 523, 492, 6128, 21, 523, 485, 1222, 63, 1064, 21, 275, 6128, 21, 14, 1222, 421, 199, 3, 11578, 2196, 1329, 4306, 199, 2355, 14, 5176, 342, 199, 199, 3, 21645, 83, 367, 2199, 2943, 199, 7285, 63, 2711, 63, 17856, 51, 275, 469, 272, 283, 1715, 356, 5041, 24, 6265, 25, 2089, 34, 24, 13, 24, 34, 20, 33, 13, 845, 36, 16, 13, 24, 36, 845, 13, 383, 33, 16, 35, 3328, 6265, 25, 2260, 7293, 272, 283, 3741, 356, 5041, 7842, 16, 37, 11769, 13, 24, 38, 5196, 13, 2260, 33, 19, 13, 2635, 1342, 13, 17, 33, 1355, 1367, 36, 2466, 1093, 24, 7293, 199, 93, 199, 199, 20974, 199, 3, 11642, 3423, 421, 199, 318, 4155, 18834, 8, 354, 12, 6347, 534, 8338, 63, 1222, 735, 523, 408, 3407, 282, 21645, 367, 314, 2013, 1347, 536, 14, 819, 3033, 26, 272, 536, 26, 10256, 536, 14, 272, 6347, 26, 3240, 379, 367, 15830, 21, 2631, 14, 523, 1803, 26, 272, 437, 21645, 13, 604, 1059, 12950, 687, 314, 536, 436, 6347, 14, 819, 961, 12821, 6020, 1314, 10734, 2839, 282, 21645, 12, 1325, 8350, 1454, 641, 314, 523, 536, 436, 6347, 14, 221, 961, 4910, 314, 2011, 536, 15, 5176, 911, 3544, 3550, 314, 2011, 523, 21645, 12, 880, 626, 11336, 436, 24886, 1314, 10618, 370, 1924, 1163, 883, 7662, 523, 6705, 314, 21645, 370, 10618, 370, 7662, 14, 221, 2779, 2597, 4910, 626, 314, 21645, 911, 523, 440, 1570, 1380, 314, 2199, 367, 282, 1347, 365, 295, 11730, 14, 523, 408, 523, 327, 12707, 282, 15830, 21, 4955, 367, 314, 6347, 436, 536, 14, 523, 366, 275, 485, 1222, 63, 1064, 21, 8, 495, 8, 5176, 9, 435, 620, 8, 354, 4992, 11453, 1252, 4142, 342, 523, 327, 7905, 4750, 402, 314, 4955, 370, 21645, 1824, 334, 14394, 314, 4618, 9, 523, 15593, 275, 661, 1445, 435, 366, 1491, 24, 61, 435, 10791, 435, 366, 59, 24, 26, 713, 61, 435, 10791, 435, 366, 59, 713, 26, 975, 61, 435, 10791, 435, 366, 59, 975, 26, 1165, 61, 881, 435, 10791, 435, 366, 59, 1165, 26, 708, 61, 435, 283, 12216, 523, 372, 15593, 199, 199, 20974, 421, 199, 533, 11694, 2300, 3347, 3900, 8, 785, 304, 523, 347, 636, 5730, 721, 277, 12, 1163, 304, 272, 327, 16722, 701, 536, 2066, 15593, 334, 1152, 7645, 787, 315, 1865, 641, 8118, 9300, 680, 272, 372, 10467, 1332, 277, 14, 354, 12, 291, 14, 362, 63, 9473, 4000, 334, 1848, 14, 354, 12, 1163, 14, 362, 63, 9473, 4059, 421, 199, 533, 13828, 7850, 8, 3053, 54, 2300, 3347, 3900, 304, 523, 408, 7850, 315, 282, 14702, 13225, 2199, 503, 8744, 1041, 819, 347, 636, 826, 721, 277, 12, 931, 12, 536, 275, 488, 12, 4811, 275, 488, 12, 2049, 15593, 275, 488, 12, 2974, 275, 488, 304, 272, 408, 23489, 314, 4922, 14, 339, 3033, 26, 489, 931, 26, 16579, 931, 370, 314, 4922, 14, 489, 536, 26, 2812, 402, 314, 4922, 14, 489, 4811, 26, 3820, 402, 4922, 4811, 370, 10715, 6272, 642, 4922, 14, 221, 10162, 1395, 881, 29121, 503, 7290, 2251, 14, 221, 10162, 506, 488, 12, 340, 314, 4922, 365, 2701, 14, 489, 15593, 26, 21645, 370, 675, 367, 4922, 12, 340, 440, 488, 14, 489, 2974, 26, 3820, 402, 8744, 2974, 370, 2387, 315, 314, 4922, 2199, 14, 221, 10162, 506, 881, 488, 12, 340, 314, 4922, 1630, 440, 5370, 1395, 2974, 14, 272, 408, 272, 340, 536, 26, 489, 291, 14, 354, 275, 536, 272, 587, 26, 489, 327, 3645, 2061, 4045, 14, 489, 291, 14, 354, 275, 747, 14, 515, 14, 4846, 8, 515, 9, 339, 291, 14, 515, 275, 931, 272, 291, 14, 9473, 275, 15593, 339, 327, 11247, 3032, 5548, 334, 269, 663, 370, 2701, 5548, 9, 272, 291, 14, 3189, 275, 3355, 8, 513, 8, 3189, 503, 15927, 272, 291, 14, 1744, 275, 769, 8, 1744, 503, 3073, 339, 291, 14, 2373, 63, 466, 63, 9473, 275, 5070, 21177, 63, 2711, 63, 17856, 51, 459, 3741, 418, 819, 347, 664, 63, 9473, 8, 277, 304, 272, 340, 291, 14, 9473, 365, 488, 26, 489, 327, 3645, 12137, 15593, 83, 367, 16533, 334, 1152, 7645, 2793, 1133, 30943, 680, 489, 291, 14, 9473, 275, 4155, 18834, 8, 277, 14, 515, 12, 6347, 534, 8338, 63, 3741, 358, 272, 372, 291, 14, 9473, 421, 199, 20974, 421, 199, 533, 13828, 4761, 8, 3053, 54, 2300, 3347, 3900, 304, 523, 408, 15039, 13225, 2199, 1041, 819, 347, 636, 826, 721, 277, 12, 931, 12, 536, 275, 488, 12, 5124, 275, 488, 12, 15593, 275, 488, 12, 2049, 3158, 275, 488, 12, 1900, 63, 493, 275, 488, 12, 1101, 63, 3246, 63, 12867, 275, 488, 12, 2049, 5325, 515, 63, 1861, 275, 488, 304, 272, 408, 23489, 314, 2199, 14, 339, 3033, 26, 489, 931, 26, 24964, 931, 370, 314, 2199, 570, 14, 489, 536, 26, 2812, 402, 2199, 14, 221, 982, 488, 12, 314, 536, 911, 506, 314, 2011, 465, 314, 1300, 881, 536, 402, 314, 2199, 570, 14, 489, 5124, 26, 3820, 402, 1163, 7290, 2251, 642, 2199, 365, 11410, 881, 12188, 12, 340, 440, 488, 14, 489, 15593, 26, 21645, 370, 675, 367, 2199, 12, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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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 ]
xiyuansun/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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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 ]
Azulinho/ansible
test/units/modules/network/nxos/test_nxos_feature.py
4
2696
# (c) 2016 Red Hat Inc. # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # Make coding more python3-ish from __future__ import (absolute_import, division, print_function) __metaclass__ = type import json from ansible.compat.tests.mock import patch from ansible.modules.network.nxos import nxos_feature from .nxos_module import TestNxosModule, load_fixture, set_module_args class TestNxosFeatureModule(TestNxosModule): module = nxos_feature def setUp(self): super(TestNxosFeatureModule, self).setUp() self.mock_run_commands = patch('ansible.modules.network.nxos.nxos_feature.run_commands') self.run_commands = self.mock_run_commands.start() self.mock_load_config = patch('ansible.modules.network.nxos.nxos_feature.load_config') self.load_config = self.mock_load_config.start() def tearDown(self): super(TestNxosFeatureModule, self).tearDown() self.mock_run_commands.stop() self.mock_load_config.stop() def load_fixtures(self, commands=None, device=''): def load_from_file(*args, **kwargs): module, commands = args output = list() for item in commands: try: obj = json.loads(item['command']) command = obj['command'] except ValueError: command = item['command'] filename = '%s.txt' % str(command).replace(' ', '_') output.append(load_fixture('nxos_feature', filename)) return output self.run_commands.side_effect = load_from_file self.load_config.return_value = None def test_nxos_feature_enable(self): set_module_args(dict(feature='nve', state='enabled')) result = self.execute_module(changed=True) self.assertEqual(result['commands'], ['feature nv overlay']) def test_nxos_feature_disable(self): set_module_args(dict(feature='ospf', state='disabled')) result = self.execute_module(changed=True) self.assertEqual(result['commands'], ['no feature ospf'])
gpl-3.0
[ 3, 334, 67, 9, 7800, 9572, 13002, 3277, 14, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 2622, 199, 3, 199, 3, 2622, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 2622, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 2622, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 3, 4155, 2803, 1655, 2366, 19, 13, 2453, 199, 504, 636, 2443, 363, 492, 334, 6116, 63, 646, 12, 4629, 12, 870, 63, 1593, 9, 199, 363, 6577, 363, 275, 730, 199, 199, 646, 2022, 199, 199, 504, 3242, 14, 5819, 14, 2219, 14, 1805, 492, 3371, 199, 504, 3242, 14, 3112, 14, 1200, 14, 17982, 492, 22072, 63, 4445, 199, 504, 1275, 17982, 63, 578, 492, 1379, 46, 22101, 2377, 12, 2248, 63, 5997, 12, 663, 63, 578, 63, 589, 421, 199, 533, 1379, 46, 22101, 5968, 2377, 8, 774, 46, 22101, 2377, 304, 339, 859, 275, 22072, 63, 4445, 339, 347, 3613, 8, 277, 304, 267, 1613, 8, 774, 46, 22101, 5968, 2377, 12, 291, 680, 5996, 342, 267, 291, 14, 1805, 63, 1065, 63, 4405, 275, 3371, 360, 4853, 14, 3112, 14, 1200, 14, 17982, 14, 17982, 63, 4445, 14, 1065, 63, 4405, 358, 267, 291, 14, 1065, 63, 4405, 275, 291, 14, 1805, 63, 1065, 63, 4405, 14, 928, 342, 398, 291, 14, 1805, 63, 912, 63, 888, 275, 3371, 360, 4853, 14, 3112, 14, 1200, 14, 17982, 14, 17982, 63, 4445, 14, 912, 63, 888, 358, 267, 291, 14, 912, 63, 888, 275, 291, 14, 1805, 63, 912, 63, 888, 14, 928, 342, 339, 347, 6766, 8, 277, 304, 267, 1613, 8, 774, 46, 22101, 5968, 2377, 12, 291, 680, 12336, 342, 267, 291, 14, 1805, 63, 1065, 63, 4405, 14, 2379, 342, 267, 291, 14, 1805, 63, 912, 63, 888, 14, 2379, 342, 339, 347, 2248, 63, 8769, 8, 277, 12, 3718, 29, 403, 12, 2243, 9280, 267, 347, 2248, 63, 504, 63, 493, 2031, 589, 12, 1011, 958, 304, 288, 859, 12, 3718, 275, 1249, 288, 1072, 275, 769, 342, 953, 367, 1242, 315, 3718, 26, 355, 862, 26, 490, 1559, 275, 2022, 14, 3640, 8, 1053, 459, 1531, 1105, 490, 1414, 275, 1559, 459, 1531, 418, 355, 871, 1722, 26, 490, 1414, 275, 1242, 459, 1531, 418, 288, 1788, 275, 1543, 83, 14, 2424, 7, 450, 620, 8, 1531, 680, 1814, 360, 1656, 18962, 288, 1072, 14, 740, 8, 912, 63, 5997, 360, 17982, 63, 4445, 297, 1788, 430, 288, 372, 1072, 398, 291, 14, 1065, 63, 4405, 14, 2441, 63, 5881, 275, 2248, 63, 504, 63, 493, 267, 291, 14, 912, 63, 888, 14, 1107, 63, 585, 275, 488, 339, 347, 511, 63, 17982, 63, 4445, 63, 4296, 8, 277, 304, 267, 663, 63, 578, 63, 589, 8, 807, 8, 4445, 534, 78, 432, 297, 1174, 534, 3827, 1333, 267, 754, 275, 291, 14, 2526, 63, 578, 8, 2489, 29, 549, 9, 267, 291, 14, 629, 8, 1099, 459, 4405, 995, 788, 4445, 26510, 24393, 1105, 339, 347, 511, 63, 17982, 63, 4445, 63, 5993, 8, 277, 304, 267, 663, 63, 578, 63, 589, 8, 807, 8, 4445, 534, 18303, 297, 1174, 534, 7011, 1333, 267, 754, 275, 291, 14, 2526, 63, 578, 8, 2489, 29, 549, 9, 267, 291, 14, 629, 8, 1099, 459, 4405, 995, 788, 889, 3878, 26494, 1105, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 334, 67, 9, 7800, 9572, 13002, 3277, 14, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 2622, 199, 3, 199, 3, 2622, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 2622, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 2622, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 3, 4155, 2803, 1655, 2366, 19, 13, 2453, 199, 504, 636, 2443, 363, 492, 334, 6116, 63, 646, 12, 4629, 12, 870, 63, 1593, 9, 199, 363, 6577, 363, 275, 730, 199, 199, 646, 2022, 199, 199, 504, 3242, 14, 5819, 14, 2219, 14, 1805, 492, 3371, 199, 504, 3242, 14, 3112, 14, 1200, 14, 17982, 492, 22072, 63, 4445, 199, 504, 1275, 17982, 63, 578, 492, 1379, 46, 22101, 2377, 12, 2248, 63, 5997, 12, 663, 63, 578, 63, 589, 421, 199, 533, 1379, 46, 22101, 5968, 2377, 8, 774, 46, 22101, 2377, 304, 339, 859, 275, 22072, 63, 4445, 339, 347, 3613, 8, 277, 304, 267, 1613, 8, 774, 46, 22101, 5968, 2377, 12, 291, 680, 5996, 342, 267, 291, 14, 1805, 63, 1065, 63, 4405, 275, 3371, 360, 4853, 14, 3112, 14, 1200, 14, 17982, 14, 17982, 63, 4445, 14, 1065, 63, 4405, 358, 267, 291, 14, 1065, 63, 4405, 275, 291, 14, 1805, 63, 1065, 63, 4405, 14, 928, 342, 398, 291, 14, 1805, 63, 912, 63, 888, 275, 3371, 360, 4853, 14, 3112, 14, 1200, 14, 17982, 14, 17982, 63, 4445, 14, 912, 63, 888, 358, 267, 291, 14, 912, 63, 888, 275, 291, 14, 1805, 63, 912, 63, 888, 14, 928, 342, 339, 347, 6766, 8, 277, 304, 267, 1613, 8, 774, 46, 22101, 5968, 2377, 12, 291, 680, 12336, 342, 267, 291, 14, 1805, 63, 1065, 63, 4405, 14, 2379, 342, 267, 291, 14, 1805, 63, 912, 63, 888, 14, 2379, 342, 339, 347, 2248, 63, 8769, 8, 277, 12, 3718, 29, 403, 12, 2243, 9280, 267, 347, 2248, 63, 504, 63, 493, 2031, 589, 12, 1011, 958, 304, 288, 859, 12, 3718, 275, 1249, 288, 1072, 275, 769, 342, 953, 367, 1242, 315, 3718, 26, 355, 862, 26, 490, 1559, 275, 2022, 14, 3640, 8, 1053, 459, 1531, 1105, 490, 1414, 275, 1559, 459, 1531, 418, 355, 871, 1722, 26, 490, 1414, 275, 1242, 459, 1531, 418, 288, 1788, 275, 1543, 83, 14, 2424, 7, 450, 620, 8, 1531, 680, 1814, 360, 1656, 18962, 288, 1072, 14, 740, 8, 912, 63, 5997, 360, 17982, 63, 4445, 297, 1788, 430, 288, 372, 1072, 398, 291, 14, 1065, 63, 4405, 14, 2441, 63, 5881, 275, 2248, 63, 504, 63, 493, 267, 291, 14, 912, 63, 888, 14, 1107, 63, 585, 275, 488, 339, 347, 511, 63, 17982, 63, 4445, 63, 4296, 8, 277, 304, 267, 663, 63, 578, 63, 589, 8, 807, 8, 4445, 534, 78, 432, 297, 1174, 534, 3827, 1333, 267, 754, 275, 291, 14, 2526, 63, 578, 8, 2489, 29, 549, 9, 267, 291, 14, 629, 8, 1099, 459, 4405, 995, 788, 4445, 26510, 24393, 1105, 339, 347, 511, 63, 17982, 63, 4445, 63, 5993, 8, 277, 304, 267, 663, 63, 578, 63, 589, 8, 807, 8, 4445, 534, 18303, 297, 1174, 534, 7011, 1333, 267, 754, 275, 291, 14, 2526, 63, 578, 8, 2489, 29, 549, 9, 267, 291, 14, 629, 8, 1099, 459, 4405, 995, 788, 889, 3878, 26494, 1105, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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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 ]
orione7/Italorione
servers/realvid.py
9
2427
# -*- coding: utf-8 -*- #------------------------------------------------------------ # pelisalacarta - XBMC Plugin # Conector para realvid # http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/ #------------------------------------------------------------ import urlparse,urllib2,urllib,re import os from core import scrapertools from core import logger from core import config from core import jsunpack def test_video_exists( page_url ): logger.info("[realvid.py] test_video_exists(page_url='%s')" % page_url) return True,"" def get_video_url( page_url , premium = False , user="" , password="", video_password="" ): logger.info("[realvid.py] url="+page_url) if not "embed" in page_url: page_url = page_url.replace("http://realvid.net/","http://realvid.net/embed-") + ".html" data = scrapertools.cache_page( page_url ) media_url = scrapertools.get_match(data,'file: "([^"]+)",') video_urls = [] video_urls.append( [ scrapertools.get_filename_from_url(media_url)[-4:]+" [realvid]",media_url]) return video_urls # Encuentra vídeos del servidor en el texto pasado def find_videos(data): # Añade manualmente algunos erróneos para evitarlos encontrados = set() devuelve = [] patronvideos = 'realvid.net/embed-([a-z0-9A-Z]+)' logger.info("[realvid.py] find_videos #"+patronvideos+"#") matches = re.compile(patronvideos,re.DOTALL).findall(data) for match in matches: titulo = "[realvid]" url = "http://realvid.net/embed-"+match+".html" if url not in encontrados: logger.info(" url="+url) devuelve.append( [ titulo , url , 'realvid' ] ) encontrados.add(url) else: logger.info(" url duplicada="+url) patronvideos = 'realvid.net/([a-z0-9A-Z]+)' logger.info("[realvid.py] find_videos #"+patronvideos+"#") matches = re.compile(patronvideos,re.DOTALL).findall(data) for match in matches: titulo = "[realvid]" url = "http://realvid.net/embed-"+match+".html" if url not in encontrados: logger.info(" url="+url) devuelve.append( [ titulo , url , 'realvid' ] ) encontrados.add(url) else: logger.info(" url duplicada="+url) return devuelve def test(): video_urls = get_video_url("http://realvid.net/embed-m4snvxoc2tsn.html") return len(video_urls)>0
gpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 17807, 4559, 199, 3, 4837, 317, 6327, 645, 29549, 446, 1323, 28994, 11349, 199, 3, 445, 368, 630, 12665, 3363, 5017, 199, 3, 1455, 921, 11486, 14, 84, 637, 645, 29549, 14, 815, 15, 2718, 13, 21382, 15, 321, 317, 6327, 645, 29549, 15, 199, 17807, 4559, 199, 199, 646, 7097, 12, 4078, 18, 12, 4078, 12, 264, 199, 646, 747, 199, 199, 504, 6170, 492, 28348, 199, 504, 6170, 492, 2512, 199, 504, 6170, 492, 1101, 199, 504, 6170, 492, 8586, 5301, 199, 199, 318, 511, 63, 3722, 63, 2444, 8, 2034, 63, 633, 3461, 272, 2512, 14, 815, 10994, 3093, 5017, 14, 647, 61, 511, 63, 3722, 63, 2444, 8, 1606, 63, 633, 9569, 83, 19124, 450, 2034, 63, 633, 9, 272, 372, 715, 12, 341, 199, 199, 318, 664, 63, 3722, 63, 633, 8, 2034, 63, 633, 2360, 876, 23481, 275, 756, 2360, 922, 9287, 2360, 2505, 8772, 3991, 63, 2060, 9287, 3461, 272, 2512, 14, 815, 10994, 3093, 5017, 14, 647, 61, 1166, 16368, 1606, 63, 633, 9, 272, 340, 440, 298, 6427, 2, 315, 2034, 63, 633, 26, 489, 2034, 63, 633, 275, 2034, 63, 633, 14, 1814, 480, 1014, 921, 3093, 5017, 14, 846, 15, 2266, 1014, 921, 3093, 5017, 14, 846, 15, 6427, 13, 531, 435, 3680, 1360, 2, 272, 666, 275, 28348, 14, 1637, 63, 1606, 8, 2034, 63, 633, 776, 272, 5898, 63, 633, 275, 28348, 14, 362, 63, 1431, 8, 576, 2584, 493, 26, 32397, 11, 4186, 358, 272, 3991, 63, 3603, 275, 942, 272, 3991, 63, 3603, 14, 740, 8, 359, 28348, 14, 362, 63, 1501, 63, 504, 63, 633, 8, 4603, 63, 633, 15786, 20, 26, 2807, 2, 359, 3093, 5017, 11472, 4603, 63, 633, 566, 339, 372, 3991, 63, 3603, 199, 199, 3, 3447, 15140, 484, 345, 373, 13676, 18808, 2150, 8926, 5017, 269, 655, 579, 1318, 79, 19099, 5129, 199, 318, 2342, 63, 11418, 8, 576, 304, 272, 327, 437, 22692, 9587, 8722, 1410, 266, 15760, 21003, 2329, 11980, 685, 736, 12665, 8145, 390, 285, 11560, 272, 655, 17926, 18339, 275, 663, 342, 272, 4866, 13086, 432, 275, 942, 339, 32500, 11418, 221, 275, 283, 3093, 5017, 14, 846, 15, 6427, 13, 779, 65, 13, 90, 16, 13, 25, 33, 13, 58, 29716, 272, 2512, 14, 815, 10994, 3093, 5017, 14, 647, 61, 2342, 63, 11418, 327, 7709, 10853, 2641, 11418, 5207, 3, 531, 272, 4450, 275, 295, 14, 2014, 8, 10853, 2641, 11418, 12, 264, 14, 16504, 680, 6452, 8, 576, 9, 339, 367, 1336, 315, 4450, 26, 267, 3367, 10963, 320, 275, 7369, 3093, 5017, 8480, 267, 1166, 275, 298, 1014, 921, 3093, 5017, 14, 846, 15, 6427, 13, 7709, 1431, 24878, 1360, 2, 267, 340, 1166, 440, 315, 655, 17926, 18339, 26, 288, 2512, 14, 815, 480, 221, 1166, 16368, 633, 9, 288, 4866, 13086, 432, 14, 740, 8, 359, 3367, 10963, 320, 2360, 1166, 2360, 283, 3093, 5017, 7, 1622, 776, 288, 655, 17926, 18339, 14, 525, 8, 633, 9, 267, 587, 26, 288, 2512, 14, 815, 480, 221, 1166, 366, 4230, 10641, 16368, 633, 9, 15567, 32500, 11418, 221, 275, 283, 3093, 5017, 14, 846, 15, 779, 65, 13, 90, 16, 13, 25, 33, 13, 58, 29716, 272, 2512, 14, 815, 10994, 3093, 5017, 14, 647, 61, 2342, 63, 11418, 327, 7709, 10853, 2641, 11418, 5207, 3, 531, 272, 4450, 275, 295, 14, 2014, 8, 10853, 2641, 11418, 12, 264, 14, 16504, 680, 6452, 8, 576, 9, 339, 367, 1336, 315, 4450, 26, 267, 3367, 10963, 320, 275, 7369, 3093, 5017, 8480, 267, 1166, 275, 298, 1014, 921, 3093, 5017, 14, 846, 15, 6427, 13, 7709, 1431, 24878, 1360, 2, 267, 340, 1166, 440, 315, 655, 17926, 18339, 26, 288, 2512, 14, 815, 480, 221, 1166, 16368, 633, 9, 288, 4866, 13086, 432, 14, 740, 8, 359, 3367, 10963, 320, 2360, 1166, 2360, 283, 3093, 5017, 7, 1622, 776, 288, 655, 17926, 18339, 14, 525, 8, 633, 9, 267, 587, 26, 288, 2512, 14, 815, 480, 221, 1166, 366, 4230, 10641, 16368, 633, 9, 272, 372, 4866, 13086, 432, 199, 199, 318, 511, 837, 339, 3991, 63, 3603, 275, 664, 63, 3722, 63, 633, 480, 1014, 921, 3093, 5017, 14, 846, 15, 6427, 13, 77, 20, 5167, 18843, 679, 18, 1086, 78, 14, 1360, 531, 339, 372, 822, 8, 3722, 63, 3603, 13032, 16, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 17807, 4559, 199, 3, 4837, 317, 6327, 645, 29549, 446, 1323, 28994, 11349, 199, 3, 445, 368, 630, 12665, 3363, 5017, 199, 3, 1455, 921, 11486, 14, 84, 637, 645, 29549, 14, 815, 15, 2718, 13, 21382, 15, 321, 317, 6327, 645, 29549, 15, 199, 17807, 4559, 199, 199, 646, 7097, 12, 4078, 18, 12, 4078, 12, 264, 199, 646, 747, 199, 199, 504, 6170, 492, 28348, 199, 504, 6170, 492, 2512, 199, 504, 6170, 492, 1101, 199, 504, 6170, 492, 8586, 5301, 199, 199, 318, 511, 63, 3722, 63, 2444, 8, 2034, 63, 633, 3461, 272, 2512, 14, 815, 10994, 3093, 5017, 14, 647, 61, 511, 63, 3722, 63, 2444, 8, 1606, 63, 633, 9569, 83, 19124, 450, 2034, 63, 633, 9, 272, 372, 715, 12, 341, 199, 199, 318, 664, 63, 3722, 63, 633, 8, 2034, 63, 633, 2360, 876, 23481, 275, 756, 2360, 922, 9287, 2360, 2505, 8772, 3991, 63, 2060, 9287, 3461, 272, 2512, 14, 815, 10994, 3093, 5017, 14, 647, 61, 1166, 16368, 1606, 63, 633, 9, 272, 340, 440, 298, 6427, 2, 315, 2034, 63, 633, 26, 489, 2034, 63, 633, 275, 2034, 63, 633, 14, 1814, 480, 1014, 921, 3093, 5017, 14, 846, 15, 2266, 1014, 921, 3093, 5017, 14, 846, 15, 6427, 13, 531, 435, 3680, 1360, 2, 272, 666, 275, 28348, 14, 1637, 63, 1606, 8, 2034, 63, 633, 776, 272, 5898, 63, 633, 275, 28348, 14, 362, 63, 1431, 8, 576, 2584, 493, 26, 32397, 11, 4186, 358, 272, 3991, 63, 3603, 275, 942, 272, 3991, 63, 3603, 14, 740, 8, 359, 28348, 14, 362, 63, 1501, 63, 504, 63, 633, 8, 4603, 63, 633, 15786, 20, 26, 2807, 2, 359, 3093, 5017, 11472, 4603, 63, 633, 566, 339, 372, 3991, 63, 3603, 199, 199, 3, 3447, 15140, 484, 345, 373, 13676, 18808, 2150, 8926, 5017, 269, 655, 579, 1318, 79, 19099, 5129, 199, 318, 2342, 63, 11418, 8, 576, 304, 272, 327, 437, 22692, 9587, 8722, 1410, 266, 15760, 21003, 2329, 11980, 685, 736, 12665, 8145, 390, 285, 11560, 272, 655, 17926, 18339, 275, 663, 342, 272, 4866, 13086, 432, 275, 942, 339, 32500, 11418, 221, 275, 283, 3093, 5017, 14, 846, 15, 6427, 13, 779, 65, 13, 90, 16, 13, 25, 33, 13, 58, 29716, 272, 2512, 14, 815, 10994, 3093, 5017, 14, 647, 61, 2342, 63, 11418, 327, 7709, 10853, 2641, 11418, 5207, 3, 531, 272, 4450, 275, 295, 14, 2014, 8, 10853, 2641, 11418, 12, 264, 14, 16504, 680, 6452, 8, 576, 9, 339, 367, 1336, 315, 4450, 26, 267, 3367, 10963, 320, 275, 7369, 3093, 5017, 8480, 267, 1166, 275, 298, 1014, 921, 3093, 5017, 14, 846, 15, 6427, 13, 7709, 1431, 24878, 1360, 2, 267, 340, 1166, 440, 315, 655, 17926, 18339, 26, 288, 2512, 14, 815, 480, 221, 1166, 16368, 633, 9, 288, 4866, 13086, 432, 14, 740, 8, 359, 3367, 10963, 320, 2360, 1166, 2360, 283, 3093, 5017, 7, 1622, 776, 288, 655, 17926, 18339, 14, 525, 8, 633, 9, 267, 587, 26, 288, 2512, 14, 815, 480, 221, 1166, 366, 4230, 10641, 16368, 633, 9, 15567, 32500, 11418, 221, 275, 283, 3093, 5017, 14, 846, 15, 779, 65, 13, 90, 16, 13, 25, 33, 13, 58, 29716, 272, 2512, 14, 815, 10994, 3093, 5017, 14, 647, 61, 2342, 63, 11418, 327, 7709, 10853, 2641, 11418, 5207, 3, 531, 272, 4450, 275, 295, 14, 2014, 8, 10853, 2641, 11418, 12, 264, 14, 16504, 680, 6452, 8, 576, 9, 339, 367, 1336, 315, 4450, 26, 267, 3367, 10963, 320, 275, 7369, 3093, 5017, 8480, 267, 1166, 275, 298, 1014, 921, 3093, 5017, 14, 846, 15, 6427, 13, 7709, 1431, 24878, 1360, 2, 267, 340, 1166, 440, 315, 655, 17926, 18339, 26, 288, 2512, 14, 815, 480, 221, 1166, 16368, 633, 9, 288, 4866, 13086, 432, 14, 740, 8, 359, 3367, 10963, 320, 2360, 1166, 2360, 283, 3093, 5017, 7, 1622, 776, 288, 655, 17926, 18339, 14, 525, 8, 633, 9, 267, 587, 26, 288, 2512, 14, 815, 480, 221, 1166, 366, 4230, 10641, 16368, 633, 9, 272, 372, 4866, 13086, 432, 199, 199, 318, 511, 837, 339, 3991, 63, 3603, 275, 664, 63, 3722, 63, 633, 480, 1014, 921, 3093, 5017, 14, 846, 15, 6427, 13, 77, 20, 5167, 18843, 679, 18, 1086, 78, 14, 1360, 531, 339, 372, 822, 8, 3722, 63, 3603, 13032, 16, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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,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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 ]
yencarnacion/jaikuengine
.google_appengine/google/appengine/tools/devappserver2/admin/xmpp_request_handler_test.py
10
7646
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # """Tests for devappserver2.admin.xmpp_request_handler.""" import unittest import google from lxml import doctestcompare import mox import webapp2 from google.appengine.tools.devappserver2 import dispatcher from google.appengine.tools.devappserver2.admin import xmpp_request_handler class CompareXml(mox.Comparator): """Compare XML using only semantic differences e.g. ignore attribute order.""" def __init__(self, xml): self._xml = xml def equals(self, rhs): checker = doctestcompare.LXMLOutputChecker() return checker.check_output(self._xml, rhs, 0) class TestFormData(unittest.TestCase): """Tests for xmpp_request_handler._FormData.""" def test(self): form_data = xmpp_request_handler._FormData() form_data.add_text('message', u'\N{White Smiling Face}', 'plain') form_data.add_text('stanza', '<p>This is\na\ntest!</p>', 'xml') boundary, content = form_data.get_boundary_and_content() self.assertMultiLineEqual( '--{boundary}\r\n' 'Content-Type: text/plain; charset="UTF-8"\r\n' 'Content-Disposition: form-data; name="message"\r\n' '\r\n' '\xe2\x98\xba\r\n' '--{boundary}\r\n' 'Content-Type: text/xml; charset="UTF-8"\r\n' 'Content-Disposition: form-data; name="stanza"\r\n' '\r\n' '<p>This is\na\ntest!</p>\r\n' '--{boundary}--\r\n'.format(boundary=boundary), content ) class TestXmppRequestHandler(unittest.TestCase): """Tests for xmpp_request_handler.XmppRequestHandler.""" def setUp(self): self.mox = mox.Mox() def tearDown(self): self.mox.UnsetStubs() def test_send(self): self.mox.StubOutWithMock(xmpp_request_handler.XmppRequestHandler, 'dispatcher') handler = xmpp_request_handler.XmppRequestHandler() handler.dispatcher = self.mox.CreateMock(dispatcher.Dispatcher) handler.dispatcher.add_request( method='POST', relative_url='url', headers=[('Content-Type', mox.Regex('multipart/form-data; boundary=".*?"'))], body=mox.IsA(str), source_ip='0.1.0.10', fake_login=True) data = xmpp_request_handler._FormData() self.mox.ReplayAll() handler._send('url', data) self.mox.VerifyAll() def test_chat(self): self.mox.StubOutWithMock(xmpp_request_handler.XmppRequestHandler, '_send') request = webapp2.Request.blank('/xmpp', POST={'message_type': 'chat', 'to': 'foo@example.com', 'from': 'baz@example.com', 'chat': 'Chat content'}) response = webapp2.Response() handler = xmpp_request_handler.XmppRequestHandler(request, response) data = xmpp_request_handler._FormData() data.add_text('from', 'baz@example.com', 'plain') data.add_text('to', 'foo@example.com', 'plain') data.add_text('body', 'Chat content', 'plain') data.add_text( 'stanza', CompareXml( '<ns0:message from="baz@example.com" to="foo@example.com" ' 'type="chat" xmlns:ns0="jabber:client">' '<ns0:body>Chat content</ns0:body>' '</ns0:message>'), 'xml') handler._send('/_ah/xmpp/message/chat/', data).AndReturn( dispatcher.ResponseTuple('404 Not Found', [], 'Response')) self.mox.ReplayAll() handler.post() self.mox.VerifyAll() self.assertEqual('404 Not Found', response.status) def test_presence_available(self): self.mox.StubOutWithMock(xmpp_request_handler.XmppRequestHandler, '_send') request = webapp2.Request.blank('/xmpp', POST={'message_type': 'presence', 'to': 'foo@example.com', 'from': 'baz@example.com', 'presence': 'available'}) response = webapp2.Response() handler = xmpp_request_handler.XmppRequestHandler(request, response) data = xmpp_request_handler._FormData() data.add_text('from', 'baz@example.com', 'plain') data.add_text('to', 'foo@example.com', 'plain') data.add_text( 'stanza', CompareXml( '<ns0:presence from="baz@example.com" to="foo@example.com" ' 'xmlns:ns0="jabber:client" />'), 'xml') handler._send('/_ah/xmpp/presence/available/', data).AndReturn( dispatcher.ResponseTuple('404 Not Found', [], 'Response')) self.mox.ReplayAll() handler.post() self.mox.VerifyAll() self.assertEqual('404 Not Found', response.status) def test_presence_unavailable(self): self.mox.StubOutWithMock(xmpp_request_handler.XmppRequestHandler, '_send') request = webapp2.Request.blank('/xmpp', POST={'message_type': 'presence', 'to': 'foo@example.com', 'from': 'baz@example.com', 'presence': 'unavailable'}) response = webapp2.Response() handler = xmpp_request_handler.XmppRequestHandler(request, response) data = xmpp_request_handler._FormData() data.add_text('from', 'baz@example.com', 'plain') data.add_text('to', 'foo@example.com', 'plain') data.add_text( 'stanza', CompareXml( '<ns0:presence from="baz@example.com" to="foo@example.com" ' 'type="unavailable" xmlns:ns0="jabber:client" />'), 'xml') handler._send('/_ah/xmpp/presence/unavailable/', data).AndReturn( dispatcher.ResponseTuple('404 Not Found', [], 'Response')) self.mox.ReplayAll() handler.post() self.mox.VerifyAll() self.assertEqual('404 Not Found', response.status) def test_subscribe(self): self.mox.StubOutWithMock(xmpp_request_handler.XmppRequestHandler, '_send') request = webapp2.Request.blank('/xmpp', POST={'message_type': 'subscribe', 'to': 'foo@example.com', 'from': 'baz@example.com', 'subscription_type': 'subscribe'}) response = webapp2.Response() handler = xmpp_request_handler.XmppRequestHandler(request, response) data = xmpp_request_handler._FormData() data.add_text('from', 'baz@example.com', 'plain') data.add_text('to', 'foo@example.com', 'plain') data.add_text( 'stanza', CompareXml( '<ns0:presence from="baz@example.com" to="foo@example.com" ' 'type="subscribe" xmlns:ns0="jabber:client" />'), 'xml') handler._send('/_ah/xmpp/subscription/subscribe/', data).AndReturn( dispatcher.ResponseTuple('404 Not Found', [], 'Response')) self.mox.ReplayAll() handler.post() self.mox.VerifyAll() self.assertEqual('404 Not Found', response.status) if __name__ == '__main__': unittest.main()
apache-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 199, 3, 1898, 10219, 4475, 3277, 14, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 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, 199, 624, 2925, 367, 4866, 571, 1000, 18, 14, 2113, 14, 26608, 63, 1069, 63, 2232, 1041, 421, 199, 646, 2882, 199, 199, 646, 6233, 199, 504, 14490, 492, 8868, 5785, 199, 646, 18610, 199, 646, 24812, 18, 199, 199, 504, 6233, 14, 15358, 14, 2537, 14, 2374, 571, 1000, 18, 492, 17475, 199, 504, 6233, 14, 15358, 14, 2537, 14, 2374, 571, 1000, 18, 14, 2113, 492, 671, 17901, 63, 1069, 63, 2232, 421, 199, 533, 18955, 8672, 8, 6625, 14, 26636, 304, 523, 408, 16051, 4692, 1808, 1454, 32451, 15109, 325, 14, 71, 14, 3686, 2225, 1865, 1041, 819, 347, 636, 826, 721, 277, 12, 2748, 304, 272, 291, 423, 1652, 275, 2748, 819, 347, 18527, 8, 277, 12, 9085, 304, 272, 7739, 275, 8868, 5785, 14, 44, 13901, 1484, 337, 524, 3048, 342, 272, 372, 7739, 14, 1074, 63, 1199, 8, 277, 423, 1652, 12, 9085, 12, 378, 9, 421, 199, 533, 1379, 2821, 1451, 8, 2796, 14, 1746, 304, 523, 408, 2925, 367, 671, 17901, 63, 1069, 63, 2232, 423, 2821, 1451, 1041, 819, 347, 511, 8, 277, 304, 272, 1824, 63, 576, 275, 671, 17901, 63, 1069, 63, 2232, 423, 2821, 1451, 342, 272, 1824, 63, 576, 14, 525, 63, 505, 360, 1188, 297, 399, 1154, 46, 91, 19803, 16392, 5662, 21459, 7293, 283, 6104, 358, 272, 1824, 63, 576, 14, 525, 63, 505, 360, 29455, 297, 2650, 80, 30, 2765, 365, 60, 3540, 60, 78, 396, 28718, 80, 4206, 283, 1652, 358, 272, 8424, 12, 1564, 275, 1824, 63, 576, 14, 362, 63, 9891, 63, 460, 63, 1317, 342, 272, 291, 14, 479, 3947, 3049, 591, 8, 267, 2850, 91, 9891, 4988, 82, 60, 78, 7, 267, 283, 2714, 13, 804, 26, 1318, 15, 6104, 27, 5960, 628, 6610, 13, 24, 3212, 82, 60, 78, 7, 267, 283, 2714, 13, 15954, 26, 1824, 13, 576, 27, 536, 628, 1188, 3212, 82, 60, 78, 7, 267, 1557, 82, 60, 78, 7, 267, 1557, 1845, 18, 60, 88, 2905, 60, 10539, 60, 82, 60, 78, 7, 267, 2850, 91, 9891, 4988, 82, 60, 78, 7, 267, 283, 2714, 13, 804, 26, 1318, 15, 1652, 27, 5960, 628, 6610, 13, 24, 3212, 82, 60, 78, 7, 267, 283, 2714, 13, 15954, 26, 1824, 13, 576, 27, 536, 628, 29455, 3212, 82, 60, 78, 7, 267, 1557, 82, 60, 78, 7, 267, 2650, 80, 30, 2765, 365, 60, 3540, 60, 78, 396, 28718, 80, 3072, 82, 60, 78, 7, 267, 2850, 91, 9891, 93, 306, 60, 82, 60, 78, 1370, 908, 8, 9891, 29, 9891, 395, 267, 1564, 272, 776, 421, 199, 533, 1379, 56, 17901, 11149, 8, 2796, 14, 1746, 304, 523, 408, 2925, 367, 671, 17901, 63, 1069, 63, 2232, 14, 56, 17901, 11149, 1041, 819, 347, 3613, 8, 277, 304, 272, 291, 14, 6625, 275, 18610, 14, 3716, 88, 342, 819, 347, 6766, 8, 277, 304, 272, 291, 14, 6625, 14, 1358, 409, 8067, 83, 342, 819, 347, 511, 63, 2254, 8, 277, 304, 272, 291, 14, 6625, 14, 12088, 8, 26608, 63, 1069, 63, 2232, 14, 56, 17901, 11149, 12, 2490, 283, 14913, 358, 339, 3016, 275, 671, 17901, 63, 1069, 63, 2232, 14, 56, 17901, 11149, 342, 272, 3016, 14, 14913, 275, 291, 14, 6625, 14, 2499, 3346, 8, 14913, 14, 15461, 9, 272, 3016, 14, 14913, 14, 525, 63, 1069, 8, 267, 1083, 534, 4030, 297, 267, 3847, 63, 633, 534, 633, 297, 267, 2323, 11699, 2714, 13, 804, 297, 2116, 18610, 14, 5103, 360, 10123, 15, 964, 13, 576, 27, 8424, 628, 6697, 2, 1333, 467, 267, 2396, 29, 6625, 14, 14104, 8, 495, 395, 267, 1350, 63, 711, 534, 16, 14, 17, 14, 16, 14, 709, 297, 267, 4026, 63, 2886, 29, 549, 9, 339, 666, 275, 671, 17901, 63, 1069, 63, 2232, 423, 2821, 1451, 342, 272, 291, 14, 6625, 14, 12982, 342, 272, 3016, 423, 2254, 360, 633, 297, 666, 9, 272, 291, 14, 6625, 14, 31912, 342, 819, 347, 511, 63, 10289, 8, 277, 304, 272, 291, 14, 6625, 14, 12088, 8, 26608, 63, 1069, 63, 2232, 14, 56, 17901, 11149, 12, 2513, 2254, 358, 339, 1056, 275, 24812, 18, 14, 2017, 14, 2500, 2336, 26608, 297, 8761, 3713, 1188, 63, 466, 356, 283, 10289, 297, 8962, 283, 475, 356, 283, 1421, 32, 2694, 14, 957, 297, 8962, 283, 504, 356, 283, 6185, 32, 2694, 14, 957, 297, 8962, 283, 10289, 356, 283, 21954, 1564, 3071, 272, 1177, 275, 24812, 18, 14, 2364, 342, 272, 3016, 275, 671, 17901, 63, 1069, 63, 2232, 14, 56, 17901, 11149, 8, 1069, 12, 1177, 9, 272, 666, 275, 671, 17901, 63, 1069, 63, 2232, 423, 2821, 1451, 342, 272, 666, 14, 525, 63, 505, 360, 504, 297, 283, 6185, 32, 2694, 14, 957, 297, 283, 6104, 358, 272, 666, 14, 525, 63, 505, 360, 475, 297, 283, 1421, 32, 2694, 14, 957, 297, 283, 6104, 358, 272, 666, 14, 525, 63, 505, 360, 2030, 297, 283, 21954, 1564, 297, 283, 6104, 358, 272, 666, 14, 525, 63, 505, 8, 267, 283, 29455, 297, 267, 18955, 8672, 8, 288, 2650, 561, 16, 26, 1188, 687, 628, 6185, 32, 2694, 14, 957, 2, 370, 628, 1421, 32, 2694, 14, 957, 2, 283, 288, 283, 466, 628, 10289 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 199, 3, 1898, 10219, 4475, 3277, 14, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 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, 199, 624, 2925, 367, 4866, 571, 1000, 18, 14, 2113, 14, 26608, 63, 1069, 63, 2232, 1041, 421, 199, 646, 2882, 199, 199, 646, 6233, 199, 504, 14490, 492, 8868, 5785, 199, 646, 18610, 199, 646, 24812, 18, 199, 199, 504, 6233, 14, 15358, 14, 2537, 14, 2374, 571, 1000, 18, 492, 17475, 199, 504, 6233, 14, 15358, 14, 2537, 14, 2374, 571, 1000, 18, 14, 2113, 492, 671, 17901, 63, 1069, 63, 2232, 421, 199, 533, 18955, 8672, 8, 6625, 14, 26636, 304, 523, 408, 16051, 4692, 1808, 1454, 32451, 15109, 325, 14, 71, 14, 3686, 2225, 1865, 1041, 819, 347, 636, 826, 721, 277, 12, 2748, 304, 272, 291, 423, 1652, 275, 2748, 819, 347, 18527, 8, 277, 12, 9085, 304, 272, 7739, 275, 8868, 5785, 14, 44, 13901, 1484, 337, 524, 3048, 342, 272, 372, 7739, 14, 1074, 63, 1199, 8, 277, 423, 1652, 12, 9085, 12, 378, 9, 421, 199, 533, 1379, 2821, 1451, 8, 2796, 14, 1746, 304, 523, 408, 2925, 367, 671, 17901, 63, 1069, 63, 2232, 423, 2821, 1451, 1041, 819, 347, 511, 8, 277, 304, 272, 1824, 63, 576, 275, 671, 17901, 63, 1069, 63, 2232, 423, 2821, 1451, 342, 272, 1824, 63, 576, 14, 525, 63, 505, 360, 1188, 297, 399, 1154, 46, 91, 19803, 16392, 5662, 21459, 7293, 283, 6104, 358, 272, 1824, 63, 576, 14, 525, 63, 505, 360, 29455, 297, 2650, 80, 30, 2765, 365, 60, 3540, 60, 78, 396, 28718, 80, 4206, 283, 1652, 358, 272, 8424, 12, 1564, 275, 1824, 63, 576, 14, 362, 63, 9891, 63, 460, 63, 1317, 342, 272, 291, 14, 479, 3947, 3049, 591, 8, 267, 2850, 91, 9891, 4988, 82, 60, 78, 7, 267, 283, 2714, 13, 804, 26, 1318, 15, 6104, 27, 5960, 628, 6610, 13, 24, 3212, 82, 60, 78, 7, 267, 283, 2714, 13, 15954, 26, 1824, 13, 576, 27, 536, 628, 1188, 3212, 82, 60, 78, 7, 267, 1557, 82, 60, 78, 7, 267, 1557, 1845, 18, 60, 88, 2905, 60, 10539, 60, 82, 60, 78, 7, 267, 2850, 91, 9891, 4988, 82, 60, 78, 7, 267, 283, 2714, 13, 804, 26, 1318, 15, 1652, 27, 5960, 628, 6610, 13, 24, 3212, 82, 60, 78, 7, 267, 283, 2714, 13, 15954, 26, 1824, 13, 576, 27, 536, 628, 29455, 3212, 82, 60, 78, 7, 267, 1557, 82, 60, 78, 7, 267, 2650, 80, 30, 2765, 365, 60, 3540, 60, 78, 396, 28718, 80, 3072, 82, 60, 78, 7, 267, 2850, 91, 9891, 93, 306, 60, 82, 60, 78, 1370, 908, 8, 9891, 29, 9891, 395, 267, 1564, 272, 776, 421, 199, 533, 1379, 56, 17901, 11149, 8, 2796, 14, 1746, 304, 523, 408, 2925, 367, 671, 17901, 63, 1069, 63, 2232, 14, 56, 17901, 11149, 1041, 819, 347, 3613, 8, 277, 304, 272, 291, 14, 6625, 275, 18610, 14, 3716, 88, 342, 819, 347, 6766, 8, 277, 304, 272, 291, 14, 6625, 14, 1358, 409, 8067, 83, 342, 819, 347, 511, 63, 2254, 8, 277, 304, 272, 291, 14, 6625, 14, 12088, 8, 26608, 63, 1069, 63, 2232, 14, 56, 17901, 11149, 12, 2490, 283, 14913, 358, 339, 3016, 275, 671, 17901, 63, 1069, 63, 2232, 14, 56, 17901, 11149, 342, 272, 3016, 14, 14913, 275, 291, 14, 6625, 14, 2499, 3346, 8, 14913, 14, 15461, 9, 272, 3016, 14, 14913, 14, 525, 63, 1069, 8, 267, 1083, 534, 4030, 297, 267, 3847, 63, 633, 534, 633, 297, 267, 2323, 11699, 2714, 13, 804, 297, 2116, 18610, 14, 5103, 360, 10123, 15, 964, 13, 576, 27, 8424, 628, 6697, 2, 1333, 467, 267, 2396, 29, 6625, 14, 14104, 8, 495, 395, 267, 1350, 63, 711, 534, 16, 14, 17, 14, 16, 14, 709, 297, 267, 4026, 63, 2886, 29, 549, 9, 339, 666, 275, 671, 17901, 63, 1069, 63, 2232, 423, 2821, 1451, 342, 272, 291, 14, 6625, 14, 12982, 342, 272, 3016, 423, 2254, 360, 633, 297, 666, 9, 272, 291, 14, 6625, 14, 31912, 342, 819, 347, 511, 63, 10289, 8, 277, 304, 272, 291, 14, 6625, 14, 12088, 8, 26608, 63, 1069, 63, 2232, 14, 56, 17901, 11149, 12, 2513, 2254, 358, 339, 1056, 275, 24812, 18, 14, 2017, 14, 2500, 2336, 26608, 297, 8761, 3713, 1188, 63, 466, 356, 283, 10289, 297, 8962, 283, 475, 356, 283, 1421, 32, 2694, 14, 957, 297, 8962, 283, 504, 356, 283, 6185, 32, 2694, 14, 957, 297, 8962, 283, 10289, 356, 283, 21954, 1564, 3071, 272, 1177, 275, 24812, 18, 14, 2364, 342, 272, 3016, 275, 671, 17901, 63, 1069, 63, 2232, 14, 56, 17901, 11149, 8, 1069, 12, 1177, 9, 272, 666, 275, 671, 17901, 63, 1069, 63, 2232, 423, 2821, 1451, 342, 272, 666, 14, 525, 63, 505, 360, 504, 297, 283, 6185, 32, 2694, 14, 957, 297, 283, 6104, 358, 272, 666, 14, 525, 63, 505, 360, 475, 297, 283, 1421, 32, 2694, 14, 957, 297, 283, 6104, 358, 272, 666, 14, 525, 63, 505, 360, 2030, 297, 283, 21954, 1564, 297, 283, 6104, 358, 272, 666, 14, 525, 63, 505, 8, 267, 283, 29455, 297, 267, 18955, 8672, 8, 288, 2650, 561, 16, 26, 1188, 687, 628, 6185, 32, 2694, 14, 957, 2, 370, 628, 1421, 32, 2694, 14, 957, 2, 283, 288, 283, 466, 628, 10289, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
mhaberler/machinekit
src/emc/usr_intf/touchy/listing.py
35
3481
# Touchy is Copyright (c) 2009 Chris Radek <chris@timeguy.com> # # Touchy is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # Touchy 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. class listing: def __init__(self, gtk, emc, labels, eventboxes): self.labels = labels self.eventboxes = eventboxes self.numlabels = len(labels) self.gtk = gtk self.emc = emc self.lineoffset = 0 self.selected = -1 self.start_line = -1 self.filename = "" self.program = [] self.lines = 0 self.populate() def populate(self): program = self.program[self.lineoffset:self.lineoffset + self.numlabels] for i in range(self.numlabels): l = self.labels[i] e = self.eventboxes[i] if i < len(program): l.set_text(program[i].rstrip()) else: l.set_text('') if self.start_line == self.lineoffset + i: e.modify_bg(self.gtk.STATE_NORMAL, self.gtk.gdk.color_parse('#66f')) elif self.selected == self.lineoffset + i: e.modify_bg(self.gtk.STATE_NORMAL, self.gtk.gdk.color_parse('#fff')) else: e.modify_bg(self.gtk.STATE_NORMAL, self.gtk.gdk.color_parse('#ccc')) def show_line(self, n): if len(self.program) <= self.numlabels: self.lineoffset = 0 else: self.lineoffset = min(max(0, n - self.numlabels/2),self.lines - self.numlabels) self.populate() def highlight_line(self, n): n -= 1 # program[] is zero-based, emc line numbers are one-based if self.selected == n: return self.selected = n self.show_line(n) def up(self, b): self.lineoffset -= self.numlabels if self.lineoffset < 0: self.lineoffset = 0 self.populate() def down(self, b): self.lineoffset += self.numlabels self.populate() def readfile(self, fn): self.filename = fn f = file(fn, 'r') self.program = f.readlines() f.close() self.lines = len(self.program) self.lineoffset = 0 self.selected = -1 self.populate() def reload(self, b): pass def previous(self, b,count=1): for i in range(count): while True: if self.start_line <= 0: break self.start_line -= 1 if (self.program[self.start_line][0] == 'N' or self.program[self.start_line][0] == 'n' ): break self.show_line(self.start_line) def next(self,b,count=1): if count < 0: return self.previous(b, -count) for i in range(count): while True: if self.start_line >= len(self.program)-1: break self.start_line += 1 if (self.program[self.start_line][0] == 'N' or self.program[self.start_line][0] == 'n' ): break self.show_line(self.start_line) def clear_startline(self): self.start_line = -1 self.populate() def get_startline(self): return self.start_line + 1
lgpl-2.1
[ 3, 377, 13087, 89, 365, 1898, 334, 67, 9, 8937, 221, 2799, 5719, 3898, 271, 75, 665, 335, 5719, 32, 521, 6051, 89, 14, 957, 30, 199, 3, 199, 3, 377, 13087, 89, 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, 499, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 377, 13087, 89, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 4388, 199, 533, 13778, 26, 272, 347, 636, 826, 721, 277, 12, 8116, 12, 325, 5466, 12, 3628, 12, 1566, 12922, 304, 267, 291, 14, 3512, 275, 3628, 267, 291, 14, 1430, 12922, 275, 1566, 12922, 267, 291, 14, 1507, 3512, 275, 822, 8, 3512, 9, 267, 291, 14, 12275, 275, 8116, 267, 291, 14, 69, 5466, 275, 325, 5466, 267, 291, 14, 604, 2743, 275, 378, 267, 291, 14, 5511, 275, 446, 17, 267, 291, 14, 928, 63, 604, 275, 446, 17, 267, 291, 14, 1501, 275, 3087, 267, 291, 14, 6815, 275, 942, 267, 291, 14, 1278, 275, 378, 267, 291, 14, 13817, 342, 339, 347, 13904, 8, 277, 304, 267, 2240, 275, 291, 14, 6815, 59, 277, 14, 604, 2743, 26, 277, 14, 604, 2743, 435, 291, 14, 1507, 3512, 61, 267, 367, 284, 315, 1425, 8, 277, 14, 1507, 3512, 304, 288, 634, 275, 291, 14, 3512, 59, 73, 61, 288, 325, 275, 291, 14, 1430, 12922, 59, 73, 61, 288, 340, 284, 665, 822, 8, 6815, 304, 355, 634, 14, 409, 63, 505, 8, 6815, 59, 73, 1055, 6735, 1012, 288, 587, 26, 355, 634, 14, 409, 63, 505, 8355, 7846, 340, 291, 14, 928, 63, 604, 508, 291, 14, 604, 2743, 435, 284, 26, 355, 325, 14, 8951, 63, 6856, 8, 277, 14, 12275, 14, 6689, 63, 10765, 12, 291, 14, 12275, 14, 24697, 14, 2326, 63, 1122, 7863, 1272, 70, 1333, 288, 916, 291, 14, 5511, 508, 291, 14, 604, 2743, 435, 284, 26, 355, 325, 14, 8951, 63, 6856, 8, 277, 14, 12275, 14, 6689, 63, 10765, 12, 291, 14, 12275, 14, 24697, 14, 2326, 63, 1122, 7863, 18190, 1333, 288, 587, 26, 355, 325, 14, 8951, 63, 6856, 8, 277, 14, 12275, 14, 6689, 63, 10765, 12, 291, 14, 12275, 14, 24697, 14, 2326, 63, 1122, 7863, 19504, 1333, 339, 347, 2498, 63, 604, 8, 277, 12, 302, 304, 267, 340, 822, 8, 277, 14, 6815, 9, 2695, 291, 14, 1507, 3512, 26, 288, 291, 14, 604, 2743, 275, 378, 267, 587, 26, 288, 291, 14, 604, 2743, 275, 1748, 8, 988, 8, 16, 12, 302, 446, 291, 14, 1507, 3512, 15, 18, 395, 277, 14, 1278, 446, 291, 14, 1507, 3512, 9, 267, 291, 14, 13817, 342, 339, 347, 11850, 63, 604, 8, 277, 12, 302, 304, 267, 302, 4862, 413, 14516, 327, 2240, 8607, 365, 4697, 13, 6788, 12, 325, 5466, 1004, 5579, 787, 1373, 13, 6788, 267, 340, 291, 14, 5511, 508, 302, 26, 372, 267, 291, 14, 5511, 275, 302, 267, 291, 14, 2384, 63, 604, 8, 78, 9, 339, 347, 1536, 8, 277, 12, 330, 304, 267, 291, 14, 604, 2743, 4862, 291, 14, 1507, 3512, 267, 340, 291, 14, 604, 2743, 665, 378, 26, 288, 291, 14, 604, 2743, 275, 378, 267, 291, 14, 13817, 342, 339, 347, 3224, 8, 277, 12, 330, 304, 267, 291, 14, 604, 2743, 847, 291, 14, 1507, 3512, 267, 291, 14, 13817, 342, 339, 347, 1586, 493, 8, 277, 12, 4325, 304, 267, 291, 14, 1501, 275, 4325, 267, 289, 275, 570, 8, 2324, 12, 283, 82, 358, 267, 291, 14, 6815, 275, 289, 14, 9684, 342, 267, 289, 14, 1600, 342, 267, 291, 14, 1278, 275, 822, 8, 277, 14, 6815, 9, 267, 291, 14, 604, 2743, 275, 378, 267, 291, 14, 5511, 275, 446, 17, 267, 291, 14, 13817, 342, 339, 347, 13101, 8, 277, 12, 330, 304, 267, 986, 339, 347, 4136, 8, 277, 12, 330, 12, 835, 29, 17, 304, 199, 198, 509, 284, 315, 1425, 8, 835, 304, 6722, 1830, 715, 26, 507, 198, 692, 291, 14, 928, 63, 604, 2695, 378, 26, 15075, 2059, 507, 198, 277, 14, 928, 63, 604, 4862, 413, 507, 198, 692, 334, 277, 14, 6815, 59, 277, 14, 928, 63, 604, 1527, 16, 61, 508, 283, 46, 7, 503, 15075, 291, 14, 6815, 59, 277, 14, 928, 63, 604, 1527, 16, 61, 508, 283, 78, 7, 3461, 15075, 2059, 267, 291, 14, 2384, 63, 604, 8, 277, 14, 928, 63, 604, 9, 339, 347, 2163, 8, 277, 12, 66, 12, 835, 29, 17, 304, 267, 340, 2338, 665, 378, 26, 372, 291, 14, 6352, 8, 66, 12, 446, 835, 9, 199, 198, 509, 284, 315, 1425, 8, 835, 304, 6722, 1830, 715, 26, 507, 198, 692, 291, 14, 928, 63, 604, 2356, 822, 8, 277, 14, 6815, 7216, 17, 26, 15075, 2059, 507, 198, 277, 14, 928, 63, 604, 847, 413, 507, 198, 692, 334, 277, 14, 6815, 59, 277, 14, 928, 63, 604, 1527, 16, 61, 508, 283, 46, 7, 503, 15075, 291, 14, 6815, 59, 277, 14, 928, 63, 604, 1527, 16, 61, 508, 283, 78, 7, 3461, 15075, 2059, 267, 291, 14, 2384, 63, 604, 8, 277, 14, 928, 63, 604, 9, 339, 347, 5436, 63, 928, 604, 8, 277, 304, 267, 291, 14, 928, 63, 604, 275, 446, 17, 267, 291, 14, 13817, 342, 339, 347, 664, 63, 928, 604, 8, 277, 304, 267, 372, 291, 14, 928, 63, 604, 435, 413, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 377, 13087, 89, 365, 1898, 334, 67, 9, 8937, 221, 2799, 5719, 3898, 271, 75, 665, 335, 5719, 32, 521, 6051, 89, 14, 957, 30, 199, 3, 199, 3, 377, 13087, 89, 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, 499, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 377, 13087, 89, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 4388, 199, 533, 13778, 26, 272, 347, 636, 826, 721, 277, 12, 8116, 12, 325, 5466, 12, 3628, 12, 1566, 12922, 304, 267, 291, 14, 3512, 275, 3628, 267, 291, 14, 1430, 12922, 275, 1566, 12922, 267, 291, 14, 1507, 3512, 275, 822, 8, 3512, 9, 267, 291, 14, 12275, 275, 8116, 267, 291, 14, 69, 5466, 275, 325, 5466, 267, 291, 14, 604, 2743, 275, 378, 267, 291, 14, 5511, 275, 446, 17, 267, 291, 14, 928, 63, 604, 275, 446, 17, 267, 291, 14, 1501, 275, 3087, 267, 291, 14, 6815, 275, 942, 267, 291, 14, 1278, 275, 378, 267, 291, 14, 13817, 342, 339, 347, 13904, 8, 277, 304, 267, 2240, 275, 291, 14, 6815, 59, 277, 14, 604, 2743, 26, 277, 14, 604, 2743, 435, 291, 14, 1507, 3512, 61, 267, 367, 284, 315, 1425, 8, 277, 14, 1507, 3512, 304, 288, 634, 275, 291, 14, 3512, 59, 73, 61, 288, 325, 275, 291, 14, 1430, 12922, 59, 73, 61, 288, 340, 284, 665, 822, 8, 6815, 304, 355, 634, 14, 409, 63, 505, 8, 6815, 59, 73, 1055, 6735, 1012, 288, 587, 26, 355, 634, 14, 409, 63, 505, 8355, 7846, 340, 291, 14, 928, 63, 604, 508, 291, 14, 604, 2743, 435, 284, 26, 355, 325, 14, 8951, 63, 6856, 8, 277, 14, 12275, 14, 6689, 63, 10765, 12, 291, 14, 12275, 14, 24697, 14, 2326, 63, 1122, 7863, 1272, 70, 1333, 288, 916, 291, 14, 5511, 508, 291, 14, 604, 2743, 435, 284, 26, 355, 325, 14, 8951, 63, 6856, 8, 277, 14, 12275, 14, 6689, 63, 10765, 12, 291, 14, 12275, 14, 24697, 14, 2326, 63, 1122, 7863, 18190, 1333, 288, 587, 26, 355, 325, 14, 8951, 63, 6856, 8, 277, 14, 12275, 14, 6689, 63, 10765, 12, 291, 14, 12275, 14, 24697, 14, 2326, 63, 1122, 7863, 19504, 1333, 339, 347, 2498, 63, 604, 8, 277, 12, 302, 304, 267, 340, 822, 8, 277, 14, 6815, 9, 2695, 291, 14, 1507, 3512, 26, 288, 291, 14, 604, 2743, 275, 378, 267, 587, 26, 288, 291, 14, 604, 2743, 275, 1748, 8, 988, 8, 16, 12, 302, 446, 291, 14, 1507, 3512, 15, 18, 395, 277, 14, 1278, 446, 291, 14, 1507, 3512, 9, 267, 291, 14, 13817, 342, 339, 347, 11850, 63, 604, 8, 277, 12, 302, 304, 267, 302, 4862, 413, 14516, 327, 2240, 8607, 365, 4697, 13, 6788, 12, 325, 5466, 1004, 5579, 787, 1373, 13, 6788, 267, 340, 291, 14, 5511, 508, 302, 26, 372, 267, 291, 14, 5511, 275, 302, 267, 291, 14, 2384, 63, 604, 8, 78, 9, 339, 347, 1536, 8, 277, 12, 330, 304, 267, 291, 14, 604, 2743, 4862, 291, 14, 1507, 3512, 267, 340, 291, 14, 604, 2743, 665, 378, 26, 288, 291, 14, 604, 2743, 275, 378, 267, 291, 14, 13817, 342, 339, 347, 3224, 8, 277, 12, 330, 304, 267, 291, 14, 604, 2743, 847, 291, 14, 1507, 3512, 267, 291, 14, 13817, 342, 339, 347, 1586, 493, 8, 277, 12, 4325, 304, 267, 291, 14, 1501, 275, 4325, 267, 289, 275, 570, 8, 2324, 12, 283, 82, 358, 267, 291, 14, 6815, 275, 289, 14, 9684, 342, 267, 289, 14, 1600, 342, 267, 291, 14, 1278, 275, 822, 8, 277, 14, 6815, 9, 267, 291, 14, 604, 2743, 275, 378, 267, 291, 14, 5511, 275, 446, 17, 267, 291, 14, 13817, 342, 339, 347, 13101, 8, 277, 12, 330, 304, 267, 986, 339, 347, 4136, 8, 277, 12, 330, 12, 835, 29, 17, 304, 199, 198, 509, 284, 315, 1425, 8, 835, 304, 6722, 1830, 715, 26, 507, 198, 692, 291, 14, 928, 63, 604, 2695, 378, 26, 15075, 2059, 507, 198, 277, 14, 928, 63, 604, 4862, 413, 507, 198, 692, 334, 277, 14, 6815, 59, 277, 14, 928, 63, 604, 1527, 16, 61, 508, 283, 46, 7, 503, 15075, 291, 14, 6815, 59, 277, 14, 928, 63, 604, 1527, 16, 61, 508, 283, 78, 7, 3461, 15075, 2059, 267, 291, 14, 2384, 63, 604, 8, 277, 14, 928, 63, 604, 9, 339, 347, 2163, 8, 277, 12, 66, 12, 835, 29, 17, 304, 267, 340, 2338, 665, 378, 26, 372, 291, 14, 6352, 8, 66, 12, 446, 835, 9, 199, 198, 509, 284, 315, 1425, 8, 835, 304, 6722, 1830, 715, 26, 507, 198, 692, 291, 14, 928, 63, 604, 2356, 822, 8, 277, 14, 6815, 7216, 17, 26, 15075, 2059, 507, 198, 277, 14, 928, 63, 604, 847, 413, 507, 198, 692, 334, 277, 14, 6815, 59, 277, 14, 928, 63, 604, 1527, 16, 61, 508, 283, 46, 7, 503, 15075, 291, 14, 6815, 59, 277, 14, 928, 63, 604, 1527, 16, 61, 508, 283, 78, 7, 3461, 15075, 2059, 267, 291, 14, 2384, 63, 604, 8, 277, 14, 928, 63, 604, 9, 339, 347, 5436, 63, 928, 604, 8, 277, 304, 267, 291, 14, 928, 63, 604, 275, 446, 17, 267, 291, 14, 13817, 342, 339, 347, 664, 63, 928, 604, 8, 277, 304, 267, 372, 291, 14, 928, 63, 604, 435, 413, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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itertools from functools import wraps from django.http import HttpResponse from django.shortcuts import render_to_response, redirect, get_object_or_404 from django.template import RequestContext from django.contrib import messages from django.contrib.admin.views.decorators import staff_member_required from django.contrib.auth.decorators import login_required from symposion.sponsors_pro.forms import SponsorApplicationForm, SponsorDetailsForm, SponsorBenefitsFormSet from symposion.sponsors_pro.models import Sponsor, SponsorBenefit def require_no_sponsorship(only_active=False): def inner(func): @wraps(func) def view(request, *args, **kwargs): if request.user.is_authenticated(): try: sponsorship = request.user.sponsorship except Sponsor.DoesNotExist: pass else: if not only_active or sponsorship.active: return redirect(sponsorship) return func(request, *args, **kwargs) return view return inner def sponsor_info(request): return render_to_response("sponsors/info.html", { }, context_instance=RequestContext(request)) @login_required @require_no_sponsorship() def sponsor_apply(request): if request.method == "POST": form = SponsorApplicationForm(request.POST, user=request.user) if form.is_valid(): form.save() return redirect("sponsor_info") else: form = SponsorApplicationForm(user=request.user) return render_to_response("sponsors/apply.html", { "form": form, }, context_instance=RequestContext(request)) @login_required def sponsor_detail(request, pk): sponsor = get_object_or_404(Sponsor, pk=pk) if not sponsor.active or sponsor.applicant != request.user: return redirect("sponsor_info") formset_kwargs = { "instance": sponsor, "queryset": SponsorBenefit.objects.filter(active=True) } if request.method == "POST": form = SponsorDetailsForm(request.POST, instance=sponsor) formset = SponsorBenefitsFormSet(request.POST, request.FILES, **formset_kwargs) if form.is_valid() and formset.is_valid(): form.save() formset.save() messages.success(request, "Your sponsorship application has been submitted!") return redirect(request.path) else: form = SponsorDetailsForm(instance=sponsor) formset = SponsorBenefitsFormSet(**formset_kwargs) return render_to_response("sponsors/detail.html", { "sponsor": sponsor, "form": form, "formset": formset, }, context_instance=RequestContext(request)) @staff_member_required def sponsor_export_data(request): sponsors = [] data = "" for sponsor in Sponsor.objects.order_by("added"): d = { "name": sponsor.name, "url": sponsor.external_url, "level": (sponsor.level.order, sponsor.level.name), "description": "", } for sponsor_benefit in sponsor.sponsor_benefits.all(): if sponsor_benefit.benefit_id == 2: d["description"] = sponsor_benefit.text sponsors.append(d) def izip_longest(*args): fv = None def sentinel(counter=([fv]*(len(args)-1)).pop): yield counter() iters = [itertools.chain(it, sentinel(), itertools.repeat(fv)) for it in args] try: for tup in itertools.izip(*iters): yield tup except IndexError: pass def pairwise(iterable): a, b = itertools.tee(iterable) b.next() return izip_longest(a, b) def level_key(s): return s["level"] for level, level_sponsors in itertools.groupby(sorted(sponsors, key=level_key), level_key): data += "%s\n" % ("-" * (len(level[1])+4)) data += "| %s |\n" % level[1] data += "%s\n\n" % ("-" * (len(level[1])+4)) for sponsor, next in pairwise(level_sponsors): description = sponsor["description"].strip() description = description if description else "-- NO DESCRIPTION FOR THIS SPONSOR --" data += "%s\n\n%s" % (sponsor["name"], description) if next is not None: data += "\n\n%s\n\n" % ("-"*80) else: data += "\n\n" return HttpResponse(data, content_type="text/plain;charset=utf-8")
mit
[ 646, 7975, 199, 199, 504, 9143, 492, 14018, 199, 199, 504, 1639, 14, 1014, 492, 6183, 199, 504, 1639, 14, 17469, 492, 3795, 63, 475, 63, 1310, 12, 4660, 12, 664, 63, 785, 63, 269, 63, 5188, 199, 504, 1639, 14, 1160, 492, 22538, 199, 199, 504, 1639, 14, 2828, 492, 3788, 199, 504, 1639, 14, 2828, 14, 2113, 14, 4196, 14, 11582, 492, 12622, 63, 1114, 63, 2427, 199, 504, 1639, 14, 2828, 14, 1178, 14, 11582, 492, 4676, 63, 2427, 199, 199, 504, 1847, 9613, 438, 14, 83, 678, 83, 1384, 63, 496, 14, 3351, 492, 428, 29733, 5039, 2821, 12, 428, 29733, 11347, 2821, 12, 428, 29733, 34, 6349, 14948, 14736, 199, 504, 1847, 9613, 438, 14, 83, 678, 83, 1384, 63, 496, 14, 992, 492, 428, 29733, 12, 428, 29733, 34, 6349, 3269, 421, 199, 318, 4409, 63, 889, 63, 83, 29733, 3319, 8, 2118, 63, 2682, 29, 797, 304, 272, 347, 6506, 8, 1532, 304, 267, 768, 13582, 8, 1532, 9, 267, 347, 2455, 8, 1069, 12, 627, 589, 12, 1011, 958, 304, 288, 340, 1056, 14, 751, 14, 374, 63, 12177, 837, 355, 862, 26, 490, 308, 29733, 3319, 275, 1056, 14, 751, 14, 83, 29733, 3319, 355, 871, 428, 29733, 14, 7400, 26, 490, 986, 355, 587, 26, 490, 340, 440, 1454, 63, 2682, 503, 308, 29733, 3319, 14, 2682, 26, 717, 372, 4660, 8, 83, 29733, 3319, 9, 288, 372, 2562, 8, 1069, 12, 627, 589, 12, 1011, 958, 9, 267, 372, 2455, 272, 372, 6506, 421, 199, 318, 308, 29733, 63, 815, 8, 1069, 304, 272, 372, 3795, 63, 475, 63, 1310, 480, 83, 678, 83, 1384, 15, 815, 14, 1360, 401, 469, 272, 1660, 1067, 63, 842, 29, 17679, 8, 1069, 430, 421, 199, 32, 2886, 63, 2427, 199, 32, 4365, 63, 889, 63, 83, 29733, 3319, 342, 199, 318, 308, 29733, 63, 4998, 8, 1069, 304, 272, 340, 1056, 14, 765, 508, 298, 4030, 582, 267, 1824, 275, 428, 29733, 5039, 2821, 8, 1069, 14, 4030, 12, 922, 29, 1069, 14, 751, 9, 267, 340, 1824, 14, 374, 63, 1078, 837, 288, 1824, 14, 2117, 342, 288, 372, 4660, 480, 83, 29733, 63, 815, 531, 272, 587, 26, 267, 1824, 275, 428, 29733, 5039, 2821, 8, 751, 29, 1069, 14, 751, 9, 272, 372, 3795, 63, 475, 63, 1310, 480, 83, 678, 83, 1384, 15, 4998, 14, 1360, 401, 469, 267, 298, 964, 582, 1824, 12, 272, 1660, 1067, 63, 842, 29, 17679, 8, 1069, 430, 421, 199, 32, 2886, 63, 2427, 199, 318, 308, 29733, 63, 5506, 8, 1069, 12, 3803, 304, 272, 308, 29733, 275, 664, 63, 785, 63, 269, 63, 5188, 8, 51, 29733, 12, 3803, 29, 2051, 9, 2286, 340, 440, 308, 29733, 14, 2682, 503, 308, 29733, 14, 21276, 867, 1137, 1056, 14, 751, 26, 267, 372, 4660, 480, 83, 29733, 63, 815, 531, 2286, 11068, 63, 958, 275, 469, 267, 298, 842, 582, 308, 29733, 12, 267, 298, 7924, 582, 428, 29733, 34, 6349, 3269, 14, 1462, 14, 1541, 8, 2682, 29, 549, 9, 272, 789, 2286, 340, 1056, 14, 765, 508, 298, 4030, 582, 2728, 1824, 275, 428, 29733, 11347, 2821, 8, 1069, 14, 4030, 12, 1256, 29, 83, 29733, 9, 267, 11068, 275, 428, 29733, 34, 6349, 14948, 14736, 8, 1069, 14, 4030, 12, 1056, 14, 9472, 12, 1011, 10724, 63, 958, 9, 2728, 340, 1824, 14, 374, 63, 1078, 342, 436, 11068, 14, 374, 63, 1078, 837, 288, 1824, 14, 2117, 342, 288, 11068, 14, 2117, 342, 7846, 3788, 14, 3742, 8, 1069, 12, 298, 14398, 308, 29733, 3319, 4223, 965, 2757, 16930, 9124, 7846, 372, 4660, 8, 1069, 14, 515, 9, 272, 587, 26, 267, 1824, 275, 428, 29733, 11347, 2821, 8, 842, 29, 83, 29733, 9, 267, 11068, 275, 428, 29733, 34, 6349, 14948, 14736, 3682, 10724, 63, 958, 9, 2286, 372, 3795, 63, 475, 63, 1310, 480, 83, 678, 83, 1384, 15, 5506, 14, 1360, 401, 469, 267, 298, 83, 29733, 582, 308, 29733, 12, 267, 298, 964, 582, 1824, 12, 267, 298, 10724, 582, 11068, 12, 272, 1660, 1067, 63, 842, 29, 17679, 8, 1069, 430, 421, 199, 32, 7018, 63, 1114, 63, 2427, 199, 318, 308, 29733, 63, 3790, 63, 576, 8, 1069, 304, 272, 308, 678, 83, 1384, 275, 942, 272, 666, 275, 3087, 2286, 367, 308, 29733, 315, 428, 29733, 14, 1462, 14, 1648, 63, 991, 480, 3270, 2349, 267, 366, 275, 469, 288, 298, 354, 582, 308, 29733, 14, 354, 12, 288, 298, 633, 582, 308, 29733, 14, 5159, 63, 633, 12, 288, 298, 1896, 582, 334, 83, 29733, 14, 1896, 14, 1648, 12, 308, 29733, 14, 1896, 14, 354, 395, 288, 298, 1802, 582, 4873, 267, 789, 267, 367, 308, 29733, 63, 66, 6349, 3269, 315, 308, 29733, 14, 83, 29733, 63, 66, 6349, 14948, 14, 452, 837, 288, 340, 308, 29733, 63, 66, 6349, 3269, 14, 66, 6349, 3269, 63, 344, 508, 499, 26, 355, 366, 905, 1802, 937, 275, 308, 29733, 63, 66, 6349, 3269, 14, 505, 267, 308, 678, 83, 1384, 14, 740, 8, 68, 9, 2286, 347, 28697, 63, 20820, 2031, 589, 304, 267, 289, 86, 275, 488, 267, 347, 13792, 8, 5337, 30982, 13692, 3672, 8, 552, 8, 589, 7216, 17, 4992, 1935, 304, 288, 1995, 7055, 342, 267, 284, 878, 275, 359, 17691, 14, 4429, 8, 390, 12, 13792, 1062, 7975, 14, 8755, 8, 13692, 430, 367, 652, 315, 1249, 61, 267, 862, 26, 288, 367, 16477, 315, 7975, 14, 565, 711, 2031, 15266, 304, 355, 1995, 16477, 267, 871, 7888, 26, 288, 986, 272, 347, 24859, 8, 8147, 304, 267, 282, 12, 330, 275, 7975, 14, 15557, 8, 8147, 9, 267, 330, 14, 2184, 342, 267, 372, 28697, 63, 20820, 8, 65, 12, 330, 9, 2286, 347, 2166, 63, 498, 8, 83, 304, 267, 372, 308, 905, 1896, 937, 2286, 367, 2166, 12, 2166, 63, 83, 678, 83, 1384, 315, 7975, 14, 16968, 8, 5917, 8, 83, 678, 83, 1384, 12, 790, 29, 1896, 63, 498, 395, 2166, 63, 498, 304, 267, 666, 847, 2071, 83, 60, 78, 2, 450, 19372, 2, 627, 334, 552, 8, 1896, 59 ]
[ 7975, 199, 199, 504, 9143, 492, 14018, 199, 199, 504, 1639, 14, 1014, 492, 6183, 199, 504, 1639, 14, 17469, 492, 3795, 63, 475, 63, 1310, 12, 4660, 12, 664, 63, 785, 63, 269, 63, 5188, 199, 504, 1639, 14, 1160, 492, 22538, 199, 199, 504, 1639, 14, 2828, 492, 3788, 199, 504, 1639, 14, 2828, 14, 2113, 14, 4196, 14, 11582, 492, 12622, 63, 1114, 63, 2427, 199, 504, 1639, 14, 2828, 14, 1178, 14, 11582, 492, 4676, 63, 2427, 199, 199, 504, 1847, 9613, 438, 14, 83, 678, 83, 1384, 63, 496, 14, 3351, 492, 428, 29733, 5039, 2821, 12, 428, 29733, 11347, 2821, 12, 428, 29733, 34, 6349, 14948, 14736, 199, 504, 1847, 9613, 438, 14, 83, 678, 83, 1384, 63, 496, 14, 992, 492, 428, 29733, 12, 428, 29733, 34, 6349, 3269, 421, 199, 318, 4409, 63, 889, 63, 83, 29733, 3319, 8, 2118, 63, 2682, 29, 797, 304, 272, 347, 6506, 8, 1532, 304, 267, 768, 13582, 8, 1532, 9, 267, 347, 2455, 8, 1069, 12, 627, 589, 12, 1011, 958, 304, 288, 340, 1056, 14, 751, 14, 374, 63, 12177, 837, 355, 862, 26, 490, 308, 29733, 3319, 275, 1056, 14, 751, 14, 83, 29733, 3319, 355, 871, 428, 29733, 14, 7400, 26, 490, 986, 355, 587, 26, 490, 340, 440, 1454, 63, 2682, 503, 308, 29733, 3319, 14, 2682, 26, 717, 372, 4660, 8, 83, 29733, 3319, 9, 288, 372, 2562, 8, 1069, 12, 627, 589, 12, 1011, 958, 9, 267, 372, 2455, 272, 372, 6506, 421, 199, 318, 308, 29733, 63, 815, 8, 1069, 304, 272, 372, 3795, 63, 475, 63, 1310, 480, 83, 678, 83, 1384, 15, 815, 14, 1360, 401, 469, 272, 1660, 1067, 63, 842, 29, 17679, 8, 1069, 430, 421, 199, 32, 2886, 63, 2427, 199, 32, 4365, 63, 889, 63, 83, 29733, 3319, 342, 199, 318, 308, 29733, 63, 4998, 8, 1069, 304, 272, 340, 1056, 14, 765, 508, 298, 4030, 582, 267, 1824, 275, 428, 29733, 5039, 2821, 8, 1069, 14, 4030, 12, 922, 29, 1069, 14, 751, 9, 267, 340, 1824, 14, 374, 63, 1078, 837, 288, 1824, 14, 2117, 342, 288, 372, 4660, 480, 83, 29733, 63, 815, 531, 272, 587, 26, 267, 1824, 275, 428, 29733, 5039, 2821, 8, 751, 29, 1069, 14, 751, 9, 272, 372, 3795, 63, 475, 63, 1310, 480, 83, 678, 83, 1384, 15, 4998, 14, 1360, 401, 469, 267, 298, 964, 582, 1824, 12, 272, 1660, 1067, 63, 842, 29, 17679, 8, 1069, 430, 421, 199, 32, 2886, 63, 2427, 199, 318, 308, 29733, 63, 5506, 8, 1069, 12, 3803, 304, 272, 308, 29733, 275, 664, 63, 785, 63, 269, 63, 5188, 8, 51, 29733, 12, 3803, 29, 2051, 9, 2286, 340, 440, 308, 29733, 14, 2682, 503, 308, 29733, 14, 21276, 867, 1137, 1056, 14, 751, 26, 267, 372, 4660, 480, 83, 29733, 63, 815, 531, 2286, 11068, 63, 958, 275, 469, 267, 298, 842, 582, 308, 29733, 12, 267, 298, 7924, 582, 428, 29733, 34, 6349, 3269, 14, 1462, 14, 1541, 8, 2682, 29, 549, 9, 272, 789, 2286, 340, 1056, 14, 765, 508, 298, 4030, 582, 2728, 1824, 275, 428, 29733, 11347, 2821, 8, 1069, 14, 4030, 12, 1256, 29, 83, 29733, 9, 267, 11068, 275, 428, 29733, 34, 6349, 14948, 14736, 8, 1069, 14, 4030, 12, 1056, 14, 9472, 12, 1011, 10724, 63, 958, 9, 2728, 340, 1824, 14, 374, 63, 1078, 342, 436, 11068, 14, 374, 63, 1078, 837, 288, 1824, 14, 2117, 342, 288, 11068, 14, 2117, 342, 7846, 3788, 14, 3742, 8, 1069, 12, 298, 14398, 308, 29733, 3319, 4223, 965, 2757, 16930, 9124, 7846, 372, 4660, 8, 1069, 14, 515, 9, 272, 587, 26, 267, 1824, 275, 428, 29733, 11347, 2821, 8, 842, 29, 83, 29733, 9, 267, 11068, 275, 428, 29733, 34, 6349, 14948, 14736, 3682, 10724, 63, 958, 9, 2286, 372, 3795, 63, 475, 63, 1310, 480, 83, 678, 83, 1384, 15, 5506, 14, 1360, 401, 469, 267, 298, 83, 29733, 582, 308, 29733, 12, 267, 298, 964, 582, 1824, 12, 267, 298, 10724, 582, 11068, 12, 272, 1660, 1067, 63, 842, 29, 17679, 8, 1069, 430, 421, 199, 32, 7018, 63, 1114, 63, 2427, 199, 318, 308, 29733, 63, 3790, 63, 576, 8, 1069, 304, 272, 308, 678, 83, 1384, 275, 942, 272, 666, 275, 3087, 2286, 367, 308, 29733, 315, 428, 29733, 14, 1462, 14, 1648, 63, 991, 480, 3270, 2349, 267, 366, 275, 469, 288, 298, 354, 582, 308, 29733, 14, 354, 12, 288, 298, 633, 582, 308, 29733, 14, 5159, 63, 633, 12, 288, 298, 1896, 582, 334, 83, 29733, 14, 1896, 14, 1648, 12, 308, 29733, 14, 1896, 14, 354, 395, 288, 298, 1802, 582, 4873, 267, 789, 267, 367, 308, 29733, 63, 66, 6349, 3269, 315, 308, 29733, 14, 83, 29733, 63, 66, 6349, 14948, 14, 452, 837, 288, 340, 308, 29733, 63, 66, 6349, 3269, 14, 66, 6349, 3269, 63, 344, 508, 499, 26, 355, 366, 905, 1802, 937, 275, 308, 29733, 63, 66, 6349, 3269, 14, 505, 267, 308, 678, 83, 1384, 14, 740, 8, 68, 9, 2286, 347, 28697, 63, 20820, 2031, 589, 304, 267, 289, 86, 275, 488, 267, 347, 13792, 8, 5337, 30982, 13692, 3672, 8, 552, 8, 589, 7216, 17, 4992, 1935, 304, 288, 1995, 7055, 342, 267, 284, 878, 275, 359, 17691, 14, 4429, 8, 390, 12, 13792, 1062, 7975, 14, 8755, 8, 13692, 430, 367, 652, 315, 1249, 61, 267, 862, 26, 288, 367, 16477, 315, 7975, 14, 565, 711, 2031, 15266, 304, 355, 1995, 16477, 267, 871, 7888, 26, 288, 986, 272, 347, 24859, 8, 8147, 304, 267, 282, 12, 330, 275, 7975, 14, 15557, 8, 8147, 9, 267, 330, 14, 2184, 342, 267, 372, 28697, 63, 20820, 8, 65, 12, 330, 9, 2286, 347, 2166, 63, 498, 8, 83, 304, 267, 372, 308, 905, 1896, 937, 2286, 367, 2166, 12, 2166, 63, 83, 678, 83, 1384, 315, 7975, 14, 16968, 8, 5917, 8, 83, 678, 83,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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 ]
vbelakov/h2o
py/testdir_multi_jvm/notest_create_rebalance_2enum.py
9
5646
import unittest, random, sys, time sys.path.extend(['.','..','../..','py']) import h2o, h2o_cmd, h2o_util, h2o_import as h2i REBALANCE_CHUNKS = 100 print "Keeping the # of rows > the number of chunks I ask for. Is that a requirement?" paramDict = { 'rows': [100,1000], 'cols': [1,10,100], # Number of data columns (in addition to the first response column) 'seed': [None, 1234], 'randomize': [None, 0, 1], 'value': [None, 0, 1234567890, 1e6, -1e6], # Constant value (for randomize=false) 'real_range': [None, 0, 1234567890, 1e6, -1e6], # -range to range 'categorical_fraction': [None, 0.1, 1.0], # Fraction of integer columns (for randomize=true) 'factors': [None, 5, 17], # Factor levels for categorical variables 'integer_fraction': [None, 0.1, 1.0], # Fraction of integer columns (for randomize=true) 'integer_range': [None, 0, 1, 1234567890], # -range to range 'missing_fraction': [None, 0.1, 1.0], 'response_factors': [None, 1, 2, 10], # Number of factor levels of the first column (1=real, 2=binomial, N=multinomial) } class Basic(unittest.TestCase): def tearDown(self): h2o.check_sandbox_for_errors() @classmethod def setUpClass(cls): global SEED SEED = h2o.setup_random_seed() h2o.init(3) global SYNDATASETS_DIR SYNDATASETS_DIR = h2o.make_syn_dir() @classmethod def tearDownClass(cls): h2o.tear_down_cloud() def test_create_rebalance_2enum(self): # default params = { 'rows': 100, 'cols': 1 } for trial in range(20): # CREATE FRAME params################################################################ h2o_util.pickRandParams(paramDict, params) i = params.get('integer_fraction', None) c = params.get('categorical_fraction', None) r = params.get('randomize', None) v = params.get('value', None) # h2o does some strict checking on the combinations of these things # fractions have to add up to <= 1 and only be used if randomize # h2o default randomize=1? if r: if not i: i = 0 if not c: c = 0 if (i and c) and (i + c) >= 1.0: c = 1.0 - i params['integer_fraction'] = i params['categorical_fraction'] = c params['value'] = None else: params['randomize'] = 0 params['integer_fraction'] = 0 params['categorical_fraction'] = 0 # CREATE FRAME***************************************************** kwargs = params.copy() print kwargs timeoutSecs = 300 hex_key='temp1000.hex' cfResult = h2o.nodes[0].create_frame(key=hex_key, timeoutSecs=timeoutSecs, **kwargs) # REBALANCE***************************************************** print "Rebalancing it to create an artificially large # of chunks" rb_key = "rb_%s" % (hex_key) start = time.time() print "Rebalancing %s to %s with %s chunks" % (hex_key, rb_key, REBALANCE_CHUNKS) SEEDPERFILE = random.randint(0, sys.maxint) rebalanceResult = h2o.nodes[0].rebalance(source=hex_key, after=rb_key, chunks=REBALANCE_CHUNKS) elapsed = time.time() - start print "rebalance end on ", hex_key, 'to', rb_key, 'took', elapsed, 'seconds',\ # TO ENUM***************************************************** print "Now doing to_enum across all columns of %s" % rb_key for column_index in range(params['cols']): # is the column index 1-base in to_enum result = h2o.nodes[0].to_enum(None, src_key=rb_key, column_index=column_index+1) # print "\nto_enum result:", h2o.dump_json(result) summaryResult = h2o_cmd.runSummary(key=hex_key) # check that it at least is an enum column now, with no na's # just look at the column we touched column = summaryResult['summaries'][column_index] colname = column['colname'] coltype = column['type'] nacnt = column['nacnt'] stats = column['stats'] stattype = stats['type'] # we have some # of na's in the columns...but there should not be 100% NA if nacnt>=params['rows']: raise Exception("column %s, which has name '%s', somehow too many NAs after convert to Enum %s %s" % (column_index, colname, nacnt, params['rows'])) print "I suspect that columns that are constant, maybe with NAs also, don't convert to Enum" if stattype != 'Enum': raise Exception("column %s, which has name '%s', didn't convert to Enum, is %s %s %s" % (column_index, colname, stattype, coltype, h2o.dump_json(column))) cardinality = stats['cardinality'] # don't know the cardinality expected # if cardinality!=4: # raise Exception("column %s, which has name '%s', should have cardinality 4, got: %s" % # (column_index, colname, cardinality)) h2o_cmd.infoFromSummary(summaryResult) print "Trial #", trial, "completed" if __name__ == '__main__': h2o.unit_main()
apache-2.0
[ 646, 2882, 12, 2196, 12, 984, 12, 900, 199, 1274, 14, 515, 14, 2880, 2941, 14, 1673, 703, 1673, 5093, 703, 1673, 647, 1105, 199, 646, 394, 18, 79, 12, 394, 18, 79, 63, 1760, 12, 394, 18, 79, 63, 1974, 12, 394, 18, 79, 63, 646, 465, 394, 18, 73, 199, 199, 907, 31232, 7140, 63, 20512, 51, 275, 2948, 199, 199, 1361, 298, 43, 1024, 4073, 314, 327, 402, 4730, 690, 314, 1329, 402, 8291, 473, 7198, 367, 14, 6596, 626, 282, 10685, 13472, 199, 635, 2141, 275, 469, 272, 283, 3838, 356, 359, 1960, 12, 5279, 467, 272, 283, 4574, 356, 359, 17, 12, 709, 12, 1960, 467, 327, 4860, 402, 666, 4362, 334, 262, 10234, 370, 314, 1642, 1177, 2763, 9, 272, 283, 5176, 356, 359, 403, 12, 14763, 467, 272, 283, 28610, 356, 359, 403, 12, 378, 12, 413, 467, 272, 283, 585, 356, 359, 403, 12, 378, 12, 32695, 16, 12, 413, 69, 22, 12, 446, 17, 69, 22, 467, 327, 19991, 574, 334, 509, 2196, 794, 29, 3910, 9, 272, 283, 3093, 63, 1842, 356, 359, 403, 12, 378, 12, 32695, 16, 12, 413, 69, 22, 12, 446, 17, 69, 22, 467, 327, 446, 1842, 370, 1425, 272, 283, 16810, 63, 13054, 356, 359, 403, 12, 378, 14, 17, 12, 413, 14, 16, 467, 327, 17980, 402, 3000, 4362, 334, 509, 2196, 794, 29, 2052, 9, 272, 283, 16125, 356, 359, 403, 12, 959, 12, 5557, 467, 327, 27348, 11106, 367, 22138, 2860, 272, 283, 4115, 63, 13054, 356, 359, 403, 12, 378, 14, 17, 12, 413, 14, 16, 467, 327, 17980, 402, 3000, 4362, 334, 509, 2196, 794, 29, 2052, 9, 272, 283, 4115, 63, 1842, 356, 359, 403, 12, 378, 12, 413, 12, 32695, 16, 467, 327, 446, 1842, 370, 1425, 272, 283, 4752, 63, 13054, 356, 359, 403, 12, 378, 14, 17, 12, 413, 14, 16, 467, 272, 283, 1310, 63, 16125, 356, 359, 403, 12, 413, 12, 499, 12, 1616, 467, 327, 4860, 402, 6535, 11106, 402, 314, 1642, 2763, 334, 17, 29, 3093, 12, 499, 29, 27578, 12, 653, 29, 28265, 9, 199, 93, 199, 199, 533, 10082, 8, 2796, 14, 1746, 304, 272, 347, 6766, 8, 277, 304, 267, 394, 18, 79, 14, 1074, 63, 16647, 63, 509, 63, 2550, 342, 339, 768, 3744, 272, 347, 18561, 8, 1886, 304, 267, 2288, 5795, 1149, 267, 5795, 1149, 275, 394, 18, 79, 14, 2758, 63, 2355, 63, 5176, 342, 267, 394, 18, 79, 14, 826, 8, 19, 9, 267, 2288, 10046, 46, 28231, 30416, 63, 3022, 267, 10046, 46, 28231, 30416, 63, 3022, 275, 394, 18, 79, 14, 1875, 63, 9466, 63, 694, 342, 339, 768, 3744, 272, 347, 24468, 8, 1886, 304, 267, 394, 18, 79, 14, 266, 285, 63, 2110, 63, 4091, 342, 339, 347, 511, 63, 981, 63, 264, 7358, 63, 18, 4869, 8, 277, 304, 267, 327, 849, 267, 1862, 275, 469, 288, 283, 3838, 356, 2948, 12, 7205, 283, 4574, 356, 413, 267, 789, 267, 367, 16324, 315, 1425, 8, 1165, 304, 288, 327, 16999, 28671, 1991, 1862, 3060, 288, 394, 18, 79, 63, 1974, 14, 4510, 50, 460, 6007, 8, 635, 2141, 12, 1862, 9, 288, 284, 275, 1862, 14, 362, 360, 4115, 63, 13054, 297, 488, 9, 288, 286, 275, 1862, 14, 362, 360, 16810, 63, 13054, 297, 488, 9, 288, 519, 275, 1862, 14, 362, 360, 28610, 297, 488, 9, 288, 373, 275, 1862, 14, 362, 360, 585, 297, 488, 9, 288, 327, 394, 18, 79, 1630, 2005, 7478, 7907, 641, 314, 15821, 402, 3520, 7645, 288, 327, 28213, 2452, 1172, 370, 1050, 1536, 370, 2695, 413, 436, 1454, 506, 1202, 340, 2196, 794, 288, 327, 394, 18, 79, 849, 2196, 794, 29, 17, 31, 288, 340, 519, 26, 355, 340, 440, 284, 26, 259, 490, 284, 275, 378, 355, 340, 440, 286, 26, 490, 286, 275, 378, 355, 340, 334, 73, 436, 286, 9, 436, 334, 73, 435, 286, 9, 2356, 413, 14, 16, 26, 490, 286, 275, 413, 14, 16, 446, 284, 355, 1862, 459, 4115, 63, 13054, 418, 275, 284, 355, 1862, 459, 16810, 63, 13054, 418, 275, 286, 355, 1862, 459, 585, 418, 275, 488, 24850, 587, 26, 355, 1862, 459, 28610, 418, 275, 378, 355, 1862, 459, 4115, 63, 13054, 418, 275, 378, 355, 1862, 459, 16810, 63, 13054, 418, 275, 378, 22919, 327, 16999, 28671, 1991, 5815, 3096, 1116, 10, 288, 2074, 275, 1862, 14, 1574, 342, 288, 870, 2074, 288, 2653, 29224, 275, 9601, 288, 6318, 63, 498, 534, 808, 5279, 14, 4097, 7, 288, 3980, 2889, 275, 394, 18, 79, 14, 2415, 59, 16, 1055, 981, 63, 1943, 8, 498, 29, 4097, 63, 498, 12, 2653, 29224, 29, 2593, 29224, 12, 1011, 958, 9, 953, 327, 5363, 31232, 7140, 5815, 3096, 1116, 10, 288, 870, 298, 497, 30260, 652, 370, 1218, 376, 601, 1428, 559, 1183, 7031, 327, 402, 8291, 2, 288, 11587, 63, 498, 275, 298, 4848, 4970, 83, 2, 450, 334, 4097, 63, 498, 9, 288, 1343, 275, 900, 14, 521, 342, 288, 870, 298, 497, 30260, 450, 83, 370, 450, 83, 543, 450, 83, 8291, 2, 450, 334, 4097, 63, 498, 12, 11587, 63, 498, 12, 5363, 31232, 7140, 63, 20512, 51, 9, 288, 5795, 1149, 4227, 3817, 275, 2196, 14, 8393, 8, 16, 12, 984, 14, 21411, 9, 288, 295, 7358, 2889, 275, 394, 18, 79, 14, 2415, 59, 16, 1055, 264, 7358, 8, 1365, 29, 4097, 63, 498, 12, 2410, 29, 4848, 63, 498, 12, 8291, 29, 907, 31232, 7140, 63, 20512, 51, 9, 288, 14439, 275, 900, 14, 521, 342, 446, 1343, 288, 870, 298, 264, 7358, 1284, 641, 3872, 6318, 63, 498, 12, 283, 475, 297, 11587, 63, 498, 12, 283, 475, 745, 297, 14439, 12, 283, 4515, 30989, 953, 327, 2296, 662, 7125, 5815, 3096, 1116, 10, 288, 870, 298, 14351, 9689, 370, 63, 4869, 9371, 1006, 4362, 402, 450, 83, 2, 450, 11587, 63, 498, 288, 367, 2763, 63, 1080, 315, 1425, 8, 1162, 459, 4574, 9090, 355, 327, 365, 314, 2763, 1478, 413, 13, 1095, 315, 370, 63, 4869, 355, 754, 275, 394, 18, 79, 14 ]
[ 2882, 12, 2196, 12, 984, 12, 900, 199, 1274, 14, 515, 14, 2880, 2941, 14, 1673, 703, 1673, 5093, 703, 1673, 647, 1105, 199, 646, 394, 18, 79, 12, 394, 18, 79, 63, 1760, 12, 394, 18, 79, 63, 1974, 12, 394, 18, 79, 63, 646, 465, 394, 18, 73, 199, 199, 907, 31232, 7140, 63, 20512, 51, 275, 2948, 199, 199, 1361, 298, 43, 1024, 4073, 314, 327, 402, 4730, 690, 314, 1329, 402, 8291, 473, 7198, 367, 14, 6596, 626, 282, 10685, 13472, 199, 635, 2141, 275, 469, 272, 283, 3838, 356, 359, 1960, 12, 5279, 467, 272, 283, 4574, 356, 359, 17, 12, 709, 12, 1960, 467, 327, 4860, 402, 666, 4362, 334, 262, 10234, 370, 314, 1642, 1177, 2763, 9, 272, 283, 5176, 356, 359, 403, 12, 14763, 467, 272, 283, 28610, 356, 359, 403, 12, 378, 12, 413, 467, 272, 283, 585, 356, 359, 403, 12, 378, 12, 32695, 16, 12, 413, 69, 22, 12, 446, 17, 69, 22, 467, 327, 19991, 574, 334, 509, 2196, 794, 29, 3910, 9, 272, 283, 3093, 63, 1842, 356, 359, 403, 12, 378, 12, 32695, 16, 12, 413, 69, 22, 12, 446, 17, 69, 22, 467, 327, 446, 1842, 370, 1425, 272, 283, 16810, 63, 13054, 356, 359, 403, 12, 378, 14, 17, 12, 413, 14, 16, 467, 327, 17980, 402, 3000, 4362, 334, 509, 2196, 794, 29, 2052, 9, 272, 283, 16125, 356, 359, 403, 12, 959, 12, 5557, 467, 327, 27348, 11106, 367, 22138, 2860, 272, 283, 4115, 63, 13054, 356, 359, 403, 12, 378, 14, 17, 12, 413, 14, 16, 467, 327, 17980, 402, 3000, 4362, 334, 509, 2196, 794, 29, 2052, 9, 272, 283, 4115, 63, 1842, 356, 359, 403, 12, 378, 12, 413, 12, 32695, 16, 467, 327, 446, 1842, 370, 1425, 272, 283, 4752, 63, 13054, 356, 359, 403, 12, 378, 14, 17, 12, 413, 14, 16, 467, 272, 283, 1310, 63, 16125, 356, 359, 403, 12, 413, 12, 499, 12, 1616, 467, 327, 4860, 402, 6535, 11106, 402, 314, 1642, 2763, 334, 17, 29, 3093, 12, 499, 29, 27578, 12, 653, 29, 28265, 9, 199, 93, 199, 199, 533, 10082, 8, 2796, 14, 1746, 304, 272, 347, 6766, 8, 277, 304, 267, 394, 18, 79, 14, 1074, 63, 16647, 63, 509, 63, 2550, 342, 339, 768, 3744, 272, 347, 18561, 8, 1886, 304, 267, 2288, 5795, 1149, 267, 5795, 1149, 275, 394, 18, 79, 14, 2758, 63, 2355, 63, 5176, 342, 267, 394, 18, 79, 14, 826, 8, 19, 9, 267, 2288, 10046, 46, 28231, 30416, 63, 3022, 267, 10046, 46, 28231, 30416, 63, 3022, 275, 394, 18, 79, 14, 1875, 63, 9466, 63, 694, 342, 339, 768, 3744, 272, 347, 24468, 8, 1886, 304, 267, 394, 18, 79, 14, 266, 285, 63, 2110, 63, 4091, 342, 339, 347, 511, 63, 981, 63, 264, 7358, 63, 18, 4869, 8, 277, 304, 267, 327, 849, 267, 1862, 275, 469, 288, 283, 3838, 356, 2948, 12, 7205, 283, 4574, 356, 413, 267, 789, 267, 367, 16324, 315, 1425, 8, 1165, 304, 288, 327, 16999, 28671, 1991, 1862, 3060, 288, 394, 18, 79, 63, 1974, 14, 4510, 50, 460, 6007, 8, 635, 2141, 12, 1862, 9, 288, 284, 275, 1862, 14, 362, 360, 4115, 63, 13054, 297, 488, 9, 288, 286, 275, 1862, 14, 362, 360, 16810, 63, 13054, 297, 488, 9, 288, 519, 275, 1862, 14, 362, 360, 28610, 297, 488, 9, 288, 373, 275, 1862, 14, 362, 360, 585, 297, 488, 9, 288, 327, 394, 18, 79, 1630, 2005, 7478, 7907, 641, 314, 15821, 402, 3520, 7645, 288, 327, 28213, 2452, 1172, 370, 1050, 1536, 370, 2695, 413, 436, 1454, 506, 1202, 340, 2196, 794, 288, 327, 394, 18, 79, 849, 2196, 794, 29, 17, 31, 288, 340, 519, 26, 355, 340, 440, 284, 26, 259, 490, 284, 275, 378, 355, 340, 440, 286, 26, 490, 286, 275, 378, 355, 340, 334, 73, 436, 286, 9, 436, 334, 73, 435, 286, 9, 2356, 413, 14, 16, 26, 490, 286, 275, 413, 14, 16, 446, 284, 355, 1862, 459, 4115, 63, 13054, 418, 275, 284, 355, 1862, 459, 16810, 63, 13054, 418, 275, 286, 355, 1862, 459, 585, 418, 275, 488, 24850, 587, 26, 355, 1862, 459, 28610, 418, 275, 378, 355, 1862, 459, 4115, 63, 13054, 418, 275, 378, 355, 1862, 459, 16810, 63, 13054, 418, 275, 378, 22919, 327, 16999, 28671, 1991, 5815, 3096, 1116, 10, 288, 2074, 275, 1862, 14, 1574, 342, 288, 870, 2074, 288, 2653, 29224, 275, 9601, 288, 6318, 63, 498, 534, 808, 5279, 14, 4097, 7, 288, 3980, 2889, 275, 394, 18, 79, 14, 2415, 59, 16, 1055, 981, 63, 1943, 8, 498, 29, 4097, 63, 498, 12, 2653, 29224, 29, 2593, 29224, 12, 1011, 958, 9, 953, 327, 5363, 31232, 7140, 5815, 3096, 1116, 10, 288, 870, 298, 497, 30260, 652, 370, 1218, 376, 601, 1428, 559, 1183, 7031, 327, 402, 8291, 2, 288, 11587, 63, 498, 275, 298, 4848, 4970, 83, 2, 450, 334, 4097, 63, 498, 9, 288, 1343, 275, 900, 14, 521, 342, 288, 870, 298, 497, 30260, 450, 83, 370, 450, 83, 543, 450, 83, 8291, 2, 450, 334, 4097, 63, 498, 12, 11587, 63, 498, 12, 5363, 31232, 7140, 63, 20512, 51, 9, 288, 5795, 1149, 4227, 3817, 275, 2196, 14, 8393, 8, 16, 12, 984, 14, 21411, 9, 288, 295, 7358, 2889, 275, 394, 18, 79, 14, 2415, 59, 16, 1055, 264, 7358, 8, 1365, 29, 4097, 63, 498, 12, 2410, 29, 4848, 63, 498, 12, 8291, 29, 907, 31232, 7140, 63, 20512, 51, 9, 288, 14439, 275, 900, 14, 521, 342, 446, 1343, 288, 870, 298, 264, 7358, 1284, 641, 3872, 6318, 63, 498, 12, 283, 475, 297, 11587, 63, 498, 12, 283, 475, 745, 297, 14439, 12, 283, 4515, 30989, 953, 327, 2296, 662, 7125, 5815, 3096, 1116, 10, 288, 870, 298, 14351, 9689, 370, 63, 4869, 9371, 1006, 4362, 402, 450, 83, 2, 450, 11587, 63, 498, 288, 367, 2763, 63, 1080, 315, 1425, 8, 1162, 459, 4574, 9090, 355, 327, 365, 314, 2763, 1478, 413, 13, 1095, 315, 370, 63, 4869, 355, 754, 275, 394, 18, 79, 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,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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 ]
Shaswat27/sympy
sympy/polys/agca/tests/test_modules.py
121
13526
"""Test modules.py code.""" from sympy.polys.agca.modules import FreeModule, ModuleOrder, FreeModulePolyRing from sympy.polys import CoercionFailed, QQ, lex, grlex, ilex, ZZ from sympy.abc import x, y, z from sympy.utilities.pytest import raises from sympy import S def test_FreeModuleElement(): M = QQ.old_poly_ring(x).free_module(3) e = M.convert([1, x, x**2]) f = [QQ.old_poly_ring(x).convert(1), QQ.old_poly_ring(x).convert(x), QQ.old_poly_ring(x).convert(x**2)] assert list(e) == f assert f[0] == e[0] assert f[1] == e[1] assert f[2] == e[2] raises(IndexError, lambda: e[3]) g = M.convert([x, 0, 0]) assert e + g == M.convert([x + 1, x, x**2]) assert f + g == M.convert([x + 1, x, x**2]) assert -e == M.convert([-1, -x, -x**2]) assert e - g == M.convert([1 - x, x, x**2]) assert e != g assert M.convert([x, x, x]) / QQ.old_poly_ring(x).convert(x) == [1, 1, 1] R = QQ.old_poly_ring(x, order="ilex") assert R.free_module(1).convert([x]) / R.convert(x) == [1] def test_FreeModule(): M1 = FreeModule(QQ.old_poly_ring(x), 2) assert M1 == FreeModule(QQ.old_poly_ring(x), 2) assert M1 != FreeModule(QQ.old_poly_ring(y), 2) assert M1 != FreeModule(QQ.old_poly_ring(x), 3) M2 = FreeModule(QQ.old_poly_ring(x, order="ilex"), 2) assert [x, 1] in M1 assert [x] not in M1 assert [2, y] not in M1 assert [1/(x + 1), 2] not in M1 e = M1.convert([x, x**2 + 1]) X = QQ.old_poly_ring(x).convert(x) assert e == [X, X**2 + 1] assert e == [x, x**2 + 1] assert 2*e == [2*x, 2*x**2 + 2] assert e*2 == [2*x, 2*x**2 + 2] assert e/2 == [x/2, (x**2 + 1)/2] assert x*e == [x**2, x**3 + x] assert e*x == [x**2, x**3 + x] assert X*e == [x**2, x**3 + x] assert e*X == [x**2, x**3 + x] assert [x, 1] in M2 assert [x] not in M2 assert [2, y] not in M2 assert [1/(x + 1), 2] in M2 e = M2.convert([x, x**2 + 1]) X = QQ.old_poly_ring(x, order="ilex").convert(x) assert e == [X, X**2 + 1] assert e == [x, x**2 + 1] assert 2*e == [2*x, 2*x**2 + 2] assert e*2 == [2*x, 2*x**2 + 2] assert e/2 == [x/2, (x**2 + 1)/2] assert x*e == [x**2, x**3 + x] assert e*x == [x**2, x**3 + x] assert e/(1 + x) == [x/(1 + x), (x**2 + 1)/(1 + x)] assert X*e == [x**2, x**3 + x] assert e*X == [x**2, x**3 + x] M3 = FreeModule(QQ.old_poly_ring(x, y), 2) assert M3.convert(e) == M3.convert([x, x**2 + 1]) assert not M3.is_submodule(0) assert not M3.is_zero() raises(NotImplementedError, lambda: ZZ.old_poly_ring(x).free_module(2)) raises(NotImplementedError, lambda: FreeModulePolyRing(ZZ, 2)) raises(CoercionFailed, lambda: M1.convert(QQ.old_poly_ring(x).free_module(3) .convert([1, 2, 3]))) raises(CoercionFailed, lambda: M3.convert(1)) def test_ModuleOrder(): o1 = ModuleOrder(lex, grlex, False) o2 = ModuleOrder(ilex, lex, False) assert o1 == ModuleOrder(lex, grlex, False) assert (o1 != ModuleOrder(lex, grlex, False)) is False assert o1 != o2 assert o1((1, 2, 3)) == (1, (5, (2, 3))) assert o2((1, 2, 3)) == (-1, (2, 3)) def test_SubModulePolyRing_global(): R = QQ.old_poly_ring(x, y) F = R.free_module(3) Fd = F.submodule([1, 0, 0], [1, 2, 0], [1, 2, 3]) M = F.submodule([x**2 + y**2, 1, 0], [x, y, 1]) assert F == Fd assert Fd == F assert F != M assert M != F assert Fd != M assert M != Fd assert Fd == F.submodule(*F.basis()) assert Fd.is_full_module() assert not M.is_full_module() assert not Fd.is_zero() assert not M.is_zero() assert Fd.submodule().is_zero() assert M.contains([x**2 + y**2 + x, 1 + y, 1]) assert not M.contains([x**2 + y**2 + x, 1 + y, 2]) assert M.contains([y**2, 1 - x*y, -x]) assert not F.submodule([1 + x, 0, 0]) == F.submodule([1, 0, 0]) assert F.submodule([1, 0, 0], [0, 1, 0]).union(F.submodule([0, 0, 1])) == F assert not M.is_submodule(0) m = F.convert([x**2 + y**2, 1, 0]) n = M.convert(m) assert m.module is F assert n.module is M raises(ValueError, lambda: M.submodule([1, 0, 0])) raises(TypeError, lambda: M.union(1)) raises(ValueError, lambda: M.union(R.free_module(1).submodule([x]))) assert F.submodule([x, x, x]) != F.submodule([x, x, x], order="ilex") def test_SubModulePolyRing_local(): R = QQ.old_poly_ring(x, y, order=ilex) F = R.free_module(3) Fd = F.submodule([1 + x, 0, 0], [1 + y, 2 + 2*y, 0], [1, 2, 3]) M = F.submodule([x**2 + y**2, 1, 0], [x, y, 1]) assert F == Fd assert Fd == F assert F != M assert M != F assert Fd != M assert M != Fd assert Fd == F.submodule(*F.basis()) assert Fd.is_full_module() assert not M.is_full_module() assert not Fd.is_zero() assert not M.is_zero() assert Fd.submodule().is_zero() assert M.contains([x**2 + y**2 + x, 1 + y, 1]) assert not M.contains([x**2 + y**2 + x, 1 + y, 2]) assert M.contains([y**2, 1 - x*y, -x]) assert F.submodule([1 + x, 0, 0]) == F.submodule([1, 0, 0]) assert F.submodule( [1, 0, 0], [0, 1, 0]).union(F.submodule([0, 0, 1 + x*y])) == F raises(ValueError, lambda: M.submodule([1, 0, 0])) def test_SubModulePolyRing_nontriv_global(): R = QQ.old_poly_ring(x, y, z) F = R.free_module(1) def contains(I, f): return F.submodule(*[[g] for g in I]).contains([f]) assert contains([x, y], x) assert contains([x, y], x + y) assert not contains([x, y], 1) assert not contains([x, y], z) assert contains([x**2 + y, x**2 + x], x - y) assert not contains([x + y + z, x*y + x*z + y*z, x*y*z], x**2) assert contains([x + y + z, x*y + x*z + y*z, x*y*z], x**3) assert contains([x + y + z, x*y + x*z + y*z, x*y*z], x**4) assert not contains([x + y + z, x*y + x*z + y*z, x*y*z], x*y**2) assert contains([x + y + z, x*y + x*z + y*z, x*y*z], x**4 + y**3 + 2*z*y*x) assert contains([x + y + z, x*y + x*z + y*z, x*y*z], x*y*z) assert contains([x, 1 + x + y, 5 - 7*y], 1) assert contains( [x**3 + y**3, y**3 + z**3, z**3 + x**3, x**2*y + x**2*z + y**2*z], x**3) assert not contains( [x**3 + y**3, y**3 + z**3, z**3 + x**3, x**2*y + x**2*z + y**2*z], x**2 + y**2) # compare local order assert not contains([x*(1 + x + y), y*(1 + z)], x) assert not contains([x*(1 + x + y), y*(1 + z)], x + y) def test_SubModulePolyRing_nontriv_local(): R = QQ.old_poly_ring(x, y, z, order=ilex) F = R.free_module(1) def contains(I, f): return F.submodule(*[[g] for g in I]).contains([f]) assert contains([x, y], x) assert contains([x, y], x + y) assert not contains([x, y], 1) assert not contains([x, y], z) assert contains([x**2 + y, x**2 + x], x - y) assert not contains([x + y + z, x*y + x*z + y*z, x*y*z], x**2) assert contains([x*(1 + x + y), y*(1 + z)], x) assert contains([x*(1 + x + y), y*(1 + z)], x + y) def test_syzygy(): R = QQ.old_poly_ring(x, y, z) M = R.free_module(1).submodule([x*y], [y*z], [x*z]) S = R.free_module(3).submodule([0, x, -y], [z, -x, 0]) assert M.syzygy_module() == S M2 = M / ([x*y*z],) S2 = R.free_module(3).submodule([z, 0, 0], [0, x, 0], [0, 0, y]) assert M2.syzygy_module() == S2 F = R.free_module(3) assert F.submodule(*F.basis()).syzygy_module() == F.submodule() R2 = QQ.old_poly_ring(x, y, z) / [x*y*z] M3 = R2.free_module(1).submodule([x*y], [y*z], [x*z]) S3 = R2.free_module(3).submodule([z, 0, 0], [0, x, 0], [0, 0, y]) assert M3.syzygy_module() == S3 def test_in_terms_of_generators(): R = QQ.old_poly_ring(x, order="ilex") M = R.free_module(2).submodule([2*x, 0], [1, 2]) assert M.in_terms_of_generators( [x, x]) == [R.convert(S(1)/4), R.convert(x/2)] raises(ValueError, lambda: M.in_terms_of_generators([1, 0])) M = R.free_module(2) / ([x, 0], [1, 1]) SM = M.submodule([1, x]) assert SM.in_terms_of_generators([2, 0]) == [R.convert(-2/(x - 1))] R = QQ.old_poly_ring(x, y) / [x**2 - y**2] M = R.free_module(2) SM = M.submodule([x, 0], [0, y]) assert SM.in_terms_of_generators( [x**2, x**2]) == [R.convert(x), R.convert(y)] def test_QuotientModuleElement(): R = QQ.old_poly_ring(x) F = R.free_module(3) N = F.submodule([1, x, x**2]) M = F/N e = M.convert([x**2, 2, 0]) assert M.convert([x + 1, x**2 + x, x**3 + x**2]) == 0 assert e == [x**2, 2, 0] + N == F.convert([x**2, 2, 0]) + N == \ M.convert(F.convert([x**2, 2, 0])) assert M.convert([x**2 + 1, 2*x + 2, x**2]) == e + [0, x, 0] == \ e + M.convert([0, x, 0]) == e + F.convert([0, x, 0]) assert M.convert([x**2 + 1, 2, x**2]) == e - [0, x, 0] == \ e - M.convert([0, x, 0]) == e - F.convert([0, x, 0]) assert M.convert([0, 2, 0]) == M.convert([x**2, 4, 0]) - e == \ [x**2, 4, 0] - e == F.convert([x**2, 4, 0]) - e assert M.convert([x**3 + x**2, 2*x + 2, 0]) == (1 + x)*e == \ R.convert(1 + x)*e == e*(1 + x) == e*R.convert(1 + x) assert -e == [-x**2, -2, 0] f = [x, x, 0] + N assert M.convert([1, 1, 0]) == f / x == f / R.convert(x) M2 = F/[(2, 2*x, 2*x**2), (0, 0, 1)] G = R.free_module(2) M3 = G/[[1, x]] M4 = F.submodule([1, x, x**2], [1, 0, 0]) / N raises(CoercionFailed, lambda: M.convert(G.convert([1, x]))) raises(CoercionFailed, lambda: M.convert(M3.convert([1, x]))) raises(CoercionFailed, lambda: M.convert(M2.convert([1, x, x]))) assert M2.convert(M.convert([2, x, x**2])) == [2, x, 0] assert M.convert(M4.convert([2, 0, 0])) == [2, 0, 0] def test_QuotientModule(): R = QQ.old_poly_ring(x) F = R.free_module(3) N = F.submodule([1, x, x**2]) M = F/N assert M != F assert M != N assert M == F / [(1, x, x**2)] assert not M.is_zero() assert (F / F.basis()).is_zero() SQ = F.submodule([1, x, x**2], [2, 0, 0]) / N assert SQ == M.submodule([2, x, x**2]) assert SQ != M.submodule([2, 1, 0]) assert SQ != M assert M.is_submodule(SQ) assert not SQ.is_full_module() raises(ValueError, lambda: N/F) raises(ValueError, lambda: F.submodule([2, 0, 0]) / N) raises(ValueError, lambda: R.free_module(2)/F) raises(CoercionFailed, lambda: F.convert(M.convert([1, x, x**2]))) M1 = F / [[1, 1, 1]] M2 = M1.submodule([1, 0, 0], [0, 1, 0]) assert M1 == M2 def test_ModulesQuotientRing(): R = QQ.old_poly_ring(x, y, order=(("lex", x), ("ilex", y))) / [x**2 + 1] M1 = R.free_module(2) assert M1 == R.free_module(2) assert M1 != QQ.old_poly_ring(x).free_module(2) assert M1 != R.free_module(3) assert [x, 1] in M1 assert [x] not in M1 assert [1/(R.convert(x) + 1), 2] in M1 assert [1, 2/(1 + y)] in M1 assert [1, 2/y] not in M1 assert M1.convert([x**2, y]) == [-1, y] F = R.free_module(3) Fd = F.submodule([x**2, 0, 0], [1, 2, 0], [1, 2, 3]) M = F.submodule([x**2 + y**2, 1, 0], [x, y, 1]) assert F == Fd assert Fd == F assert F != M assert M != F assert Fd != M assert M != Fd assert Fd == F.submodule(*F.basis()) assert Fd.is_full_module() assert not M.is_full_module() assert not Fd.is_zero() assert not M.is_zero() assert Fd.submodule().is_zero() assert M.contains([x**2 + y**2 + x, -x**2 + y, 1]) assert not M.contains([x**2 + y**2 + x, 1 + y, 2]) assert M.contains([y**2, 1 - x*y, -x]) assert F.submodule([x, 0, 0]) == F.submodule([1, 0, 0]) assert not F.submodule([y, 0, 0]) == F.submodule([1, 0, 0]) assert F.submodule([1, 0, 0], [0, 1, 0]).union(F.submodule([0, 0, 1])) == F assert not M.is_submodule(0) def test_module_mul(): R = QQ.old_poly_ring(x) M = R.free_module(2) S1 = M.submodule([x, 0], [0, x]) S2 = M.submodule([x**2, 0], [0, x**2]) I = R.ideal(x) assert I*M == M*I == S1 == x*M == M*x assert I*S1 == S2 == x*S1 def test_intersection(): # SCA, example 2.8.5 F = QQ.old_poly_ring(x, y).free_module(2) M1 = F.submodule([x, y], [y, 1]) M2 = F.submodule([0, y - 1], [x, 1], [y, x]) I = F.submodule([x, y], [y**2 - y, y - 1], [x*y + y, x + 1]) I1, rel1, rel2 = M1.intersect(M2, relations=True) assert I1 == M2.intersect(M1) == I for i, g in enumerate(I1.gens): assert g == sum(c*x for c, x in zip(rel1[i], M1.gens)) \ == sum(d*y for d, y in zip(rel2[i], M2.gens)) assert F.submodule([x, y]).intersect(F.submodule([y, x])).is_zero() def test_quotient(): # SCA, example 2.8.6 R = QQ.old_poly_ring(x, y, z) F = R.free_module(2) assert F.submodule([x*y, x*z], [y*z, x*y]).module_quotient( F.submodule([y, z], [z, y])) == QQ.old_poly_ring(x, y, z).ideal(x**2*y**2 - x*y*z**2) assert F.submodule([x, y]).module_quotient(F.submodule()).is_whole_ring() M = F.submodule([x**2, x**2], [y**2, y**2]) N = F.submodule([x + y, x + y]) q, rel = M.module_quotient(N, relations=True) assert q == R.ideal(y**2, x - y) for i, g in enumerate(q.gens): assert g*N.gens[0] == sum(c*x for c, x in zip(rel[i], M.gens)) def test_groebner_extendend(): M = QQ.old_poly_ring(x, y, z).free_module(3).submodule([x + 1, y, 1], [x*y, z, z**2]) G, R = M._groebner_vec(extended=True) for i, g in enumerate(G): assert g == sum(c*gen for c, gen in zip(R[i], M.gens))
bsd-3-clause
[ 624, 774, 4621, 14, 647, 1233, 1041, 199, 199, 504, 5840, 14, 15743, 14, 643, 696, 14, 3112, 492, 2868, 2377, 12, 5673, 4738, 12, 2868, 2377, 12747, 15420, 199, 504, 5840, 14, 15743, 492, 1849, 281, 9718, 4276, 12, 16679, 12, 7103, 12, 7192, 3113, 12, 284, 3113, 12, 11739, 199, 504, 5840, 14, 3175, 492, 671, 12, 612, 12, 1315, 199, 504, 5840, 14, 16355, 14, 4462, 492, 6534, 199, 504, 5840, 492, 428, 421, 199, 318, 511, 63, 10146, 2377, 2162, 837, 272, 603, 275, 16679, 14, 1753, 63, 6023, 63, 5985, 8, 88, 680, 4624, 63, 578, 8, 19, 9, 272, 325, 275, 603, 14, 3916, 779, 17, 12, 671, 12, 671, 538, 18, 566, 272, 289, 275, 359, 12917, 14, 1753, 63, 6023, 63, 5985, 8, 88, 680, 3916, 8, 17, 395, 16679, 14, 1753, 63, 6023, 63, 5985, 8, 88, 680, 3916, 8, 88, 395, 16679, 14, 1753, 63, 6023, 63, 5985, 8, 88, 680, 3916, 8, 88, 538, 18, 1874, 272, 702, 769, 8, 69, 9, 508, 289, 272, 702, 289, 59, 16, 61, 508, 325, 59, 16, 61, 272, 702, 289, 59, 17, 61, 508, 325, 59, 17, 61, 272, 702, 289, 59, 18, 61, 508, 325, 59, 18, 61, 272, 6534, 8, 12129, 12, 2400, 26, 325, 59, 19, 566, 339, 486, 275, 603, 14, 3916, 779, 88, 12, 378, 12, 378, 566, 272, 702, 325, 435, 486, 508, 603, 14, 3916, 779, 88, 435, 413, 12, 671, 12, 671, 538, 18, 566, 272, 702, 289, 435, 486, 508, 603, 14, 3916, 779, 88, 435, 413, 12, 671, 12, 671, 538, 18, 566, 272, 702, 446, 69, 508, 603, 14, 3916, 11468, 17, 12, 446, 88, 12, 446, 88, 538, 18, 566, 272, 702, 325, 446, 486, 508, 603, 14, 3916, 779, 17, 446, 671, 12, 671, 12, 671, 538, 18, 566, 272, 702, 325, 1137, 486, 339, 702, 603, 14, 3916, 779, 88, 12, 671, 12, 671, 566, 1182, 16679, 14, 1753, 63, 6023, 63, 5985, 8, 88, 680, 3916, 8, 88, 9, 508, 359, 17, 12, 413, 12, 413, 61, 272, 820, 275, 16679, 14, 1753, 63, 6023, 63, 5985, 8, 88, 12, 1865, 628, 441, 88, 531, 272, 702, 820, 14, 4624, 63, 578, 8, 17, 680, 3916, 779, 88, 566, 1182, 820, 14, 3916, 8, 88, 9, 508, 359, 17, 61, 421, 199, 318, 511, 63, 10146, 2377, 837, 272, 603, 17, 275, 2868, 2377, 8, 12917, 14, 1753, 63, 6023, 63, 5985, 8, 88, 395, 499, 9, 272, 702, 603, 17, 508, 2868, 2377, 8, 12917, 14, 1753, 63, 6023, 63, 5985, 8, 88, 395, 499, 9, 272, 702, 603, 17, 1137, 2868, 2377, 8, 12917, 14, 1753, 63, 6023, 63, 5985, 8, 89, 395, 499, 9, 272, 702, 603, 17, 1137, 2868, 2377, 8, 12917, 14, 1753, 63, 6023, 63, 5985, 8, 88, 395, 650, 9, 272, 603, 18, 275, 2868, 2377, 8, 12917, 14, 1753, 63, 6023, 63, 5985, 8, 88, 12, 1865, 628, 441, 88, 1288, 499, 9, 339, 702, 359, 88, 12, 413, 61, 315, 603, 17, 272, 702, 359, 88, 61, 440, 315, 603, 17, 272, 702, 359, 18, 12, 612, 61, 440, 315, 603, 17, 272, 702, 359, 17, 7985, 88, 435, 413, 395, 499, 61, 440, 315, 603, 17, 339, 325, 275, 603, 17, 14, 3916, 779, 88, 12, 671, 538, 18, 435, 413, 566, 272, 1323, 275, 16679, 14, 1753, 63, 6023, 63, 5985, 8, 88, 680, 3916, 8, 88, 9, 272, 702, 325, 508, 359, 56, 12, 1323, 538, 18, 435, 413, 61, 272, 702, 325, 508, 359, 88, 12, 671, 538, 18, 435, 413, 61, 272, 702, 499, 10, 69, 508, 359, 18, 10, 88, 12, 499, 10, 88, 538, 18, 435, 499, 61, 272, 702, 325, 10, 18, 508, 359, 18, 10, 88, 12, 499, 10, 88, 538, 18, 435, 499, 61, 272, 702, 325, 15, 18, 508, 359, 88, 15, 18, 12, 334, 88, 538, 18, 435, 413, 2447, 18, 61, 272, 702, 671, 10, 69, 508, 359, 88, 538, 18, 12, 671, 538, 19, 435, 671, 61, 272, 702, 325, 10, 88, 508, 359, 88, 538, 18, 12, 671, 538, 19, 435, 671, 61, 272, 702, 1323, 10, 69, 508, 359, 88, 538, 18, 12, 671, 538, 19, 435, 671, 61, 272, 702, 325, 10, 56, 508, 359, 88, 538, 18, 12, 671, 538, 19, 435, 671, 61, 339, 702, 359, 88, 12, 413, 61, 315, 603, 18, 272, 702, 359, 88, 61, 440, 315, 603, 18, 272, 702, 359, 18, 12, 612, 61, 440, 315, 603, 18, 272, 702, 359, 17, 7985, 88, 435, 413, 395, 499, 61, 315, 603, 18, 339, 325, 275, 603, 18, 14, 3916, 779, 88, 12, 671, 538, 18, 435, 413, 566, 272, 1323, 275, 16679, 14, 1753, 63, 6023, 63, 5985, 8, 88, 12, 1865, 628, 441, 88, 3471, 3916, 8, 88, 9, 272, 702, 325, 508, 359, 56, 12, 1323, 538, 18, 435, 413, 61, 272, 702, 325, 508, 359, 88, 12, 671, 538, 18, 435, 413, 61, 272, 702, 499, 10, 69, 508, 359, 18, 10, 88, 12, 499, 10, 88, 538, 18, 435, 499, 61, 272, 702, 325, 10, 18, 508, 359, 18, 10, 88, 12, 499, 10, 88, 538, 18, 435, 499, 61, 272, 702, 325, 15, 18, 508, 359, 88, 15, 18, 12, 334, 88, 538, 18, 435, 413, 2447, 18, 61, 272, 702, 671, 10, 69, 508, 359, 88, 538, 18, 12, 671, 538, 19, 435, 671, 61, 272, 702, 325, 10, 88, 508, 359, 88, 538, 18, 12, 671, 538, 19, 435, 671, 61, 272, 702, 325, 7985, 17, 435, 671, 9, 508, 359, 88, 7985, 17, 435, 671, 395, 334, 88, 538, 18, 435, 413, 15136, 17, 435, 671, 1874, 272, 702, 1323, 10, 69, 508, 359, 88, 538, 18, 12, 671, 538, 19, 435, 671, 61, 272, 702, 325, 10, 56, 508, 359, 88, 538, 18, 12, 671, 538, 19, 435, 671, 61, 339, 603, 19, 275, 2868, 2377, 8, 12917, 14, 1753, 63, 6023, 63, 5985, 8, 88, 12, 612, 395, 499, 9, 272, 702, 603, 19, 14, 3916, 8 ]
[ 774, 4621, 14, 647, 1233, 1041, 199, 199, 504, 5840, 14, 15743, 14, 643, 696, 14, 3112, 492, 2868, 2377, 12, 5673, 4738, 12, 2868, 2377, 12747, 15420, 199, 504, 5840, 14, 15743, 492, 1849, 281, 9718, 4276, 12, 16679, 12, 7103, 12, 7192, 3113, 12, 284, 3113, 12, 11739, 199, 504, 5840, 14, 3175, 492, 671, 12, 612, 12, 1315, 199, 504, 5840, 14, 16355, 14, 4462, 492, 6534, 199, 504, 5840, 492, 428, 421, 199, 318, 511, 63, 10146, 2377, 2162, 837, 272, 603, 275, 16679, 14, 1753, 63, 6023, 63, 5985, 8, 88, 680, 4624, 63, 578, 8, 19, 9, 272, 325, 275, 603, 14, 3916, 779, 17, 12, 671, 12, 671, 538, 18, 566, 272, 289, 275, 359, 12917, 14, 1753, 63, 6023, 63, 5985, 8, 88, 680, 3916, 8, 17, 395, 16679, 14, 1753, 63, 6023, 63, 5985, 8, 88, 680, 3916, 8, 88, 395, 16679, 14, 1753, 63, 6023, 63, 5985, 8, 88, 680, 3916, 8, 88, 538, 18, 1874, 272, 702, 769, 8, 69, 9, 508, 289, 272, 702, 289, 59, 16, 61, 508, 325, 59, 16, 61, 272, 702, 289, 59, 17, 61, 508, 325, 59, 17, 61, 272, 702, 289, 59, 18, 61, 508, 325, 59, 18, 61, 272, 6534, 8, 12129, 12, 2400, 26, 325, 59, 19, 566, 339, 486, 275, 603, 14, 3916, 779, 88, 12, 378, 12, 378, 566, 272, 702, 325, 435, 486, 508, 603, 14, 3916, 779, 88, 435, 413, 12, 671, 12, 671, 538, 18, 566, 272, 702, 289, 435, 486, 508, 603, 14, 3916, 779, 88, 435, 413, 12, 671, 12, 671, 538, 18, 566, 272, 702, 446, 69, 508, 603, 14, 3916, 11468, 17, 12, 446, 88, 12, 446, 88, 538, 18, 566, 272, 702, 325, 446, 486, 508, 603, 14, 3916, 779, 17, 446, 671, 12, 671, 12, 671, 538, 18, 566, 272, 702, 325, 1137, 486, 339, 702, 603, 14, 3916, 779, 88, 12, 671, 12, 671, 566, 1182, 16679, 14, 1753, 63, 6023, 63, 5985, 8, 88, 680, 3916, 8, 88, 9, 508, 359, 17, 12, 413, 12, 413, 61, 272, 820, 275, 16679, 14, 1753, 63, 6023, 63, 5985, 8, 88, 12, 1865, 628, 441, 88, 531, 272, 702, 820, 14, 4624, 63, 578, 8, 17, 680, 3916, 779, 88, 566, 1182, 820, 14, 3916, 8, 88, 9, 508, 359, 17, 61, 421, 199, 318, 511, 63, 10146, 2377, 837, 272, 603, 17, 275, 2868, 2377, 8, 12917, 14, 1753, 63, 6023, 63, 5985, 8, 88, 395, 499, 9, 272, 702, 603, 17, 508, 2868, 2377, 8, 12917, 14, 1753, 63, 6023, 63, 5985, 8, 88, 395, 499, 9, 272, 702, 603, 17, 1137, 2868, 2377, 8, 12917, 14, 1753, 63, 6023, 63, 5985, 8, 89, 395, 499, 9, 272, 702, 603, 17, 1137, 2868, 2377, 8, 12917, 14, 1753, 63, 6023, 63, 5985, 8, 88, 395, 650, 9, 272, 603, 18, 275, 2868, 2377, 8, 12917, 14, 1753, 63, 6023, 63, 5985, 8, 88, 12, 1865, 628, 441, 88, 1288, 499, 9, 339, 702, 359, 88, 12, 413, 61, 315, 603, 17, 272, 702, 359, 88, 61, 440, 315, 603, 17, 272, 702, 359, 18, 12, 612, 61, 440, 315, 603, 17, 272, 702, 359, 17, 7985, 88, 435, 413, 395, 499, 61, 440, 315, 603, 17, 339, 325, 275, 603, 17, 14, 3916, 779, 88, 12, 671, 538, 18, 435, 413, 566, 272, 1323, 275, 16679, 14, 1753, 63, 6023, 63, 5985, 8, 88, 680, 3916, 8, 88, 9, 272, 702, 325, 508, 359, 56, 12, 1323, 538, 18, 435, 413, 61, 272, 702, 325, 508, 359, 88, 12, 671, 538, 18, 435, 413, 61, 272, 702, 499, 10, 69, 508, 359, 18, 10, 88, 12, 499, 10, 88, 538, 18, 435, 499, 61, 272, 702, 325, 10, 18, 508, 359, 18, 10, 88, 12, 499, 10, 88, 538, 18, 435, 499, 61, 272, 702, 325, 15, 18, 508, 359, 88, 15, 18, 12, 334, 88, 538, 18, 435, 413, 2447, 18, 61, 272, 702, 671, 10, 69, 508, 359, 88, 538, 18, 12, 671, 538, 19, 435, 671, 61, 272, 702, 325, 10, 88, 508, 359, 88, 538, 18, 12, 671, 538, 19, 435, 671, 61, 272, 702, 1323, 10, 69, 508, 359, 88, 538, 18, 12, 671, 538, 19, 435, 671, 61, 272, 702, 325, 10, 56, 508, 359, 88, 538, 18, 12, 671, 538, 19, 435, 671, 61, 339, 702, 359, 88, 12, 413, 61, 315, 603, 18, 272, 702, 359, 88, 61, 440, 315, 603, 18, 272, 702, 359, 18, 12, 612, 61, 440, 315, 603, 18, 272, 702, 359, 17, 7985, 88, 435, 413, 395, 499, 61, 315, 603, 18, 339, 325, 275, 603, 18, 14, 3916, 779, 88, 12, 671, 538, 18, 435, 413, 566, 272, 1323, 275, 16679, 14, 1753, 63, 6023, 63, 5985, 8, 88, 12, 1865, 628, 441, 88, 3471, 3916, 8, 88, 9, 272, 702, 325, 508, 359, 56, 12, 1323, 538, 18, 435, 413, 61, 272, 702, 325, 508, 359, 88, 12, 671, 538, 18, 435, 413, 61, 272, 702, 499, 10, 69, 508, 359, 18, 10, 88, 12, 499, 10, 88, 538, 18, 435, 499, 61, 272, 702, 325, 10, 18, 508, 359, 18, 10, 88, 12, 499, 10, 88, 538, 18, 435, 499, 61, 272, 702, 325, 15, 18, 508, 359, 88, 15, 18, 12, 334, 88, 538, 18, 435, 413, 2447, 18, 61, 272, 702, 671, 10, 69, 508, 359, 88, 538, 18, 12, 671, 538, 19, 435, 671, 61, 272, 702, 325, 10, 88, 508, 359, 88, 538, 18, 12, 671, 538, 19, 435, 671, 61, 272, 702, 325, 7985, 17, 435, 671, 9, 508, 359, 88, 7985, 17, 435, 671, 395, 334, 88, 538, 18, 435, 413, 15136, 17, 435, 671, 1874, 272, 702, 1323, 10, 69, 508, 359, 88, 538, 18, 12, 671, 538, 19, 435, 671, 61, 272, 702, 325, 10, 56, 508, 359, 88, 538, 18, 12, 671, 538, 19, 435, 671, 61, 339, 603, 19, 275, 2868, 2377, 8, 12917, 14, 1753, 63, 6023, 63, 5985, 8, 88, 12, 612, 395, 499, 9, 272, 702, 603, 19, 14, 3916, 8, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
simonwydooghe/ansible
lib/ansible/modules/cloud/azure/azure_rm_resource_info.py
28
17641
#!/usr/bin/python # # Copyright (c) 2018 Zim Kalinowski, <zikalino@microsoft.com> # # 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 ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = ''' --- module: azure_rm_resource_info version_added: "2.9" short_description: Generic facts of Azure resources description: - Obtain facts of any resource using Azure REST API. - This module gives access to resources that are not supported via Ansible modules. - Refer to U(https://docs.microsoft.com/en-us/rest/api/) regarding details related to specific resource REST API. options: url: description: - Azure RM Resource URL. api_version: description: - Specific API version to be used. provider: description: - Provider type, should be specified in no URL is given. resource_group: description: - Resource group to be used. - Required if URL is not specified. resource_type: description: - Resource type. resource_name: description: - Resource name. subresource: description: - List of subresources. suboptions: namespace: description: - Subresource namespace. type: description: - Subresource type. name: description: - Subresource name. extends_documentation_fragment: - azure author: - Zim Kalinowski (@zikalino) ''' EXAMPLES = ''' - name: Get scaleset info azure_rm_resource_info: resource_group: myResourceGroup provider: compute resource_type: virtualmachinescalesets resource_name: myVmss api_version: "2017-12-01" - name: Query all the resources in the resource group azure_rm_resource_info: resource_group: "{{ resource_group }}" resource_type: resources ''' RETURN = ''' response: description: - Response specific to resource type. returned: always type: complex contains: id: description: - Id of the Azure resource. type: str returned: always sample: "/subscriptions/xxxx...xxxx/resourceGroups/v-xisuRG/providers/Microsoft.Compute/virtualMachines/myVM" location: description: - Resource location. type: str returned: always sample: eastus name: description: - Resource name. type: str returned: always sample: myVM properties: description: - Specifies the virtual machine's property. type: complex returned: always contains: diagnosticsProfile: description: - Specifies the boot diagnostic settings state. type: complex returned: always contains: bootDiagnostics: description: - A debugging feature, which to view Console Output and Screenshot to diagnose VM status. type: dict returned: always sample: { "enabled": true, "storageUri": "https://vxisurgdiag.blob.core.windows.net/" } hardwareProfile: description: - Specifies the hardware settings for the virtual machine. type: dict returned: always sample: { "vmSize": "Standard_D2s_v3" } networkProfile: description: - Specifies the network interfaces of the virtual machine. type: complex returned: always contains: networkInterfaces: description: - Describes a network interface reference. type: list returned: always sample: - { "id": "/subscriptions/xxxx...xxxx/resourceGroups/v-xisuRG/providers/Microsoft.Network/networkInterfaces/myvm441" } osProfile: description: - Specifies the operating system settings for the virtual machine. type: complex returned: always contains: adminUsername: description: - Specifies the name of the administrator account. type: str returned: always sample: azureuser allowExtensionOperations: description: - Specifies whether extension operations should be allowed on the virtual machine. - This may only be set to False when no extensions are present on the virtual machine. type: bool returned: always sample: true computerName: description: - Specifies the host OS name of the virtual machine. type: str returned: always sample: myVM requireGuestProvisionSignale: description: - Specifies the host require guest provision signal or not. type: bool returned: always sample: true secrets: description: - Specifies set of certificates that should be installed onto the virtual machine. type: list returned: always sample: [] linuxConfiguration: description: - Specifies the Linux operating system settings on the virtual machine. type: dict returned: when OS type is Linux sample: { "disablePasswordAuthentication": false, "provisionVMAgent": true } provisioningState: description: - The provisioning state. type: str returned: always sample: Succeeded vmID: description: - Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in all Azure laaS VMs SMBIOS. - It can be read using platform BIOS commands. type: str returned: always sample: "eb86d9bb-6725-4787-a487-2e497d5b340c" storageProfile: description: - Specifies the storage account type for the managed disk. type: complex returned: always contains: dataDisks: description: - Specifies the parameters that are used to add a data disk to virtual machine. type: list returned: always sample: - { "caching": "None", "createOption": "Attach", "diskSizeGB": 1023, "lun": 2, "managedDisk": { "id": "/subscriptions/xxxx....xxxx/resourceGroups/V-XISURG/providers/Microsoft.Compute/disks/testdisk2", "storageAccountType": "StandardSSD_LRS" }, "name": "testdisk2" } - { "caching": "None", "createOption": "Attach", "diskSizeGB": 1023, "lun": 1, "managedDisk": { "id": "/subscriptions/xxxx...xxxx/resourceGroups/V-XISURG/providers/Microsoft.Compute/disks/testdisk3", "storageAccountType": "StandardSSD_LRS" }, "name": "testdisk3" } imageReference: description: - Specifies information about the image to use. type: dict returned: always sample: { "offer": "UbuntuServer", "publisher": "Canonical", "sku": "18.04-LTS", "version": "latest" } osDisk: description: - Specifies information about the operating system disk used by the virtual machine. type: dict returned: always sample: { "caching": "ReadWrite", "createOption": "FromImage", "diskSizeGB": 30, "managedDisk": { "id": "/subscriptions/xxx...xxxx/resourceGroups/v-xisuRG/providers/Microsoft.Compute/disks/myVM_disk1_xxx", "storageAccountType": "Premium_LRS" }, "name": "myVM_disk1_xxx", "osType": "Linux" } type: description: - The type of identity used for the virtual machine. type: str returned: always sample: "Microsoft.Compute/virtualMachines" ''' from ansible.module_utils.azure_rm_common import AzureRMModuleBase from ansible.module_utils.azure_rm_common_rest import GenericRestClient try: from msrestazure.azure_exceptions import CloudError from msrest.service_client import ServiceClient from msrestazure.tools import resource_id, is_valid_resource_id import json except ImportError: # This is handled in azure_rm_common pass class AzureRMResourceInfo(AzureRMModuleBase): def __init__(self): # define user inputs into argument self.module_arg_spec = dict( url=dict( type='str' ), provider=dict( type='str' ), resource_group=dict( type='str' ), resource_type=dict( type='str' ), resource_name=dict( type='str' ), subresource=dict( type='list', default=[] ), api_version=dict( type='str' ) ) # store the results of the module operation self.results = dict( response=[] ) self.mgmt_client = None self.url = None self.api_version = None self.provider = None self.resource_group = None self.resource_type = None self.resource_name = None self.subresource = [] super(AzureRMResourceInfo, self).__init__(self.module_arg_spec, supports_tags=False) def exec_module(self, **kwargs): is_old_facts = self.module._name == 'azure_rm_resource_facts' if is_old_facts: self.module.deprecate("The 'azure_rm_resource_facts' module has been renamed to 'azure_rm_resource_info'", version='2.13') for key in self.module_arg_spec: setattr(self, key, kwargs[key]) self.mgmt_client = self.get_mgmt_svc_client(GenericRestClient, base_url=self._cloud_environment.endpoints.resource_manager) if self.url is None: orphan = None rargs = dict() rargs['subscription'] = self.subscription_id rargs['resource_group'] = self.resource_group if not (self.provider is None or self.provider.lower().startswith('.microsoft')): rargs['namespace'] = "Microsoft." + self.provider else: rargs['namespace'] = self.provider if self.resource_type is not None and self.resource_name is not None: rargs['type'] = self.resource_type rargs['name'] = self.resource_name for i in range(len(self.subresource)): resource_ns = self.subresource[i].get('namespace', None) resource_type = self.subresource[i].get('type', None) resource_name = self.subresource[i].get('name', None) if resource_type is not None and resource_name is not None: rargs['child_namespace_' + str(i + 1)] = resource_ns rargs['child_type_' + str(i + 1)] = resource_type rargs['child_name_' + str(i + 1)] = resource_name else: orphan = resource_type else: orphan = self.resource_type self.url = resource_id(**rargs) if orphan is not None: self.url += '/' + orphan # if api_version was not specified, get latest one if not self.api_version: try: # extract provider and resource type if "/providers/" in self.url: provider = self.url.split("/providers/")[1].split("/")[0] resourceType = self.url.split(provider + "/")[1].split("/")[0] url = "/subscriptions/" + self.subscription_id + "/providers/" + provider api_versions = json.loads(self.mgmt_client.query(url, "GET", {'api-version': '2015-01-01'}, None, None, [200], 0, 0).text) for rt in api_versions['resourceTypes']: if rt['resourceType'].lower() == resourceType.lower(): self.api_version = rt['apiVersions'][0] break else: # if there's no provider in API version, assume Microsoft.Resources self.api_version = '2018-05-01' if not self.api_version: self.fail("Couldn't find api version for {0}/{1}".format(provider, resourceType)) except Exception as exc: self.fail("Failed to obtain API version: {0}".format(str(exc))) self.results['url'] = self.url query_parameters = {} query_parameters['api-version'] = self.api_version header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' skiptoken = None while True: if skiptoken: query_parameters['skiptoken'] = skiptoken response = self.mgmt_client.query(self.url, "GET", query_parameters, header_parameters, None, [200, 404], 0, 0) try: response = json.loads(response.text) if isinstance(response, dict): if response.get('value'): self.results['response'] = self.results['response'] + response['value'] skiptoken = response.get('nextLink') else: self.results['response'] = self.results['response'] + [response] except Exception as e: self.fail('Failed to parse response: ' + str(e)) if not skiptoken: break return self.results def main(): AzureRMResourceInfo() if __name__ == '__main__': main()
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1548, 199, 3, 199, 3, 1898, 334, 67, 9, 14894, 3107, 1017, 1804, 279, 262, 19844, 12, 665, 90, 3258, 279, 10175, 32, 17040, 14, 957, 30, 199, 3, 199, 3, 1664, 1696, 1684, 844, 373, 19, 14, 16, 11, 334, 3239, 9685, 503, 4178, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 15, 11692, 13, 19, 14, 16, 14, 2424, 9, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 870, 63, 1593, 199, 363, 6577, 363, 275, 730, 421, 199, 8490, 63, 8314, 275, 791, 2343, 63, 1023, 356, 283, 17, 14, 17, 297, 490, 283, 1205, 356, 788, 7780, 995, 490, 283, 4946, 63, 991, 356, 283, 9387, 936, 421, 199, 8948, 275, 1449, 199, 2595, 199, 578, 26, 13601, 63, 5682, 63, 1927, 63, 815, 199, 1023, 63, 3270, 26, 298, 18, 14, 25, 2, 199, 3612, 63, 1802, 26, 8307, 9036, 402, 15474, 5944, 199, 1802, 26, 272, 446, 17985, 877, 9036, 402, 1263, 2073, 1808, 15474, 14880, 3261, 14, 272, 446, 961, 859, 10557, 2879, 370, 5944, 626, 787, 440, 3748, 4799, 2622, 4621, 14, 272, 446, 21751, 370, 738, 8, 2859, 921, 4757, 14, 17040, 14, 957, 15, 287, 13, 527, 15, 3911, 15, 1246, 24793, 12602, 2436, 4048, 370, 2488, 2073, 14880, 3261, 14, 199, 199, 1419, 26, 272, 1166, 26, 267, 1369, 26, 288, 446, 15474, 820, 45, 7337, 2851, 14, 272, 2986, 63, 1023, 26, 267, 1369, 26, 288, 446, 20411, 3261, 1015, 370, 506, 1202, 14, 272, 5022, 26, 267, 1369, 26, 288, 446, 18489, 730, 12, 1077, 506, 2013, 315, 949, 2851, 365, 1627, 14, 272, 2073, 63, 923, 26, 267, 1369, 26, 288, 446, 7337, 1572, 370, 506, 1202, 14, 288, 446, 11105, 340, 2851, 365, 440, 2013, 14, 272, 2073, 63, 466, 26, 267, 1369, 26, 288, 446, 7337, 730, 14, 272, 2073, 63, 354, 26, 267, 1369, 26, 288, 446, 7337, 536, 14, 272, 1007, 1927, 26, 267, 1369, 26, 288, 446, 3820, 402, 1007, 4435, 14, 267, 26265, 26, 288, 3231, 26, 355, 1369, 26, 490, 446, 4804, 1927, 3231, 14, 288, 730, 26, 355, 1369, 26, 490, 446, 4804, 1927, 730, 14, 288, 536, 26, 355, 1369, 26, 490, 446, 4804, 1927, 536, 14, 199, 199, 11036, 63, 9970, 63, 7677, 26, 272, 446, 13601, 199, 199, 2502, 26, 272, 446, 3107, 1017, 1804, 279, 262, 19844, 8593, 90, 3258, 279, 10175, 9, 199, 199, 2344, 199, 199, 8918, 275, 1449, 523, 446, 536, 26, 2372, 4666, 409, 2256, 272, 13601, 63, 5682, 63, 1927, 63, 815, 26, 489, 2073, 63, 923, 26, 3002, 4031, 2448, 489, 5022, 26, 4526, 489, 2073, 63, 466, 26, 5791, 26489, 2357, 2193, 489, 2073, 63, 354, 26, 3002, 17402, 385, 489, 2986, 63, 1023, 26, 298, 10680, 13, 713, 13, 614, 2, 819, 446, 536, 26, 8133, 1006, 314, 5944, 315, 314, 2073, 1572, 272, 13601, 63, 5682, 63, 1927, 63, 815, 26, 489, 2073, 63, 923, 26, 7370, 2073, 63, 923, 7820, 489, 2073, 63, 466, 26, 5944, 199, 2344, 199, 199, 9677, 275, 1449, 199, 1310, 26, 272, 1369, 26, 267, 446, 7232, 2488, 370, 2073, 730, 14, 272, 2138, 26, 3544, 272, 730, 26, 6114, 272, 3509, 26, 267, 1305, 26, 288, 1369, 26, 355, 446, 15418, 402, 314, 15474, 2073, 14, 288, 730, 26, 620, 288, 2138, 26, 3544, 288, 2690, 26, 3286, 13233, 15, 5336, 1396, 5336, 15, 26952, 15, 86, 13, 7291, 85, 14058, 15, 9710, 15, 12940, 14, 8564, 15, 2065, 45, 1225, 3746, 15, 1662, 6849, 2, 267, 2909, 26, 288, 1369, 26, 355, 446, 7337, 2909, 14, 288, 730, 26, 620, 288, 2138, 26, 3544, 288, 2690, 26, 30254, 527, 267, 536, 26, 288, 1369, 26, 355, 446, 7337, 536, 14, 288, 730, 26, 620, 288, 2138, 26, 3544, 288, 2690, 26, 3002, 6849, 267, 4382, 26, 288, 1369, 26, 355, 446, 11015, 314, 5791, 6844, 1159, 3324, 14, 288, 730, 26, 6114, 288, 2138, 26, 3544, 288, 3509, 26, 355, 8348, 21204, 5736, 26, 490, 1369, 26, 717, 446, 11015, 314, 8498, 8348, 19075, 2202, 1174, 14, 490, 730, 26, 6114, 490, 2138, 26, 3544, 490, 3509, 26, 717, 8498, 16094, 21204, 26, 1169, 1369, 26, 1816, 446, 437, 10201, 3878, 12, 1314, 370, 2455, 19809, 7242, 436, 17804, 2782, 370, 8348, 21085, 7525, 2004, 14, 1169, 730, 26, 1211, 1169, 2138, 26, 3544, 1169, 2690, 26, 469, 2511, 298, 3827, 582, 2549, 12, 2511, 298, 3494, 14014, 582, 298, 2859, 921, 86, 7291, 17629, 6706, 14, 6582, 14, 1018, 14, 8258, 14, 846, 6687, 2511, 789, 355, 14991, 5736, 26, 490, 1369, 26, 717, 446, 11015, 314, 14991, 2202, 367, 314, 5791, 6844, 14, 490, 730, 26, 1211, 490, 2138, 26, 3544, 490, 2690, 26, 469, 1169, 298, 2611, 2320, 582, 298, 9232, 63, 36, 18, 83, 63, 86, 19, 2, 1169, 789, 355, 2784, 5736, 26, 490, 1369, 26, 717, 446, 11015, 314, 2784, 8386, 402, 314, 5791, 6844, 14, 490, 730, 26, 6114, 490, 2138, 26, 3544, 490, 3509, 26, 717, 2784, 18680, 26, 1169, 1369, 26, 1816, 446, 28571, 11562, 282, 2784, 3217, 3659, 14, 1169, 730, 26, 769, 1169, 2138, 26, 3544, 1169, 2690, 26, 1816, 446, 469, 3303, 298, 344, 582, 3286, 13233, 15, 5336, 1396, 5336, 15, 26952, 15, 86, 13, 7291, 85, 14058, 15, 9710, 15, 12940, 14, 4491, 15, 1200, 18680, 15, 1662, 2611, 24284, 2, 3303, 789, 355, 747, 5736, 26, 490, 1369, 26, 717, 446, 11015, 314, 17406, 2656, 2202, 367, 314, 5791, 6844, 14, 490, 730, 26, 6114, 490, 2138, 26, 3544, 490, 3509, 26, 717, 4628, 13355, 26, 1169, 1369, 26, 1816, 446, 11015, 314, 536, 402, 314, 31056, 2933, 14, 1169, 730, 26, 620, 1169, 2138, 26, 3544, 1169, 2690, 26, 13601, 751, 717, 2040, 6382, 12929, 26, 1169, 1369, 26, 1816, 446, 11015, 3775, 3329, 5331, 1077, 506, 4370, 641, 314, 5791, 6844, 14, 1816, 446, 961, 1443, 1454, 506, 663, 370, 756, 1380, 949, 5478, 787, 3451, 641, 314, 5791, 6844, 14, 1169, 730, 26, 2155, 1169, 2138, 26, 3544, 1169, 2690, 26, 2549, 717 ]
[ 2647, 15, 1393, 15, 1548, 199, 3, 199, 3, 1898, 334, 67, 9, 14894, 3107, 1017, 1804, 279, 262, 19844, 12, 665, 90, 3258, 279, 10175, 32, 17040, 14, 957, 30, 199, 3, 199, 3, 1664, 1696, 1684, 844, 373, 19, 14, 16, 11, 334, 3239, 9685, 503, 4178, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 15, 11692, 13, 19, 14, 16, 14, 2424, 9, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 870, 63, 1593, 199, 363, 6577, 363, 275, 730, 421, 199, 8490, 63, 8314, 275, 791, 2343, 63, 1023, 356, 283, 17, 14, 17, 297, 490, 283, 1205, 356, 788, 7780, 995, 490, 283, 4946, 63, 991, 356, 283, 9387, 936, 421, 199, 8948, 275, 1449, 199, 2595, 199, 578, 26, 13601, 63, 5682, 63, 1927, 63, 815, 199, 1023, 63, 3270, 26, 298, 18, 14, 25, 2, 199, 3612, 63, 1802, 26, 8307, 9036, 402, 15474, 5944, 199, 1802, 26, 272, 446, 17985, 877, 9036, 402, 1263, 2073, 1808, 15474, 14880, 3261, 14, 272, 446, 961, 859, 10557, 2879, 370, 5944, 626, 787, 440, 3748, 4799, 2622, 4621, 14, 272, 446, 21751, 370, 738, 8, 2859, 921, 4757, 14, 17040, 14, 957, 15, 287, 13, 527, 15, 3911, 15, 1246, 24793, 12602, 2436, 4048, 370, 2488, 2073, 14880, 3261, 14, 199, 199, 1419, 26, 272, 1166, 26, 267, 1369, 26, 288, 446, 15474, 820, 45, 7337, 2851, 14, 272, 2986, 63, 1023, 26, 267, 1369, 26, 288, 446, 20411, 3261, 1015, 370, 506, 1202, 14, 272, 5022, 26, 267, 1369, 26, 288, 446, 18489, 730, 12, 1077, 506, 2013, 315, 949, 2851, 365, 1627, 14, 272, 2073, 63, 923, 26, 267, 1369, 26, 288, 446, 7337, 1572, 370, 506, 1202, 14, 288, 446, 11105, 340, 2851, 365, 440, 2013, 14, 272, 2073, 63, 466, 26, 267, 1369, 26, 288, 446, 7337, 730, 14, 272, 2073, 63, 354, 26, 267, 1369, 26, 288, 446, 7337, 536, 14, 272, 1007, 1927, 26, 267, 1369, 26, 288, 446, 3820, 402, 1007, 4435, 14, 267, 26265, 26, 288, 3231, 26, 355, 1369, 26, 490, 446, 4804, 1927, 3231, 14, 288, 730, 26, 355, 1369, 26, 490, 446, 4804, 1927, 730, 14, 288, 536, 26, 355, 1369, 26, 490, 446, 4804, 1927, 536, 14, 199, 199, 11036, 63, 9970, 63, 7677, 26, 272, 446, 13601, 199, 199, 2502, 26, 272, 446, 3107, 1017, 1804, 279, 262, 19844, 8593, 90, 3258, 279, 10175, 9, 199, 199, 2344, 199, 199, 8918, 275, 1449, 523, 446, 536, 26, 2372, 4666, 409, 2256, 272, 13601, 63, 5682, 63, 1927, 63, 815, 26, 489, 2073, 63, 923, 26, 3002, 4031, 2448, 489, 5022, 26, 4526, 489, 2073, 63, 466, 26, 5791, 26489, 2357, 2193, 489, 2073, 63, 354, 26, 3002, 17402, 385, 489, 2986, 63, 1023, 26, 298, 10680, 13, 713, 13, 614, 2, 819, 446, 536, 26, 8133, 1006, 314, 5944, 315, 314, 2073, 1572, 272, 13601, 63, 5682, 63, 1927, 63, 815, 26, 489, 2073, 63, 923, 26, 7370, 2073, 63, 923, 7820, 489, 2073, 63, 466, 26, 5944, 199, 2344, 199, 199, 9677, 275, 1449, 199, 1310, 26, 272, 1369, 26, 267, 446, 7232, 2488, 370, 2073, 730, 14, 272, 2138, 26, 3544, 272, 730, 26, 6114, 272, 3509, 26, 267, 1305, 26, 288, 1369, 26, 355, 446, 15418, 402, 314, 15474, 2073, 14, 288, 730, 26, 620, 288, 2138, 26, 3544, 288, 2690, 26, 3286, 13233, 15, 5336, 1396, 5336, 15, 26952, 15, 86, 13, 7291, 85, 14058, 15, 9710, 15, 12940, 14, 8564, 15, 2065, 45, 1225, 3746, 15, 1662, 6849, 2, 267, 2909, 26, 288, 1369, 26, 355, 446, 7337, 2909, 14, 288, 730, 26, 620, 288, 2138, 26, 3544, 288, 2690, 26, 30254, 527, 267, 536, 26, 288, 1369, 26, 355, 446, 7337, 536, 14, 288, 730, 26, 620, 288, 2138, 26, 3544, 288, 2690, 26, 3002, 6849, 267, 4382, 26, 288, 1369, 26, 355, 446, 11015, 314, 5791, 6844, 1159, 3324, 14, 288, 730, 26, 6114, 288, 2138, 26, 3544, 288, 3509, 26, 355, 8348, 21204, 5736, 26, 490, 1369, 26, 717, 446, 11015, 314, 8498, 8348, 19075, 2202, 1174, 14, 490, 730, 26, 6114, 490, 2138, 26, 3544, 490, 3509, 26, 717, 8498, 16094, 21204, 26, 1169, 1369, 26, 1816, 446, 437, 10201, 3878, 12, 1314, 370, 2455, 19809, 7242, 436, 17804, 2782, 370, 8348, 21085, 7525, 2004, 14, 1169, 730, 26, 1211, 1169, 2138, 26, 3544, 1169, 2690, 26, 469, 2511, 298, 3827, 582, 2549, 12, 2511, 298, 3494, 14014, 582, 298, 2859, 921, 86, 7291, 17629, 6706, 14, 6582, 14, 1018, 14, 8258, 14, 846, 6687, 2511, 789, 355, 14991, 5736, 26, 490, 1369, 26, 717, 446, 11015, 314, 14991, 2202, 367, 314, 5791, 6844, 14, 490, 730, 26, 1211, 490, 2138, 26, 3544, 490, 2690, 26, 469, 1169, 298, 2611, 2320, 582, 298, 9232, 63, 36, 18, 83, 63, 86, 19, 2, 1169, 789, 355, 2784, 5736, 26, 490, 1369, 26, 717, 446, 11015, 314, 2784, 8386, 402, 314, 5791, 6844, 14, 490, 730, 26, 6114, 490, 2138, 26, 3544, 490, 3509, 26, 717, 2784, 18680, 26, 1169, 1369, 26, 1816, 446, 28571, 11562, 282, 2784, 3217, 3659, 14, 1169, 730, 26, 769, 1169, 2138, 26, 3544, 1169, 2690, 26, 1816, 446, 469, 3303, 298, 344, 582, 3286, 13233, 15, 5336, 1396, 5336, 15, 26952, 15, 86, 13, 7291, 85, 14058, 15, 9710, 15, 12940, 14, 4491, 15, 1200, 18680, 15, 1662, 2611, 24284, 2, 3303, 789, 355, 747, 5736, 26, 490, 1369, 26, 717, 446, 11015, 314, 17406, 2656, 2202, 367, 314, 5791, 6844, 14, 490, 730, 26, 6114, 490, 2138, 26, 3544, 490, 3509, 26, 717, 4628, 13355, 26, 1169, 1369, 26, 1816, 446, 11015, 314, 536, 402, 314, 31056, 2933, 14, 1169, 730, 26, 620, 1169, 2138, 26, 3544, 1169, 2690, 26, 13601, 751, 717, 2040, 6382, 12929, 26, 1169, 1369, 26, 1816, 446, 11015, 3775, 3329, 5331, 1077, 506, 4370, 641, 314, 5791, 6844, 14, 1816, 446, 961, 1443, 1454, 506, 663, 370, 756, 1380, 949, 5478, 787, 3451, 641, 314, 5791, 6844, 14, 1169, 730, 26, 2155, 1169, 2138, 26, 3544, 1169, 2690, 26, 2549, 717, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
GenoaIO/ews-python-suds
src/suds/wsdl.py
197
31503
# This program is free software; you can redistribute it and/or modify # it under the terms of the (LGPL) GNU Lesser General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library Lesser General Public License for more details at # ( http://www.gnu.org/licenses/lgpl.html ). # # You should have received a copy of the GNU Lesser General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # written by: Jeff Ortel ( jortel@redhat.com ) """ The I{wsdl} module provides an objectification of the WSDL. The primary class is I{Definitions} as it represends the root element found in the document. """ from logging import getLogger from suds import * from suds.sax import splitPrefix from suds.sax.element import Element from suds.bindings.document import Document from suds.bindings.rpc import RPC, Encoded from suds.xsd import qualify, Namespace from suds.xsd.schema import Schema, SchemaCollection from suds.xsd.query import ElementQuery from suds.sudsobject import Object, Facade, Metadata from suds.reader import DocumentReader, DefinitionsReader from urlparse import urljoin import re, soaparray log = getLogger(__name__) wsdlns = (None, "http://schemas.xmlsoap.org/wsdl/") soapns = (None, 'http://schemas.xmlsoap.org/wsdl/soap/') soap12ns = (None, 'http://schemas.xmlsoap.org/wsdl/soap12/') class WObject(Object): """ Base object for wsdl types. @ivar root: The XML I{root} element. @type root: L{Element} """ def __init__(self, root, definitions=None): """ @param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions} """ Object.__init__(self) self.root = root pmd = Metadata() pmd.excludes = ['root'] pmd.wrappers = dict(qname=repr) self.__metadata__.__print__ = pmd def resolve(self, definitions): """ Resolve named references to other WSDL objects. @param definitions: A definitions object. @type definitions: L{Definitions} """ pass class NamedObject(WObject): """ A B{named} WSDL object. @ivar name: The name of the object. @type name: str @ivar qname: The I{qualified} name of the object. @type qname: (name, I{namespace-uri}). """ def __init__(self, root, definitions): """ @param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions} """ WObject.__init__(self, root, definitions) self.name = root.get('name') self.qname = (self.name, definitions.tns[1]) pmd = self.__metadata__.__print__ pmd.wrappers['qname'] = repr class Definitions(WObject): """ Represents the I{root} container of the WSDL objects as defined by <wsdl:definitions/> @ivar id: The object id. @type id: str @ivar options: An options dictionary. @type options: L{options.Options} @ivar url: The URL used to load the object. @type url: str @ivar tns: The target namespace for the WSDL. @type tns: str @ivar schema: The collective WSDL schema object. @type schema: L{SchemaCollection} @ivar children: The raw list of child objects. @type children: [L{WObject},...] @ivar imports: The list of L{Import} children. @type imports: [L{Import},...] @ivar messages: The dictionary of L{Message} children key'd by I{qname} @type messages: [L{Message},...] @ivar port_types: The dictionary of L{PortType} children key'd by I{qname} @type port_types: [L{PortType},...] @ivar bindings: The dictionary of L{Binding} children key'd by I{qname} @type bindings: [L{Binding},...] @ivar service: The service object. @type service: L{Service} """ Tag = 'definitions' def __init__(self, url, options): """ @param url: A URL to the WSDL. @type url: str @param options: An options dictionary. @type options: L{options.Options} """ log.debug('reading wsdl at: %s ...', url) reader = DocumentReader(options) d = reader.open(url) root = d.root() WObject.__init__(self, root) self.id = objid(self) self.options = options self.url = url self.tns = self.mktns(root) self.types = [] self.schema = None self.children = [] self.imports = [] self.messages = {} self.port_types = {} self.bindings = {} self.services = [] self.add_children(self.root) self.children.sort() pmd = self.__metadata__.__print__ pmd.excludes.append('children') pmd.excludes.append('wsdl') pmd.wrappers['schema'] = repr self.open_imports() self.resolve() self.build_schema() self.set_wrapped() for s in self.services: self.add_methods(s) log.debug("wsdl at '%s' loaded:\n%s", url, self) def mktns(self, root): """ Get/create the target namespace """ tns = root.get('targetNamespace') prefix = root.findPrefix(tns) if prefix is None: log.debug('warning: tns (%s), not mapped to prefix', tns) prefix = 'tns' return (prefix, tns) def add_children(self, root): """ Add child objects using the factory """ for c in root.getChildren(ns=wsdlns): child = Factory.create(c, self) if child is None: continue self.children.append(child) if isinstance(child, Import): self.imports.append(child) continue if isinstance(child, Types): self.types.append(child) continue if isinstance(child, Message): self.messages[child.qname] = child continue if isinstance(child, PortType): self.port_types[child.qname] = child continue if isinstance(child, Binding): self.bindings[child.qname] = child continue if isinstance(child, Service): self.services.append(child) continue def open_imports(self): """ Import the I{imported} WSDLs. """ for imp in self.imports: imp.load(self) def resolve(self): """ Tell all children to resolve themselves """ for c in self.children: c.resolve(self) def build_schema(self): """ Process L{Types} objects and create the schema collection """ container = SchemaCollection(self) for t in [t for t in self.types if t.local()]: for root in t.contents(): schema = Schema(root, self.url, self.options, container) container.add(schema) if not len(container): # empty root = Element.buildPath(self.root, 'types/schema') schema = Schema(root, self.url, self.options, container) container.add(schema) self.schema = container.load(self.options) for s in [t.schema() for t in self.types if t.imported()]: self.schema.merge(s) return self.schema def add_methods(self, service): """ Build method view for service """ bindings = { 'document/literal' : Document(self), 'rpc/literal' : RPC(self), 'rpc/encoded' : Encoded(self) } for p in service.ports: binding = p.binding ptype = p.binding.type operations = p.binding.type.operations.values() for name in [op.name for op in operations]: m = Facade('Method') m.name = name m.location = p.location m.binding = Facade('binding') op = binding.operation(name) m.soap = op.soap key = '/'.join((op.soap.style, op.soap.input.body.use)) m.binding.input = bindings.get(key) key = '/'.join((op.soap.style, op.soap.output.body.use)) m.binding.output = bindings.get(key) op = ptype.operation(name) p.methods[name] = m def set_wrapped(self): """ set (wrapped|bare) flag on messages """ for b in self.bindings.values(): for op in b.operations.values(): for body in (op.soap.input.body, op.soap.output.body): body.wrapped = False if len(body.parts) != 1: continue for p in body.parts: if p.element is None: continue query = ElementQuery(p.element) pt = query.execute(self.schema) if pt is None: raise TypeNotFound(query.ref) resolved = pt.resolve() if resolved.builtin(): continue body.wrapped = True def __getstate__(self): nopickle = ('options',) state = self.__dict__.copy() for k in nopickle: if k in state: del state[k] return state def __repr__(self): return 'Definitions (id=%s)' % self.id class Import(WObject): """ Represents the <wsdl:import/>. @ivar location: The value of the I{location} attribute. @type location: str @ivar ns: The value of the I{namespace} attribute. @type ns: str @ivar imported: The imported object. @type imported: L{Definitions} """ def __init__(self, root, definitions): """ @param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions} """ WObject.__init__(self, root, definitions) self.location = root.get('location') self.ns = root.get('namespace') self.imported = None pmd = self.__metadata__.__print__ pmd.wrappers['imported'] = repr def load(self, definitions): """ Load the object by opening the URL """ url = self.location log.debug('importing (%s)', url) if '://' not in url: url = urljoin(definitions.url, url) options = definitions.options d = Definitions(url, options) if d.root.match(Definitions.Tag, wsdlns): self.import_definitions(definitions, d) return if d.root.match(Schema.Tag, Namespace.xsdns): self.import_schema(definitions, d) return raise Exception('document at "%s" is unknown' % url) def import_definitions(self, definitions, d): """ import/merge wsdl definitions """ definitions.types += d.types definitions.messages.update(d.messages) definitions.port_types.update(d.port_types) definitions.bindings.update(d.bindings) self.imported = d log.debug('imported (WSDL):\n%s', d) def import_schema(self, definitions, d): """ import schema as <types/> content """ if not len(definitions.types): types = Types.create(definitions) definitions.types.append(types) else: types = definitions.types[-1] types.root.append(d.root) log.debug('imported (XSD):\n%s', d.root) def __gt__(self, other): return False class Types(WObject): """ Represents <types><schema/></types>. """ @classmethod def create(cls, definitions): root = Element('types', ns=wsdlns) definitions.root.insert(root) return Types(root, definitions) def __init__(self, root, definitions): """ @param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions} """ WObject.__init__(self, root, definitions) self.definitions = definitions def contents(self): return self.root.getChildren('schema', Namespace.xsdns) def schema(self): return self.definitions.schema def local(self): return ( self.definitions.schema is None ) def imported(self): return ( not self.local() ) def __gt__(self, other): return isinstance(other, Import) class Part(NamedObject): """ Represents <message><part/></message>. @ivar element: The value of the {element} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type element: str @ivar type: The value of the {type} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type type: str """ def __init__(self, root, definitions): """ @param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions} """ NamedObject.__init__(self, root, definitions) pmd = Metadata() pmd.wrappers = dict(element=repr, type=repr) self.__metadata__.__print__ = pmd tns = definitions.tns self.element = self.__getref('element', tns) self.type = self.__getref('type', tns) def __getref(self, a, tns): """ Get the qualified value of attribute named 'a'.""" s = self.root.get(a) if s is None: return s else: return qualify(s, self.root, tns) class Message(NamedObject): """ Represents <message/>. @ivar parts: A list of message parts. @type parts: [I{Part},...] """ def __init__(self, root, definitions): """ @param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions} """ NamedObject.__init__(self, root, definitions) self.parts = [] for p in root.getChildren('part'): part = Part(p, definitions) self.parts.append(part) def __gt__(self, other): return isinstance(other, (Import, Types)) class PortType(NamedObject): """ Represents <portType/>. @ivar operations: A list of contained operations. @type operations: list """ def __init__(self, root, definitions): """ @param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions} """ NamedObject.__init__(self, root, definitions) self.operations = {} for c in root.getChildren('operation'): op = Facade('Operation') op.name = c.get('name') op.tns = definitions.tns input = c.getChild('input') if input is None: op.input = None else: op.input = input.get('message') output = c.getChild('output') if output is None: op.output = None else: op.output = output.get('message') faults = [] for fault in c.getChildren('fault'): f = Facade('Fault') f.name = fault.get('name') f.message = fault.get('message') faults.append(f) op.faults = faults self.operations[op.name] = op def resolve(self, definitions): """ Resolve named references to other WSDL objects. @param definitions: A definitions object. @type definitions: L{Definitions} """ for op in self.operations.values(): if op.input is None: op.input = Message(Element('no-input'), definitions) else: qref = qualify(op.input, self.root, definitions.tns) msg = definitions.messages.get(qref) if msg is None: raise Exception("msg '%s', not-found" % op.input) else: op.input = msg if op.output is None: op.output = Message(Element('no-output'), definitions) else: qref = qualify(op.output, self.root, definitions.tns) msg = definitions.messages.get(qref) if msg is None: raise Exception("msg '%s', not-found" % op.output) else: op.output = msg for f in op.faults: qref = qualify(f.message, self.root, definitions.tns) msg = definitions.messages.get(qref) if msg is None: raise Exception, "msg '%s', not-found" % f.message f.message = msg def operation(self, name): """ Shortcut used to get a contained operation by name. @param name: An operation name. @type name: str @return: The named operation. @rtype: Operation @raise L{MethodNotFound}: When not found. """ try: return self.operations[name] except Exception, e: raise MethodNotFound(name) def __gt__(self, other): return isinstance(other, (Import, Types, Message)) class Binding(NamedObject): """ Represents <binding/> @ivar operations: A list of contained operations. @type operations: list """ def __init__(self, root, definitions): """ @param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions} """ NamedObject.__init__(self, root, definitions) self.operations = {} self.type = root.get('type') sr = self.soaproot() if sr is None: self.soap = None log.debug('binding: "%s" not a soap binding', self.name) return soap = Facade('soap') self.soap = soap self.soap.style = sr.get('style', default='document') self.add_operations(self.root, definitions) def soaproot(self): """ get the soap:binding """ for ns in (soapns, soap12ns): sr = self.root.getChild('binding', ns=ns) if sr is not None: return sr return None def add_operations(self, root, definitions): """ Add <operation/> children """ dsop = Element('operation', ns=soapns) for c in root.getChildren('operation'): op = Facade('Operation') op.name = c.get('name') sop = c.getChild('operation', default=dsop) soap = Facade('soap') soap.action = '"%s"' % sop.get('soapAction', default='') soap.style = sop.get('style', default=self.soap.style) soap.input = Facade('Input') soap.input.body = Facade('Body') soap.input.headers = [] soap.output = Facade('Output') soap.output.body = Facade('Body') soap.output.headers = [] op.soap = soap input = c.getChild('input') if input is None: input = Element('input', ns=wsdlns) body = input.getChild('body') self.body(definitions, soap.input.body, body) for header in input.getChildren('header'): self.header(definitions, soap.input, header) output = c.getChild('output') if output is None: output = Element('output', ns=wsdlns) body = output.getChild('body') self.body(definitions, soap.output.body, body) for header in output.getChildren('header'): self.header(definitions, soap.output, header) faults = [] for fault in c.getChildren('fault'): sf = fault.getChild('fault') if sf is None: continue fn = fault.get('name') f = Facade('Fault') f.name = sf.get('name', default=fn) f.use = sf.get('use', default='literal') faults.append(f) soap.faults = faults self.operations[op.name] = op def body(self, definitions, body, root): """ add the input/output body properties """ if root is None: body.use = 'literal' body.namespace = definitions.tns body.parts = () return parts = root.get('parts') if parts is None: body.parts = () else: body.parts = re.split('[\s,]', parts) body.use = root.get('use', default='literal') ns = root.get('namespace') if ns is None: body.namespace = definitions.tns else: prefix = root.findPrefix(ns, 'b0') body.namespace = (prefix, ns) def header(self, definitions, parent, root): """ add the input/output header properties """ if root is None: return header = Facade('Header') parent.headers.append(header) header.use = root.get('use', default='literal') ns = root.get('namespace') if ns is None: header.namespace = definitions.tns else: prefix = root.findPrefix(ns, 'h0') header.namespace = (prefix, ns) msg = root.get('message') if msg is not None: header.message = msg part = root.get('part') if part is not None: header.part = part def resolve(self, definitions): """ Resolve named references to other WSDL objects. This includes cross-linking information (from) the portType (to) the I{soap} protocol information on the binding for each operation. @param definitions: A definitions object. @type definitions: L{Definitions} """ self.resolveport(definitions) for op in self.operations.values(): self.resolvesoapbody(definitions, op) self.resolveheaders(definitions, op) self.resolvefaults(definitions, op) def resolveport(self, definitions): """ Resolve port_type reference. @param definitions: A definitions object. @type definitions: L{Definitions} """ ref = qualify(self.type, self.root, definitions.tns) port_type = definitions.port_types.get(ref) if port_type is None: raise Exception("portType '%s', not-found" % self.type) else: self.type = port_type def resolvesoapbody(self, definitions, op): """ Resolve soap body I{message} parts by cross-referencing with operation defined in port type. @param definitions: A definitions object. @type definitions: L{Definitions} @param op: An I{operation} object. @type op: I{operation} """ ptop = self.type.operation(op.name) if ptop is None: raise Exception, \ "operation '%s' not defined in portType" % op.name soap = op.soap parts = soap.input.body.parts if len(parts): pts = [] for p in ptop.input.parts: if p.name in parts: pts.append(p) soap.input.body.parts = pts else: soap.input.body.parts = ptop.input.parts parts = soap.output.body.parts if len(parts): pts = [] for p in ptop.output.parts: if p.name in parts: pts.append(p) soap.output.body.parts = pts else: soap.output.body.parts = ptop.output.parts def resolveheaders(self, definitions, op): """ Resolve soap header I{message} references. @param definitions: A definitions object. @type definitions: L{Definitions} @param op: An I{operation} object. @type op: I{operation} """ soap = op.soap headers = soap.input.headers + soap.output.headers for header in headers: mn = header.message ref = qualify(mn, self.root, definitions.tns) message = definitions.messages.get(ref) if message is None: raise Exception, "message'%s', not-found" % mn pn = header.part for p in message.parts: if p.name == pn: header.part = p break if pn == header.part: raise Exception, \ "message '%s' has not part named '%s'" % (ref, pn) def resolvefaults(self, definitions, op): """ Resolve soap fault I{message} references by cross-referencing with operation defined in port type. @param definitions: A definitions object. @type definitions: L{Definitions} @param op: An I{operation} object. @type op: I{operation} """ ptop = self.type.operation(op.name) if ptop is None: raise Exception, \ "operation '%s' not defined in portType" % op.name soap = op.soap for fault in soap.faults: for f in ptop.faults: if f.name == fault.name: fault.parts = f.message.parts continue if hasattr(fault, 'parts'): continue raise Exception, \ "fault '%s' not defined in portType '%s'" % (fault.name, self.type.name) def operation(self, name): """ Shortcut used to get a contained operation by name. @param name: An operation name. @type name: str @return: The named operation. @rtype: Operation @raise L{MethodNotFound}: When not found. """ try: return self.operations[name] except: raise MethodNotFound(name) def __gt__(self, other): return ( not isinstance(other, Service) ) class Port(NamedObject): """ Represents a service port. @ivar service: A service. @type service: L{Service} @ivar binding: A binding name. @type binding: str @ivar location: The service location (url). @type location: str """ def __init__(self, root, definitions, service): """ @param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions} @param service: A service object. @type service: L{Service} """ NamedObject.__init__(self, root, definitions) self.__service = service self.binding = root.get('binding') address = root.getChild('address') if address is None: self.location = None else: self.location = address.get('location').encode('utf-8') self.methods = {} def method(self, name): """ Get a method defined in this portType by name. @param name: A method name. @type name: str @return: The requested method object. @rtype: I{Method} """ return self.methods.get(name) class Service(NamedObject): """ Represents <service/>. @ivar port: The contained ports. @type port: [Port,..] @ivar methods: The contained methods for all ports. @type methods: [Method,..] """ def __init__(self, root, definitions): """ @param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions} """ NamedObject.__init__(self, root, definitions) self.ports = [] for p in root.getChildren('port'): port = Port(p, definitions, self) self.ports.append(port) def port(self, name): """ Locate a port by name. @param name: A port name. @type name: str @return: The port object. @rtype: L{Port} """ for p in self.ports: if p.name == name: return p return None def setlocation(self, url, names=None): """ Override the invocation location (url) for service method. @param url: A url location. @type url: A url. @param names: A list of method names. None=ALL @type names: [str,..] """ for p in self.ports: for m in p.methods.values(): if names is None or m.name in names: m.location = url def resolve(self, definitions): """ Resolve named references to other WSDL objects. Ports without soap bindings are discarded. @param definitions: A definitions object. @type definitions: L{Definitions} """ filtered = [] for p in self.ports: ref = qualify(p.binding, self.root, definitions.tns) binding = definitions.bindings.get(ref) if binding is None: raise Exception("binding '%s', not-found" % p.binding) if binding.soap is None: log.debug('binding "%s" - not a soap, discarded', binding.name) continue p.binding = binding filtered.append(p) self.ports = filtered def __gt__(self, other): return True class Factory: """ Simple WSDL object factory. @cvar tags: Dictionary of tag->constructor mappings. @type tags: dict """ tags =\ { 'import' : Import, 'types' : Types, 'message' : Message, 'portType' : PortType, 'binding' : Binding, 'service' : Service, } @classmethod def create(cls, root, definitions): """ Create an object based on the root tag name. @param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions} @return: The created object. @rtype: L{WObject} """ fn = cls.tags.get(root.name) if fn is not None: return fn(root, definitions) else: return None
bsd-2-clause
[ 3, 961, 2240, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 334, 44, 12006, 9, 1664, 6401, 1696, 1684, 844, 465, 199, 3, 3267, 701, 314, 2868, 2290, 2752, 27, 1902, 1015, 650, 402, 314, 221, 199, 3, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 11243, 6401, 1696, 1684, 844, 367, 1655, 2436, 737, 199, 3, 334, 1455, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 15, 9783, 1168, 14, 1360, 7092, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 6401, 1696, 1684, 844, 199, 3, 3180, 543, 642, 2240, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 199, 3, 2752, 12, 3277, 2020, 8155, 15630, 10902, 446, 14453, 13540, 12, 8226, 12, 4828, 15673, 13, 13421, 12, 8217, 14, 199, 3, 5313, 701, 26, 1603, 3609, 4236, 14146, 334, 1335, 269, 14146, 32, 17164, 14, 957, 776, 199, 199, 624, 199, 1918, 473, 91, 21452, 93, 859, 6571, 376, 1559, 825, 3793, 402, 314, 644, 14029, 14, 199, 1918, 5062, 1021, 365, 473, 91, 16738, 93, 465, 652, 295, 7732, 795, 314, 1738, 1819, 199, 4214, 315, 314, 2213, 14, 199, 624, 199, 199, 504, 2050, 492, 28138, 199, 504, 30713, 492, 627, 199, 504, 30713, 14, 14338, 492, 3715, 4793, 199, 504, 30713, 14, 14338, 14, 2108, 492, 6566, 199, 504, 30713, 14, 10880, 14, 3554, 492, 7543, 199, 504, 30713, 14, 10880, 14, 4354, 492, 11785, 12, 3447, 15282, 199, 504, 30713, 14, 10515, 492, 6420, 2021, 12, 19317, 199, 504, 30713, 14, 10515, 14, 3629, 492, 13268, 12, 13268, 7768, 199, 504, 30713, 14, 10515, 14, 1131, 492, 6566, 3227, 199, 504, 30713, 14, 9648, 795, 785, 492, 6935, 12, 481, 645, 9587, 12, 16160, 199, 504, 30713, 14, 5503, 492, 7543, 5929, 12, 22659, 852, 5929, 199, 504, 7097, 492, 20818, 199, 646, 295, 12, 880, 439, 1144, 199, 199, 793, 275, 28138, 3460, 354, 3368, 199, 199, 21452, 561, 275, 334, 403, 12, 298, 1014, 921, 9482, 14, 10198, 5770, 439, 14, 1308, 15, 21452, 13589, 199, 21818, 561, 275, 334, 403, 12, 283, 1014, 921, 9482, 14, 10198, 5770, 439, 14, 1308, 15, 21452, 15, 21818, 6217, 199, 21818, 713, 561, 275, 334, 403, 12, 283, 1014, 921, 9482, 14, 10198, 5770, 439, 14, 1308, 15, 21452, 15, 21818, 713, 6217, 421, 199, 533, 644, 1692, 8, 1692, 304, 272, 408, 272, 3523, 909, 367, 336, 22837, 2943, 14, 272, 768, 7725, 1738, 26, 710, 4692, 473, 91, 1231, 93, 1819, 14, 272, 768, 466, 1738, 26, 491, 91, 2162, 93, 272, 408, 2286, 347, 636, 826, 721, 277, 12, 1738, 12, 10269, 29, 403, 304, 267, 408, 267, 768, 635, 1738, 26, 1626, 4692, 1738, 1819, 14, 267, 768, 466, 1738, 26, 491, 91, 2162, 93, 267, 768, 635, 10269, 26, 437, 10269, 909, 14, 267, 768, 466, 10269, 26, 491, 91, 16738, 93, 267, 408, 267, 6935, 855, 826, 721, 277, 9, 267, 291, 14, 1231, 275, 1738, 267, 299, 1064, 275, 16160, 342, 267, 299, 1064, 14, 26984, 275, 788, 1231, 418, 267, 299, 1064, 14, 21148, 275, 1211, 8, 12333, 29, 2722, 9, 267, 291, 855, 2343, 4914, 1361, 363, 275, 299, 1064, 5493, 347, 7512, 8, 277, 12, 10269, 304, 267, 408, 267, 31096, 4310, 6941, 370, 1163, 644, 14029, 2251, 14, 267, 768, 635, 10269, 26, 437, 10269, 909, 14, 267, 768, 466, 10269, 26, 491, 91, 16738, 93, 267, 408, 267, 986, 13359, 199, 533, 16198, 1692, 8, 55, 1692, 304, 272, 408, 272, 437, 699, 91, 4579, 93, 644, 14029, 909, 14, 272, 768, 7725, 536, 26, 710, 536, 402, 314, 909, 14, 272, 768, 466, 536, 26, 620, 272, 768, 7725, 20834, 26, 710, 473, 91, 11661, 93, 536, 402, 314, 909, 14, 272, 768, 466, 20834, 26, 334, 354, 12, 473, 91, 3251, 13, 2302, 21385, 272, 408, 339, 347, 636, 826, 721, 277, 12, 1738, 12, 10269, 304, 267, 408, 267, 768, 635, 1738, 26, 1626, 4692, 1738, 1819, 14, 267, 768, 466, 1738, 26, 491, 91, 2162, 93, 267, 768, 635, 10269, 26, 437, 10269, 909, 14, 267, 768, 466, 10269, 26, 491, 91, 16738, 93, 267, 408, 267, 644, 1692, 855, 826, 721, 277, 12, 1738, 12, 10269, 9, 267, 291, 14, 354, 275, 1738, 14, 362, 360, 354, 358, 267, 291, 14, 12333, 275, 334, 277, 14, 354, 12, 10269, 14, 84, 561, 59, 17, 566, 267, 299, 1064, 275, 291, 855, 2343, 4914, 1361, 363, 267, 299, 1064, 14, 21148, 459, 12333, 418, 275, 4700, 421, 199, 533, 22659, 852, 8, 55, 1692, 304, 272, 408, 272, 21591, 314, 473, 91, 1231, 93, 3970, 402, 314, 644, 14029, 2251, 465, 3247, 272, 701, 665, 21452, 26, 15388, 3133, 272, 768, 7725, 1305, 26, 710, 909, 1305, 14, 272, 768, 466, 1305, 26, 620, 272, 768, 7725, 1511, 26, 1626, 1511, 2600, 14, 272, 768, 466, 1511, 26, 491, 91, 1419, 14, 4558, 93, 272, 768, 7725, 1166, 26, 710, 2851, 1202, 370, 2248, 314, 909, 14, 272, 768, 466, 1166, 26, 620, 272, 768, 7725, 307, 561, 26, 710, 1347, 3231, 367, 314, 644, 14029, 14, 272, 768, 466, 307, 561, 26, 620, 272, 768, 7725, 4177, 26, 710, 1048, 25982, 644, 14029, 4177, 909, 14, 272, 768, 466, 4177, 26, 491, 91, 6700, 7768, 93, 272, 768, 7725, 4978, 26, 710, 3066, 769, 402, 1982, 2251, 14, 272, 768, 466, 4978, 26, 359, 44, 91, 55, 1692, 1386, 18737, 272, 768, 7725, 8925, 26, 710, 769, 402, 491, 91, 6295, 93, 4978, 14, 272, 768, 466, 8925, 26, 359, 44, 91, 6295, 1386, 18737, 272, 768, 7725, 3788, 26, 710, 2600, 402, 491, 91, 2209, 93, 4978, 790, 5121, 701, 473, 91, 12333, 93, 272, 768, 466, 3788, 26, 359, 44, 91 ]
[ 961, 2240, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 334, 44, 12006, 9, 1664, 6401, 1696, 1684, 844, 465, 199, 3, 3267, 701, 314, 2868, 2290, 2752, 27, 1902, 1015, 650, 402, 314, 221, 199, 3, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 11243, 6401, 1696, 1684, 844, 367, 1655, 2436, 737, 199, 3, 334, 1455, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 15, 9783, 1168, 14, 1360, 7092, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 6401, 1696, 1684, 844, 199, 3, 3180, 543, 642, 2240, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 199, 3, 2752, 12, 3277, 2020, 8155, 15630, 10902, 446, 14453, 13540, 12, 8226, 12, 4828, 15673, 13, 13421, 12, 8217, 14, 199, 3, 5313, 701, 26, 1603, 3609, 4236, 14146, 334, 1335, 269, 14146, 32, 17164, 14, 957, 776, 199, 199, 624, 199, 1918, 473, 91, 21452, 93, 859, 6571, 376, 1559, 825, 3793, 402, 314, 644, 14029, 14, 199, 1918, 5062, 1021, 365, 473, 91, 16738, 93, 465, 652, 295, 7732, 795, 314, 1738, 1819, 199, 4214, 315, 314, 2213, 14, 199, 624, 199, 199, 504, 2050, 492, 28138, 199, 504, 30713, 492, 627, 199, 504, 30713, 14, 14338, 492, 3715, 4793, 199, 504, 30713, 14, 14338, 14, 2108, 492, 6566, 199, 504, 30713, 14, 10880, 14, 3554, 492, 7543, 199, 504, 30713, 14, 10880, 14, 4354, 492, 11785, 12, 3447, 15282, 199, 504, 30713, 14, 10515, 492, 6420, 2021, 12, 19317, 199, 504, 30713, 14, 10515, 14, 3629, 492, 13268, 12, 13268, 7768, 199, 504, 30713, 14, 10515, 14, 1131, 492, 6566, 3227, 199, 504, 30713, 14, 9648, 795, 785, 492, 6935, 12, 481, 645, 9587, 12, 16160, 199, 504, 30713, 14, 5503, 492, 7543, 5929, 12, 22659, 852, 5929, 199, 504, 7097, 492, 20818, 199, 646, 295, 12, 880, 439, 1144, 199, 199, 793, 275, 28138, 3460, 354, 3368, 199, 199, 21452, 561, 275, 334, 403, 12, 298, 1014, 921, 9482, 14, 10198, 5770, 439, 14, 1308, 15, 21452, 13589, 199, 21818, 561, 275, 334, 403, 12, 283, 1014, 921, 9482, 14, 10198, 5770, 439, 14, 1308, 15, 21452, 15, 21818, 6217, 199, 21818, 713, 561, 275, 334, 403, 12, 283, 1014, 921, 9482, 14, 10198, 5770, 439, 14, 1308, 15, 21452, 15, 21818, 713, 6217, 421, 199, 533, 644, 1692, 8, 1692, 304, 272, 408, 272, 3523, 909, 367, 336, 22837, 2943, 14, 272, 768, 7725, 1738, 26, 710, 4692, 473, 91, 1231, 93, 1819, 14, 272, 768, 466, 1738, 26, 491, 91, 2162, 93, 272, 408, 2286, 347, 636, 826, 721, 277, 12, 1738, 12, 10269, 29, 403, 304, 267, 408, 267, 768, 635, 1738, 26, 1626, 4692, 1738, 1819, 14, 267, 768, 466, 1738, 26, 491, 91, 2162, 93, 267, 768, 635, 10269, 26, 437, 10269, 909, 14, 267, 768, 466, 10269, 26, 491, 91, 16738, 93, 267, 408, 267, 6935, 855, 826, 721, 277, 9, 267, 291, 14, 1231, 275, 1738, 267, 299, 1064, 275, 16160, 342, 267, 299, 1064, 14, 26984, 275, 788, 1231, 418, 267, 299, 1064, 14, 21148, 275, 1211, 8, 12333, 29, 2722, 9, 267, 291, 855, 2343, 4914, 1361, 363, 275, 299, 1064, 5493, 347, 7512, 8, 277, 12, 10269, 304, 267, 408, 267, 31096, 4310, 6941, 370, 1163, 644, 14029, 2251, 14, 267, 768, 635, 10269, 26, 437, 10269, 909, 14, 267, 768, 466, 10269, 26, 491, 91, 16738, 93, 267, 408, 267, 986, 13359, 199, 533, 16198, 1692, 8, 55, 1692, 304, 272, 408, 272, 437, 699, 91, 4579, 93, 644, 14029, 909, 14, 272, 768, 7725, 536, 26, 710, 536, 402, 314, 909, 14, 272, 768, 466, 536, 26, 620, 272, 768, 7725, 20834, 26, 710, 473, 91, 11661, 93, 536, 402, 314, 909, 14, 272, 768, 466, 20834, 26, 334, 354, 12, 473, 91, 3251, 13, 2302, 21385, 272, 408, 339, 347, 636, 826, 721, 277, 12, 1738, 12, 10269, 304, 267, 408, 267, 768, 635, 1738, 26, 1626, 4692, 1738, 1819, 14, 267, 768, 466, 1738, 26, 491, 91, 2162, 93, 267, 768, 635, 10269, 26, 437, 10269, 909, 14, 267, 768, 466, 10269, 26, 491, 91, 16738, 93, 267, 408, 267, 644, 1692, 855, 826, 721, 277, 12, 1738, 12, 10269, 9, 267, 291, 14, 354, 275, 1738, 14, 362, 360, 354, 358, 267, 291, 14, 12333, 275, 334, 277, 14, 354, 12, 10269, 14, 84, 561, 59, 17, 566, 267, 299, 1064, 275, 291, 855, 2343, 4914, 1361, 363, 267, 299, 1064, 14, 21148, 459, 12333, 418, 275, 4700, 421, 199, 533, 22659, 852, 8, 55, 1692, 304, 272, 408, 272, 21591, 314, 473, 91, 1231, 93, 3970, 402, 314, 644, 14029, 2251, 465, 3247, 272, 701, 665, 21452, 26, 15388, 3133, 272, 768, 7725, 1305, 26, 710, 909, 1305, 14, 272, 768, 466, 1305, 26, 620, 272, 768, 7725, 1511, 26, 1626, 1511, 2600, 14, 272, 768, 466, 1511, 26, 491, 91, 1419, 14, 4558, 93, 272, 768, 7725, 1166, 26, 710, 2851, 1202, 370, 2248, 314, 909, 14, 272, 768, 466, 1166, 26, 620, 272, 768, 7725, 307, 561, 26, 710, 1347, 3231, 367, 314, 644, 14029, 14, 272, 768, 466, 307, 561, 26, 620, 272, 768, 7725, 4177, 26, 710, 1048, 25982, 644, 14029, 4177, 909, 14, 272, 768, 466, 4177, 26, 491, 91, 6700, 7768, 93, 272, 768, 7725, 4978, 26, 710, 3066, 769, 402, 1982, 2251, 14, 272, 768, 466, 4978, 26, 359, 44, 91, 55, 1692, 1386, 18737, 272, 768, 7725, 8925, 26, 710, 769, 402, 491, 91, 6295, 93, 4978, 14, 272, 768, 466, 8925, 26, 359, 44, 91, 6295, 1386, 18737, 272, 768, 7725, 3788, 26, 710, 2600, 402, 491, 91, 2209, 93, 4978, 790, 5121, 701, 473, 91, 12333, 93, 272, 768, 466, 3788, 26, 359, 44, 91, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
wsmith323/django
django/template/smartif.py
69
6197
""" Parser and utilities for the smart 'if' tag """ # Using a simple top down parser, as described here: # http://effbot.org/zone/simple-top-down-parsing.htm. # 'led' = left denotation # 'nud' = null denotation # 'bp' = binding power (left = lbp, right = rbp) class TokenBase(object): """ Base class for operators and literals, mainly for debugging and for throwing syntax errors. """ id = None # node/token type name value = None # used by literals first = second = None # used by tree nodes def nud(self, parser): # Null denotation - called in prefix context raise parser.error_class( "Not expecting '%s' in this position in if tag." % self.id ) def led(self, left, parser): # Left denotation - called in infix context raise parser.error_class( "Not expecting '%s' as infix operator in if tag." % self.id ) def display(self): """ Returns what to display in error messages for this node """ return self.id def __repr__(self): out = [str(x) for x in [self.id, self.first, self.second] if x is not None] return "(" + " ".join(out) + ")" def infix(bp, func): """ Creates an infix operator, given a binding power and a function that evaluates the node """ class Operator(TokenBase): lbp = bp def led(self, left, parser): self.first = left self.second = parser.expression(bp) return self def eval(self, context): try: return func(context, self.first, self.second) except Exception: # Templates shouldn't throw exceptions when rendering. We are # most likely to get exceptions for things like {% if foo in bar # %} where 'bar' does not support 'in', so default to False return False return Operator def prefix(bp, func): """ Creates a prefix operator, given a binding power and a function that evaluates the node. """ class Operator(TokenBase): lbp = bp def nud(self, parser): self.first = parser.expression(bp) self.second = None return self def eval(self, context): try: return func(context, self.first) except Exception: return False return Operator # Operator precedence follows Python. # NB - we can get slightly more accurate syntax error messages by not using the # same object for '==' and '='. # We defer variable evaluation to the lambda to ensure that terms are # lazily evaluated using Python's boolean parsing logic. OPERATORS = { 'or': infix(6, lambda context, x, y: x.eval(context) or y.eval(context)), 'and': infix(7, lambda context, x, y: x.eval(context) and y.eval(context)), 'not': prefix(8, lambda context, x: not x.eval(context)), 'in': infix(9, lambda context, x, y: x.eval(context) in y.eval(context)), 'not in': infix(9, lambda context, x, y: x.eval(context) not in y.eval(context)), '==': infix(10, lambda context, x, y: x.eval(context) == y.eval(context)), '!=': infix(10, lambda context, x, y: x.eval(context) != y.eval(context)), '>': infix(10, lambda context, x, y: x.eval(context) > y.eval(context)), '>=': infix(10, lambda context, x, y: x.eval(context) >= y.eval(context)), '<': infix(10, lambda context, x, y: x.eval(context) < y.eval(context)), '<=': infix(10, lambda context, x, y: x.eval(context) <= y.eval(context)), } # Assign 'id' to each: for key, op in OPERATORS.items(): op.id = key class Literal(TokenBase): """ A basic self-resolvable object similar to a Django template variable. """ # IfParser uses Literal in create_var, but TemplateIfParser overrides # create_var so that a proper implementation that actually resolves # variables, filters etc is used. id = "literal" lbp = 0 def __init__(self, value): self.value = value def display(self): return repr(self.value) def nud(self, parser): return self def eval(self, context): return self.value def __repr__(self): return "(%s %r)" % (self.id, self.value) class EndToken(TokenBase): lbp = 0 def nud(self, parser): raise parser.error_class("Unexpected end of expression in if tag.") EndToken = EndToken() class IfParser(object): error_class = ValueError def __init__(self, tokens): # pre-pass necessary to turn 'not','in' into single token l = len(tokens) mapped_tokens = [] i = 0 while i < l: token = tokens[i] if token == "not" and i + 1 < l and tokens[i + 1] == "in": token = "not in" i += 1 # skip 'in' mapped_tokens.append(self.translate_token(token)) i += 1 self.tokens = mapped_tokens self.pos = 0 self.current_token = self.next_token() def translate_token(self, token): try: op = OPERATORS[token] except (KeyError, TypeError): return self.create_var(token) else: return op() def next_token(self): if self.pos >= len(self.tokens): return EndToken else: retval = self.tokens[self.pos] self.pos += 1 return retval def parse(self): retval = self.expression() # Check that we have exhausted all the tokens if self.current_token is not EndToken: raise self.error_class("Unused '%s' at end of if expression." % self.current_token.display()) return retval def expression(self, rbp=0): t = self.current_token self.current_token = self.next_token() left = t.nud(self) while rbp < self.current_token.lbp: t = self.current_token self.current_token = self.next_token() left = t.led(left, self) return left def create_var(self, value): return Literal(value)
bsd-3-clause
[ 624, 199, 2842, 436, 15841, 367, 314, 11179, 283, 692, 7, 1947, 199, 624, 199, 3, 11719, 282, 3486, 2746, 3224, 1798, 12, 465, 11736, 2348, 26, 199, 3, 259, 1455, 921, 3609, 3018, 14, 1308, 15, 2619, 15, 4129, 13, 2119, 13, 2110, 13, 11059, 14, 15575, 14, 199, 3, 283, 1146, 7, 275, 3602, 477, 12251, 199, 3, 283, 78, 1181, 7, 275, 2973, 477, 12251, 199, 3, 283, 10913, 7, 275, 11696, 7074, 334, 3039, 275, 634, 10913, 12, 2451, 275, 519, 10913, 9, 421, 199, 533, 8767, 1563, 8, 785, 304, 272, 408, 272, 3523, 1021, 367, 10211, 436, 18041, 12, 27580, 367, 10201, 436, 367, 7978, 316, 272, 6302, 2552, 14, 272, 408, 272, 1305, 275, 488, 221, 327, 1031, 15, 1418, 730, 536, 272, 574, 275, 488, 221, 327, 1202, 701, 18041, 272, 1642, 275, 3499, 275, 488, 221, 327, 1202, 701, 3123, 3380, 339, 347, 302, 1181, 8, 277, 12, 1798, 304, 267, 327, 12119, 477, 12251, 446, 2797, 315, 2403, 1067, 267, 746, 1798, 14, 705, 63, 533, 8, 288, 298, 1763, 21055, 1543, 83, 7, 315, 642, 3421, 315, 340, 1947, 2122, 450, 291, 14, 344, 267, 776, 339, 347, 29239, 8, 277, 12, 3602, 12, 1798, 304, 267, 327, 29350, 477, 12251, 446, 2797, 315, 315, 970, 1067, 267, 746, 1798, 14, 705, 63, 533, 8, 288, 298, 1763, 21055, 1543, 83, 7, 465, 315, 970, 4182, 315, 340, 1947, 2122, 450, 291, 14, 344, 267, 776, 339, 347, 2929, 8, 277, 304, 267, 408, 267, 1803, 4052, 370, 2929, 315, 1125, 3788, 367, 642, 1031, 267, 408, 267, 372, 291, 14, 344, 339, 347, 636, 2722, 721, 277, 304, 267, 734, 275, 359, 495, 8, 88, 9, 367, 671, 315, 359, 277, 14, 344, 12, 291, 14, 2246, 12, 291, 14, 4375, 61, 340, 671, 365, 440, 488, 61, 267, 372, 26054, 435, 298, 3680, 904, 8, 548, 9, 435, 19607, 421, 199, 318, 315, 970, 8, 10913, 12, 2562, 304, 272, 408, 272, 10560, 376, 315, 970, 4182, 12, 1627, 282, 11696, 7074, 436, 282, 805, 626, 272, 22014, 314, 1031, 272, 408, 272, 1021, 11013, 8, 3264, 1563, 304, 267, 634, 10913, 275, 13292, 398, 347, 29239, 8, 277, 12, 3602, 12, 1798, 304, 288, 291, 14, 2246, 275, 3602, 288, 291, 14, 4375, 275, 1798, 14, 5599, 8, 10913, 9, 288, 372, 291, 398, 347, 3468, 8, 277, 12, 1067, 304, 288, 862, 26, 355, 372, 2562, 8, 1100, 12, 291, 14, 2246, 12, 291, 14, 4375, 9, 288, 871, 2186, 26, 355, 327, 31273, 9296, 1133, 7978, 4967, 1380, 14066, 14, 221, 2136, 787, 355, 327, 4750, 12060, 370, 664, 4967, 367, 7645, 2839, 7749, 340, 3925, 315, 4681, 355, 327, 3674, 2382, 283, 1700, 7, 1630, 440, 2291, 283, 262, 297, 880, 849, 370, 756, 355, 372, 756, 339, 372, 11013, 421, 199, 318, 2403, 8, 10913, 12, 2562, 304, 272, 408, 272, 10560, 282, 2403, 4182, 12, 1627, 282, 11696, 7074, 436, 282, 805, 626, 272, 22014, 314, 1031, 14, 272, 408, 272, 1021, 11013, 8, 3264, 1563, 304, 267, 634, 10913, 275, 13292, 398, 347, 302, 1181, 8, 277, 12, 1798, 304, 288, 291, 14, 2246, 275, 1798, 14, 5599, 8, 10913, 9, 288, 291, 14, 4375, 275, 488, 288, 372, 291, 398, 347, 3468, 8, 277, 12, 1067, 304, 288, 862, 26, 355, 372, 2562, 8, 1100, 12, 291, 14, 2246, 9, 288, 871, 2186, 26, 355, 372, 756, 339, 372, 11013, 421, 199, 3, 11013, 13823, 11924, 2018, 14, 199, 3, 25377, 446, 781, 883, 664, 18023, 1655, 23189, 6302, 1125, 3788, 701, 440, 1808, 314, 199, 3, 2011, 909, 367, 283, 6803, 436, 14051, 14, 199, 3, 2136, 10133, 1750, 11735, 370, 314, 2400, 370, 4868, 626, 2895, 787, 199, 3, 29667, 3444, 13006, 1808, 2018, 1159, 5046, 6057, 9661, 14, 199, 15598, 19033, 275, 469, 272, 283, 269, 356, 315, 970, 8, 22, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 503, 612, 14, 2579, 8, 1100, 1826, 272, 283, 460, 356, 315, 970, 8, 23, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 436, 612, 14, 2579, 8, 1100, 1826, 272, 283, 1397, 356, 2403, 8, 24, 12, 2400, 1067, 12, 671, 26, 440, 671, 14, 2579, 8, 1100, 1826, 272, 283, 262, 356, 315, 970, 8, 25, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 315, 612, 14, 2579, 8, 1100, 1826, 272, 283, 1397, 315, 356, 315, 970, 8, 25, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 440, 315, 612, 14, 2579, 8, 1100, 1826, 272, 283, 389, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 508, 612, 14, 2579, 8, 1100, 1826, 272, 26656, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 1137, 612, 14, 2579, 8, 1100, 1826, 272, 12696, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 690, 612, 14, 2579, 8, 1100, 1826, 272, 283, 8119, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 2356, 612, 14, 2579, 8, 1100, 1826, 272, 2650, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 665, 612, 14, 2579, 8, 1100, 1826, 272, 2650, 18749, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 2695, 612, 14, 2579, 8, 1100, 1826, 199, 93, 199, 199, 3, 16927, 283, 344, 7, 370, 1924, 26, 199, 509, 790, 12, 1687, 315, 29771, 19033, 14, 1744, 837, 272, 1687, 14, 344, 275, 790, 421, 199, 533, 18271, 8, 3264, 1563, 304, 272, 408, 272, 437, 5678, 291, 13, 26702, 30456, 909, 8545, 370, 282, 5634, 1978, 1750, 14, 272, 408, 272, 327, 982, 2842, 4440, 18271, 315, 1218, 63, 1391, 12, 1325, 5458 ]
[ 199, 2842, 436, 15841, 367, 314, 11179, 283, 692, 7, 1947, 199, 624, 199, 3, 11719, 282, 3486, 2746, 3224, 1798, 12, 465, 11736, 2348, 26, 199, 3, 259, 1455, 921, 3609, 3018, 14, 1308, 15, 2619, 15, 4129, 13, 2119, 13, 2110, 13, 11059, 14, 15575, 14, 199, 3, 283, 1146, 7, 275, 3602, 477, 12251, 199, 3, 283, 78, 1181, 7, 275, 2973, 477, 12251, 199, 3, 283, 10913, 7, 275, 11696, 7074, 334, 3039, 275, 634, 10913, 12, 2451, 275, 519, 10913, 9, 421, 199, 533, 8767, 1563, 8, 785, 304, 272, 408, 272, 3523, 1021, 367, 10211, 436, 18041, 12, 27580, 367, 10201, 436, 367, 7978, 316, 272, 6302, 2552, 14, 272, 408, 272, 1305, 275, 488, 221, 327, 1031, 15, 1418, 730, 536, 272, 574, 275, 488, 221, 327, 1202, 701, 18041, 272, 1642, 275, 3499, 275, 488, 221, 327, 1202, 701, 3123, 3380, 339, 347, 302, 1181, 8, 277, 12, 1798, 304, 267, 327, 12119, 477, 12251, 446, 2797, 315, 2403, 1067, 267, 746, 1798, 14, 705, 63, 533, 8, 288, 298, 1763, 21055, 1543, 83, 7, 315, 642, 3421, 315, 340, 1947, 2122, 450, 291, 14, 344, 267, 776, 339, 347, 29239, 8, 277, 12, 3602, 12, 1798, 304, 267, 327, 29350, 477, 12251, 446, 2797, 315, 315, 970, 1067, 267, 746, 1798, 14, 705, 63, 533, 8, 288, 298, 1763, 21055, 1543, 83, 7, 465, 315, 970, 4182, 315, 340, 1947, 2122, 450, 291, 14, 344, 267, 776, 339, 347, 2929, 8, 277, 304, 267, 408, 267, 1803, 4052, 370, 2929, 315, 1125, 3788, 367, 642, 1031, 267, 408, 267, 372, 291, 14, 344, 339, 347, 636, 2722, 721, 277, 304, 267, 734, 275, 359, 495, 8, 88, 9, 367, 671, 315, 359, 277, 14, 344, 12, 291, 14, 2246, 12, 291, 14, 4375, 61, 340, 671, 365, 440, 488, 61, 267, 372, 26054, 435, 298, 3680, 904, 8, 548, 9, 435, 19607, 421, 199, 318, 315, 970, 8, 10913, 12, 2562, 304, 272, 408, 272, 10560, 376, 315, 970, 4182, 12, 1627, 282, 11696, 7074, 436, 282, 805, 626, 272, 22014, 314, 1031, 272, 408, 272, 1021, 11013, 8, 3264, 1563, 304, 267, 634, 10913, 275, 13292, 398, 347, 29239, 8, 277, 12, 3602, 12, 1798, 304, 288, 291, 14, 2246, 275, 3602, 288, 291, 14, 4375, 275, 1798, 14, 5599, 8, 10913, 9, 288, 372, 291, 398, 347, 3468, 8, 277, 12, 1067, 304, 288, 862, 26, 355, 372, 2562, 8, 1100, 12, 291, 14, 2246, 12, 291, 14, 4375, 9, 288, 871, 2186, 26, 355, 327, 31273, 9296, 1133, 7978, 4967, 1380, 14066, 14, 221, 2136, 787, 355, 327, 4750, 12060, 370, 664, 4967, 367, 7645, 2839, 7749, 340, 3925, 315, 4681, 355, 327, 3674, 2382, 283, 1700, 7, 1630, 440, 2291, 283, 262, 297, 880, 849, 370, 756, 355, 372, 756, 339, 372, 11013, 421, 199, 318, 2403, 8, 10913, 12, 2562, 304, 272, 408, 272, 10560, 282, 2403, 4182, 12, 1627, 282, 11696, 7074, 436, 282, 805, 626, 272, 22014, 314, 1031, 14, 272, 408, 272, 1021, 11013, 8, 3264, 1563, 304, 267, 634, 10913, 275, 13292, 398, 347, 302, 1181, 8, 277, 12, 1798, 304, 288, 291, 14, 2246, 275, 1798, 14, 5599, 8, 10913, 9, 288, 291, 14, 4375, 275, 488, 288, 372, 291, 398, 347, 3468, 8, 277, 12, 1067, 304, 288, 862, 26, 355, 372, 2562, 8, 1100, 12, 291, 14, 2246, 9, 288, 871, 2186, 26, 355, 372, 756, 339, 372, 11013, 421, 199, 3, 11013, 13823, 11924, 2018, 14, 199, 3, 25377, 446, 781, 883, 664, 18023, 1655, 23189, 6302, 1125, 3788, 701, 440, 1808, 314, 199, 3, 2011, 909, 367, 283, 6803, 436, 14051, 14, 199, 3, 2136, 10133, 1750, 11735, 370, 314, 2400, 370, 4868, 626, 2895, 787, 199, 3, 29667, 3444, 13006, 1808, 2018, 1159, 5046, 6057, 9661, 14, 199, 15598, 19033, 275, 469, 272, 283, 269, 356, 315, 970, 8, 22, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 503, 612, 14, 2579, 8, 1100, 1826, 272, 283, 460, 356, 315, 970, 8, 23, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 436, 612, 14, 2579, 8, 1100, 1826, 272, 283, 1397, 356, 2403, 8, 24, 12, 2400, 1067, 12, 671, 26, 440, 671, 14, 2579, 8, 1100, 1826, 272, 283, 262, 356, 315, 970, 8, 25, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 315, 612, 14, 2579, 8, 1100, 1826, 272, 283, 1397, 315, 356, 315, 970, 8, 25, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 440, 315, 612, 14, 2579, 8, 1100, 1826, 272, 283, 389, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 508, 612, 14, 2579, 8, 1100, 1826, 272, 26656, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 1137, 612, 14, 2579, 8, 1100, 1826, 272, 12696, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 690, 612, 14, 2579, 8, 1100, 1826, 272, 283, 8119, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 2356, 612, 14, 2579, 8, 1100, 1826, 272, 2650, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 665, 612, 14, 2579, 8, 1100, 1826, 272, 2650, 18749, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 2695, 612, 14, 2579, 8, 1100, 1826, 199, 93, 199, 199, 3, 16927, 283, 344, 7, 370, 1924, 26, 199, 509, 790, 12, 1687, 315, 29771, 19033, 14, 1744, 837, 272, 1687, 14, 344, 275, 790, 421, 199, 533, 18271, 8, 3264, 1563, 304, 272, 408, 272, 437, 5678, 291, 13, 26702, 30456, 909, 8545, 370, 282, 5634, 1978, 1750, 14, 272, 408, 272, 327, 982, 2842, 4440, 18271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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
RogueFrog/calculator
lexer_calc.py
1
1083
from types_calc import * class Lexer: def setLine(self, line): self.line = line + ' ' self.tokenizes = [] self.tokenNumber = '' def tokenize(self): for i in self.line: Lexer.tokenizeNumber(self, i) Lexer.tokenizeMath(self, i) self.tokenizes.append(Token(EOF, 0)) def tokenizeNumber(self, char): if char.isdigit(): self.tokenNumber += char else: if self.tokenNumber != '': self.tokenizes.append(Token(NUMBER, int(self.tokenNumber))) self.tokenNumber = '' def tokenizeMath(self, char): if char == '+': self.tokenizes.append(Token(PLUS, char)) elif char == '-': self.tokenizes.append(Token(MINUS, char)) elif char == '*': self.tokenizes.append(Token(STAR, char)) elif char == '/': self.tokenizes.append(Token(SLASH, char)) class Token: def __init__(self, token, data): self.token = token self.data = data
mit
[ 504, 2943, 63, 8104, 492, 627, 199, 199, 533, 21125, 26, 267, 272, 347, 663, 3049, 8, 277, 12, 1004, 304, 267, 291, 14, 604, 275, 1004, 435, 283, 283, 267, 291, 14, 1418, 6491, 275, 942, 267, 291, 14, 1418, 3259, 275, 2125, 15567, 347, 13343, 8, 277, 304, 267, 367, 284, 315, 291, 14, 604, 26, 288, 21125, 14, 15246, 3259, 8, 277, 12, 284, 9, 288, 21125, 14, 15246, 18568, 8, 277, 12, 284, 9, 267, 291, 14, 1418, 6491, 14, 740, 8, 3264, 8, 13178, 12, 378, 430, 339, 347, 13343, 3259, 8, 277, 12, 1495, 304, 267, 340, 1495, 14, 13896, 837, 288, 291, 14, 1418, 3259, 847, 1495, 267, 587, 26, 288, 340, 291, 14, 1418, 3259, 1137, 8061, 355, 291, 14, 1418, 6491, 14, 740, 8, 3264, 8, 9190, 12, 1109, 8, 277, 14, 1418, 3259, 1724, 355, 291, 14, 1418, 3259, 275, 2125, 2286, 347, 13343, 18568, 8, 277, 12, 1495, 304, 267, 340, 1495, 508, 6681, 356, 288, 291, 14, 1418, 6491, 14, 740, 8, 3264, 8, 27280, 12, 1495, 430, 267, 916, 1495, 508, 20905, 288, 291, 14, 1418, 6491, 14, 740, 8, 3264, 8, 18004, 12, 1495, 430, 267, 916, 1495, 508, 22969, 288, 291, 14, 1418, 6491, 14, 740, 8, 3264, 8, 30302, 12, 1495, 430, 267, 916, 1495, 508, 20549, 288, 291, 14, 1418, 6491, 14, 740, 8, 3264, 8, 27192, 12, 1495, 430, 199, 199, 533, 8767, 26, 272, 347, 636, 826, 721, 277, 12, 1526, 12, 666, 304, 267, 291, 14, 1418, 275, 1526, 267, 291, 14, 576, 275, 666, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2943, 63, 8104, 492, 627, 199, 199, 533, 21125, 26, 267, 272, 347, 663, 3049, 8, 277, 12, 1004, 304, 267, 291, 14, 604, 275, 1004, 435, 283, 283, 267, 291, 14, 1418, 6491, 275, 942, 267, 291, 14, 1418, 3259, 275, 2125, 15567, 347, 13343, 8, 277, 304, 267, 367, 284, 315, 291, 14, 604, 26, 288, 21125, 14, 15246, 3259, 8, 277, 12, 284, 9, 288, 21125, 14, 15246, 18568, 8, 277, 12, 284, 9, 267, 291, 14, 1418, 6491, 14, 740, 8, 3264, 8, 13178, 12, 378, 430, 339, 347, 13343, 3259, 8, 277, 12, 1495, 304, 267, 340, 1495, 14, 13896, 837, 288, 291, 14, 1418, 3259, 847, 1495, 267, 587, 26, 288, 340, 291, 14, 1418, 3259, 1137, 8061, 355, 291, 14, 1418, 6491, 14, 740, 8, 3264, 8, 9190, 12, 1109, 8, 277, 14, 1418, 3259, 1724, 355, 291, 14, 1418, 3259, 275, 2125, 2286, 347, 13343, 18568, 8, 277, 12, 1495, 304, 267, 340, 1495, 508, 6681, 356, 288, 291, 14, 1418, 6491, 14, 740, 8, 3264, 8, 27280, 12, 1495, 430, 267, 916, 1495, 508, 20905, 288, 291, 14, 1418, 6491, 14, 740, 8, 3264, 8, 18004, 12, 1495, 430, 267, 916, 1495, 508, 22969, 288, 291, 14, 1418, 6491, 14, 740, 8, 3264, 8, 30302, 12, 1495, 430, 267, 916, 1495, 508, 20549, 288, 291, 14, 1418, 6491, 14, 740, 8, 3264, 8, 27192, 12, 1495, 430, 199, 199, 533, 8767, 26, 272, 347, 636, 826, 721, 277, 12, 1526, 12, 666, 304, 267, 291, 14, 1418, 275, 1526, 267, 291, 14, 576, 275, 666, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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 ]
rahul67/hue
desktop/core/ext-py/lxml/src/lxml/html/tests/transform_feedparser_data.py
28
2819
""" This takes the feedparser tests from here: http://feedparser.org/tests/wellformed/sanitize/ and rewrites them to be easier to handle (not using the internal model of feedparser). The input format is:: <!-- Description: {description} Expect: {expression} --> ... <content ...>{content}</content> ... The Expect expression is checked for ``entries[0]['content'][0]['value'] == {data}``. The output format is:: Description: {description} Expect: {expression} (if data couldn't be parsed) Options: {content, unescaped} ---------- {data, unescaped, if found} """ import re import os import traceback _desc_re = re.compile(r'\s*Description:\s*(.*)') _expect_re = re.compile(r'\s*Expect:\s*(.*)') _data_expect_re = re.compile(r"entries\[0\]\['[^']+'\](?:\[0\]\['value'\])?\s*==\s*(.*)") _feed_data_expect_re = re.compile(r"feed\['[^']+'\]\s*==\s*(.*)") def parse_content(content): match = _desc_re.search(content) desc = match.group(1) match = _expect_re.search(content) expect = match.group(1) data = None for regex in [_data_expect_re, _feed_data_expect_re]: match = regex.search(expect) if match: # Icky, but I'll trust it data = eval(match.group(1).strip()) break c = None for tag in ['content', 'summary', 'title', 'copyright', 'tagline', 'info', 'subtitle', 'fullitem', 'body', 'description', 'content:encoded']: regex = re.compile(r"<%s.*?>(.*)</%s>" % (tag, tag), re.S) match = regex.search(content) if match: c = match.group(1) break assert c is not None # Seems like body isn't quoted if tag != 'body': c = c.replace('&lt;', '<') c = c.replace('&amp;', '&') # FIXME: I should really do more unescaping... return { 'Description': desc, 'Expect': expect, 'data': data, 'content': c} def serialize_content(d): s = '''\ Description: %(Description)s Expect: %(Expect)s Options: %(content)s ''' % d if d.get('data') is not None: s += '----------\n%s' % d['data'] return s def translate_file(filename): f = open(filename, 'rb') c = f.read() f.close() try: output = serialize_content(parse_content(c)) except: print 'Bad data in %s:' % filename print c traceback.print_exc() print '-'*60 return new = os.path.splitext(filename)[0] + '.data' f = open(new, 'wb') f.write(output) f.close() def translate_all(dir): for fn in os.listdir(dir): fn = os.path.join(dir, fn) if fn.endswith('.xml'): translate_file(fn) if __name__ == '__main__': import sys translate_all(os.path.join(os.path.dirname(__file__), 'feedparser-data'))
apache-2.0
[ 624, 199, 2765, 6181, 314, 4733, 2087, 2295, 687, 2348, 26, 819, 1455, 921, 3871, 2087, 14, 1308, 15, 2219, 15, 87, 352, 17733, 15, 18177, 15, 199, 199, 460, 295, 16334, 3062, 370, 506, 14905, 370, 2429, 334, 1397, 1808, 314, 5007, 1402, 199, 1618, 4733, 2087, 680, 221, 710, 1324, 1475, 365, 447, 819, 28253, 523, 11994, 26, 469, 1802, 93, 523, 15100, 26, 469, 5599, 93, 523, 10541, 523, 2263, 523, 665, 1317, 2263, 22266, 1317, 17890, 1317, 30, 523, 2263, 199, 199, 1918, 15100, 3965, 365, 7923, 367, 199, 1040, 3189, 59, 16, 2733, 1317, 3488, 16, 2733, 585, 418, 508, 469, 576, 93, 4345, 199, 199, 1918, 1072, 1475, 365, 447, 819, 11994, 26, 469, 1802, 93, 523, 15100, 26, 469, 5599, 93, 334, 692, 666, 21554, 1133, 506, 4565, 9, 523, 8394, 26, 221, 819, 469, 1317, 12, 625, 13572, 93, 523, 4143, 523, 469, 576, 12, 625, 13572, 12, 340, 1911, 93, 199, 199, 624, 199, 199, 646, 295, 199, 646, 747, 199, 646, 5190, 199, 199, 63, 3257, 63, 264, 275, 295, 14, 2014, 8, 82, 1154, 83, 10, 5831, 3427, 83, 5830, 2795, 5942, 199, 63, 4921, 63, 264, 275, 295, 14, 2014, 8, 82, 1154, 83, 10, 13495, 3427, 83, 5830, 2795, 5942, 199, 63, 576, 63, 4921, 63, 264, 275, 295, 14, 2014, 8, 82, 2, 3189, 25621, 16, 60, 7272, 459, 4735, 418, 19192, 61, 15840, 59, 16, 60, 7272, 459, 585, 1154, 566, 8995, 83, 10, 389, 60, 83, 5830, 2795, 6320, 199, 63, 3871, 63, 576, 63, 4921, 63, 264, 275, 295, 14, 2014, 8, 82, 2, 3871, 60, 459, 4735, 418, 19192, 7272, 83, 10, 389, 60, 83, 5830, 2795, 6320, 199, 199, 318, 2198, 63, 1317, 8, 1317, 304, 272, 1336, 275, 485, 3257, 63, 264, 14, 1733, 8, 1317, 9, 272, 4328, 275, 1336, 14, 923, 8, 17, 9, 272, 1336, 275, 485, 4921, 63, 264, 14, 1733, 8, 1317, 9, 272, 4282, 275, 1336, 14, 923, 8, 17, 9, 272, 666, 275, 488, 272, 367, 5163, 315, 15500, 576, 63, 4921, 63, 264, 12, 485, 3871, 63, 576, 63, 4921, 63, 264, 2189, 267, 1336, 275, 5163, 14, 1733, 8, 4921, 9, 267, 340, 1336, 26, 288, 327, 473, 346, 89, 12, 1325, 473, 7171, 16822, 652, 288, 666, 275, 3468, 8, 1431, 14, 923, 8, 17, 680, 1913, 1012, 288, 2059, 272, 286, 275, 488, 272, 367, 1947, 315, 788, 1317, 297, 283, 4705, 297, 283, 1213, 297, 283, 7307, 297, 283, 1450, 604, 297, 283, 815, 297, 283, 14348, 297, 283, 1893, 317, 563, 297, 283, 2030, 297, 283, 1802, 297, 283, 1317, 26, 8167, 2565, 267, 5163, 275, 295, 14, 2014, 8, 82, 17030, 5, 83, 6697, 13661, 12432, 26191, 83, 4335, 450, 334, 1450, 12, 1947, 395, 295, 14, 51, 9, 267, 1336, 275, 5163, 14, 1733, 8, 1317, 9, 267, 340, 1336, 26, 288, 286, 275, 1336, 14, 923, 8, 17, 9, 288, 2059, 272, 702, 286, 365, 440, 488, 272, 327, 1666, 706, 2839, 2396, 5712, 1133, 10999, 272, 340, 1947, 1137, 283, 2030, 356, 267, 286, 275, 286, 14, 1814, 20040, 4116, 10805, 2650, 358, 267, 286, 275, 286, 14, 1814, 20040, 5282, 10805, 7673, 358, 272, 327, 7600, 26, 473, 1077, 7710, 886, 1655, 625, 26306, 1396, 272, 372, 469, 267, 283, 5831, 356, 4328, 12, 267, 283, 13495, 356, 4282, 12, 267, 283, 576, 356, 666, 12, 267, 283, 1317, 356, 286, 93, 199, 199, 318, 8437, 63, 1317, 8, 68, 304, 272, 308, 275, 18087, 199, 5831, 26, 2818, 5831, 9, 83, 199, 13495, 26, 2818, 13495, 9, 83, 199, 4558, 26, 9948, 199, 2840, 1317, 9, 83, 199, 2344, 450, 366, 272, 340, 366, 14, 362, 360, 576, 358, 365, 440, 488, 26, 267, 308, 847, 283, 9460, 60, 78, 5, 83, 7, 450, 366, 459, 576, 418, 272, 372, 308, 199, 199, 318, 9028, 63, 493, 8, 1501, 304, 272, 289, 275, 1551, 8, 1501, 12, 283, 4848, 358, 272, 286, 275, 289, 14, 739, 342, 272, 289, 14, 1600, 342, 272, 862, 26, 267, 1072, 275, 8437, 63, 1317, 8, 1122, 63, 1317, 8, 67, 430, 272, 871, 26, 267, 870, 283, 5725, 666, 315, 450, 83, 4881, 450, 1788, 267, 870, 286, 267, 5190, 14, 1361, 63, 2804, 342, 267, 870, 10791, 10, 2259, 267, 372, 272, 892, 275, 747, 14, 515, 14, 7973, 8, 1501, 2788, 16, 61, 435, 1987, 576, 7, 272, 289, 275, 1551, 8, 1222, 12, 283, 6603, 358, 272, 289, 14, 952, 8, 1199, 9, 272, 289, 14, 1600, 342, 199, 199, 318, 9028, 63, 452, 8, 694, 304, 272, 367, 4325, 315, 747, 14, 7374, 8, 694, 304, 267, 4325, 275, 747, 14, 515, 14, 904, 8, 694, 12, 4325, 9, 267, 340, 4325, 14, 4130, 5175, 1652, 735, 288, 9028, 63, 493, 8, 2324, 9, 268, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 492, 984, 272, 9028, 63, 452, 8, 736, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 283, 3871, 2087, 13, 576, 1333, 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 ]
[ 199, 2765, 6181, 314, 4733, 2087, 2295, 687, 2348, 26, 819, 1455, 921, 3871, 2087, 14, 1308, 15, 2219, 15, 87, 352, 17733, 15, 18177, 15, 199, 199, 460, 295, 16334, 3062, 370, 506, 14905, 370, 2429, 334, 1397, 1808, 314, 5007, 1402, 199, 1618, 4733, 2087, 680, 221, 710, 1324, 1475, 365, 447, 819, 28253, 523, 11994, 26, 469, 1802, 93, 523, 15100, 26, 469, 5599, 93, 523, 10541, 523, 2263, 523, 665, 1317, 2263, 22266, 1317, 17890, 1317, 30, 523, 2263, 199, 199, 1918, 15100, 3965, 365, 7923, 367, 199, 1040, 3189, 59, 16, 2733, 1317, 3488, 16, 2733, 585, 418, 508, 469, 576, 93, 4345, 199, 199, 1918, 1072, 1475, 365, 447, 819, 11994, 26, 469, 1802, 93, 523, 15100, 26, 469, 5599, 93, 334, 692, 666, 21554, 1133, 506, 4565, 9, 523, 8394, 26, 221, 819, 469, 1317, 12, 625, 13572, 93, 523, 4143, 523, 469, 576, 12, 625, 13572, 12, 340, 1911, 93, 199, 199, 624, 199, 199, 646, 295, 199, 646, 747, 199, 646, 5190, 199, 199, 63, 3257, 63, 264, 275, 295, 14, 2014, 8, 82, 1154, 83, 10, 5831, 3427, 83, 5830, 2795, 5942, 199, 63, 4921, 63, 264, 275, 295, 14, 2014, 8, 82, 1154, 83, 10, 13495, 3427, 83, 5830, 2795, 5942, 199, 63, 576, 63, 4921, 63, 264, 275, 295, 14, 2014, 8, 82, 2, 3189, 25621, 16, 60, 7272, 459, 4735, 418, 19192, 61, 15840, 59, 16, 60, 7272, 459, 585, 1154, 566, 8995, 83, 10, 389, 60, 83, 5830, 2795, 6320, 199, 63, 3871, 63, 576, 63, 4921, 63, 264, 275, 295, 14, 2014, 8, 82, 2, 3871, 60, 459, 4735, 418, 19192, 7272, 83, 10, 389, 60, 83, 5830, 2795, 6320, 199, 199, 318, 2198, 63, 1317, 8, 1317, 304, 272, 1336, 275, 485, 3257, 63, 264, 14, 1733, 8, 1317, 9, 272, 4328, 275, 1336, 14, 923, 8, 17, 9, 272, 1336, 275, 485, 4921, 63, 264, 14, 1733, 8, 1317, 9, 272, 4282, 275, 1336, 14, 923, 8, 17, 9, 272, 666, 275, 488, 272, 367, 5163, 315, 15500, 576, 63, 4921, 63, 264, 12, 485, 3871, 63, 576, 63, 4921, 63, 264, 2189, 267, 1336, 275, 5163, 14, 1733, 8, 4921, 9, 267, 340, 1336, 26, 288, 327, 473, 346, 89, 12, 1325, 473, 7171, 16822, 652, 288, 666, 275, 3468, 8, 1431, 14, 923, 8, 17, 680, 1913, 1012, 288, 2059, 272, 286, 275, 488, 272, 367, 1947, 315, 788, 1317, 297, 283, 4705, 297, 283, 1213, 297, 283, 7307, 297, 283, 1450, 604, 297, 283, 815, 297, 283, 14348, 297, 283, 1893, 317, 563, 297, 283, 2030, 297, 283, 1802, 297, 283, 1317, 26, 8167, 2565, 267, 5163, 275, 295, 14, 2014, 8, 82, 17030, 5, 83, 6697, 13661, 12432, 26191, 83, 4335, 450, 334, 1450, 12, 1947, 395, 295, 14, 51, 9, 267, 1336, 275, 5163, 14, 1733, 8, 1317, 9, 267, 340, 1336, 26, 288, 286, 275, 1336, 14, 923, 8, 17, 9, 288, 2059, 272, 702, 286, 365, 440, 488, 272, 327, 1666, 706, 2839, 2396, 5712, 1133, 10999, 272, 340, 1947, 1137, 283, 2030, 356, 267, 286, 275, 286, 14, 1814, 20040, 4116, 10805, 2650, 358, 267, 286, 275, 286, 14, 1814, 20040, 5282, 10805, 7673, 358, 272, 327, 7600, 26, 473, 1077, 7710, 886, 1655, 625, 26306, 1396, 272, 372, 469, 267, 283, 5831, 356, 4328, 12, 267, 283, 13495, 356, 4282, 12, 267, 283, 576, 356, 666, 12, 267, 283, 1317, 356, 286, 93, 199, 199, 318, 8437, 63, 1317, 8, 68, 304, 272, 308, 275, 18087, 199, 5831, 26, 2818, 5831, 9, 83, 199, 13495, 26, 2818, 13495, 9, 83, 199, 4558, 26, 9948, 199, 2840, 1317, 9, 83, 199, 2344, 450, 366, 272, 340, 366, 14, 362, 360, 576, 358, 365, 440, 488, 26, 267, 308, 847, 283, 9460, 60, 78, 5, 83, 7, 450, 366, 459, 576, 418, 272, 372, 308, 199, 199, 318, 9028, 63, 493, 8, 1501, 304, 272, 289, 275, 1551, 8, 1501, 12, 283, 4848, 358, 272, 286, 275, 289, 14, 739, 342, 272, 289, 14, 1600, 342, 272, 862, 26, 267, 1072, 275, 8437, 63, 1317, 8, 1122, 63, 1317, 8, 67, 430, 272, 871, 26, 267, 870, 283, 5725, 666, 315, 450, 83, 4881, 450, 1788, 267, 870, 286, 267, 5190, 14, 1361, 63, 2804, 342, 267, 870, 10791, 10, 2259, 267, 372, 272, 892, 275, 747, 14, 515, 14, 7973, 8, 1501, 2788, 16, 61, 435, 1987, 576, 7, 272, 289, 275, 1551, 8, 1222, 12, 283, 6603, 358, 272, 289, 14, 952, 8, 1199, 9, 272, 289, 14, 1600, 342, 199, 199, 318, 9028, 63, 452, 8, 694, 304, 272, 367, 4325, 315, 747, 14, 7374, 8, 694, 304, 267, 4325, 275, 747, 14, 515, 14, 904, 8, 694, 12, 4325, 9, 267, 340, 4325, 14, 4130, 5175, 1652, 735, 288, 9028, 63, 493, 8, 2324, 9, 268, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 492, 984, 272, 9028, 63, 452, 8, 736, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 283, 3871, 2087, 13, 576, 1333, 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, 0 ]
[ 1, 1, 1, 1, 1,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ator
Python/App/Lib/test/curses_tests.py
201
1241
#!/usr/bin/env python # # $Id: ncurses.py 36559 2004-07-18 05:56:09Z tim_one $ # # Interactive test suite for the curses module. # This script displays various things and the user should verify whether # they display correctly. # import curses from curses import textpad def test_textpad(stdscr, insert_mode=False): ncols, nlines = 8, 3 uly, ulx = 3, 2 if insert_mode: mode = 'insert mode' else: mode = 'overwrite mode' stdscr.addstr(uly-3, ulx, "Use Ctrl-G to end editing (%s)." % mode) stdscr.addstr(uly-2, ulx, "Be sure to try typing in the lower-right corner.") win = curses.newwin(nlines, ncols, uly, ulx) textpad.rectangle(stdscr, uly-1, ulx-1, uly + nlines, ulx + ncols) stdscr.refresh() box = textpad.Textbox(win, insert_mode) contents = box.edit() stdscr.addstr(uly+ncols+2, 0, "Text entered in the box\n") stdscr.addstr(repr(contents)) stdscr.addstr('\n') stdscr.addstr('Press any key') stdscr.getch() for i in range(3): stdscr.move(uly+ncols+2 + i, 0) stdscr.clrtoeol() def main(stdscr): stdscr.clear() test_textpad(stdscr, False) test_textpad(stdscr, True) if __name__ == '__main__': curses.wrapper(main)
apache-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 199, 3, 2672, 1304, 26, 302, 12026, 14, 647, 8780, 17257, 8353, 13, 1780, 13, 1085, 22528, 26, 1367, 26, 1643, 58, 221, 2906, 63, 368, 2672, 199, 3, 199, 3, 1010, 7502, 511, 5241, 367, 314, 15429, 859, 14, 199, 3, 961, 2884, 17561, 7750, 7645, 436, 314, 922, 1077, 4911, 3775, 199, 3, 2985, 2929, 6657, 14, 199, 3, 199, 199, 646, 15429, 199, 504, 15429, 492, 1318, 6226, 199, 199, 318, 511, 63, 505, 6226, 8, 1516, 11047, 12, 5518, 63, 632, 29, 797, 304, 272, 302, 4574, 12, 302, 1278, 275, 1695, 12, 650, 272, 12581, 89, 12, 12581, 88, 275, 650, 12, 499, 272, 340, 5518, 63, 632, 26, 267, 818, 275, 283, 3176, 818, 7, 272, 587, 26, 267, 818, 275, 283, 14658, 818, 7, 339, 2418, 11047, 14, 525, 495, 8, 21797, 13, 19, 12, 12581, 88, 12, 298, 6119, 445, 7245, 13, 39, 370, 1284, 20401, 4366, 83, 17617, 450, 818, 9, 272, 2418, 11047, 14, 525, 495, 8, 21797, 13, 18, 12, 12581, 88, 12, 298, 3655, 3238, 370, 862, 14090, 315, 314, 5117, 13, 1019, 17703, 2685, 272, 4747, 275, 15429, 14, 1222, 2676, 8, 78, 1278, 12, 302, 4574, 12, 12581, 89, 12, 12581, 88, 9, 272, 1318, 6226, 14, 19954, 8, 1516, 11047, 12, 12581, 89, 13, 17, 12, 12581, 88, 13, 17, 12, 12581, 89, 435, 302, 1278, 12, 12581, 88, 435, 302, 4574, 9, 272, 2418, 11047, 14, 6635, 342, 339, 5689, 275, 1318, 6226, 14, 1872, 1977, 8, 2676, 12, 5518, 63, 632, 9, 272, 4072, 275, 5689, 14, 3773, 342, 272, 2418, 11047, 14, 525, 495, 8, 21797, 11, 78, 4574, 11, 18, 12, 378, 12, 298, 1872, 19138, 315, 314, 5689, 60, 78, 531, 272, 2418, 11047, 14, 525, 495, 8, 2722, 8, 4407, 430, 272, 2418, 11047, 14, 525, 495, 2258, 78, 358, 272, 2418, 11047, 14, 525, 495, 360, 14414, 1263, 790, 358, 272, 2418, 11047, 14, 362, 335, 342, 339, 367, 284, 315, 1425, 8, 19, 304, 267, 2418, 11047, 14, 1185, 8, 21797, 11, 78, 4574, 11, 18, 435, 284, 12, 378, 9, 267, 2418, 11047, 14, 31553, 475, 20470, 342, 199, 199, 318, 2446, 8, 1516, 11047, 304, 272, 2418, 11047, 14, 3584, 342, 272, 511, 63, 505, 6226, 8, 1516, 11047, 12, 756, 9, 272, 511, 63, 505, 6226, 8, 1516, 11047, 12, 715, 9, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 15429, 14, 5029, 8, 973, 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 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 199, 3, 2672, 1304, 26, 302, 12026, 14, 647, 8780, 17257, 8353, 13, 1780, 13, 1085, 22528, 26, 1367, 26, 1643, 58, 221, 2906, 63, 368, 2672, 199, 3, 199, 3, 1010, 7502, 511, 5241, 367, 314, 15429, 859, 14, 199, 3, 961, 2884, 17561, 7750, 7645, 436, 314, 922, 1077, 4911, 3775, 199, 3, 2985, 2929, 6657, 14, 199, 3, 199, 199, 646, 15429, 199, 504, 15429, 492, 1318, 6226, 199, 199, 318, 511, 63, 505, 6226, 8, 1516, 11047, 12, 5518, 63, 632, 29, 797, 304, 272, 302, 4574, 12, 302, 1278, 275, 1695, 12, 650, 272, 12581, 89, 12, 12581, 88, 275, 650, 12, 499, 272, 340, 5518, 63, 632, 26, 267, 818, 275, 283, 3176, 818, 7, 272, 587, 26, 267, 818, 275, 283, 14658, 818, 7, 339, 2418, 11047, 14, 525, 495, 8, 21797, 13, 19, 12, 12581, 88, 12, 298, 6119, 445, 7245, 13, 39, 370, 1284, 20401, 4366, 83, 17617, 450, 818, 9, 272, 2418, 11047, 14, 525, 495, 8, 21797, 13, 18, 12, 12581, 88, 12, 298, 3655, 3238, 370, 862, 14090, 315, 314, 5117, 13, 1019, 17703, 2685, 272, 4747, 275, 15429, 14, 1222, 2676, 8, 78, 1278, 12, 302, 4574, 12, 12581, 89, 12, 12581, 88, 9, 272, 1318, 6226, 14, 19954, 8, 1516, 11047, 12, 12581, 89, 13, 17, 12, 12581, 88, 13, 17, 12, 12581, 89, 435, 302, 1278, 12, 12581, 88, 435, 302, 4574, 9, 272, 2418, 11047, 14, 6635, 342, 339, 5689, 275, 1318, 6226, 14, 1872, 1977, 8, 2676, 12, 5518, 63, 632, 9, 272, 4072, 275, 5689, 14, 3773, 342, 272, 2418, 11047, 14, 525, 495, 8, 21797, 11, 78, 4574, 11, 18, 12, 378, 12, 298, 1872, 19138, 315, 314, 5689, 60, 78, 531, 272, 2418, 11047, 14, 525, 495, 8, 2722, 8, 4407, 430, 272, 2418, 11047, 14, 525, 495, 2258, 78, 358, 272, 2418, 11047, 14, 525, 495, 360, 14414, 1263, 790, 358, 272, 2418, 11047, 14, 362, 335, 342, 339, 367, 284, 315, 1425, 8, 19, 304, 267, 2418, 11047, 14, 1185, 8, 21797, 11, 78, 4574, 11, 18, 435, 284, 12, 378, 9, 267, 2418, 11047, 14, 31553, 475, 20470, 342, 199, 199, 318, 2446, 8, 1516, 11047, 304, 272, 2418, 11047, 14, 3584, 342, 272, 511, 63, 505, 6226, 8, 1516, 11047, 12, 756, 9, 272, 511, 63, 505, 6226, 8, 1516, 11047, 12, 715, 9, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 15429, 14, 5029, 8, 973, 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, 32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0, 0, 0, 0, 0, 0, 0, 0, 0 ]
cgstudiomap/cgstudiomap
main/eggs/python_stdnum-1.2-py2.7.egg/stdnum/verhoeff.py
3
3161
# verhoeff.py - functions for performing the Verhoeff checksum # # Copyright (C) 2010, 2011, 2012, 2013 Arthur de Jong # # 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 Street, Fifth Floor, Boston, MA # 02110-1301 USA """The Verhoeff algorithm. The Verhoeff algorithm uses two tables for permutations and multiplications to calculate a checksum. >>> validate('1234') Traceback (most recent call last): ... InvalidChecksum: ... >>> checksum('1234') 1 >>> calc_check_digit('1234') '0' >>> validate('12340') '12340' """ from stdnum.exceptions import * # These are the multiplication and permutation tables used in the # Verhoeff algorithm. _multiplication_table = ( [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 0, 6, 7, 8, 9, 5], [2, 3, 4, 0, 1, 7, 8, 9, 5, 6], [3, 4, 0, 1, 2, 8, 9, 5, 6, 7], [4, 0, 1, 2, 3, 9, 5, 6, 7, 8], [5, 9, 8, 7, 6, 0, 4, 3, 2, 1], [6, 5, 9, 8, 7, 1, 0, 4, 3, 2], [7, 6, 5, 9, 8, 2, 1, 0, 4, 3], [8, 7, 6, 5, 9, 3, 2, 1, 0, 4], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) _permutation_table = ( (0, 1, 2, 3, 4, 5, 6, 7, 8, 9), (1, 5, 7, 6, 2, 8, 3, 0, 9, 4), (5, 8, 0, 3, 7, 9, 6, 1, 4, 2), (8, 9, 1, 6, 0, 4, 3, 5, 2, 7), (9, 4, 5, 3, 1, 2, 6, 8, 7, 0), (4, 2, 8, 6, 5, 7, 3, 9, 0, 1), (2, 7, 9, 3, 8, 0, 6, 4, 1, 5), (7, 0, 4, 6, 9, 1, 3, 2, 5, 8)) def checksum(number): """Calculate the Verhoeff checksum over the provided number. The checksum is returned as an int. Valid numbers should have a checksum of 0.""" # transform number list number = tuple(int(n) for n in reversed(str(number))) # calculate checksum check = 0 for i, n in enumerate(number): check = _multiplication_table[check][_permutation_table[i % 8][n]] return check def validate(number): """Checks to see if the number provided passes the Verhoeff checksum.""" if not bool(number): raise InvalidFormat() try: valid = checksum(number) == 0 except Exception: raise InvalidFormat() if not valid: raise InvalidChecksum() return number def is_valid(number): """Checks to see if the number provided passes the Verhoeff checksum.""" try: return bool(validate(number)) except ValidationError: return False def calc_check_digit(number): """With the provided number, calculate the extra digit that should be appended to make it pass the Verhoeff checksum.""" return str(_multiplication_table[checksum(str(number) + '0')].index(0))
agpl-3.0
[ 3, 809, 526, 3609, 14, 647, 446, 3423, 367, 19203, 314, 5444, 526, 3609, 9040, 199, 3, 199, 3, 1898, 334, 35, 9, 7129, 12, 7760, 12, 6029, 12, 6171, 1952, 273, 300, 477, 1603, 951, 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, 14259, 12, 12066, 11844, 12, 8226, 12, 4828, 199, 3, 11315, 13, 10067, 8217, 199, 199, 624, 1918, 5444, 526, 3609, 5563, 14, 199, 199, 1918, 5444, 526, 3609, 5563, 4440, 2877, 6716, 367, 26899, 436, 199, 8016, 10785, 370, 8671, 282, 9040, 14, 199, 199, 6071, 4107, 360, 4321, 358, 199, 15905, 334, 2786, 8058, 1240, 2061, 304, 272, 2263, 199, 3364, 17394, 26, 2263, 199, 6071, 9040, 360, 4321, 358, 199, 17, 199, 6071, 12831, 63, 1074, 63, 8573, 360, 4321, 358, 199, 7, 16, 7, 199, 6071, 4107, 360, 4321, 16, 358, 199, 7, 4321, 16, 7, 199, 624, 199, 199, 504, 2418, 1507, 14, 3924, 492, 627, 421, 199, 3, 5723, 787, 314, 24638, 436, 22966, 6716, 1202, 315, 314, 199, 3, 5444, 526, 3609, 5563, 14, 199, 199, 63, 8016, 1863, 63, 1224, 275, 334, 272, 359, 16, 12, 413, 12, 499, 12, 650, 12, 841, 12, 959, 12, 1227, 12, 1520, 12, 1695, 12, 1749, 467, 272, 359, 17, 12, 499, 12, 650, 12, 841, 12, 378, 12, 1227, 12, 1520, 12, 1695, 12, 1749, 12, 959, 467, 272, 359, 18, 12, 650, 12, 841, 12, 378, 12, 413, 12, 1520, 12, 1695, 12, 1749, 12, 959, 12, 1227, 467, 272, 359, 19, 12, 841, 12, 378, 12, 413, 12, 499, 12, 1695, 12, 1749, 12, 959, 12, 1227, 12, 1520, 467, 272, 359, 20, 12, 378, 12, 413, 12, 499, 12, 650, 12, 1749, 12, 959, 12, 1227, 12, 1520, 12, 1695, 467, 272, 359, 21, 12, 1749, 12, 1695, 12, 1520, 12, 1227, 12, 378, 12, 841, 12, 650, 12, 499, 12, 413, 467, 272, 359, 22, 12, 959, 12, 1749, 12, 1695, 12, 1520, 12, 413, 12, 378, 12, 841, 12, 650, 12, 499, 467, 272, 359, 23, 12, 1227, 12, 959, 12, 1749, 12, 1695, 12, 499, 12, 413, 12, 378, 12, 841, 12, 650, 467, 272, 359, 24, 12, 1520, 12, 1227, 12, 959, 12, 1749, 12, 650, 12, 499, 12, 413, 12, 378, 12, 841, 467, 272, 359, 25, 12, 1695, 12, 1520, 12, 1227, 12, 959, 12, 841, 12, 650, 12, 499, 12, 413, 12, 378, 566, 199, 199, 63, 23832, 63, 1224, 275, 334, 272, 334, 16, 12, 413, 12, 499, 12, 650, 12, 841, 12, 959, 12, 1227, 12, 1520, 12, 1695, 12, 1749, 395, 272, 334, 17, 12, 959, 12, 1520, 12, 1227, 12, 499, 12, 1695, 12, 650, 12, 378, 12, 1749, 12, 841, 395, 272, 334, 21, 12, 1695, 12, 378, 12, 650, 12, 1520, 12, 1749, 12, 1227, 12, 413, 12, 841, 12, 499, 395, 272, 334, 24, 12, 1749, 12, 413, 12, 1227, 12, 378, 12, 841, 12, 650, 12, 959, 12, 499, 12, 1520, 395, 272, 334, 25, 12, 841, 12, 959, 12, 650, 12, 413, 12, 499, 12, 1227, 12, 1695, 12, 1520, 12, 378, 395, 272, 334, 20, 12, 499, 12, 1695, 12, 1227, 12, 959, 12, 1520, 12, 650, 12, 1749, 12, 378, 12, 413, 395, 272, 334, 18, 12, 1520, 12, 1749, 12, 650, 12, 1695, 12, 378, 12, 1227, 12, 841, 12, 413, 12, 959, 395, 272, 334, 23, 12, 378, 12, 841, 12, 1227, 12, 1749, 12, 413, 12, 650, 12, 499, 12, 959, 12, 1695, 430, 421, 199, 318, 9040, 8, 1955, 304, 272, 408, 14860, 314, 5444, 526, 3609, 9040, 1806, 314, 2741, 1329, 14, 710, 9040, 272, 365, 2138, 465, 376, 1109, 14, 4821, 5579, 1077, 1172, 282, 9040, 402, 378, 1041, 272, 327, 5793, 1329, 769, 272, 1329, 275, 2008, 8, 442, 8, 78, 9, 367, 302, 315, 10822, 8, 495, 8, 1955, 1724, 272, 327, 8671, 9040, 272, 1104, 275, 378, 272, 367, 284, 12, 302, 315, 3874, 8, 1955, 304, 267, 1104, 275, 485, 8016, 1863, 63, 1224, 59, 1074, 1527, 63, 23832, 63, 1224, 59, 73, 450, 1695, 1527, 78, 2677, 272, 372, 1104, 421, 199, 318, 4107, 8, 1955, 304, 272, 408, 11834, 370, 1937, 340, 314, 1329, 2741, 14933, 314, 5444, 526, 3609, 9040, 1041, 272, 340, 440, 2155, 8, 1955, 304, 267, 746, 6378, 3484, 342, 272, 862, 26, 267, 1686, 275, 9040, 8, 1955, 9, 508, 378, 272, 871, 2186, 26, 267, 746, 6378, 3484, 342, 272, 340, 440, 1686, 26, 267, 746, 6378, 17394, 342, 272, 372, 1329, 421, 199, 318, 365, 63, 1078, 8, 1955, 304, 272, 408, 11834, 370, 1937, 340, 314, 1329, 2741, 14933, 314, 5444, 526, 3609, 9040, 1041, 272, 862, 26, 267, 372, 2155, 8, 3502, 8, 1955, 430, 272, 871, 8505, 26, 267, 372, 756, 421, 199, 318, 12831, 63, 1074, 63, 8573, 8, 1955, 304, 272, 408, 3007, 314, 2741, 1329, 12, 8671, 314, 2402, 10964, 626, 1077, 506, 272, 11544, 370, 1852, 652, 986, 314, 5444, 526, 3609, 9040, 1041, 272, 372, 620, 1547, 8016, 1863, 63, 1224, 59, 8928, 8, 495, 8, 1955, 9, 435, 283, 16, 358, 1055, 1080, 8, 16, 430, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 809, 526, 3609, 14, 647, 446, 3423, 367, 19203, 314, 5444, 526, 3609, 9040, 199, 3, 199, 3, 1898, 334, 35, 9, 7129, 12, 7760, 12, 6029, 12, 6171, 1952, 273, 300, 477, 1603, 951, 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, 14259, 12, 12066, 11844, 12, 8226, 12, 4828, 199, 3, 11315, 13, 10067, 8217, 199, 199, 624, 1918, 5444, 526, 3609, 5563, 14, 199, 199, 1918, 5444, 526, 3609, 5563, 4440, 2877, 6716, 367, 26899, 436, 199, 8016, 10785, 370, 8671, 282, 9040, 14, 199, 199, 6071, 4107, 360, 4321, 358, 199, 15905, 334, 2786, 8058, 1240, 2061, 304, 272, 2263, 199, 3364, 17394, 26, 2263, 199, 6071, 9040, 360, 4321, 358, 199, 17, 199, 6071, 12831, 63, 1074, 63, 8573, 360, 4321, 358, 199, 7, 16, 7, 199, 6071, 4107, 360, 4321, 16, 358, 199, 7, 4321, 16, 7, 199, 624, 199, 199, 504, 2418, 1507, 14, 3924, 492, 627, 421, 199, 3, 5723, 787, 314, 24638, 436, 22966, 6716, 1202, 315, 314, 199, 3, 5444, 526, 3609, 5563, 14, 199, 199, 63, 8016, 1863, 63, 1224, 275, 334, 272, 359, 16, 12, 413, 12, 499, 12, 650, 12, 841, 12, 959, 12, 1227, 12, 1520, 12, 1695, 12, 1749, 467, 272, 359, 17, 12, 499, 12, 650, 12, 841, 12, 378, 12, 1227, 12, 1520, 12, 1695, 12, 1749, 12, 959, 467, 272, 359, 18, 12, 650, 12, 841, 12, 378, 12, 413, 12, 1520, 12, 1695, 12, 1749, 12, 959, 12, 1227, 467, 272, 359, 19, 12, 841, 12, 378, 12, 413, 12, 499, 12, 1695, 12, 1749, 12, 959, 12, 1227, 12, 1520, 467, 272, 359, 20, 12, 378, 12, 413, 12, 499, 12, 650, 12, 1749, 12, 959, 12, 1227, 12, 1520, 12, 1695, 467, 272, 359, 21, 12, 1749, 12, 1695, 12, 1520, 12, 1227, 12, 378, 12, 841, 12, 650, 12, 499, 12, 413, 467, 272, 359, 22, 12, 959, 12, 1749, 12, 1695, 12, 1520, 12, 413, 12, 378, 12, 841, 12, 650, 12, 499, 467, 272, 359, 23, 12, 1227, 12, 959, 12, 1749, 12, 1695, 12, 499, 12, 413, 12, 378, 12, 841, 12, 650, 467, 272, 359, 24, 12, 1520, 12, 1227, 12, 959, 12, 1749, 12, 650, 12, 499, 12, 413, 12, 378, 12, 841, 467, 272, 359, 25, 12, 1695, 12, 1520, 12, 1227, 12, 959, 12, 841, 12, 650, 12, 499, 12, 413, 12, 378, 566, 199, 199, 63, 23832, 63, 1224, 275, 334, 272, 334, 16, 12, 413, 12, 499, 12, 650, 12, 841, 12, 959, 12, 1227, 12, 1520, 12, 1695, 12, 1749, 395, 272, 334, 17, 12, 959, 12, 1520, 12, 1227, 12, 499, 12, 1695, 12, 650, 12, 378, 12, 1749, 12, 841, 395, 272, 334, 21, 12, 1695, 12, 378, 12, 650, 12, 1520, 12, 1749, 12, 1227, 12, 413, 12, 841, 12, 499, 395, 272, 334, 24, 12, 1749, 12, 413, 12, 1227, 12, 378, 12, 841, 12, 650, 12, 959, 12, 499, 12, 1520, 395, 272, 334, 25, 12, 841, 12, 959, 12, 650, 12, 413, 12, 499, 12, 1227, 12, 1695, 12, 1520, 12, 378, 395, 272, 334, 20, 12, 499, 12, 1695, 12, 1227, 12, 959, 12, 1520, 12, 650, 12, 1749, 12, 378, 12, 413, 395, 272, 334, 18, 12, 1520, 12, 1749, 12, 650, 12, 1695, 12, 378, 12, 1227, 12, 841, 12, 413, 12, 959, 395, 272, 334, 23, 12, 378, 12, 841, 12, 1227, 12, 1749, 12, 413, 12, 650, 12, 499, 12, 959, 12, 1695, 430, 421, 199, 318, 9040, 8, 1955, 304, 272, 408, 14860, 314, 5444, 526, 3609, 9040, 1806, 314, 2741, 1329, 14, 710, 9040, 272, 365, 2138, 465, 376, 1109, 14, 4821, 5579, 1077, 1172, 282, 9040, 402, 378, 1041, 272, 327, 5793, 1329, 769, 272, 1329, 275, 2008, 8, 442, 8, 78, 9, 367, 302, 315, 10822, 8, 495, 8, 1955, 1724, 272, 327, 8671, 9040, 272, 1104, 275, 378, 272, 367, 284, 12, 302, 315, 3874, 8, 1955, 304, 267, 1104, 275, 485, 8016, 1863, 63, 1224, 59, 1074, 1527, 63, 23832, 63, 1224, 59, 73, 450, 1695, 1527, 78, 2677, 272, 372, 1104, 421, 199, 318, 4107, 8, 1955, 304, 272, 408, 11834, 370, 1937, 340, 314, 1329, 2741, 14933, 314, 5444, 526, 3609, 9040, 1041, 272, 340, 440, 2155, 8, 1955, 304, 267, 746, 6378, 3484, 342, 272, 862, 26, 267, 1686, 275, 9040, 8, 1955, 9, 508, 378, 272, 871, 2186, 26, 267, 746, 6378, 3484, 342, 272, 340, 440, 1686, 26, 267, 746, 6378, 17394, 342, 272, 372, 1329, 421, 199, 318, 365, 63, 1078, 8, 1955, 304, 272, 408, 11834, 370, 1937, 340, 314, 1329, 2741, 14933, 314, 5444, 526, 3609, 9040, 1041, 272, 862, 26, 267, 372, 2155, 8, 3502, 8, 1955, 430, 272, 871, 8505, 26, 267, 372, 756, 421, 199, 318, 12831, 63, 1074, 63, 8573, 8, 1955, 304, 272, 408, 3007, 314, 2741, 1329, 12, 8671, 314, 2402, 10964, 626, 1077, 506, 272, 11544, 370, 1852, 652, 986, 314, 5444, 526, 3609, 9040, 1041, 272, 372, 620, 1547, 8016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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
pratikmallya/hue
desktop/core/ext-py/boto-2.38.0/boto/beanstalk/layer1.py
146
56259
# Copyright (c) 2012 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2012 Amazon.com, Inc. or its affiliates. # All Rights Reserved # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, dis- # tribute, sublicense, and/or sell copies of the Software, and to permit # persons to whom the Software is furnished to do so, subject to the fol- # lowing conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. # import boto import boto.jsonresponse from boto.compat import json from boto.regioninfo import RegionInfo from boto.connection import AWSQueryConnection class Layer1(AWSQueryConnection): APIVersion = '2010-12-01' DefaultRegionName = 'us-east-1' DefaultRegionEndpoint = 'elasticbeanstalk.us-east-1.amazonaws.com' def __init__(self, aws_access_key_id=None, aws_secret_access_key=None, is_secure=True, port=None, proxy=None, proxy_port=None, proxy_user=None, proxy_pass=None, debug=0, https_connection_factory=None, region=None, path='/', api_version=None, security_token=None, profile_name=None): if not region: region = RegionInfo(self, self.DefaultRegionName, self.DefaultRegionEndpoint) self.region = region super(Layer1, self).__init__(aws_access_key_id, aws_secret_access_key, is_secure, port, proxy, proxy_port, proxy_user, proxy_pass, self.region.endpoint, debug, https_connection_factory, path, security_token, profile_name=profile_name) def _required_auth_capability(self): return ['hmac-v4'] def _encode_bool(self, v): v = bool(v) return {True: "true", False: "false"}[v] def _get_response(self, action, params, path='/', verb='GET'): params['ContentType'] = 'JSON' response = self.make_request(action, params, path, verb) body = response.read().decode('utf-8') boto.log.debug(body) if response.status == 200: return json.loads(body) else: raise self.ResponseError(response.status, response.reason, body) def check_dns_availability(self, cname_prefix): """Checks if the specified CNAME is available. :type cname_prefix: string :param cname_prefix: The prefix used when this CNAME is reserved. """ params = {'CNAMEPrefix': cname_prefix} return self._get_response('CheckDNSAvailability', params) def create_application(self, application_name, description=None): """ Creates an application that has one configuration template named default and no application versions. :type application_name: string :param application_name: The name of the application. Constraint: This name must be unique within your account. If the specified name already exists, the action returns an InvalidParameterValue error. :type description: string :param description: Describes the application. :raises: TooManyApplicationsException """ params = {'ApplicationName': application_name} if description: params['Description'] = description return self._get_response('CreateApplication', params) def create_application_version(self, application_name, version_label, description=None, s3_bucket=None, s3_key=None, auto_create_application=None): """Creates an application version for the specified application. :type application_name: string :param application_name: The name of the application. If no application is found with this name, and AutoCreateApplication is false, returns an InvalidParameterValue error. :type version_label: string :param version_label: A label identifying this version. Constraint: Must be unique per application. If an application version already exists with this label for the specified application, AWS Elastic Beanstalk returns an InvalidParameterValue error. :type description: string :param description: Describes this version. :type s3_bucket: string :param s3_bucket: The Amazon S3 bucket where the data is located. :type s3_key: string :param s3_key: The Amazon S3 key where the data is located. Both s3_bucket and s3_key must be specified in order to use a specific source bundle. If both of these values are not specified the sample application will be used. :type auto_create_application: boolean :param auto_create_application: Determines how the system behaves if the specified application for this version does not already exist: true: Automatically creates the specified application for this version if it does not already exist. false: Returns an InvalidParameterValue if the specified application for this version does not already exist. Default: false Valid Values: true | false :raises: TooManyApplicationsException, TooManyApplicationVersionsException, InsufficientPrivilegesException, S3LocationNotInServiceRegionException """ params = {'ApplicationName': application_name, 'VersionLabel': version_label} if description: params['Description'] = description if s3_bucket and s3_key: params['SourceBundle.S3Bucket'] = s3_bucket params['SourceBundle.S3Key'] = s3_key if auto_create_application: params['AutoCreateApplication'] = self._encode_bool( auto_create_application) return self._get_response('CreateApplicationVersion', params) def create_configuration_template(self, application_name, template_name, solution_stack_name=None, source_configuration_application_name=None, source_configuration_template_name=None, environment_id=None, description=None, option_settings=None): """Creates a configuration template. Templates are associated with a specific application and are used to deploy different versions of the application with the same configuration settings. :type application_name: string :param application_name: The name of the application to associate with this configuration template. If no application is found with this name, AWS Elastic Beanstalk returns an InvalidParameterValue error. :type template_name: string :param template_name: The name of the configuration template. Constraint: This name must be unique per application. Default: If a configuration template already exists with this name, AWS Elastic Beanstalk returns an InvalidParameterValue error. :type solution_stack_name: string :param solution_stack_name: The name of the solution stack used by this configuration. The solution stack specifies the operating system, architecture, and application server for a configuration template. It determines the set of configuration options as well as the possible and default values. Use ListAvailableSolutionStacks to obtain a list of available solution stacks. Default: If the SolutionStackName is not specified and the source configuration parameter is blank, AWS Elastic Beanstalk uses the default solution stack. If not specified and the source configuration parameter is specified, AWS Elastic Beanstalk uses the same solution stack as the source configuration template. :type source_configuration_application_name: string :param source_configuration_application_name: The name of the application associated with the configuration. :type source_configuration_template_name: string :param source_configuration_template_name: The name of the configuration template. :type environment_id: string :param environment_id: The ID of the environment used with this configuration template. :type description: string :param description: Describes this configuration. :type option_settings: list :param option_settings: If specified, AWS Elastic Beanstalk sets the specified configuration option to the requested value. The new value overrides the value obtained from the solution stack or the source configuration template. :raises: InsufficientPrivilegesException, TooManyConfigurationTemplatesException """ params = {'ApplicationName': application_name, 'TemplateName': template_name} if solution_stack_name: params['SolutionStackName'] = solution_stack_name if source_configuration_application_name: params['SourceConfiguration.ApplicationName'] = source_configuration_application_name if source_configuration_template_name: params['SourceConfiguration.TemplateName'] = source_configuration_template_name if environment_id: params['EnvironmentId'] = environment_id if description: params['Description'] = description if option_settings: self._build_list_params(params, option_settings, 'OptionSettings.member', ('Namespace', 'OptionName', 'Value')) return self._get_response('CreateConfigurationTemplate', params) def create_environment(self, application_name, environment_name, version_label=None, template_name=None, solution_stack_name=None, cname_prefix=None, description=None, option_settings=None, options_to_remove=None, tier_name=None, tier_type=None, tier_version='1.0'): """Launches an environment for the application using a configuration. :type application_name: string :param application_name: The name of the application that contains the version to be deployed. If no application is found with this name, CreateEnvironment returns an InvalidParameterValue error. :type environment_name: string :param environment_name: A unique name for the deployment environment. Used in the application URL. Constraint: Must be from 4 to 23 characters in length. The name can contain only letters, numbers, and hyphens. It cannot start or end with a hyphen. This name must be unique in your account. If the specified name already exists, AWS Elastic Beanstalk returns an InvalidParameterValue error. Default: If the CNAME parameter is not specified, the environment name becomes part of the CNAME, and therefore part of the visible URL for your application. :type version_label: string :param version_label: The name of the application version to deploy. If the specified application has no associated application versions, AWS Elastic Beanstalk UpdateEnvironment returns an InvalidParameterValue error. Default: If not specified, AWS Elastic Beanstalk attempts to launch the most recently created application version. :type template_name: string :param template_name: The name of the configuration template to use in deployment. If no configuration template is found with this name, AWS Elastic Beanstalk returns an InvalidParameterValue error. Condition: You must specify either this parameter or a SolutionStackName, but not both. If you specify both, AWS Elastic Beanstalk returns an InvalidParameterCombination error. If you do not specify either, AWS Elastic Beanstalk returns a MissingRequiredParameter error. :type solution_stack_name: string :param solution_stack_name: This is an alternative to specifying a configuration name. If specified, AWS Elastic Beanstalk sets the configuration values to the default values associated with the specified solution stack. Condition: You must specify either this or a TemplateName, but not both. If you specify both, AWS Elastic Beanstalk returns an InvalidParameterCombination error. If you do not specify either, AWS Elastic Beanstalk returns a MissingRequiredParameter error. :type cname_prefix: string :param cname_prefix: If specified, the environment attempts to use this value as the prefix for the CNAME. If not specified, the environment uses the environment name. :type description: string :param description: Describes this environment. :type option_settings: list :param option_settings: If specified, AWS Elastic Beanstalk sets the specified configuration options to the requested value in the configuration set for the new environment. These override the values obtained from the solution stack or the configuration template. Each element in the list is a tuple of (Namespace, OptionName, Value), for example:: [('aws:autoscaling:launchconfiguration', 'Ec2KeyName', 'mykeypair')] :type options_to_remove: list :param options_to_remove: A list of custom user-defined configuration options to remove from the configuration set for this new environment. :type tier_name: string :param tier_name: The name of the tier. Valid values are "WebServer" and "Worker". Defaults to "WebServer". The ``tier_name`` and a ``tier_type`` parameters are related and the values provided must be valid. The possible combinations are: * "WebServer" and "Standard" (the default) * "Worker" and "SQS/HTTP" :type tier_type: string :param tier_type: The type of the tier. Valid values are "Standard" if ``tier_name`` is "WebServer" and "SQS/HTTP" if ``tier_name`` is "Worker". Defaults to "Standard". :type tier_version: string :type tier_version: The version of the tier. Valid values currently are "1.0". Defaults to "1.0". :raises: TooManyEnvironmentsException, InsufficientPrivilegesException """ params = {'ApplicationName': application_name, 'EnvironmentName': environment_name} if version_label: params['VersionLabel'] = version_label if template_name: params['TemplateName'] = template_name if solution_stack_name: params['SolutionStackName'] = solution_stack_name if cname_prefix: params['CNAMEPrefix'] = cname_prefix if description: params['Description'] = description if option_settings: self._build_list_params(params, option_settings, 'OptionSettings.member', ('Namespace', 'OptionName', 'Value')) if options_to_remove: self.build_list_params(params, options_to_remove, 'OptionsToRemove.member') if tier_name and tier_type and tier_version: params['Tier.Name'] = tier_name params['Tier.Type'] = tier_type params['Tier.Version'] = tier_version return self._get_response('CreateEnvironment', params) def create_storage_location(self): """ Creates the Amazon S3 storage location for the account. This location is used to store user log files. :raises: TooManyBucketsException, S3SubscriptionRequiredException, InsufficientPrivilegesException """ return self._get_response('CreateStorageLocation', params={}) def delete_application(self, application_name, terminate_env_by_force=None): """ Deletes the specified application along with all associated versions and configurations. The application versions will not be deleted from your Amazon S3 bucket. :type application_name: string :param application_name: The name of the application to delete. :type terminate_env_by_force: boolean :param terminate_env_by_force: When set to true, running environments will be terminated before deleting the application. :raises: OperationInProgressException """ params = {'ApplicationName': application_name} if terminate_env_by_force: params['TerminateEnvByForce'] = self._encode_bool( terminate_env_by_force) return self._get_response('DeleteApplication', params) def delete_application_version(self, application_name, version_label, delete_source_bundle=None): """Deletes the specified version from the specified application. :type application_name: string :param application_name: The name of the application to delete releases from. :type version_label: string :param version_label: The label of the version to delete. :type delete_source_bundle: boolean :param delete_source_bundle: Indicates whether to delete the associated source bundle from Amazon S3. Valid Values: true | false :raises: SourceBundleDeletionException, InsufficientPrivilegesException, OperationInProgressException, S3LocationNotInServiceRegionException """ params = {'ApplicationName': application_name, 'VersionLabel': version_label} if delete_source_bundle: params['DeleteSourceBundle'] = self._encode_bool( delete_source_bundle) return self._get_response('DeleteApplicationVersion', params) def delete_configuration_template(self, application_name, template_name): """Deletes the specified configuration template. :type application_name: string :param application_name: The name of the application to delete the configuration template from. :type template_name: string :param template_name: The name of the configuration template to delete. :raises: OperationInProgressException """ params = {'ApplicationName': application_name, 'TemplateName': template_name} return self._get_response('DeleteConfigurationTemplate', params) def delete_environment_configuration(self, application_name, environment_name): """ Deletes the draft configuration associated with the running environment. Updating a running environment with any configuration changes creates a draft configuration set. You can get the draft configuration using DescribeConfigurationSettings while the update is in progress or if the update fails. The DeploymentStatus for the draft configuration indicates whether the deployment is in process or has failed. The draft configuration remains in existence until it is deleted with this action. :type application_name: string :param application_name: The name of the application the environment is associated with. :type environment_name: string :param environment_name: The name of the environment to delete the draft configuration from. """ params = {'ApplicationName': application_name, 'EnvironmentName': environment_name} return self._get_response('DeleteEnvironmentConfiguration', params) def describe_application_versions(self, application_name=None, version_labels=None): """Returns descriptions for existing application versions. :type application_name: string :param application_name: If specified, AWS Elastic Beanstalk restricts the returned descriptions to only include ones that are associated with the specified application. :type version_labels: list :param version_labels: If specified, restricts the returned descriptions to only include ones that have the specified version labels. """ params = {} if application_name: params['ApplicationName'] = application_name if version_labels: self.build_list_params(params, version_labels, 'VersionLabels.member') return self._get_response('DescribeApplicationVersions', params) def describe_applications(self, application_names=None): """Returns the descriptions of existing applications. :type application_names: list :param application_names: If specified, AWS Elastic Beanstalk restricts the returned descriptions to only include those with the specified names. """ params = {} if application_names: self.build_list_params(params, application_names, 'ApplicationNames.member') return self._get_response('DescribeApplications', params) def describe_configuration_options(self, application_name=None, template_name=None, environment_name=None, solution_stack_name=None, options=None): """Describes configuration options used in a template or environment. Describes the configuration options that are used in a particular configuration template or environment, or that a specified solution stack defines. The description includes the values the options, their default values, and an indication of the required action on a running environment if an option value is changed. :type application_name: string :param application_name: The name of the application associated with the configuration template or environment. Only needed if you want to describe the configuration options associated with either the configuration template or environment. :type template_name: string :param template_name: The name of the configuration template whose configuration options you want to describe. :type environment_name: string :param environment_name: The name of the environment whose configuration options you want to describe. :type solution_stack_name: string :param solution_stack_name: The name of the solution stack whose configuration options you want to describe. :type options: list :param options: If specified, restricts the descriptions to only the specified options. """ params = {} if application_name: params['ApplicationName'] = application_name if template_name: params['TemplateName'] = template_name if environment_name: params['EnvironmentName'] = environment_name if solution_stack_name: params['SolutionStackName'] = solution_stack_name if options: self.build_list_params(params, options, 'Options.member') return self._get_response('DescribeConfigurationOptions', params) def describe_configuration_settings(self, application_name, template_name=None, environment_name=None): """ Returns a description of the settings for the specified configuration set, that is, either a configuration template or the configuration set associated with a running environment. When describing the settings for the configuration set associated with a running environment, it is possible to receive two sets of setting descriptions. One is the deployed configuration set, and the other is a draft configuration of an environment that is either in the process of deployment or that failed to deploy. :type application_name: string :param application_name: The application for the environment or configuration template. :type template_name: string :param template_name: The name of the configuration template to describe. Conditional: You must specify either this parameter or an EnvironmentName, but not both. If you specify both, AWS Elastic Beanstalk returns an InvalidParameterCombination error. If you do not specify either, AWS Elastic Beanstalk returns a MissingRequiredParameter error. :type environment_name: string :param environment_name: The name of the environment to describe. Condition: You must specify either this or a TemplateName, but not both. If you specify both, AWS Elastic Beanstalk returns an InvalidParameterCombination error. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error. """ params = {'ApplicationName': application_name} if template_name: params['TemplateName'] = template_name if environment_name: params['EnvironmentName'] = environment_name return self._get_response('DescribeConfigurationSettings', params) def describe_environment_resources(self, environment_id=None, environment_name=None): """Returns AWS resources for this environment. :type environment_id: string :param environment_id: The ID of the environment to retrieve AWS resource usage data. Condition: You must specify either this or an EnvironmentName, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error. :type environment_name: string :param environment_name: The name of the environment to retrieve AWS resource usage data. Condition: You must specify either this or an EnvironmentId, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error. :raises: InsufficientPrivilegesException """ params = {} if environment_id: params['EnvironmentId'] = environment_id if environment_name: params['EnvironmentName'] = environment_name return self._get_response('DescribeEnvironmentResources', params) def describe_environments(self, application_name=None, version_label=None, environment_ids=None, environment_names=None, include_deleted=None, included_deleted_back_to=None): """Returns descriptions for existing environments. :type application_name: string :param application_name: If specified, AWS Elastic Beanstalk restricts the returned descriptions to include only those that are associated with this application. :type version_label: string :param version_label: If specified, AWS Elastic Beanstalk restricts the returned descriptions to include only those that are associated with this application version. :type environment_ids: list :param environment_ids: If specified, AWS Elastic Beanstalk restricts the returned descriptions to include only those that have the specified IDs. :type environment_names: list :param environment_names: If specified, AWS Elastic Beanstalk restricts the returned descriptions to include only those that have the specified names. :type include_deleted: boolean :param include_deleted: Indicates whether to include deleted environments: true: Environments that have been deleted after IncludedDeletedBackTo are displayed. false: Do not include deleted environments. :type included_deleted_back_to: timestamp :param included_deleted_back_to: If specified when IncludeDeleted is set to true, then environments deleted after this date are displayed. """ params = {} if application_name: params['ApplicationName'] = application_name if version_label: params['VersionLabel'] = version_label if environment_ids: self.build_list_params(params, environment_ids, 'EnvironmentIds.member') if environment_names: self.build_list_params(params, environment_names, 'EnvironmentNames.member') if include_deleted: params['IncludeDeleted'] = self._encode_bool(include_deleted) if included_deleted_back_to: params['IncludedDeletedBackTo'] = included_deleted_back_to return self._get_response('DescribeEnvironments', params) def describe_events(self, application_name=None, version_label=None, template_name=None, environment_id=None, environment_name=None, request_id=None, severity=None, start_time=None, end_time=None, max_records=None, next_token=None): """Returns event descriptions matching criteria up to the last 6 weeks. :type application_name: string :param application_name: If specified, AWS Elastic Beanstalk restricts the returned descriptions to include only those associated with this application. :type version_label: string :param version_label: If specified, AWS Elastic Beanstalk restricts the returned descriptions to those associated with this application version. :type template_name: string :param template_name: If specified, AWS Elastic Beanstalk restricts the returned descriptions to those that are associated with this environment configuration. :type environment_id: string :param environment_id: If specified, AWS Elastic Beanstalk restricts the returned descriptions to those associated with this environment. :type environment_name: string :param environment_name: If specified, AWS Elastic Beanstalk restricts the returned descriptions to those associated with this environment. :type request_id: string :param request_id: If specified, AWS Elastic Beanstalk restricts the described events to include only those associated with this request ID. :type severity: string :param severity: If specified, limits the events returned from this call to include only those with the specified severity or higher. :type start_time: timestamp :param start_time: If specified, AWS Elastic Beanstalk restricts the returned descriptions to those that occur on or after this time. :type end_time: timestamp :param end_time: If specified, AWS Elastic Beanstalk restricts the returned descriptions to those that occur up to, but not including, the EndTime. :type max_records: integer :param max_records: Specifies the maximum number of events that can be returned, beginning with the most recent event. :type next_token: string :param next_token: Pagination token. If specified, the events return the next batch of results. """ params = {} if application_name: params['ApplicationName'] = application_name if version_label: params['VersionLabel'] = version_label if template_name: params['TemplateName'] = template_name if environment_id: params['EnvironmentId'] = environment_id if environment_name: params['EnvironmentName'] = environment_name if request_id: params['RequestId'] = request_id if severity: params['Severity'] = severity if start_time: params['StartTime'] = start_time if end_time: params['EndTime'] = end_time if max_records: params['MaxRecords'] = max_records if next_token: params['NextToken'] = next_token return self._get_response('DescribeEvents', params) def list_available_solution_stacks(self): """Returns a list of the available solution stack names.""" return self._get_response('ListAvailableSolutionStacks', params={}) def rebuild_environment(self, environment_id=None, environment_name=None): """ Deletes and recreates all of the AWS resources (for example: the Auto Scaling group, load balancer, etc.) for a specified environment and forces a restart. :type environment_id: string :param environment_id: The ID of the environment to rebuild. Condition: You must specify either this or an EnvironmentName, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error. :type environment_name: string :param environment_name: The name of the environment to rebuild. Condition: You must specify either this or an EnvironmentId, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error. :raises: InsufficientPrivilegesException """ params = {} if environment_id: params['EnvironmentId'] = environment_id if environment_name: params['EnvironmentName'] = environment_name return self._get_response('RebuildEnvironment', params) def request_environment_info(self, info_type='tail', environment_id=None, environment_name=None): """ Initiates a request to compile the specified type of information of the deployed environment. Setting the InfoType to tail compiles the last lines from the application server log files of every Amazon EC2 instance in your environment. Use RetrieveEnvironmentInfo to access the compiled information. :type info_type: string :param info_type: The type of information to request. :type environment_id: string :param environment_id: The ID of the environment of the requested data. If no such environment is found, RequestEnvironmentInfo returns an InvalidParameterValue error. Condition: You must specify either this or an EnvironmentName, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error. :type environment_name: string :param environment_name: The name of the environment of the requested data. If no such environment is found, RequestEnvironmentInfo returns an InvalidParameterValue error. Condition: You must specify either this or an EnvironmentId, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error. """ params = {'InfoType': info_type} if environment_id: params['EnvironmentId'] = environment_id if environment_name: params['EnvironmentName'] = environment_name return self._get_response('RequestEnvironmentInfo', params) def restart_app_server(self, environment_id=None, environment_name=None): """ Causes the environment to restart the application container server running on each Amazon EC2 instance. :type environment_id: string :param environment_id: The ID of the environment to restart the server for. Condition: You must specify either this or an EnvironmentName, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error. :type environment_name: string :param environment_name: The name of the environment to restart the server for. Condition: You must specify either this or an EnvironmentId, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error. """ params = {} if environment_id: params['EnvironmentId'] = environment_id if environment_name: params['EnvironmentName'] = environment_name return self._get_response('RestartAppServer', params) def retrieve_environment_info(self, info_type='tail', environment_id=None, environment_name=None): """ Retrieves the compiled information from a RequestEnvironmentInfo request. :type info_type: string :param info_type: The type of information to retrieve. :type environment_id: string :param environment_id: The ID of the data's environment. If no such environment is found, returns an InvalidParameterValue error. Condition: You must specify either this or an EnvironmentName, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error. :type environment_name: string :param environment_name: The name of the data's environment. If no such environment is found, returns an InvalidParameterValue error. Condition: You must specify either this or an EnvironmentId, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error. """ params = {'InfoType': info_type} if environment_id: params['EnvironmentId'] = environment_id if environment_name: params['EnvironmentName'] = environment_name return self._get_response('RetrieveEnvironmentInfo', params) def swap_environment_cnames(self, source_environment_id=None, source_environment_name=None, destination_environment_id=None, destination_environment_name=None): """Swaps the CNAMEs of two environments. :type source_environment_id: string :param source_environment_id: The ID of the source environment. Condition: You must specify at least the SourceEnvironmentID or the SourceEnvironmentName. You may also specify both. If you specify the SourceEnvironmentId, you must specify the DestinationEnvironmentId. :type source_environment_name: string :param source_environment_name: The name of the source environment. Condition: You must specify at least the SourceEnvironmentID or the SourceEnvironmentName. You may also specify both. If you specify the SourceEnvironmentName, you must specify the DestinationEnvironmentName. :type destination_environment_id: string :param destination_environment_id: The ID of the destination environment. Condition: You must specify at least the DestinationEnvironmentID or the DestinationEnvironmentName. You may also specify both. You must specify the SourceEnvironmentId with the DestinationEnvironmentId. :type destination_environment_name: string :param destination_environment_name: The name of the destination environment. Condition: You must specify at least the DestinationEnvironmentID or the DestinationEnvironmentName. You may also specify both. You must specify the SourceEnvironmentName with the DestinationEnvironmentName. """ params = {} if source_environment_id: params['SourceEnvironmentId'] = source_environment_id if source_environment_name: params['SourceEnvironmentName'] = source_environment_name if destination_environment_id: params['DestinationEnvironmentId'] = destination_environment_id if destination_environment_name: params['DestinationEnvironmentName'] = destination_environment_name return self._get_response('SwapEnvironmentCNAMEs', params) def terminate_environment(self, environment_id=None, environment_name=None, terminate_resources=None): """Terminates the specified environment. :type environment_id: string :param environment_id: The ID of the environment to terminate. Condition: You must specify either this or an EnvironmentName, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error. :type environment_name: string :param environment_name: The name of the environment to terminate. Condition: You must specify either this or an EnvironmentId, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error. :type terminate_resources: boolean :param terminate_resources: Indicates whether the associated AWS resources should shut down when the environment is terminated: true: (default) The user AWS resources (for example, the Auto Scaling group, LoadBalancer, etc.) are terminated along with the environment. false: The environment is removed from the AWS Elastic Beanstalk but the AWS resources continue to operate. For more information, see the AWS Elastic Beanstalk User Guide. Default: true Valid Values: true | false :raises: InsufficientPrivilegesException """ params = {} if environment_id: params['EnvironmentId'] = environment_id if environment_name: params['EnvironmentName'] = environment_name if terminate_resources: params['TerminateResources'] = self._encode_bool( terminate_resources) return self._get_response('TerminateEnvironment', params) def update_application(self, application_name, description=None): """ Updates the specified application to have the specified properties. :type application_name: string :param application_name: The name of the application to update. If no such application is found, UpdateApplication returns an InvalidParameterValue error. :type description: string :param description: A new description for the application. Default: If not specified, AWS Elastic Beanstalk does not update the description. """ params = {'ApplicationName': application_name} if description: params['Description'] = description return self._get_response('UpdateApplication', params) def update_application_version(self, application_name, version_label, description=None): """Updates the application version to have the properties. :type application_name: string :param application_name: The name of the application associated with this version. If no application is found with this name, UpdateApplication returns an InvalidParameterValue error. :type version_label: string :param version_label: The name of the version to update. If no application version is found with this label, UpdateApplication returns an InvalidParameterValue error. :type description: string :param description: A new description for this release. """ params = {'ApplicationName': application_name, 'VersionLabel': version_label} if description: params['Description'] = description return self._get_response('UpdateApplicationVersion', params) def update_configuration_template(self, application_name, template_name, description=None, option_settings=None, options_to_remove=None): """ Updates the specified configuration template to have the specified properties or configuration option values. :type application_name: string :param application_name: The name of the application associated with the configuration template to update. If no application is found with this name, UpdateConfigurationTemplate returns an InvalidParameterValue error. :type template_name: string :param template_name: The name of the configuration template to update. If no configuration template is found with this name, UpdateConfigurationTemplate returns an InvalidParameterValue error. :type description: string :param description: A new description for the configuration. :type option_settings: list :param option_settings: A list of configuration option settings to update with the new specified option value. :type options_to_remove: list :param options_to_remove: A list of configuration options to remove from the configuration set. Constraint: You can remove only UserDefined configuration options. :raises: InsufficientPrivilegesException """ params = {'ApplicationName': application_name, 'TemplateName': template_name} if description: params['Description'] = description if option_settings: self._build_list_params(params, option_settings, 'OptionSettings.member', ('Namespace', 'OptionName', 'Value')) if options_to_remove: self.build_list_params(params, options_to_remove, 'OptionsToRemove.member') return self._get_response('UpdateConfigurationTemplate', params) def update_environment(self, environment_id=None, environment_name=None, version_label=None, template_name=None, description=None, option_settings=None, options_to_remove=None, tier_name=None, tier_type=None, tier_version='1.0'): """ Updates the environment description, deploys a new application version, updates the configuration settings to an entirely new configuration template, or updates select configuration option values in the running environment. Attempting to update both the release and configuration is not allowed and AWS Elastic Beanstalk returns an InvalidParameterCombination error. When updating the configuration settings to a new template or individual settings, a draft configuration is created and DescribeConfigurationSettings for this environment returns two setting descriptions with different DeploymentStatus values. :type environment_id: string :param environment_id: The ID of the environment to update. If no environment with this ID exists, AWS Elastic Beanstalk returns an InvalidParameterValue error. Condition: You must specify either this or an EnvironmentName, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error. :type environment_name: string :param environment_name: The name of the environment to update. If no environment with this name exists, AWS Elastic Beanstalk returns an InvalidParameterValue error. Condition: You must specify either this or an EnvironmentId, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error. :type version_label: string :param version_label: If this parameter is specified, AWS Elastic Beanstalk deploys the named application version to the environment. If no such application version is found, returns an InvalidParameterValue error. :type template_name: string :param template_name: If this parameter is specified, AWS Elastic Beanstalk deploys this configuration template to the environment. If no such configuration template is found, AWS Elastic Beanstalk returns an InvalidParameterValue error. :type description: string :param description: If this parameter is specified, AWS Elastic Beanstalk updates the description of this environment. :type option_settings: list :param option_settings: If specified, AWS Elastic Beanstalk updates the configuration set associated with the running environment and sets the specified configuration options to the requested value. :type options_to_remove: list :param options_to_remove: A list of custom user-defined configuration options to remove from the configuration set for this environment. :type tier_name: string :param tier_name: The name of the tier. Valid values are "WebServer" and "Worker". Defaults to "WebServer". The ``tier_name`` and a ``tier_type`` parameters are related and the values provided must be valid. The possible combinations are: * "WebServer" and "Standard" (the default) * "Worker" and "SQS/HTTP" :type tier_type: string :param tier_type: The type of the tier. Valid values are "Standard" if ``tier_name`` is "WebServer" and "SQS/HTTP" if ``tier_name`` is "Worker". Defaults to "Standard". :type tier_version: string :type tier_version: The version of the tier. Valid values currently are "1.0". Defaults to "1.0". :raises: InsufficientPrivilegesException """ params = {} if environment_id: params['EnvironmentId'] = environment_id if environment_name: params['EnvironmentName'] = environment_name if version_label: params['VersionLabel'] = version_label if template_name: params['TemplateName'] = template_name if description: params['Description'] = description if option_settings: self._build_list_params(params, option_settings, 'OptionSettings.member', ('Namespace', 'OptionName', 'Value')) if options_to_remove: self.build_list_params(params, options_to_remove, 'OptionsToRemove.member') if tier_name and tier_type and tier_version: params['Tier.Name'] = tier_name params['Tier.Type'] = tier_type params['Tier.Version'] = tier_version return self._get_response('UpdateEnvironment', params) def validate_configuration_settings(self, application_name, option_settings, template_name=None, environment_name=None): """ Takes a set of configuration settings and either a configuration template or environment, and determines whether those values are valid. This action returns a list of messages indicating any errors or warnings associated with the selection of option values. :type application_name: string :param application_name: The name of the application that the configuration template or environment belongs to. :type template_name: string :param template_name: The name of the configuration template to validate the settings against. Condition: You cannot specify both this and an environment name. :type environment_name: string :param environment_name: The name of the environment to validate the settings against. Condition: You cannot specify both this and a configuration template name. :type option_settings: list :param option_settings: A list of the options and desired values to evaluate. :raises: InsufficientPrivilegesException """ params = {'ApplicationName': application_name} self._build_list_params(params, option_settings, 'OptionSettings.member', ('Namespace', 'OptionName', 'Value')) if template_name: params['TemplateName'] = template_name if environment_name: params['EnvironmentName'] = environment_name return self._get_response('ValidateConfigurationSettings', params) def _build_list_params(self, params, user_values, prefix, tuple_names): # For params such as the ConfigurationOptionSettings, # they can specify a list of tuples where each tuple maps to a specific # arg. For example: # user_values = [('foo', 'bar', 'baz'] # prefix=MyOption.member # tuple_names=('One', 'Two', 'Three') # would result in: # MyOption.member.1.One = foo # MyOption.member.1.Two = bar # MyOption.member.1.Three = baz for i, user_value in enumerate(user_values, 1): current_prefix = '%s.%s' % (prefix, i) for key, value in zip(tuple_names, user_value): full_key = '%s.%s' % (current_prefix, key) params[full_key] = value
apache-2.0
[ 3, 1898, 334, 67, 9, 6029, 603, 9414, 598, 26272, 1455, 921, 71, 26272, 14, 1308, 15, 199, 3, 1898, 334, 67, 9, 6029, 14347, 14, 957, 12, 3277, 14, 503, 2399, 29172, 2335, 14, 199, 3, 2900, 5924, 5702, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 199, 3, 1331, 402, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 199, 3, 298, 10337, 1288, 370, 7962, 315, 314, 2290, 1928, 10588, 12, 5893, 199, 3, 1928, 12305, 314, 4481, 370, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 2153, 13, 199, 3, 28420, 12, 13473, 12, 436, 15, 269, 12743, 6866, 402, 314, 2290, 12, 436, 370, 11291, 199, 3, 12103, 370, 12676, 314, 2290, 365, 13985, 370, 886, 880, 12, 5420, 370, 314, 1699, 13, 199, 3, 28486, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 199, 3, 315, 1006, 6866, 503, 13393, 12468, 402, 314, 2290, 14, 199, 3, 199, 3, 2334, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 7168, 199, 3, 1549, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 28471, 13, 199, 3, 28463, 12, 3092, 2381, 437, 3115, 3104, 2401, 13229, 14, 1621, 4825, 6461, 199, 3, 7000, 2334, 17632, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 5603, 12, 199, 3, 7061, 1621, 1261, 9612, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 4442, 12, 199, 3, 5738, 1634, 1549, 1621, 11287, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 5010, 13198, 199, 3, 1621, 2334, 4141, 14, 199, 3, 199, 199, 646, 6055, 199, 646, 6055, 14, 1001, 1310, 199, 504, 6055, 14, 5819, 492, 2022, 199, 504, 6055, 14, 4551, 815, 492, 22240, 2354, 199, 504, 6055, 14, 2105, 492, 10168, 3227, 3225, 421, 199, 533, 11915, 17, 8, 13226, 3227, 3225, 304, 339, 3261, 3353, 275, 283, 6542, 13, 713, 13, 614, 7, 272, 3758, 10708, 985, 275, 283, 527, 13, 14346, 13, 17, 7, 272, 3758, 10708, 11442, 275, 283, 15565, 28142, 270, 4878, 14, 527, 13, 14346, 13, 17, 14, 21442, 14, 957, 7, 339, 347, 636, 826, 721, 277, 12, 11488, 63, 2732, 63, 498, 63, 344, 29, 403, 12, 11488, 63, 4731, 63, 2732, 63, 498, 29, 403, 12, 326, 365, 63, 7817, 29, 549, 12, 1844, 29, 403, 12, 326, 4566, 29, 403, 12, 4566, 63, 719, 29, 403, 12, 326, 4566, 63, 751, 29, 403, 12, 4566, 63, 1529, 29, 403, 12, 3105, 29, 16, 12, 326, 4178, 63, 2105, 63, 3702, 29, 403, 12, 4897, 29, 403, 12, 931, 25412, 326, 2986, 63, 1023, 29, 403, 12, 6391, 63, 1418, 29, 403, 12, 4690, 63, 354, 29, 403, 304, 267, 340, 440, 4897, 26, 288, 4897, 275, 22240, 2354, 8, 277, 12, 291, 14, 2698, 10708, 985, 12, 1816, 291, 14, 2698, 10708, 11442, 9, 267, 291, 14, 4551, 275, 4897, 267, 1613, 8, 5003, 17, 12, 291, 2843, 826, 721, 7231, 63, 2732, 63, 498, 63, 344, 12, 2511, 11488, 63, 4731, 63, 2732, 63, 498, 12, 2511, 365, 63, 7817, 12, 1844, 12, 4566, 12, 4566, 63, 719, 12, 2511, 4566, 63, 751, 12, 4566, 63, 1529, 12, 2511, 291, 14, 4551, 14, 6520, 12, 3105, 12, 2511, 4178, 63, 2105, 63, 3702, 12, 931, 12, 2511, 6391, 63, 1418, 12, 4690, 63, 354, 29, 2913, 63, 354, 9, 339, 347, 485, 2427, 63, 1178, 63, 21181, 8, 277, 304, 267, 372, 788, 18537, 13, 86, 20, 418, 339, 347, 485, 2143, 63, 2245, 8, 277, 12, 373, 304, 267, 373, 275, 2155, 8, 86, 9, 267, 372, 469, 549, 26, 298, 2052, 401, 756, 26, 298, 3910, 3570, 59, 86, 61, 339, 347, 485, 362, 63, 1310, 8, 277, 12, 1595, 12, 1862, 12, 931, 25412, 16041, 534, 2970, 735, 267, 1862, 459, 11282, 418, 275, 283, 6243, 7, 267, 1177, 275, 291, 14, 1875, 63, 1069, 8, 1287, 12, 1862, 12, 931, 12, 16041, 9, 267, 2396, 275, 1177, 14, 739, 1252, 2708, 360, 1624, 13, 24, 358, 267, 6055, 14, 793, 14, 1757, 8, 2030, 9, 267, 340, 1177, 14, 1205, 508, 1926, 26, 288, 372, 2022, 14, 3640, 8, 2030, 9, 267, 587, 26, 288, 746, 291, 14, 19712, 8, 1310, 14, 1205, 12, 1177, 14, 5764, 12, 2396, 9, 339, 347, 1104, 63, 5797, 63, 11856, 8, 277, 12, 22559, 63, 1861, 304, 267, 408, 11834, 340, 314, 2013, 445, 2339, 365, 2808, 14, 398, 520, 466, 22559, 63, 1861, 26, 1059, 267, 520, 635, 22559, 63, 1861, 26, 710, 2403, 1202, 1380, 642, 445, 2339, 365, 288, 4644, 14, 267, 408, 267, 1862, 275, 791, 35, 2339, 4793, 356, 22559, 63, 1861, 93, 267, 372, 291, 423, 362, 63, 1310, 360, 1799, 12323, 26462, 297, 1862, 9, 339, 347, 1218, 63, 3578, 8, 277, 12, 4223, 63, 354, 12, 1369, 29, 403, 304, 267, 408, 267, 10560, 376, 4223, 626, 965, 1373, 2897, 1978, 267, 4310, 849, 436, 949, 4223, 5459, 14, 398, 520, 466, 4223, 63, 354, 26, 1059, 267, 520, 635, 4223, 63, 354, 26, 710, 536, 402, 314, 4223, 14, 288, 25889, 26, 961, 536, 1471, 506, 3747, 4453, 2195, 2933, 14, 982, 314, 288, 2013, 536, 2575, 3495, 12, 314, 1595, 2529, 376, 288, 6378, 24637, 1125, 14, 398, 520, 466, 1369, 26, 1059, 267, 520, 635, 1369, 26, 28571, 11562, 314, 4223, 14, 398, 520, 3536, 26, 22893, 4089, 31907, 1726, 267, 408, 267, 1862, 275, 791, 5039, 985, 356, 4223, 63, 354, 93, 267, 340, 1369, 26, 288, 1862, 459, 5831, 418, 275, 1369, 267, 372, 291, 423, 362, 63, 1310, 360, 2499, 5039, 297, 1862, 9, 339, 347, 1218, 63, 3578, 63, 1023, 8, 277, 12, 4223, 63, 354, 12, 1015, 63, 1302, 12, 3521, 1369, 29, 403, 12, 308, 19, 63, 4623, 29, 403, 12, 3521, 308, 19, 63, 498, 29, 403, 12, 2599, 63, 981, 63, 3578, 29, 403, 304, 267, 408, 10607, 376, 4223, 1015, 367, 314, 2013, 4223, 14, 398, 520, 466, 4223, 63, 354, 26, 1059, 267, 520 ]
[ 1898, 334, 67, 9, 6029, 603, 9414, 598, 26272, 1455, 921, 71, 26272, 14, 1308, 15, 199, 3, 1898, 334, 67, 9, 6029, 14347, 14, 957, 12, 3277, 14, 503, 2399, 29172, 2335, 14, 199, 3, 2900, 5924, 5702, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 199, 3, 1331, 402, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 199, 3, 298, 10337, 1288, 370, 7962, 315, 314, 2290, 1928, 10588, 12, 5893, 199, 3, 1928, 12305, 314, 4481, 370, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 2153, 13, 199, 3, 28420, 12, 13473, 12, 436, 15, 269, 12743, 6866, 402, 314, 2290, 12, 436, 370, 11291, 199, 3, 12103, 370, 12676, 314, 2290, 365, 13985, 370, 886, 880, 12, 5420, 370, 314, 1699, 13, 199, 3, 28486, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 199, 3, 315, 1006, 6866, 503, 13393, 12468, 402, 314, 2290, 14, 199, 3, 199, 3, 2334, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 7168, 199, 3, 1549, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 28471, 13, 199, 3, 28463, 12, 3092, 2381, 437, 3115, 3104, 2401, 13229, 14, 1621, 4825, 6461, 199, 3, 7000, 2334, 17632, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 5603, 12, 199, 3, 7061, 1621, 1261, 9612, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 4442, 12, 199, 3, 5738, 1634, 1549, 1621, 11287, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 5010, 13198, 199, 3, 1621, 2334, 4141, 14, 199, 3, 199, 199, 646, 6055, 199, 646, 6055, 14, 1001, 1310, 199, 504, 6055, 14, 5819, 492, 2022, 199, 504, 6055, 14, 4551, 815, 492, 22240, 2354, 199, 504, 6055, 14, 2105, 492, 10168, 3227, 3225, 421, 199, 533, 11915, 17, 8, 13226, 3227, 3225, 304, 339, 3261, 3353, 275, 283, 6542, 13, 713, 13, 614, 7, 272, 3758, 10708, 985, 275, 283, 527, 13, 14346, 13, 17, 7, 272, 3758, 10708, 11442, 275, 283, 15565, 28142, 270, 4878, 14, 527, 13, 14346, 13, 17, 14, 21442, 14, 957, 7, 339, 347, 636, 826, 721, 277, 12, 11488, 63, 2732, 63, 498, 63, 344, 29, 403, 12, 11488, 63, 4731, 63, 2732, 63, 498, 29, 403, 12, 326, 365, 63, 7817, 29, 549, 12, 1844, 29, 403, 12, 326, 4566, 29, 403, 12, 4566, 63, 719, 29, 403, 12, 326, 4566, 63, 751, 29, 403, 12, 4566, 63, 1529, 29, 403, 12, 3105, 29, 16, 12, 326, 4178, 63, 2105, 63, 3702, 29, 403, 12, 4897, 29, 403, 12, 931, 25412, 326, 2986, 63, 1023, 29, 403, 12, 6391, 63, 1418, 29, 403, 12, 4690, 63, 354, 29, 403, 304, 267, 340, 440, 4897, 26, 288, 4897, 275, 22240, 2354, 8, 277, 12, 291, 14, 2698, 10708, 985, 12, 1816, 291, 14, 2698, 10708, 11442, 9, 267, 291, 14, 4551, 275, 4897, 267, 1613, 8, 5003, 17, 12, 291, 2843, 826, 721, 7231, 63, 2732, 63, 498, 63, 344, 12, 2511, 11488, 63, 4731, 63, 2732, 63, 498, 12, 2511, 365, 63, 7817, 12, 1844, 12, 4566, 12, 4566, 63, 719, 12, 2511, 4566, 63, 751, 12, 4566, 63, 1529, 12, 2511, 291, 14, 4551, 14, 6520, 12, 3105, 12, 2511, 4178, 63, 2105, 63, 3702, 12, 931, 12, 2511, 6391, 63, 1418, 12, 4690, 63, 354, 29, 2913, 63, 354, 9, 339, 347, 485, 2427, 63, 1178, 63, 21181, 8, 277, 304, 267, 372, 788, 18537, 13, 86, 20, 418, 339, 347, 485, 2143, 63, 2245, 8, 277, 12, 373, 304, 267, 373, 275, 2155, 8, 86, 9, 267, 372, 469, 549, 26, 298, 2052, 401, 756, 26, 298, 3910, 3570, 59, 86, 61, 339, 347, 485, 362, 63, 1310, 8, 277, 12, 1595, 12, 1862, 12, 931, 25412, 16041, 534, 2970, 735, 267, 1862, 459, 11282, 418, 275, 283, 6243, 7, 267, 1177, 275, 291, 14, 1875, 63, 1069, 8, 1287, 12, 1862, 12, 931, 12, 16041, 9, 267, 2396, 275, 1177, 14, 739, 1252, 2708, 360, 1624, 13, 24, 358, 267, 6055, 14, 793, 14, 1757, 8, 2030, 9, 267, 340, 1177, 14, 1205, 508, 1926, 26, 288, 372, 2022, 14, 3640, 8, 2030, 9, 267, 587, 26, 288, 746, 291, 14, 19712, 8, 1310, 14, 1205, 12, 1177, 14, 5764, 12, 2396, 9, 339, 347, 1104, 63, 5797, 63, 11856, 8, 277, 12, 22559, 63, 1861, 304, 267, 408, 11834, 340, 314, 2013, 445, 2339, 365, 2808, 14, 398, 520, 466, 22559, 63, 1861, 26, 1059, 267, 520, 635, 22559, 63, 1861, 26, 710, 2403, 1202, 1380, 642, 445, 2339, 365, 288, 4644, 14, 267, 408, 267, 1862, 275, 791, 35, 2339, 4793, 356, 22559, 63, 1861, 93, 267, 372, 291, 423, 362, 63, 1310, 360, 1799, 12323, 26462, 297, 1862, 9, 339, 347, 1218, 63, 3578, 8, 277, 12, 4223, 63, 354, 12, 1369, 29, 403, 304, 267, 408, 267, 10560, 376, 4223, 626, 965, 1373, 2897, 1978, 267, 4310, 849, 436, 949, 4223, 5459, 14, 398, 520, 466, 4223, 63, 354, 26, 1059, 267, 520, 635, 4223, 63, 354, 26, 710, 536, 402, 314, 4223, 14, 288, 25889, 26, 961, 536, 1471, 506, 3747, 4453, 2195, 2933, 14, 982, 314, 288, 2013, 536, 2575, 3495, 12, 314, 1595, 2529, 376, 288, 6378, 24637, 1125, 14, 398, 520, 466, 1369, 26, 1059, 267, 520, 635, 1369, 26, 28571, 11562, 314, 4223, 14, 398, 520, 3536, 26, 22893, 4089, 31907, 1726, 267, 408, 267, 1862, 275, 791, 5039, 985, 356, 4223, 63, 354, 93, 267, 340, 1369, 26, 288, 1862, 459, 5831, 418, 275, 1369, 267, 372, 291, 423, 362, 63, 1310, 360, 2499, 5039, 297, 1862, 9, 339, 347, 1218, 63, 3578, 63, 1023, 8, 277, 12, 4223, 63, 354, 12, 1015, 63, 1302, 12, 3521, 1369, 29, 403, 12, 308, 19, 63, 4623, 29, 403, 12, 3521, 308, 19, 63, 498, 29, 403, 12, 2599, 63, 981, 63, 3578, 29, 403, 304, 267, 408, 10607, 376, 4223, 1015, 367, 314, 2013, 4223, 14, 398, 520, 466, 4223, 63, 354, 26, 1059, 267, 520, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
b1-systems/kiwi
test/unit/utils_rpm_test.py
1
3046
import io import os from .test_helper import patch_open from mock import ( patch, Mock, MagicMock, call ) from kiwi.utils.rpm import Rpm from kiwi.defaults import Defaults class TestRpm(object): def setup(self): self.rpm_host = Rpm() self.rpm_image = Rpm('root_dir') self.macro_file = os.sep.join( [ Defaults.get_custom_rpm_macros_path(), Defaults.get_custom_rpm_bootstrap_macro_name() ] ) @patch('kiwi.utils.rpm.Command.run') def test_expand_query(self, mock_Command_run): self.rpm_host.expand_query('foo') mock_Command_run.assert_called_once_with( ['rpm', '-E', 'foo'] ) mock_Command_run.reset_mock() self.rpm_image.expand_query('foo') mock_Command_run.assert_called_once_with( ['chroot', 'root_dir', 'rpm', '-E', 'foo'] ) @patch('kiwi.utils.rpm.Command.run') def test_get_query(self, mock_Command_run): rpmdb_call = Mock() rpmdb_call.output = '%_dbpath %{_usr}/lib/sysimage/rpm' mock_Command_run.return_value = rpmdb_call assert self.rpm_host.get_query('_dbpath') == \ '%{_usr}/lib/sysimage/rpm' mock_Command_run.assert_called_once_with( ['rpmdb', '--showrc'] ) mock_Command_run.reset_mock() assert self.rpm_image.get_query('_dbpath') == \ '%{_usr}/lib/sysimage/rpm' mock_Command_run.assert_called_once_with( ['chroot', 'root_dir', 'rpmdb', '--showrc'] ) def test_set_config_value(self): self.rpm_host.set_config_value('key', 'value') assert self.rpm_host.custom_config[0] == '%key\tvalue' @patch('kiwi.utils.rpm.Path.wipe') def test_wipe_config(self, mock_Path_wipe): self.rpm_host.wipe_config() mock_Path_wipe.assert_called_once_with( os.sep + self.macro_file ) mock_Path_wipe.reset_mock() self.rpm_image.wipe_config() mock_Path_wipe.assert_called_once_with( os.sep.join(['root_dir', self.macro_file]) ) @patch_open @patch('kiwi.utils.rpm.Path.create') def test_write_config(self, mock_Path_create, mock_open): mock_open.return_value = MagicMock(spec=io.IOBase) file_handle = mock_open.return_value.__enter__.return_value self.rpm_host.set_config_value('key', 'value') self.rpm_host.write_config() mock_open.assert_called_once_with( os.sep + self.macro_file, 'w' ) assert file_handle.write.call_args_list == [ call('%key\tvalue\n') ] mock_open.reset_mock() file_handle.write.reset_mock() self.rpm_image.set_config_value('foo', 'bar') self.rpm_image.write_config() mock_open.assert_called_once_with( os.sep.join(['root_dir', self.macro_file]), 'w' ) assert file_handle.write.call_args_list == [ call('%foo\tbar\n') ]
gpl-3.0
[ 646, 5890, 199, 646, 747, 199, 504, 1275, 396, 63, 3676, 492, 3371, 63, 1490, 199, 504, 1683, 492, 334, 272, 3371, 12, 4420, 12, 10079, 12, 1240, 199, 9, 199, 199, 504, 1022, 73, 14249, 14, 1208, 14, 14191, 492, 820, 7073, 199, 504, 1022, 73, 14249, 14, 4322, 492, 7827, 421, 199, 533, 1379, 50, 7073, 8, 785, 304, 272, 347, 3272, 8, 277, 304, 267, 291, 14, 14191, 63, 1102, 275, 820, 7073, 342, 267, 291, 14, 14191, 63, 1569, 275, 820, 7073, 360, 1231, 63, 694, 358, 267, 291, 14, 11300, 63, 493, 275, 747, 14, 4127, 14, 904, 8, 288, 359, 355, 7827, 14, 362, 63, 4229, 63, 14191, 63, 16358, 63, 515, 1062, 355, 7827, 14, 362, 63, 4229, 63, 14191, 63, 11146, 63, 11300, 63, 354, 342, 288, 1622, 267, 776, 339, 768, 2068, 360, 8810, 14249, 14, 1208, 14, 14191, 14, 3110, 14, 1065, 358, 272, 347, 511, 63, 4441, 63, 1131, 8, 277, 12, 1683, 63, 3110, 63, 1065, 304, 267, 291, 14, 14191, 63, 1102, 14, 4441, 63, 1131, 360, 1421, 358, 267, 1683, 63, 3110, 63, 1065, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 288, 788, 14191, 297, 2475, 37, 297, 283, 1421, 418, 267, 776, 267, 1683, 63, 3110, 63, 1065, 14, 3958, 63, 1805, 342, 267, 291, 14, 14191, 63, 1569, 14, 4441, 63, 1131, 360, 1421, 358, 267, 1683, 63, 3110, 63, 1065, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 288, 788, 24769, 297, 283, 1231, 63, 694, 297, 283, 14191, 297, 2475, 37, 297, 283, 1421, 418, 267, 776, 339, 768, 2068, 360, 8810, 14249, 14, 1208, 14, 14191, 14, 3110, 14, 1065, 358, 272, 347, 511, 63, 362, 63, 1131, 8, 277, 12, 1683, 63, 3110, 63, 1065, 304, 267, 21980, 697, 63, 1250, 275, 4420, 342, 267, 21980, 697, 63, 1250, 14, 1199, 275, 1543, 63, 697, 515, 221, 450, 26975, 2647, 5995, 773, 15, 1786, 338, 960, 15, 14191, 7, 267, 1683, 63, 3110, 63, 1065, 14, 1107, 63, 585, 275, 21980, 697, 63, 1250, 267, 702, 291, 14, 14191, 63, 1102, 14, 362, 63, 1131, 6412, 697, 515, 358, 508, 971, 288, 1543, 26975, 2647, 5995, 773, 15, 1786, 338, 960, 15, 14191, 7, 267, 1683, 63, 3110, 63, 1065, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 288, 788, 14191, 697, 297, 2850, 2384, 1195, 418, 267, 776, 267, 1683, 63, 3110, 63, 1065, 14, 3958, 63, 1805, 342, 267, 702, 291, 14, 14191, 63, 1569, 14, 362, 63, 1131, 6412, 697, 515, 358, 508, 971, 288, 1543, 26975, 2647, 5995, 773, 15, 1786, 338, 960, 15, 14191, 7, 267, 1683, 63, 3110, 63, 1065, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 288, 788, 24769, 297, 283, 1231, 63, 694, 297, 283, 14191, 697, 297, 2850, 2384, 1195, 418, 267, 776, 339, 347, 511, 63, 409, 63, 888, 63, 585, 8, 277, 304, 267, 291, 14, 14191, 63, 1102, 14, 409, 63, 888, 63, 585, 360, 498, 297, 283, 585, 358, 267, 702, 291, 14, 14191, 63, 1102, 14, 4229, 63, 888, 59, 16, 61, 508, 1543, 498, 60, 84, 585, 7, 339, 768, 2068, 360, 8810, 14249, 14, 1208, 14, 14191, 14, 2042, 14, 87, 3662, 358, 272, 347, 511, 63, 87, 3662, 63, 888, 8, 277, 12, 1683, 63, 2042, 63, 87, 3662, 304, 267, 291, 14, 14191, 63, 1102, 14, 87, 3662, 63, 888, 342, 267, 1683, 63, 2042, 63, 87, 3662, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 288, 747, 14, 4127, 435, 291, 14, 11300, 63, 493, 267, 776, 267, 1683, 63, 2042, 63, 87, 3662, 14, 3958, 63, 1805, 342, 267, 291, 14, 14191, 63, 1569, 14, 87, 3662, 63, 888, 342, 267, 1683, 63, 2042, 63, 87, 3662, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 288, 747, 14, 4127, 14, 904, 2941, 1231, 63, 694, 297, 291, 14, 11300, 63, 493, 566, 267, 776, 339, 768, 2068, 63, 1490, 272, 768, 2068, 360, 8810, 14249, 14, 1208, 14, 14191, 14, 2042, 14, 981, 358, 272, 347, 511, 63, 952, 63, 888, 8, 277, 12, 1683, 63, 2042, 63, 981, 12, 1683, 63, 1490, 304, 267, 1683, 63, 1490, 14, 1107, 63, 585, 275, 10079, 8, 1650, 29, 2308, 14, 23413, 9, 267, 570, 63, 2479, 275, 1683, 63, 1490, 14, 1107, 63, 585, 855, 4200, 4343, 1107, 63, 585, 267, 291, 14, 14191, 63, 1102, 14, 409, 63, 888, 63, 585, 360, 498, 297, 283, 585, 358, 267, 291, 14, 14191, 63, 1102, 14, 952, 63, 888, 342, 267, 1683, 63, 1490, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 288, 747, 14, 4127, 435, 291, 14, 11300, 63, 493, 12, 283, 87, 7, 267, 776, 267, 702, 570, 63, 2479, 14, 952, 14, 1250, 63, 589, 63, 513, 508, 359, 288, 1240, 3508, 498, 60, 84, 585, 60, 78, 358, 267, 1622, 267, 1683, 63, 1490, 14, 3958, 63, 1805, 342, 267, 570, 63, 2479, 14, 952, 14, 3958, 63, 1805, 342, 267, 291, 14, 14191, 63, 1569, 14, 409, 63, 888, 63, 585, 360, 1421, 297, 283, 1700, 358, 267, 291, 14, 14191, 63, 1569, 14, 952, 63, 888, 342, 267, 1683, 63, 1490, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 288, 747, 14, 4127, 14, 904, 2941, 1231, 63, 694, 297, 291, 14, 11300, 63, 493, 2522, 283, 87, 7, 267, 776, 267, 702, 570, 63, 2479, 14, 952, 14, 1250, 63, 589, 63, 513, 508, 359, 288, 1240, 3508, 1421, 60, 84, 1700, 60, 78, 358, 267, 1622, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 5890, 199, 646, 747, 199, 504, 1275, 396, 63, 3676, 492, 3371, 63, 1490, 199, 504, 1683, 492, 334, 272, 3371, 12, 4420, 12, 10079, 12, 1240, 199, 9, 199, 199, 504, 1022, 73, 14249, 14, 1208, 14, 14191, 492, 820, 7073, 199, 504, 1022, 73, 14249, 14, 4322, 492, 7827, 421, 199, 533, 1379, 50, 7073, 8, 785, 304, 272, 347, 3272, 8, 277, 304, 267, 291, 14, 14191, 63, 1102, 275, 820, 7073, 342, 267, 291, 14, 14191, 63, 1569, 275, 820, 7073, 360, 1231, 63, 694, 358, 267, 291, 14, 11300, 63, 493, 275, 747, 14, 4127, 14, 904, 8, 288, 359, 355, 7827, 14, 362, 63, 4229, 63, 14191, 63, 16358, 63, 515, 1062, 355, 7827, 14, 362, 63, 4229, 63, 14191, 63, 11146, 63, 11300, 63, 354, 342, 288, 1622, 267, 776, 339, 768, 2068, 360, 8810, 14249, 14, 1208, 14, 14191, 14, 3110, 14, 1065, 358, 272, 347, 511, 63, 4441, 63, 1131, 8, 277, 12, 1683, 63, 3110, 63, 1065, 304, 267, 291, 14, 14191, 63, 1102, 14, 4441, 63, 1131, 360, 1421, 358, 267, 1683, 63, 3110, 63, 1065, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 288, 788, 14191, 297, 2475, 37, 297, 283, 1421, 418, 267, 776, 267, 1683, 63, 3110, 63, 1065, 14, 3958, 63, 1805, 342, 267, 291, 14, 14191, 63, 1569, 14, 4441, 63, 1131, 360, 1421, 358, 267, 1683, 63, 3110, 63, 1065, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 288, 788, 24769, 297, 283, 1231, 63, 694, 297, 283, 14191, 297, 2475, 37, 297, 283, 1421, 418, 267, 776, 339, 768, 2068, 360, 8810, 14249, 14, 1208, 14, 14191, 14, 3110, 14, 1065, 358, 272, 347, 511, 63, 362, 63, 1131, 8, 277, 12, 1683, 63, 3110, 63, 1065, 304, 267, 21980, 697, 63, 1250, 275, 4420, 342, 267, 21980, 697, 63, 1250, 14, 1199, 275, 1543, 63, 697, 515, 221, 450, 26975, 2647, 5995, 773, 15, 1786, 338, 960, 15, 14191, 7, 267, 1683, 63, 3110, 63, 1065, 14, 1107, 63, 585, 275, 21980, 697, 63, 1250, 267, 702, 291, 14, 14191, 63, 1102, 14, 362, 63, 1131, 6412, 697, 515, 358, 508, 971, 288, 1543, 26975, 2647, 5995, 773, 15, 1786, 338, 960, 15, 14191, 7, 267, 1683, 63, 3110, 63, 1065, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 288, 788, 14191, 697, 297, 2850, 2384, 1195, 418, 267, 776, 267, 1683, 63, 3110, 63, 1065, 14, 3958, 63, 1805, 342, 267, 702, 291, 14, 14191, 63, 1569, 14, 362, 63, 1131, 6412, 697, 515, 358, 508, 971, 288, 1543, 26975, 2647, 5995, 773, 15, 1786, 338, 960, 15, 14191, 7, 267, 1683, 63, 3110, 63, 1065, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 288, 788, 24769, 297, 283, 1231, 63, 694, 297, 283, 14191, 697, 297, 2850, 2384, 1195, 418, 267, 776, 339, 347, 511, 63, 409, 63, 888, 63, 585, 8, 277, 304, 267, 291, 14, 14191, 63, 1102, 14, 409, 63, 888, 63, 585, 360, 498, 297, 283, 585, 358, 267, 702, 291, 14, 14191, 63, 1102, 14, 4229, 63, 888, 59, 16, 61, 508, 1543, 498, 60, 84, 585, 7, 339, 768, 2068, 360, 8810, 14249, 14, 1208, 14, 14191, 14, 2042, 14, 87, 3662, 358, 272, 347, 511, 63, 87, 3662, 63, 888, 8, 277, 12, 1683, 63, 2042, 63, 87, 3662, 304, 267, 291, 14, 14191, 63, 1102, 14, 87, 3662, 63, 888, 342, 267, 1683, 63, 2042, 63, 87, 3662, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 288, 747, 14, 4127, 435, 291, 14, 11300, 63, 493, 267, 776, 267, 1683, 63, 2042, 63, 87, 3662, 14, 3958, 63, 1805, 342, 267, 291, 14, 14191, 63, 1569, 14, 87, 3662, 63, 888, 342, 267, 1683, 63, 2042, 63, 87, 3662, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 288, 747, 14, 4127, 14, 904, 2941, 1231, 63, 694, 297, 291, 14, 11300, 63, 493, 566, 267, 776, 339, 768, 2068, 63, 1490, 272, 768, 2068, 360, 8810, 14249, 14, 1208, 14, 14191, 14, 2042, 14, 981, 358, 272, 347, 511, 63, 952, 63, 888, 8, 277, 12, 1683, 63, 2042, 63, 981, 12, 1683, 63, 1490, 304, 267, 1683, 63, 1490, 14, 1107, 63, 585, 275, 10079, 8, 1650, 29, 2308, 14, 23413, 9, 267, 570, 63, 2479, 275, 1683, 63, 1490, 14, 1107, 63, 585, 855, 4200, 4343, 1107, 63, 585, 267, 291, 14, 14191, 63, 1102, 14, 409, 63, 888, 63, 585, 360, 498, 297, 283, 585, 358, 267, 291, 14, 14191, 63, 1102, 14, 952, 63, 888, 342, 267, 1683, 63, 1490, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 288, 747, 14, 4127, 435, 291, 14, 11300, 63, 493, 12, 283, 87, 7, 267, 776, 267, 702, 570, 63, 2479, 14, 952, 14, 1250, 63, 589, 63, 513, 508, 359, 288, 1240, 3508, 498, 60, 84, 585, 60, 78, 358, 267, 1622, 267, 1683, 63, 1490, 14, 3958, 63, 1805, 342, 267, 570, 63, 2479, 14, 952, 14, 3958, 63, 1805, 342, 267, 291, 14, 14191, 63, 1569, 14, 409, 63, 888, 63, 585, 360, 1421, 297, 283, 1700, 358, 267, 291, 14, 14191, 63, 1569, 14, 952, 63, 888, 342, 267, 1683, 63, 1490, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 288, 747, 14, 4127, 14, 904, 2941, 1231, 63, 694, 297, 291, 14, 11300, 63, 493, 2522, 283, 87, 7, 267, 776, 267, 702, 570, 63, 2479, 14, 952, 14, 1250, 63, 589, 63, 513, 508, 359, 288, 1240, 3508, 1421, 60, 84, 1700, 60, 78, 358, 267, 1622, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
cemoody/chainer
chainer/links/caffe/caffe_pb2.py
27
209364
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: caffe.proto from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import descriptor_pb2 # @@protoc_insertion_point(imports) DESCRIPTOR = _descriptor.FileDescriptor( name='caffe.proto', package='caffe', serialized_pb='\n\x0b\x63\x61\x66\x66\x65.proto\x12\x05\x63\x61\x66\x66\x65\"\x1c\n\tBlobShape\x12\x0f\n\x03\x64im\x18\x01 \x03(\x03\x42\x02\x10\x01\"\x9a\x01\n\tBlobProto\x12\x1f\n\x05shape\x18\x07 \x01(\x0b\x32\x10.caffe.BlobShape\x12\x10\n\x04\x64\x61ta\x18\x05 \x03(\x02\x42\x02\x10\x01\x12\x10\n\x04\x64iff\x18\x06 \x03(\x02\x42\x02\x10\x01\x12\x0e\n\x03num\x18\x01 \x01(\x05:\x01\x30\x12\x13\n\x08\x63hannels\x18\x02 \x01(\x05:\x01\x30\x12\x11\n\x06height\x18\x03 \x01(\x05:\x01\x30\x12\x10\n\x05width\x18\x04 \x01(\x05:\x01\x30\"2\n\x0f\x42lobProtoVector\x12\x1f\n\x05\x62lobs\x18\x01 \x03(\x0b\x32\x10.caffe.BlobProto\"\x81\x01\n\x05\x44\x61tum\x12\x10\n\x08\x63hannels\x18\x01 \x01(\x05\x12\x0e\n\x06height\x18\x02 \x01(\x05\x12\r\n\x05width\x18\x03 \x01(\x05\x12\x0c\n\x04\x64\x61ta\x18\x04 \x01(\x0c\x12\r\n\x05label\x18\x05 \x01(\x05\x12\x12\n\nfloat_data\x18\x06 \x03(\x02\x12\x16\n\x07\x65ncoded\x18\x07 \x01(\x08:\x05\x66\x61lse\"\x8a\x02\n\x0f\x46illerParameter\x12\x16\n\x04type\x18\x01 \x01(\t:\x08\x63onstant\x12\x10\n\x05value\x18\x02 \x01(\x02:\x01\x30\x12\x0e\n\x03min\x18\x03 \x01(\x02:\x01\x30\x12\x0e\n\x03max\x18\x04 \x01(\x02:\x01\x31\x12\x0f\n\x04mean\x18\x05 \x01(\x02:\x01\x30\x12\x0e\n\x03std\x18\x06 \x01(\x02:\x01\x31\x12\x12\n\x06sparse\x18\x07 \x01(\x05:\x02-1\x12\x42\n\rvariance_norm\x18\x08 \x01(\x0e\x32#.caffe.FillerParameter.VarianceNorm:\x06\x46\x41N_IN\"4\n\x0cVarianceNorm\x12\n\n\x06\x46\x41N_IN\x10\x00\x12\x0b\n\x07\x46\x41N_OUT\x10\x01\x12\x0b\n\x07\x41VERAGE\x10\x02\"\x8e\x02\n\x0cNetParameter\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05input\x18\x03 \x03(\t\x12%\n\x0binput_shape\x18\x08 \x03(\x0b\x32\x10.caffe.BlobShape\x12\x11\n\tinput_dim\x18\x04 \x03(\x05\x12\x1d\n\x0e\x66orce_backward\x18\x05 \x01(\x08:\x05\x66\x61lse\x12\x1e\n\x05state\x18\x06 \x01(\x0b\x32\x0f.caffe.NetState\x12\x19\n\ndebug_info\x18\x07 \x01(\x08:\x05\x66\x61lse\x12$\n\x05layer\x18\x64 \x03(\x0b\x32\x15.caffe.LayerParameter\x12\'\n\x06layers\x18\x02 \x03(\x0b\x32\x17.caffe.V1LayerParameter\"\xbd\x08\n\x0fSolverParameter\x12\x0b\n\x03net\x18\x18 \x01(\t\x12&\n\tnet_param\x18\x19 \x01(\x0b\x32\x13.caffe.NetParameter\x12\x11\n\ttrain_net\x18\x01 \x01(\t\x12\x10\n\x08test_net\x18\x02 \x03(\t\x12,\n\x0ftrain_net_param\x18\x15 \x01(\x0b\x32\x13.caffe.NetParameter\x12+\n\x0etest_net_param\x18\x16 \x03(\x0b\x32\x13.caffe.NetParameter\x12$\n\x0btrain_state\x18\x1a \x01(\x0b\x32\x0f.caffe.NetState\x12#\n\ntest_state\x18\x1b \x03(\x0b\x32\x0f.caffe.NetState\x12\x11\n\ttest_iter\x18\x03 \x03(\x05\x12\x18\n\rtest_interval\x18\x04 \x01(\x05:\x01\x30\x12 \n\x11test_compute_loss\x18\x13 \x01(\x08:\x05\x66\x61lse\x12!\n\x13test_initialization\x18 \x01(\x08:\x04true\x12\x0f\n\x07\x62\x61se_lr\x18\x05 \x01(\x02\x12\x0f\n\x07\x64isplay\x18\x06 \x01(\x05\x12\x17\n\x0c\x61verage_loss\x18! \x01(\x05:\x01\x31\x12\x10\n\x08max_iter\x18\x07 \x01(\x05\x12\x14\n\titer_size\x18$ \x01(\x05:\x01\x31\x12\x11\n\tlr_policy\x18\x08 \x01(\t\x12\r\n\x05gamma\x18\t \x01(\x02\x12\r\n\x05power\x18\n \x01(\x02\x12\x10\n\x08momentum\x18\x0b \x01(\x02\x12\x14\n\x0cweight_decay\x18\x0c \x01(\x02\x12\x1f\n\x13regularization_type\x18\x1d \x01(\t:\x02L2\x12\x10\n\x08stepsize\x18\r \x01(\x05\x12\x11\n\tstepvalue\x18\" \x03(\x05\x12\x1a\n\x0e\x63lip_gradients\x18# \x01(\x02:\x02-1\x12\x13\n\x08snapshot\x18\x0e \x01(\x05:\x01\x30\x12\x17\n\x0fsnapshot_prefix\x18\x0f \x01(\t\x12\x1c\n\rsnapshot_diff\x18\x10 \x01(\x08:\x05\x66\x61lse\x12;\n\x0bsolver_mode\x18\x11 \x01(\x0e\x32!.caffe.SolverParameter.SolverMode:\x03GPU\x12\x14\n\tdevice_id\x18\x12 \x01(\x05:\x01\x30\x12\x17\n\x0brandom_seed\x18\x14 \x01(\x03:\x02-1\x12;\n\x0bsolver_type\x18\x1e \x01(\x0e\x32!.caffe.SolverParameter.SolverType:\x03SGD\x12\x14\n\x05\x64\x65lta\x18\x1f \x01(\x02:\x05\x31\x65-08\x12\x19\n\ndebug_info\x18\x17 \x01(\x08:\x05\x66\x61lse\x12\"\n\x14snapshot_after_train\x18\x1c \x01(\x08:\x04true\"\x1e\n\nSolverMode\x12\x07\n\x03\x43PU\x10\x00\x12\x07\n\x03GPU\x10\x01\"0\n\nSolverType\x12\x07\n\x03SGD\x10\x00\x12\x0c\n\x08NESTEROV\x10\x01\x12\x0b\n\x07\x41\x44\x41GRAD\x10\x02\"l\n\x0bSolverState\x12\x0c\n\x04iter\x18\x01 \x01(\x05\x12\x13\n\x0blearned_net\x18\x02 \x01(\t\x12!\n\x07history\x18\x03 \x03(\x0b\x32\x10.caffe.BlobProto\x12\x17\n\x0c\x63urrent_step\x18\x04 \x01(\x05:\x01\x30\"N\n\x08NetState\x12!\n\x05phase\x18\x01 \x01(\x0e\x32\x0c.caffe.Phase:\x04TEST\x12\x10\n\x05level\x18\x02 \x01(\x05:\x01\x30\x12\r\n\x05stage\x18\x03 \x03(\t\"s\n\x0cNetStateRule\x12\x1b\n\x05phase\x18\x01 \x01(\x0e\x32\x0c.caffe.Phase\x12\x11\n\tmin_level\x18\x02 \x01(\x05\x12\x11\n\tmax_level\x18\x03 \x01(\x05\x12\r\n\x05stage\x18\x04 \x03(\t\x12\x11\n\tnot_stage\x18\x05 \x03(\t\"\xa3\x01\n\tParamSpec\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x31\n\nshare_mode\x18\x02 \x01(\x0e\x32\x1d.caffe.ParamSpec.DimCheckMode\x12\x12\n\x07lr_mult\x18\x03 \x01(\x02:\x01\x31\x12\x15\n\ndecay_mult\x18\x04 \x01(\x02:\x01\x31\"*\n\x0c\x44imCheckMode\x12\n\n\x06STRICT\x10\x00\x12\x0e\n\nPERMISSIVE\x10\x01\"\xb1\x10\n\x0eLayerParameter\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\t\x12\x0e\n\x06\x62ottom\x18\x03 \x03(\t\x12\x0b\n\x03top\x18\x04 \x03(\t\x12\x1b\n\x05phase\x18\n \x01(\x0e\x32\x0c.caffe.Phase\x12\x13\n\x0bloss_weight\x18\x05 \x03(\x02\x12\x1f\n\x05param\x18\x06 \x03(\x0b\x32\x10.caffe.ParamSpec\x12\x1f\n\x05\x62lobs\x18\x07 \x03(\x0b\x32\x10.caffe.BlobProto\x12\x16\n\x0epropagate_down\x18\x0b \x03(\x08\x12$\n\x07include\x18\x08 \x03(\x0b\x32\x13.caffe.NetStateRule\x12$\n\x07\x65xclude\x18\t \x03(\x0b\x32\x13.caffe.NetStateRule\x12\x37\n\x0ftransform_param\x18\x64 \x01(\x0b\x32\x1e.caffe.TransformationParameter\x12(\n\nloss_param\x18\x65 \x01(\x0b\x32\x14.caffe.LossParameter\x12\x30\n\x0e\x61\x63\x63uracy_param\x18\x66 \x01(\x0b\x32\x18.caffe.AccuracyParameter\x12,\n\x0c\x61rgmax_param\x18g \x01(\x0b\x32\x16.caffe.ArgMaxParameter\x12,\n\x0c\x63oncat_param\x18h \x01(\x0b\x32\x16.caffe.ConcatParameter\x12?\n\x16\x63ontrastive_loss_param\x18i \x01(\x0b\x32\x1f.caffe.ContrastiveLossParameter\x12\x36\n\x11\x63onvolution_param\x18j \x01(\x0b\x32\x1b.caffe.ConvolutionParameter\x12(\n\ndata_param\x18k \x01(\x0b\x32\x14.caffe.DataParameter\x12.\n\rdropout_param\x18l \x01(\x0b\x32\x17.caffe.DropoutParameter\x12\x33\n\x10\x64ummy_data_param\x18m \x01(\x0b\x32\x19.caffe.DummyDataParameter\x12.\n\reltwise_param\x18n \x01(\x0b\x32\x17.caffe.EltwiseParameter\x12&\n\texp_param\x18o \x01(\x0b\x32\x13.caffe.ExpParameter\x12/\n\rflatten_param\x18\x87\x01 \x01(\x0b\x32\x17.caffe.FlattenParameter\x12\x31\n\x0fhdf5_data_param\x18p \x01(\x0b\x32\x18.caffe.HDF5DataParameter\x12\x35\n\x11hdf5_output_param\x18q \x01(\x0b\x32\x1a.caffe.HDF5OutputParameter\x12\x33\n\x10hinge_loss_param\x18r \x01(\x0b\x32\x19.caffe.HingeLossParameter\x12\x33\n\x10image_data_param\x18s \x01(\x0b\x32\x19.caffe.ImageDataParameter\x12\x39\n\x13infogain_loss_param\x18t \x01(\x0b\x32\x1c.caffe.InfogainLossParameter\x12\x39\n\x13inner_product_param\x18u \x01(\x0b\x32\x1c.caffe.InnerProductParameter\x12\'\n\tlog_param\x18\x86\x01 \x01(\x0b\x32\x13.caffe.LogParameter\x12&\n\tlrn_param\x18v \x01(\x0b\x32\x13.caffe.LRNParameter\x12\x35\n\x11memory_data_param\x18w \x01(\x0b\x32\x1a.caffe.MemoryDataParameter\x12&\n\tmvn_param\x18x \x01(\x0b\x32\x13.caffe.MVNParameter\x12.\n\rpooling_param\x18y \x01(\x0b\x32\x17.caffe.PoolingParameter\x12*\n\x0bpower_param\x18z \x01(\x0b\x32\x15.caffe.PowerParameter\x12+\n\x0bprelu_param\x18\x83\x01 \x01(\x0b\x32\x15.caffe.PReLUParameter\x12-\n\x0cpython_param\x18\x82\x01 \x01(\x0b\x32\x16.caffe.PythonParameter\x12\x33\n\x0freduction_param\x18\x88\x01 \x01(\x0b\x32\x19.caffe.ReductionParameter\x12(\n\nrelu_param\x18{ \x01(\x0b\x32\x14.caffe.ReLUParameter\x12/\n\rreshape_param\x18\x85\x01 \x01(\x0b\x32\x17.caffe.ReshapeParameter\x12.\n\rsigmoid_param\x18| \x01(\x0b\x32\x17.caffe.SigmoidParameter\x12.\n\rsoftmax_param\x18} \x01(\x0b\x32\x17.caffe.SoftmaxParameter\x12\'\n\tspp_param\x18\x84\x01 \x01(\x0b\x32\x13.caffe.SPPParameter\x12*\n\x0bslice_param\x18~ \x01(\x0b\x32\x15.caffe.SliceParameter\x12(\n\ntanh_param\x18\x7f \x01(\x0b\x32\x14.caffe.TanHParameter\x12\x33\n\x0fthreshold_param\x18\x80\x01 \x01(\x0b\x32\x19.caffe.ThresholdParameter\x12\x36\n\x11window_data_param\x18\x81\x01 \x01(\x0b\x32\x1a.caffe.WindowDataParameter\"\xb6\x01\n\x17TransformationParameter\x12\x10\n\x05scale\x18\x01 \x01(\x02:\x01\x31\x12\x15\n\x06mirror\x18\x02 \x01(\x08:\x05\x66\x61lse\x12\x14\n\tcrop_size\x18\x03 \x01(\r:\x01\x30\x12\x11\n\tmean_file\x18\x04 \x01(\t\x12\x12\n\nmean_value\x18\x05 \x03(\x02\x12\x1a\n\x0b\x66orce_color\x18\x06 \x01(\x08:\x05\x66\x61lse\x12\x19\n\nforce_gray\x18\x07 \x01(\x08:\x05\x66\x61lse\">\n\rLossParameter\x12\x14\n\x0cignore_label\x18\x01 \x01(\x05\x12\x17\n\tnormalize\x18\x02 \x01(\x08:\x04true\"L\n\x11\x41\x63\x63uracyParameter\x12\x10\n\x05top_k\x18\x01 \x01(\r:\x01\x31\x12\x0f\n\x04\x61xis\x18\x02 \x01(\x05:\x01\x31\x12\x14\n\x0cignore_label\x18\x03 \x01(\x05\"?\n\x0f\x41rgMaxParameter\x12\x1a\n\x0bout_max_val\x18\x01 \x01(\x08:\x05\x66\x61lse\x12\x10\n\x05top_k\x18\x02 \x01(\r:\x01\x31\"9\n\x0f\x43oncatParameter\x12\x0f\n\x04\x61xis\x18\x02 \x01(\x05:\x01\x31\x12\x15\n\nconcat_dim\x18\x01 \x01(\r:\x01\x31\"L\n\x18\x43ontrastiveLossParameter\x12\x11\n\x06margin\x18\x01 \x01(\x02:\x01\x31\x12\x1d\n\x0elegacy_version\x18\x02 \x01(\x08:\x05\x66\x61lse\"\xbf\x03\n\x14\x43onvolutionParameter\x12\x12\n\nnum_output\x18\x01 \x01(\r\x12\x17\n\tbias_term\x18\x02 \x01(\x08:\x04true\x12\x0e\n\x03pad\x18\x03 \x01(\r:\x01\x30\x12\x10\n\x05pad_h\x18\t \x01(\r:\x01\x30\x12\x10\n\x05pad_w\x18\n \x01(\r:\x01\x30\x12\x13\n\x0bkernel_size\x18\x04 \x01(\r\x12\x10\n\x08kernel_h\x18\x0b \x01(\r\x12\x10\n\x08kernel_w\x18\x0c \x01(\r\x12\x10\n\x05group\x18\x05 \x01(\r:\x01\x31\x12\x11\n\x06stride\x18\x06 \x01(\r:\x01\x31\x12\x10\n\x08stride_h\x18\r \x01(\r\x12\x10\n\x08stride_w\x18\x0e \x01(\r\x12-\n\rweight_filler\x18\x07 \x01(\x0b\x32\x16.caffe.FillerParameter\x12+\n\x0b\x62ias_filler\x18\x08 \x01(\x0b\x32\x16.caffe.FillerParameter\x12;\n\x06\x65ngine\x18\x0f \x01(\x0e\x32\".caffe.ConvolutionParameter.Engine:\x07\x44\x45\x46\x41ULT\"+\n\x06\x45ngine\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x12\t\n\x05\x43\x41\x46\x46\x45\x10\x01\x12\t\n\x05\x43UDNN\x10\x02\"\x8f\x02\n\rDataParameter\x12\x0e\n\x06source\x18\x01 \x01(\t\x12\x12\n\nbatch_size\x18\x04 \x01(\r\x12\x14\n\trand_skip\x18\x07 \x01(\r:\x01\x30\x12\x31\n\x07\x62\x61\x63kend\x18\x08 \x01(\x0e\x32\x17.caffe.DataParameter.DB:\x07LEVELDB\x12\x10\n\x05scale\x18\x02 \x01(\x02:\x01\x31\x12\x11\n\tmean_file\x18\x03 \x01(\t\x12\x14\n\tcrop_size\x18\x05 \x01(\r:\x01\x30\x12\x15\n\x06mirror\x18\x06 \x01(\x08:\x05\x66\x61lse\x12\"\n\x13\x66orce_encoded_color\x18\t \x01(\x08:\x05\x66\x61lse\"\x1b\n\x02\x44\x42\x12\x0b\n\x07LEVELDB\x10\x00\x12\x08\n\x04LMDB\x10\x01\".\n\x10\x44ropoutParameter\x12\x1a\n\rdropout_ratio\x18\x01 \x01(\x02:\x03\x30.5\"\xa0\x01\n\x12\x44ummyDataParameter\x12+\n\x0b\x64\x61ta_filler\x18\x01 \x03(\x0b\x32\x16.caffe.FillerParameter\x12\x1f\n\x05shape\x18\x06 \x03(\x0b\x32\x10.caffe.BlobShape\x12\x0b\n\x03num\x18\x02 \x03(\r\x12\x10\n\x08\x63hannels\x18\x03 \x03(\r\x12\x0e\n\x06height\x18\x04 \x03(\r\x12\r\n\x05width\x18\x05 \x03(\r\"\xa5\x01\n\x10\x45ltwiseParameter\x12\x39\n\toperation\x18\x01 \x01(\x0e\x32!.caffe.EltwiseParameter.EltwiseOp:\x03SUM\x12\r\n\x05\x63oeff\x18\x02 \x03(\x02\x12\x1e\n\x10stable_prod_grad\x18\x03 \x01(\x08:\x04true\"\'\n\tEltwiseOp\x12\x08\n\x04PROD\x10\x00\x12\x07\n\x03SUM\x10\x01\x12\x07\n\x03MAX\x10\x02\"D\n\x0c\x45xpParameter\x12\x10\n\x04\x62\x61se\x18\x01 \x01(\x02:\x02-1\x12\x10\n\x05scale\x18\x02 \x01(\x02:\x01\x31\x12\x10\n\x05shift\x18\x03 \x01(\x02:\x01\x30\"9\n\x10\x46lattenParameter\x12\x0f\n\x04\x61xis\x18\x01 \x01(\x05:\x01\x31\x12\x14\n\x08\x65nd_axis\x18\x02 \x01(\x05:\x02-1\"O\n\x11HDF5DataParameter\x12\x0e\n\x06source\x18\x01 \x01(\t\x12\x12\n\nbatch_size\x18\x02 \x01(\r\x12\x16\n\x07shuffle\x18\x03 \x01(\x08:\x05\x66\x61lse\"(\n\x13HDF5OutputParameter\x12\x11\n\tfile_name\x18\x01 \x01(\t\"^\n\x12HingeLossParameter\x12\x30\n\x04norm\x18\x01 \x01(\x0e\x32\x1e.caffe.HingeLossParameter.Norm:\x02L1\"\x16\n\x04Norm\x12\x06\n\x02L1\x10\x01\x12\x06\n\x02L2\x10\x02\"\x94\x02\n\x12ImageDataParameter\x12\x0e\n\x06source\x18\x01 \x01(\t\x12\x12\n\nbatch_size\x18\x04 \x01(\r\x12\x14\n\trand_skip\x18\x07 \x01(\r:\x01\x30\x12\x16\n\x07shuffle\x18\x08 \x01(\x08:\x05\x66\x61lse\x12\x15\n\nnew_height\x18\t \x01(\r:\x01\x30\x12\x14\n\tnew_width\x18\n \x01(\r:\x01\x30\x12\x16\n\x08is_color\x18\x0b \x01(\x08:\x04true\x12\x10\n\x05scale\x18\x02 \x01(\x02:\x01\x31\x12\x11\n\tmean_file\x18\x03 \x01(\t\x12\x14\n\tcrop_size\x18\x05 \x01(\r:\x01\x30\x12\x15\n\x06mirror\x18\x06 \x01(\x08:\x05\x66\x61lse\x12\x15\n\x0broot_folder\x18\x0c \x01(\t:\x00\"\'\n\x15InfogainLossParameter\x12\x0e\n\x06source\x18\x01 \x01(\t\"\xb1\x01\n\x15InnerProductParameter\x12\x12\n\nnum_output\x18\x01 \x01(\r\x12\x17\n\tbias_term\x18\x02 \x01(\x08:\x04true\x12-\n\rweight_filler\x18\x03 \x01(\x0b\x32\x16.caffe.FillerParameter\x12+\n\x0b\x62ias_filler\x18\x04 \x01(\x0b\x32\x16.caffe.FillerParameter\x12\x0f\n\x04\x61xis\x18\x05 \x01(\x05:\x01\x31\"D\n\x0cLogParameter\x12\x10\n\x04\x62\x61se\x18\x01 \x01(\x02:\x02-1\x12\x10\n\x05scale\x18\x02 \x01(\x02:\x01\x31\x12\x10\n\x05shift\x18\x03 \x01(\x02:\x01\x30\"\xd6\x01\n\x0cLRNParameter\x12\x15\n\nlocal_size\x18\x01 \x01(\r:\x01\x35\x12\x10\n\x05\x61lpha\x18\x02 \x01(\x02:\x01\x31\x12\x12\n\x04\x62\x65ta\x18\x03 \x01(\x02:\x04\x30.75\x12\x44\n\x0bnorm_region\x18\x04 \x01(\x0e\x32\x1e.caffe.LRNParameter.NormRegion:\x0f\x41\x43ROSS_CHANNELS\x12\x0c\n\x01k\x18\x05 \x01(\x02:\x01\x31\"5\n\nNormRegion\x12\x13\n\x0f\x41\x43ROSS_CHANNELS\x10\x00\x12\x12\n\x0eWITHIN_CHANNEL\x10\x01\"Z\n\x13MemoryDataParameter\x12\x12\n\nbatch_size\x18\x01 \x01(\r\x12\x10\n\x08\x63hannels\x18\x02 \x01(\r\x12\x0e\n\x06height\x18\x03 \x01(\r\x12\r\n\x05width\x18\x04 \x01(\r\"d\n\x0cMVNParameter\x12 \n\x12normalize_variance\x18\x01 \x01(\x08:\x04true\x12\x1e\n\x0f\x61\x63ross_channels\x18\x02 \x01(\x08:\x05\x66\x61lse\x12\x12\n\x03\x65ps\x18\x03 \x01(\x02:\x05\x31\x65-09\"\xa2\x03\n\x10PoolingParameter\x12\x35\n\x04pool\x18\x01 \x01(\x0e\x32\".caffe.PoolingParameter.PoolMethod:\x03MAX\x12\x0e\n\x03pad\x18\x04 \x01(\r:\x01\x30\x12\x10\n\x05pad_h\x18\t \x01(\r:\x01\x30\x12\x10\n\x05pad_w\x18\n \x01(\r:\x01\x30\x12\x13\n\x0bkernel_size\x18\x02 \x01(\r\x12\x10\n\x08kernel_h\x18\x05 \x01(\r\x12\x10\n\x08kernel_w\x18\x06 \x01(\r\x12\x11\n\x06stride\x18\x03 \x01(\r:\x01\x31\x12\x10\n\x08stride_h\x18\x07 \x01(\r\x12\x10\n\x08stride_w\x18\x08 \x01(\r\x12\x37\n\x06\x65ngine\x18\x0b \x01(\x0e\x32\x1e.caffe.PoolingParameter.Engine:\x07\x44\x45\x46\x41ULT\x12\x1d\n\x0eglobal_pooling\x18\x0c \x01(\x08:\x05\x66\x61lse\".\n\nPoolMethod\x12\x07\n\x03MAX\x10\x00\x12\x07\n\x03\x41VE\x10\x01\x12\x0e\n\nSTOCHASTIC\x10\x02\"+\n\x06\x45ngine\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x12\t\n\x05\x43\x41\x46\x46\x45\x10\x01\x12\t\n\x05\x43UDNN\x10\x02\"F\n\x0ePowerParameter\x12\x10\n\x05power\x18\x01 \x01(\x02:\x01\x31\x12\x10\n\x05scale\x18\x02 \x01(\x02:\x01\x31\x12\x10\n\x05shift\x18\x03 \x01(\x02:\x01\x30\"0\n\x0fPythonParameter\x12\x0e\n\x06module\x18\x01 \x01(\t\x12\r\n\x05layer\x18\x02 \x01(\t\"\xad\x01\n\x12ReductionParameter\x12=\n\toperation\x18\x01 \x01(\x0e\x32%.caffe.ReductionParameter.ReductionOp:\x03SUM\x12\x0f\n\x04\x61xis\x18\x02 \x01(\x05:\x01\x30\x12\x10\n\x05\x63oeff\x18\x03 \x01(\x02:\x01\x31\"5\n\x0bReductionOp\x12\x07\n\x03SUM\x10\x01\x12\x08\n\x04\x41SUM\x10\x02\x12\t\n\x05SUMSQ\x10\x03\x12\x08\n\x04MEAN\x10\x04\"\x8d\x01\n\rReLUParameter\x12\x19\n\x0enegative_slope\x18\x01 \x01(\x02:\x01\x30\x12\x34\n\x06\x65ngine\x18\x02 \x01(\x0e\x32\x1b.caffe.ReLUParameter.Engine:\x07\x44\x45\x46\x41ULT\"+\n\x06\x45ngine\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x12\t\n\x05\x43\x41\x46\x46\x45\x10\x01\x12\t\n\x05\x43UDNN\x10\x02\"Z\n\x10ReshapeParameter\x12\x1f\n\x05shape\x18\x01 \x01(\x0b\x32\x10.caffe.BlobShape\x12\x0f\n\x04\x61xis\x18\x02 \x01(\x05:\x01\x30\x12\x14\n\x08num_axes\x18\x03 \x01(\x05:\x02-1\"x\n\x10SigmoidParameter\x12\x37\n\x06\x65ngine\x18\x01 \x01(\x0e\x32\x1e.caffe.SigmoidParameter.Engine:\x07\x44\x45\x46\x41ULT\"+\n\x06\x45ngine\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x12\t\n\x05\x43\x41\x46\x46\x45\x10\x01\x12\t\n\x05\x43UDNN\x10\x02\"L\n\x0eSliceParameter\x12\x0f\n\x04\x61xis\x18\x03 \x01(\x05:\x01\x31\x12\x13\n\x0bslice_point\x18\x02 \x03(\r\x12\x14\n\tslice_dim\x18\x01 \x01(\r:\x01\x31\"\x89\x01\n\x10SoftmaxParameter\x12\x37\n\x06\x65ngine\x18\x01 \x01(\x0e\x32\x1e.caffe.SoftmaxParameter.Engine:\x07\x44\x45\x46\x41ULT\x12\x0f\n\x04\x61xis\x18\x02 \x01(\x05:\x01\x31\"+\n\x06\x45ngine\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x12\t\n\x05\x43\x41\x46\x46\x45\x10\x01\x12\t\n\x05\x43UDNN\x10\x02\"r\n\rTanHParameter\x12\x34\n\x06\x65ngine\x18\x01 \x01(\x0e\x32\x1b.caffe.TanHParameter.Engine:\x07\x44\x45\x46\x41ULT\"+\n\x06\x45ngine\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x12\t\n\x05\x43\x41\x46\x46\x45\x10\x01\x12\t\n\x05\x43UDNN\x10\x02\"*\n\x12ThresholdParameter\x12\x14\n\tthreshold\x18\x01 \x01(\x02:\x01\x30\"\xc1\x02\n\x13WindowDataParameter\x12\x0e\n\x06source\x18\x01 \x01(\t\x12\x10\n\x05scale\x18\x02 \x01(\x02:\x01\x31\x12\x11\n\tmean_file\x18\x03 \x01(\t\x12\x12\n\nbatch_size\x18\x04 \x01(\r\x12\x14\n\tcrop_size\x18\x05 \x01(\r:\x01\x30\x12\x15\n\x06mirror\x18\x06 \x01(\x08:\x05\x66\x61lse\x12\x19\n\x0c\x66g_threshold\x18\x07 \x01(\x02:\x03\x30.5\x12\x19\n\x0c\x62g_threshold\x18\x08 \x01(\x02:\x03\x30.5\x12\x19\n\x0b\x66g_fraction\x18\t \x01(\x02:\x04\x30.25\x12\x16\n\x0b\x63ontext_pad\x18\n \x01(\r:\x01\x30\x12\x17\n\tcrop_mode\x18\x0b \x01(\t:\x04warp\x12\x1b\n\x0c\x63\x61\x63he_images\x18\x0c \x01(\x08:\x05\x66\x61lse\x12\x15\n\x0broot_folder\x18\r \x01(\t:\x00\"\xeb\x01\n\x0cSPPParameter\x12\x16\n\x0epyramid_height\x18\x01 \x01(\r\x12\x31\n\x04pool\x18\x02 \x01(\x0e\x32\x1e.caffe.SPPParameter.PoolMethod:\x03MAX\x12\x33\n\x06\x65ngine\x18\x06 \x01(\x0e\x32\x1a.caffe.SPPParameter.Engine:\x07\x44\x45\x46\x41ULT\".\n\nPoolMethod\x12\x07\n\x03MAX\x10\x00\x12\x07\n\x03\x41VE\x10\x01\x12\x0e\n\nSTOCHASTIC\x10\x02\"+\n\x06\x45ngine\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x12\t\n\x05\x43\x41\x46\x46\x45\x10\x01\x12\t\n\x05\x43UDNN\x10\x02\"\xe0\x13\n\x10V1LayerParameter\x12\x0e\n\x06\x62ottom\x18\x02 \x03(\t\x12\x0b\n\x03top\x18\x03 \x03(\t\x12\x0c\n\x04name\x18\x04 \x01(\t\x12$\n\x07include\x18 \x03(\x0b\x32\x13.caffe.NetStateRule\x12$\n\x07\x65xclude\x18! \x03(\x0b\x32\x13.caffe.NetStateRule\x12/\n\x04type\x18\x05 \x01(\x0e\x32!.caffe.V1LayerParameter.LayerType\x12\x1f\n\x05\x62lobs\x18\x06 \x03(\x0b\x32\x10.caffe.BlobProto\x12\x0e\n\x05param\x18\xe9\x07 \x03(\t\x12>\n\x0f\x62lob_share_mode\x18\xea\x07 \x03(\x0e\x32$.caffe.V1LayerParameter.DimCheckMode\x12\x10\n\x08\x62lobs_lr\x18\x07 \x03(\x02\x12\x14\n\x0cweight_decay\x18\x08 \x03(\x02\x12\x13\n\x0bloss_weight\x18# \x03(\x02\x12\x30\n\x0e\x61\x63\x63uracy_param\x18\x1b \x01(\x0b\x32\x18.caffe.AccuracyParameter\x12,\n\x0c\x61rgmax_param\x18\x17 \x01(\x0b\x32\x16.caffe.ArgMaxParameter\x12,\n\x0c\x63oncat_param\x18\t \x01(\x0b\x32\x16.caffe.ConcatParameter\x12?\n\x16\x63ontrastive_loss_param\x18( \x01(\x0b\x32\x1f.caffe.ContrastiveLossParameter\x12\x36\n\x11\x63onvolution_param\x18\n \x01(\x0b\x32\x1b.caffe.ConvolutionParameter\x12(\n\ndata_param\x18\x0b \x01(\x0b\x32\x14.caffe.DataParameter\x12.\n\rdropout_param\x18\x0c \x01(\x0b\x32\x17.caffe.DropoutParameter\x12\x33\n\x10\x64ummy_data_param\x18\x1a \x01(\x0b\x32\x19.caffe.DummyDataParameter\x12.\n\reltwise_param\x18\x18 \x01(\x0b\x32\x17.caffe.EltwiseParameter\x12&\n\texp_param\x18) \x01(\x0b\x32\x13.caffe.ExpParameter\x12\x31\n\x0fhdf5_data_param\x18\r \x01(\x0b\x32\x18.caffe.HDF5DataParameter\x12\x35\n\x11hdf5_output_param\x18\x0e \x01(\x0b\x32\x1a.caffe.HDF5OutputParameter\x12\x33\n\x10hinge_loss_param\x18\x1d \x01(\x0b\x32\x19.caffe.HingeLossParameter\x12\x33\n\x10image_data_param\x18\x0f \x01(\x0b\x32\x19.caffe.ImageDataParameter\x12\x39\n\x13infogain_loss_param\x18\x10 \x01(\x0b\x32\x1c.caffe.InfogainLossParameter\x12\x39\n\x13inner_product_param\x18\x11 \x01(\x0b\x32\x1c.caffe.InnerProductParameter\x12&\n\tlrn_param\x18\x12 \x01(\x0b\x32\x13.caffe.LRNParameter\x12\x35\n\x11memory_data_param\x18\x16 \x01(\x0b\x32\x1a.caffe.MemoryDataParameter\x12&\n\tmvn_param\x18\" \x01(\x0b\x32\x13.caffe.MVNParameter\x12.\n\rpooling_param\x18\x13 \x01(\x0b\x32\x17.caffe.PoolingParameter\x12*\n\x0bpower_param\x18\x15 \x01(\x0b\x32\x15.caffe.PowerParameter\x12(\n\nrelu_param\x18\x1e \x01(\x0b\x32\x14.caffe.ReLUParameter\x12.\n\rsigmoid_param\x18& \x01(\x0b\x32\x17.caffe.SigmoidParameter\x12.\n\rsoftmax_param\x18\' \x01(\x0b\x32\x17.caffe.SoftmaxParameter\x12*\n\x0bslice_param\x18\x1f \x01(\x0b\x32\x15.caffe.SliceParameter\x12(\n\ntanh_param\x18% \x01(\x0b\x32\x14.caffe.TanHParameter\x12\x32\n\x0fthreshold_param\x18\x19 \x01(\x0b\x32\x19.caffe.ThresholdParameter\x12\x35\n\x11window_data_param\x18\x14 \x01(\x0b\x32\x1a.caffe.WindowDataParameter\x12\x37\n\x0ftransform_param\x18$ \x01(\x0b\x32\x1e.caffe.TransformationParameter\x12(\n\nloss_param\x18* \x01(\x0b\x32\x14.caffe.LossParameter\x12&\n\x05layer\x18\x01 \x01(\x0b\x32\x17.caffe.V0LayerParameter\"\xd8\x04\n\tLayerType\x12\x08\n\x04NONE\x10\x00\x12\n\n\x06\x41\x42SVAL\x10#\x12\x0c\n\x08\x41\x43\x43URACY\x10\x01\x12\n\n\x06\x41RGMAX\x10\x1e\x12\x08\n\x04\x42NLL\x10\x02\x12\n\n\x06\x43ONCAT\x10\x03\x12\x14\n\x10\x43ONTRASTIVE_LOSS\x10%\x12\x0f\n\x0b\x43ONVOLUTION\x10\x04\x12\x08\n\x04\x44\x41TA\x10\x05\x12\x11\n\rDECONVOLUTION\x10\'\x12\x0b\n\x07\x44ROPOUT\x10\x06\x12\x0e\n\nDUMMY_DATA\x10 \x12\x12\n\x0e\x45UCLIDEAN_LOSS\x10\x07\x12\x0b\n\x07\x45LTWISE\x10\x19\x12\x07\n\x03\x45XP\x10&\x12\x0b\n\x07\x46LATTEN\x10\x08\x12\r\n\tHDF5_DATA\x10\t\x12\x0f\n\x0bHDF5_OUTPUT\x10\n\x12\x0e\n\nHINGE_LOSS\x10\x1c\x12\n\n\x06IM2COL\x10\x0b\x12\x0e\n\nIMAGE_DATA\x10\x0c\x12\x11\n\rINFOGAIN_LOSS\x10\r\x12\x11\n\rINNER_PRODUCT\x10\x0e\x12\x07\n\x03LRN\x10\x0f\x12\x0f\n\x0bMEMORY_DATA\x10\x1d\x12\x1d\n\x19MULTINOMIAL_LOGISTIC_LOSS\x10\x10\x12\x07\n\x03MVN\x10\"\x12\x0b\n\x07POOLING\x10\x11\x12\t\n\x05POWER\x10\x1a\x12\x08\n\x04RELU\x10\x12\x12\x0b\n\x07SIGMOID\x10\x13\x12\x1e\n\x1aSIGMOID_CROSS_ENTROPY_LOSS\x10\x1b\x12\x0b\n\x07SILENCE\x10$\x12\x0b\n\x07SOFTMAX\x10\x14\x12\x10\n\x0cSOFTMAX_LOSS\x10\x15\x12\t\n\x05SPLIT\x10\x16\x12\t\n\x05SLICE\x10!\x12\x08\n\x04TANH\x10\x17\x12\x0f\n\x0bWINDOW_DATA\x10\x18\x12\r\n\tTHRESHOLD\x10\x1f\"*\n\x0c\x44imCheckMode\x12\n\n\x06STRICT\x10\x00\x12\x0e\n\nPERMISSIVE\x10\x01\"\xfd\x07\n\x10V0LayerParameter\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\t\x12\x12\n\nnum_output\x18\x03 \x01(\r\x12\x16\n\x08\x62iasterm\x18\x04 \x01(\x08:\x04true\x12-\n\rweight_filler\x18\x05 \x01(\x0b\x32\x16.caffe.FillerParameter\x12+\n\x0b\x62ias_filler\x18\x06 \x01(\x0b\x32\x16.caffe.FillerParameter\x12\x0e\n\x03pad\x18\x07 \x01(\r:\x01\x30\x12\x12\n\nkernelsize\x18\x08 \x01(\r\x12\x10\n\x05group\x18\t \x01(\r:\x01\x31\x12\x11\n\x06stride\x18\n \x01(\r:\x01\x31\x12\x35\n\x04pool\x18\x0b \x01(\x0e\x32\".caffe.V0LayerParameter.PoolMethod:\x03MAX\x12\x1a\n\rdropout_ratio\x18\x0c \x01(\x02:\x03\x30.5\x12\x15\n\nlocal_size\x18\r \x01(\r:\x01\x35\x12\x10\n\x05\x61lpha\x18\x0e \x01(\x02:\x01\x31\x12\x12\n\x04\x62\x65ta\x18\x0f \x01(\x02:\x04\x30.75\x12\x0c\n\x01k\x18\x16 \x01(\x02:\x01\x31\x12\x0e\n\x06source\x18\x10 \x01(\t\x12\x10\n\x05scale\x18\x11 \x01(\x02:\x01\x31\x12\x10\n\x08meanfile\x18\x12 \x01(\t\x12\x11\n\tbatchsize\x18\x13 \x01(\r\x12\x13\n\x08\x63ropsize\x18\x14 \x01(\r:\x01\x30\x12\x15\n\x06mirror\x18\x15 \x01(\x08:\x05\x66\x61lse\x12\x1f\n\x05\x62lobs\x18\x32 \x03(\x0b\x32\x10.caffe.BlobProto\x12\x10\n\x08\x62lobs_lr\x18\x33 \x03(\x02\x12\x14\n\x0cweight_decay\x18\x34 \x03(\x02\x12\x14\n\trand_skip\x18\x35 \x01(\r:\x01\x30\x12\x1d\n\x10\x64\x65t_fg_threshold\x18\x36 \x01(\x02:\x03\x30.5\x12\x1d\n\x10\x64\x65t_bg_threshold\x18\x37 \x01(\x02:\x03\x30.5\x12\x1d\n\x0f\x64\x65t_fg_fraction\x18\x38 \x01(\x02:\x04\x30.25\x12\x1a\n\x0f\x64\x65t_context_pad\x18: \x01(\r:\x01\x30\x12\x1b\n\rdet_crop_mode\x18; \x01(\t:\x04warp\x12\x12\n\x07new_num\x18< \x01(\x05:\x01\x30\x12\x17\n\x0cnew_channels\x18= \x01(\x05:\x01\x30\x12\x15\n\nnew_height\x18> \x01(\x05:\x01\x30\x12\x14\n\tnew_width\x18? \x01(\x05:\x01\x30\x12\x1d\n\x0eshuffle_images\x18@ \x01(\x08:\x05\x66\x61lse\x12\x15\n\nconcat_dim\x18\x41 \x01(\r:\x01\x31\x12\x36\n\x11hdf5_output_param\x18\xe9\x07 \x01(\x0b\x32\x1a.caffe.HDF5OutputParameter\".\n\nPoolMethod\x12\x07\n\x03MAX\x10\x00\x12\x07\n\x03\x41VE\x10\x01\x12\x0e\n\nSTOCHASTIC\x10\x02\"W\n\x0ePReLUParameter\x12&\n\x06\x66iller\x18\x01 \x01(\x0b\x32\x16.caffe.FillerParameter\x12\x1d\n\x0e\x63hannel_shared\x18\x02 \x01(\x08:\x05\x66\x61lse*\x1c\n\x05Phase\x12\t\n\x05TRAIN\x10\x00\x12\x08\n\x04TEST\x10\x01') _PHASE = _descriptor.EnumDescriptor( name='Phase', full_name='caffe.Phase', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='TRAIN', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='TEST', index=1, number=1, options=None, type=None), ], containing_type=None, options=None, serialized_start=13218, serialized_end=13246, ) Phase = enum_type_wrapper.EnumTypeWrapper(_PHASE) TRAIN = 0 TEST = 1 _FILLERPARAMETER_VARIANCENORM = _descriptor.EnumDescriptor( name='VarianceNorm', full_name='caffe.FillerParameter.VarianceNorm', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='FAN_IN', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='FAN_OUT', index=1, number=1, options=None, type=None), _descriptor.EnumValueDescriptor( name='AVERAGE', index=2, number=2, options=None, type=None), ], containing_type=None, options=None, serialized_start=608, serialized_end=660, ) _SOLVERPARAMETER_SOLVERMODE = _descriptor.EnumDescriptor( name='SolverMode', full_name='caffe.SolverParameter.SolverMode', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='CPU', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='GPU', index=1, number=1, options=None, type=None), ], containing_type=None, options=None, serialized_start=1941, serialized_end=1971, ) _SOLVERPARAMETER_SOLVERTYPE = _descriptor.EnumDescriptor( name='SolverType', full_name='caffe.SolverParameter.SolverType', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='SGD', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='NESTEROV', index=1, number=1, options=None, type=None), _descriptor.EnumValueDescriptor( name='ADAGRAD', index=2, number=2, options=None, type=None), ], containing_type=None, options=None, serialized_start=1973, serialized_end=2021, ) _PARAMSPEC_DIMCHECKMODE = _descriptor.EnumDescriptor( name='DimCheckMode', full_name='caffe.ParamSpec.DimCheckMode', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='STRICT', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='PERMISSIVE', index=1, number=1, options=None, type=None), ], containing_type=None, options=None, serialized_start=2452, serialized_end=2494, ) _CONVOLUTIONPARAMETER_ENGINE = _descriptor.EnumDescriptor( name='Engine', full_name='caffe.ConvolutionParameter.Engine', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='DEFAULT', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='CAFFE', index=1, number=1, options=None, type=None), _descriptor.EnumValueDescriptor( name='CUDNN', index=2, number=2, options=None, type=None), ], containing_type=None, options=None, serialized_start=5530, serialized_end=5573, ) _DATAPARAMETER_DB = _descriptor.EnumDescriptor( name='DB', full_name='caffe.DataParameter.DB', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='LEVELDB', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='LMDB', index=1, number=1, options=None, type=None), ], containing_type=None, options=None, serialized_start=5820, serialized_end=5847, ) _ELTWISEPARAMETER_ELTWISEOP = _descriptor.EnumDescriptor( name='EltwiseOp', full_name='caffe.EltwiseParameter.EltwiseOp', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='PROD', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='SUM', index=1, number=1, options=None, type=None), _descriptor.EnumValueDescriptor( name='MAX', index=2, number=2, options=None, type=None), ], containing_type=None, options=None, serialized_start=6187, serialized_end=6226, ) _HINGELOSSPARAMETER_NORM = _descriptor.EnumDescriptor( name='Norm', full_name='caffe.HingeLossParameter.Norm', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='L1', index=0, number=1, options=None, type=None), _descriptor.EnumValueDescriptor( name='L2', index=1, number=2, options=None, type=None), ], containing_type=None, options=None, serialized_start=6552, serialized_end=6574, ) _LRNPARAMETER_NORMREGION = _descriptor.EnumDescriptor( name='NormRegion', full_name='caffe.LRNParameter.NormRegion', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='ACROSS_CHANNELS', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='WITHIN_CHANNEL', index=1, number=1, options=None, type=None), ], containing_type=None, options=None, serialized_start=7308, serialized_end=7361, ) _POOLINGPARAMETER_POOLMETHOD = _descriptor.EnumDescriptor( name='PoolMethod', full_name='caffe.PoolingParameter.PoolMethod', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='MAX', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='AVE', index=1, number=1, options=None, type=None), _descriptor.EnumValueDescriptor( name='STOCHASTIC', index=2, number=2, options=None, type=None), ], containing_type=None, options=None, serialized_start=7885, serialized_end=7931, ) _POOLINGPARAMETER_ENGINE = _descriptor.EnumDescriptor( name='Engine', full_name='caffe.PoolingParameter.Engine', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='DEFAULT', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='CAFFE', index=1, number=1, options=None, type=None), _descriptor.EnumValueDescriptor( name='CUDNN', index=2, number=2, options=None, type=None), ], containing_type=None, options=None, serialized_start=5530, serialized_end=5573, ) _REDUCTIONPARAMETER_REDUCTIONOP = _descriptor.EnumDescriptor( name='ReductionOp', full_name='caffe.ReductionParameter.ReductionOp', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='SUM', index=0, number=1, options=None, type=None), _descriptor.EnumValueDescriptor( name='ASUM', index=1, number=2, options=None, type=None), _descriptor.EnumValueDescriptor( name='SUMSQ', index=2, number=3, options=None, type=None), _descriptor.EnumValueDescriptor( name='MEAN', index=3, number=4, options=None, type=None), ], containing_type=None, options=None, serialized_start=8221, serialized_end=8274, ) _RELUPARAMETER_ENGINE = _descriptor.EnumDescriptor( name='Engine', full_name='caffe.ReLUParameter.Engine', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='DEFAULT', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='CAFFE', index=1, number=1, options=None, type=None), _descriptor.EnumValueDescriptor( name='CUDNN', index=2, number=2, options=None, type=None), ], containing_type=None, options=None, serialized_start=5530, serialized_end=5573, ) _SIGMOIDPARAMETER_ENGINE = _descriptor.EnumDescriptor( name='Engine', full_name='caffe.SigmoidParameter.Engine', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='DEFAULT', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='CAFFE', index=1, number=1, options=None, type=None), _descriptor.EnumValueDescriptor( name='CUDNN', index=2, number=2, options=None, type=None), ], containing_type=None, options=None, serialized_start=5530, serialized_end=5573, ) _SOFTMAXPARAMETER_ENGINE = _descriptor.EnumDescriptor( name='Engine', full_name='caffe.SoftmaxParameter.Engine', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='DEFAULT', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='CAFFE', index=1, number=1, options=None, type=None), _descriptor.EnumValueDescriptor( name='CUDNN', index=2, number=2, options=None, type=None), ], containing_type=None, options=None, serialized_start=5530, serialized_end=5573, ) _TANHPARAMETER_ENGINE = _descriptor.EnumDescriptor( name='Engine', full_name='caffe.TanHParameter.Engine', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='DEFAULT', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='CAFFE', index=1, number=1, options=None, type=None), _descriptor.EnumValueDescriptor( name='CUDNN', index=2, number=2, options=None, type=None), ], containing_type=None, options=None, serialized_start=5530, serialized_end=5573, ) _SPPPARAMETER_POOLMETHOD = _descriptor.EnumDescriptor( name='PoolMethod', full_name='caffe.SPPParameter.PoolMethod', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='MAX', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='AVE', index=1, number=1, options=None, type=None), _descriptor.EnumValueDescriptor( name='STOCHASTIC', index=2, number=2, options=None, type=None), ], containing_type=None, options=None, serialized_start=7885, serialized_end=7931, ) _SPPPARAMETER_ENGINE = _descriptor.EnumDescriptor( name='Engine', full_name='caffe.SPPParameter.Engine', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='DEFAULT', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='CAFFE', index=1, number=1, options=None, type=None), _descriptor.EnumValueDescriptor( name='CUDNN', index=2, number=2, options=None, type=None), ], containing_type=None, options=None, serialized_start=5530, serialized_end=5573, ) _V1LAYERPARAMETER_LAYERTYPE = _descriptor.EnumDescriptor( name='LayerType', full_name='caffe.V1LayerParameter.LayerType', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='NONE', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='ABSVAL', index=1, number=35, options=None, type=None), _descriptor.EnumValueDescriptor( name='ACCURACY', index=2, number=1, options=None, type=None), _descriptor.EnumValueDescriptor( name='ARGMAX', index=3, number=30, options=None, type=None), _descriptor.EnumValueDescriptor( name='BNLL', index=4, number=2, options=None, type=None), _descriptor.EnumValueDescriptor( name='CONCAT', index=5, number=3, options=None, type=None), _descriptor.EnumValueDescriptor( name='CONTRASTIVE_LOSS', index=6, number=37, options=None, type=None), _descriptor.EnumValueDescriptor( name='CONVOLUTION', index=7, number=4, options=None, type=None), _descriptor.EnumValueDescriptor( name='DATA', index=8, number=5, options=None, type=None), _descriptor.EnumValueDescriptor( name='DECONVOLUTION', index=9, number=39, options=None, type=None), _descriptor.EnumValueDescriptor( name='DROPOUT', index=10, number=6, options=None, type=None), _descriptor.EnumValueDescriptor( name='DUMMY_DATA', index=11, number=32, options=None, type=None), _descriptor.EnumValueDescriptor( name='EUCLIDEAN_LOSS', index=12, number=7, options=None, type=None), _descriptor.EnumValueDescriptor( name='ELTWISE', index=13, number=25, options=None, type=None), _descriptor.EnumValueDescriptor( name='EXP', index=14, number=38, options=None, type=None), _descriptor.EnumValueDescriptor( name='FLATTEN', index=15, number=8, options=None, type=None), _descriptor.EnumValueDescriptor( name='HDF5_DATA', index=16, number=9, options=None, type=None), _descriptor.EnumValueDescriptor( name='HDF5_OUTPUT', index=17, number=10, options=None, type=None), _descriptor.EnumValueDescriptor( name='HINGE_LOSS', index=18, number=28, options=None, type=None), _descriptor.EnumValueDescriptor( name='IM2COL', index=19, number=11, options=None, type=None), _descriptor.EnumValueDescriptor( name='IMAGE_DATA', index=20, number=12, options=None, type=None), _descriptor.EnumValueDescriptor( name='INFOGAIN_LOSS', index=21, number=13, options=None, type=None), _descriptor.EnumValueDescriptor( name='INNER_PRODUCT', index=22, number=14, options=None, type=None), _descriptor.EnumValueDescriptor( name='LRN', index=23, number=15, options=None, type=None), _descriptor.EnumValueDescriptor( name='MEMORY_DATA', index=24, number=29, options=None, type=None), _descriptor.EnumValueDescriptor( name='MULTINOMIAL_LOGISTIC_LOSS', index=25, number=16, options=None, type=None), _descriptor.EnumValueDescriptor( name='MVN', index=26, number=34, options=None, type=None), _descriptor.EnumValueDescriptor( name='POOLING', index=27, number=17, options=None, type=None), _descriptor.EnumValueDescriptor( name='POWER', index=28, number=26, options=None, type=None), _descriptor.EnumValueDescriptor( name='RELU', index=29, number=18, options=None, type=None), _descriptor.EnumValueDescriptor( name='SIGMOID', index=30, number=19, options=None, type=None), _descriptor.EnumValueDescriptor( name='SIGMOID_CROSS_ENTROPY_LOSS', index=31, number=27, options=None, type=None), _descriptor.EnumValueDescriptor( name='SILENCE', index=32, number=36, options=None, type=None), _descriptor.EnumValueDescriptor( name='SOFTMAX', index=33, number=20, options=None, type=None), _descriptor.EnumValueDescriptor( name='SOFTMAX_LOSS', index=34, number=21, options=None, type=None), _descriptor.EnumValueDescriptor( name='SPLIT', index=35, number=22, options=None, type=None), _descriptor.EnumValueDescriptor( name='SLICE', index=36, number=33, options=None, type=None), _descriptor.EnumValueDescriptor( name='TANH', index=37, number=23, options=None, type=None), _descriptor.EnumValueDescriptor( name='WINDOW_DATA', index=38, number=24, options=None, type=None), _descriptor.EnumValueDescriptor( name='THRESHOLD', index=39, number=31, options=None, type=None), ], containing_type=None, options=None, serialized_start=11459, serialized_end=12059, ) _V1LAYERPARAMETER_DIMCHECKMODE = _descriptor.EnumDescriptor( name='DimCheckMode', full_name='caffe.V1LayerParameter.DimCheckMode', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='STRICT', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='PERMISSIVE', index=1, number=1, options=None, type=None), ], containing_type=None, options=None, serialized_start=2452, serialized_end=2494, ) _V0LAYERPARAMETER_POOLMETHOD = _descriptor.EnumDescriptor( name='PoolMethod', full_name='caffe.V0LayerParameter.PoolMethod', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='MAX', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='AVE', index=1, number=1, options=None, type=None), _descriptor.EnumValueDescriptor( name='STOCHASTIC', index=2, number=2, options=None, type=None), ], containing_type=None, options=None, serialized_start=7885, serialized_end=7931, ) _BLOBSHAPE = _descriptor.Descriptor( name='BlobShape', full_name='caffe.BlobShape', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='dim', full_name='caffe.BlobShape.dim', index=0, number=1, type=3, cpp_type=2, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), '\020\001')), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=22, serialized_end=50, ) _BLOBPROTO = _descriptor.Descriptor( name='BlobProto', full_name='caffe.BlobProto', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='shape', full_name='caffe.BlobProto.shape', index=0, number=7, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='data', full_name='caffe.BlobProto.data', index=1, number=5, type=2, cpp_type=6, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), '\020\001')), _descriptor.FieldDescriptor( name='diff', full_name='caffe.BlobProto.diff', index=2, number=6, type=2, cpp_type=6, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), '\020\001')), _descriptor.FieldDescriptor( name='num', full_name='caffe.BlobProto.num', index=3, number=1, type=5, cpp_type=1, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='channels', full_name='caffe.BlobProto.channels', index=4, number=2, type=5, cpp_type=1, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='height', full_name='caffe.BlobProto.height', index=5, number=3, type=5, cpp_type=1, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='width', full_name='caffe.BlobProto.width', index=6, number=4, type=5, cpp_type=1, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=53, serialized_end=207, ) _BLOBPROTOVECTOR = _descriptor.Descriptor( name='BlobProtoVector', full_name='caffe.BlobProtoVector', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='blobs', full_name='caffe.BlobProtoVector.blobs', index=0, number=1, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=209, serialized_end=259, ) _DATUM = _descriptor.Descriptor( name='Datum', full_name='caffe.Datum', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='channels', full_name='caffe.Datum.channels', index=0, number=1, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='height', full_name='caffe.Datum.height', index=1, number=2, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='width', full_name='caffe.Datum.width', index=2, number=3, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='data', full_name='caffe.Datum.data', index=3, number=4, type=12, cpp_type=9, label=1, has_default_value=False, default_value="", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='label', full_name='caffe.Datum.label', index=4, number=5, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='float_data', full_name='caffe.Datum.float_data', index=5, number=6, type=2, cpp_type=6, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='encoded', full_name='caffe.Datum.encoded', index=6, number=7, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=262, serialized_end=391, ) _FILLERPARAMETER = _descriptor.Descriptor( name='FillerParameter', full_name='caffe.FillerParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='type', full_name='caffe.FillerParameter.type', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=True, default_value=unicode("constant", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='value', full_name='caffe.FillerParameter.value', index=1, number=2, type=2, cpp_type=6, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='min', full_name='caffe.FillerParameter.min', index=2, number=3, type=2, cpp_type=6, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='max', full_name='caffe.FillerParameter.max', index=3, number=4, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='mean', full_name='caffe.FillerParameter.mean', index=4, number=5, type=2, cpp_type=6, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='std', full_name='caffe.FillerParameter.std', index=5, number=6, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='sparse', full_name='caffe.FillerParameter.sparse', index=6, number=7, type=5, cpp_type=1, label=1, has_default_value=True, default_value=-1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='variance_norm', full_name='caffe.FillerParameter.variance_norm', index=7, number=8, type=14, cpp_type=8, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ _FILLERPARAMETER_VARIANCENORM, ], options=None, is_extendable=False, extension_ranges=[], serialized_start=394, serialized_end=660, ) _NETPARAMETER = _descriptor.Descriptor( name='NetParameter', full_name='caffe.NetParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='name', full_name='caffe.NetParameter.name', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='input', full_name='caffe.NetParameter.input', index=1, number=3, type=9, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='input_shape', full_name='caffe.NetParameter.input_shape', index=2, number=8, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='input_dim', full_name='caffe.NetParameter.input_dim', index=3, number=4, type=5, cpp_type=1, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='force_backward', full_name='caffe.NetParameter.force_backward', index=4, number=5, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='state', full_name='caffe.NetParameter.state', index=5, number=6, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='debug_info', full_name='caffe.NetParameter.debug_info', index=6, number=7, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='layer', full_name='caffe.NetParameter.layer', index=7, number=100, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='layers', full_name='caffe.NetParameter.layers', index=8, number=2, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=663, serialized_end=933, ) _SOLVERPARAMETER = _descriptor.Descriptor( name='SolverParameter', full_name='caffe.SolverParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='net', full_name='caffe.SolverParameter.net', index=0, number=24, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='net_param', full_name='caffe.SolverParameter.net_param', index=1, number=25, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='train_net', full_name='caffe.SolverParameter.train_net', index=2, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='test_net', full_name='caffe.SolverParameter.test_net', index=3, number=2, type=9, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='train_net_param', full_name='caffe.SolverParameter.train_net_param', index=4, number=21, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='test_net_param', full_name='caffe.SolverParameter.test_net_param', index=5, number=22, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='train_state', full_name='caffe.SolverParameter.train_state', index=6, number=26, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='test_state', full_name='caffe.SolverParameter.test_state', index=7, number=27, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='test_iter', full_name='caffe.SolverParameter.test_iter', index=8, number=3, type=5, cpp_type=1, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='test_interval', full_name='caffe.SolverParameter.test_interval', index=9, number=4, type=5, cpp_type=1, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='test_compute_loss', full_name='caffe.SolverParameter.test_compute_loss', index=10, number=19, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='test_initialization', full_name='caffe.SolverParameter.test_initialization', index=11, number=32, type=8, cpp_type=7, label=1, has_default_value=True, default_value=True, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='base_lr', full_name='caffe.SolverParameter.base_lr', index=12, number=5, type=2, cpp_type=6, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='display', full_name='caffe.SolverParameter.display', index=13, number=6, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='average_loss', full_name='caffe.SolverParameter.average_loss', index=14, number=33, type=5, cpp_type=1, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='max_iter', full_name='caffe.SolverParameter.max_iter', index=15, number=7, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='iter_size', full_name='caffe.SolverParameter.iter_size', index=16, number=36, type=5, cpp_type=1, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='lr_policy', full_name='caffe.SolverParameter.lr_policy', index=17, number=8, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='gamma', full_name='caffe.SolverParameter.gamma', index=18, number=9, type=2, cpp_type=6, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='power', full_name='caffe.SolverParameter.power', index=19, number=10, type=2, cpp_type=6, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='momentum', full_name='caffe.SolverParameter.momentum', index=20, number=11, type=2, cpp_type=6, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='weight_decay', full_name='caffe.SolverParameter.weight_decay', index=21, number=12, type=2, cpp_type=6, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='regularization_type', full_name='caffe.SolverParameter.regularization_type', index=22, number=29, type=9, cpp_type=9, label=1, has_default_value=True, default_value=unicode("L2", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='stepsize', full_name='caffe.SolverParameter.stepsize', index=23, number=13, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='stepvalue', full_name='caffe.SolverParameter.stepvalue', index=24, number=34, type=5, cpp_type=1, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='clip_gradients', full_name='caffe.SolverParameter.clip_gradients', index=25, number=35, type=2, cpp_type=6, label=1, has_default_value=True, default_value=-1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='snapshot', full_name='caffe.SolverParameter.snapshot', index=26, number=14, type=5, cpp_type=1, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='snapshot_prefix', full_name='caffe.SolverParameter.snapshot_prefix', index=27, number=15, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='snapshot_diff', full_name='caffe.SolverParameter.snapshot_diff', index=28, number=16, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='solver_mode', full_name='caffe.SolverParameter.solver_mode', index=29, number=17, type=14, cpp_type=8, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='device_id', full_name='caffe.SolverParameter.device_id', index=30, number=18, type=5, cpp_type=1, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='random_seed', full_name='caffe.SolverParameter.random_seed', index=31, number=20, type=3, cpp_type=2, label=1, has_default_value=True, default_value=-1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='solver_type', full_name='caffe.SolverParameter.solver_type', index=32, number=30, type=14, cpp_type=8, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='delta', full_name='caffe.SolverParameter.delta', index=33, number=31, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1e-08, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='debug_info', full_name='caffe.SolverParameter.debug_info', index=34, number=23, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='snapshot_after_train', full_name='caffe.SolverParameter.snapshot_after_train', index=35, number=28, type=8, cpp_type=7, label=1, has_default_value=True, default_value=True, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ _SOLVERPARAMETER_SOLVERMODE, _SOLVERPARAMETER_SOLVERTYPE, ], options=None, is_extendable=False, extension_ranges=[], serialized_start=936, serialized_end=2021, ) _SOLVERSTATE = _descriptor.Descriptor( name='SolverState', full_name='caffe.SolverState', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='iter', full_name='caffe.SolverState.iter', index=0, number=1, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='learned_net', full_name='caffe.SolverState.learned_net', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='history', full_name='caffe.SolverState.history', index=2, number=3, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='current_step', full_name='caffe.SolverState.current_step', index=3, number=4, type=5, cpp_type=1, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=2023, serialized_end=2131, ) _NETSTATE = _descriptor.Descriptor( name='NetState', full_name='caffe.NetState', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='phase', full_name='caffe.NetState.phase', index=0, number=1, type=14, cpp_type=8, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='level', full_name='caffe.NetState.level', index=1, number=2, type=5, cpp_type=1, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='stage', full_name='caffe.NetState.stage', index=2, number=3, type=9, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=2133, serialized_end=2211, ) _NETSTATERULE = _descriptor.Descriptor( name='NetStateRule', full_name='caffe.NetStateRule', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='phase', full_name='caffe.NetStateRule.phase', index=0, number=1, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='min_level', full_name='caffe.NetStateRule.min_level', index=1, number=2, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='max_level', full_name='caffe.NetStateRule.max_level', index=2, number=3, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='stage', full_name='caffe.NetStateRule.stage', index=3, number=4, type=9, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='not_stage', full_name='caffe.NetStateRule.not_stage', index=4, number=5, type=9, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=2213, serialized_end=2328, ) _PARAMSPEC = _descriptor.Descriptor( name='ParamSpec', full_name='caffe.ParamSpec', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='name', full_name='caffe.ParamSpec.name', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='share_mode', full_name='caffe.ParamSpec.share_mode', index=1, number=2, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='lr_mult', full_name='caffe.ParamSpec.lr_mult', index=2, number=3, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='decay_mult', full_name='caffe.ParamSpec.decay_mult', index=3, number=4, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ _PARAMSPEC_DIMCHECKMODE, ], options=None, is_extendable=False, extension_ranges=[], serialized_start=2331, serialized_end=2494, ) _LAYERPARAMETER = _descriptor.Descriptor( name='LayerParameter', full_name='caffe.LayerParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='name', full_name='caffe.LayerParameter.name', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='type', full_name='caffe.LayerParameter.type', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='bottom', full_name='caffe.LayerParameter.bottom', index=2, number=3, type=9, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='top', full_name='caffe.LayerParameter.top', index=3, number=4, type=9, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='phase', full_name='caffe.LayerParameter.phase', index=4, number=10, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='loss_weight', full_name='caffe.LayerParameter.loss_weight', index=5, number=5, type=2, cpp_type=6, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='param', full_name='caffe.LayerParameter.param', index=6, number=6, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='blobs', full_name='caffe.LayerParameter.blobs', index=7, number=7, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='propagate_down', full_name='caffe.LayerParameter.propagate_down', index=8, number=11, type=8, cpp_type=7, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='include', full_name='caffe.LayerParameter.include', index=9, number=8, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='exclude', full_name='caffe.LayerParameter.exclude', index=10, number=9, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='transform_param', full_name='caffe.LayerParameter.transform_param', index=11, number=100, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='loss_param', full_name='caffe.LayerParameter.loss_param', index=12, number=101, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='accuracy_param', full_name='caffe.LayerParameter.accuracy_param', index=13, number=102, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='argmax_param', full_name='caffe.LayerParameter.argmax_param', index=14, number=103, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='concat_param', full_name='caffe.LayerParameter.concat_param', index=15, number=104, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='contrastive_loss_param', full_name='caffe.LayerParameter.contrastive_loss_param', index=16, number=105, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='convolution_param', full_name='caffe.LayerParameter.convolution_param', index=17, number=106, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='data_param', full_name='caffe.LayerParameter.data_param', index=18, number=107, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='dropout_param', full_name='caffe.LayerParameter.dropout_param', index=19, number=108, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='dummy_data_param', full_name='caffe.LayerParameter.dummy_data_param', index=20, number=109, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='eltwise_param', full_name='caffe.LayerParameter.eltwise_param', index=21, number=110, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='exp_param', full_name='caffe.LayerParameter.exp_param', index=22, number=111, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='flatten_param', full_name='caffe.LayerParameter.flatten_param', index=23, number=135, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='hdf5_data_param', full_name='caffe.LayerParameter.hdf5_data_param', index=24, number=112, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='hdf5_output_param', full_name='caffe.LayerParameter.hdf5_output_param', index=25, number=113, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='hinge_loss_param', full_name='caffe.LayerParameter.hinge_loss_param', index=26, number=114, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='image_data_param', full_name='caffe.LayerParameter.image_data_param', index=27, number=115, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='infogain_loss_param', full_name='caffe.LayerParameter.infogain_loss_param', index=28, number=116, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='inner_product_param', full_name='caffe.LayerParameter.inner_product_param', index=29, number=117, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='log_param', full_name='caffe.LayerParameter.log_param', index=30, number=134, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='lrn_param', full_name='caffe.LayerParameter.lrn_param', index=31, number=118, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='memory_data_param', full_name='caffe.LayerParameter.memory_data_param', index=32, number=119, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='mvn_param', full_name='caffe.LayerParameter.mvn_param', index=33, number=120, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='pooling_param', full_name='caffe.LayerParameter.pooling_param', index=34, number=121, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='power_param', full_name='caffe.LayerParameter.power_param', index=35, number=122, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='prelu_param', full_name='caffe.LayerParameter.prelu_param', index=36, number=131, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='python_param', full_name='caffe.LayerParameter.python_param', index=37, number=130, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='reduction_param', full_name='caffe.LayerParameter.reduction_param', index=38, number=136, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='relu_param', full_name='caffe.LayerParameter.relu_param', index=39, number=123, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='reshape_param', full_name='caffe.LayerParameter.reshape_param', index=40, number=133, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='sigmoid_param', full_name='caffe.LayerParameter.sigmoid_param', index=41, number=124, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='softmax_param', full_name='caffe.LayerParameter.softmax_param', index=42, number=125, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='spp_param', full_name='caffe.LayerParameter.spp_param', index=43, number=132, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='slice_param', full_name='caffe.LayerParameter.slice_param', index=44, number=126, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='tanh_param', full_name='caffe.LayerParameter.tanh_param', index=45, number=127, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='threshold_param', full_name='caffe.LayerParameter.threshold_param', index=46, number=128, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='window_data_param', full_name='caffe.LayerParameter.window_data_param', index=47, number=129, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=2497, serialized_end=4594, ) _TRANSFORMATIONPARAMETER = _descriptor.Descriptor( name='TransformationParameter', full_name='caffe.TransformationParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='scale', full_name='caffe.TransformationParameter.scale', index=0, number=1, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='mirror', full_name='caffe.TransformationParameter.mirror', index=1, number=2, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='crop_size', full_name='caffe.TransformationParameter.crop_size', index=2, number=3, type=13, cpp_type=3, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='mean_file', full_name='caffe.TransformationParameter.mean_file', index=3, number=4, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='mean_value', full_name='caffe.TransformationParameter.mean_value', index=4, number=5, type=2, cpp_type=6, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='force_color', full_name='caffe.TransformationParameter.force_color', index=5, number=6, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='force_gray', full_name='caffe.TransformationParameter.force_gray', index=6, number=7, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=4597, serialized_end=4779, ) _LOSSPARAMETER = _descriptor.Descriptor( name='LossParameter', full_name='caffe.LossParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='ignore_label', full_name='caffe.LossParameter.ignore_label', index=0, number=1, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='normalize', full_name='caffe.LossParameter.normalize', index=1, number=2, type=8, cpp_type=7, label=1, has_default_value=True, default_value=True, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=4781, serialized_end=4843, ) _ACCURACYPARAMETER = _descriptor.Descriptor( name='AccuracyParameter', full_name='caffe.AccuracyParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='top_k', full_name='caffe.AccuracyParameter.top_k', index=0, number=1, type=13, cpp_type=3, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='axis', full_name='caffe.AccuracyParameter.axis', index=1, number=2, type=5, cpp_type=1, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='ignore_label', full_name='caffe.AccuracyParameter.ignore_label', index=2, number=3, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=4845, serialized_end=4921, ) _ARGMAXPARAMETER = _descriptor.Descriptor( name='ArgMaxParameter', full_name='caffe.ArgMaxParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='out_max_val', full_name='caffe.ArgMaxParameter.out_max_val', index=0, number=1, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='top_k', full_name='caffe.ArgMaxParameter.top_k', index=1, number=2, type=13, cpp_type=3, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=4923, serialized_end=4986, ) _CONCATPARAMETER = _descriptor.Descriptor( name='ConcatParameter', full_name='caffe.ConcatParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='axis', full_name='caffe.ConcatParameter.axis', index=0, number=2, type=5, cpp_type=1, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='concat_dim', full_name='caffe.ConcatParameter.concat_dim', index=1, number=1, type=13, cpp_type=3, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=4988, serialized_end=5045, ) _CONTRASTIVELOSSPARAMETER = _descriptor.Descriptor( name='ContrastiveLossParameter', full_name='caffe.ContrastiveLossParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='margin', full_name='caffe.ContrastiveLossParameter.margin', index=0, number=1, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='legacy_version', full_name='caffe.ContrastiveLossParameter.legacy_version', index=1, number=2, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=5047, serialized_end=5123, ) _CONVOLUTIONPARAMETER = _descriptor.Descriptor( name='ConvolutionParameter', full_name='caffe.ConvolutionParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='num_output', full_name='caffe.ConvolutionParameter.num_output', index=0, number=1, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='bias_term', full_name='caffe.ConvolutionParameter.bias_term', index=1, number=2, type=8, cpp_type=7, label=1, has_default_value=True, default_value=True, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='pad', full_name='caffe.ConvolutionParameter.pad', index=2, number=3, type=13, cpp_type=3, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='pad_h', full_name='caffe.ConvolutionParameter.pad_h', index=3, number=9, type=13, cpp_type=3, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='pad_w', full_name='caffe.ConvolutionParameter.pad_w', index=4, number=10, type=13, cpp_type=3, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='kernel_size', full_name='caffe.ConvolutionParameter.kernel_size', index=5, number=4, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='kernel_h', full_name='caffe.ConvolutionParameter.kernel_h', index=6, number=11, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='kernel_w', full_name='caffe.ConvolutionParameter.kernel_w', index=7, number=12, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='group', full_name='caffe.ConvolutionParameter.group', index=8, number=5, type=13, cpp_type=3, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='stride', full_name='caffe.ConvolutionParameter.stride', index=9, number=6, type=13, cpp_type=3, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='stride_h', full_name='caffe.ConvolutionParameter.stride_h', index=10, number=13, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='stride_w', full_name='caffe.ConvolutionParameter.stride_w', index=11, number=14, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='weight_filler', full_name='caffe.ConvolutionParameter.weight_filler', index=12, number=7, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='bias_filler', full_name='caffe.ConvolutionParameter.bias_filler', index=13, number=8, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='engine', full_name='caffe.ConvolutionParameter.engine', index=14, number=15, type=14, cpp_type=8, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ _CONVOLUTIONPARAMETER_ENGINE, ], options=None, is_extendable=False, extension_ranges=[], serialized_start=5126, serialized_end=5573, ) _DATAPARAMETER = _descriptor.Descriptor( name='DataParameter', full_name='caffe.DataParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='source', full_name='caffe.DataParameter.source', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='batch_size', full_name='caffe.DataParameter.batch_size', index=1, number=4, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='rand_skip', full_name='caffe.DataParameter.rand_skip', index=2, number=7, type=13, cpp_type=3, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='backend', full_name='caffe.DataParameter.backend', index=3, number=8, type=14, cpp_type=8, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='scale', full_name='caffe.DataParameter.scale', index=4, number=2, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='mean_file', full_name='caffe.DataParameter.mean_file', index=5, number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='crop_size', full_name='caffe.DataParameter.crop_size', index=6, number=5, type=13, cpp_type=3, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='mirror', full_name='caffe.DataParameter.mirror', index=7, number=6, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='force_encoded_color', full_name='caffe.DataParameter.force_encoded_color', index=8, number=9, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ _DATAPARAMETER_DB, ], options=None, is_extendable=False, extension_ranges=[], serialized_start=5576, serialized_end=5847, ) _DROPOUTPARAMETER = _descriptor.Descriptor( name='DropoutParameter', full_name='caffe.DropoutParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='dropout_ratio', full_name='caffe.DropoutParameter.dropout_ratio', index=0, number=1, type=2, cpp_type=6, label=1, has_default_value=True, default_value=0.5, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=5849, serialized_end=5895, ) _DUMMYDATAPARAMETER = _descriptor.Descriptor( name='DummyDataParameter', full_name='caffe.DummyDataParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='data_filler', full_name='caffe.DummyDataParameter.data_filler', index=0, number=1, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='shape', full_name='caffe.DummyDataParameter.shape', index=1, number=6, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='num', full_name='caffe.DummyDataParameter.num', index=2, number=2, type=13, cpp_type=3, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='channels', full_name='caffe.DummyDataParameter.channels', index=3, number=3, type=13, cpp_type=3, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='height', full_name='caffe.DummyDataParameter.height', index=4, number=4, type=13, cpp_type=3, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='width', full_name='caffe.DummyDataParameter.width', index=5, number=5, type=13, cpp_type=3, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=5898, serialized_end=6058, ) _ELTWISEPARAMETER = _descriptor.Descriptor( name='EltwiseParameter', full_name='caffe.EltwiseParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='operation', full_name='caffe.EltwiseParameter.operation', index=0, number=1, type=14, cpp_type=8, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='coeff', full_name='caffe.EltwiseParameter.coeff', index=1, number=2, type=2, cpp_type=6, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='stable_prod_grad', full_name='caffe.EltwiseParameter.stable_prod_grad', index=2, number=3, type=8, cpp_type=7, label=1, has_default_value=True, default_value=True, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ _ELTWISEPARAMETER_ELTWISEOP, ], options=None, is_extendable=False, extension_ranges=[], serialized_start=6061, serialized_end=6226, ) _EXPPARAMETER = _descriptor.Descriptor( name='ExpParameter', full_name='caffe.ExpParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='base', full_name='caffe.ExpParameter.base', index=0, number=1, type=2, cpp_type=6, label=1, has_default_value=True, default_value=-1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='scale', full_name='caffe.ExpParameter.scale', index=1, number=2, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='shift', full_name='caffe.ExpParameter.shift', index=2, number=3, type=2, cpp_type=6, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=6228, serialized_end=6296, ) _FLATTENPARAMETER = _descriptor.Descriptor( name='FlattenParameter', full_name='caffe.FlattenParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='axis', full_name='caffe.FlattenParameter.axis', index=0, number=1, type=5, cpp_type=1, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='end_axis', full_name='caffe.FlattenParameter.end_axis', index=1, number=2, type=5, cpp_type=1, label=1, has_default_value=True, default_value=-1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=6298, serialized_end=6355, ) _HDF5DATAPARAMETER = _descriptor.Descriptor( name='HDF5DataParameter', full_name='caffe.HDF5DataParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='source', full_name='caffe.HDF5DataParameter.source', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='batch_size', full_name='caffe.HDF5DataParameter.batch_size', index=1, number=2, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='shuffle', full_name='caffe.HDF5DataParameter.shuffle', index=2, number=3, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=6357, serialized_end=6436, ) _HDF5OUTPUTPARAMETER = _descriptor.Descriptor( name='HDF5OutputParameter', full_name='caffe.HDF5OutputParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='file_name', full_name='caffe.HDF5OutputParameter.file_name', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=6438, serialized_end=6478, ) _HINGELOSSPARAMETER = _descriptor.Descriptor( name='HingeLossParameter', full_name='caffe.HingeLossParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='norm', full_name='caffe.HingeLossParameter.norm', index=0, number=1, type=14, cpp_type=8, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ _HINGELOSSPARAMETER_NORM, ], options=None, is_extendable=False, extension_ranges=[], serialized_start=6480, serialized_end=6574, ) _IMAGEDATAPARAMETER = _descriptor.Descriptor( name='ImageDataParameter', full_name='caffe.ImageDataParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='source', full_name='caffe.ImageDataParameter.source', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='batch_size', full_name='caffe.ImageDataParameter.batch_size', index=1, number=4, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='rand_skip', full_name='caffe.ImageDataParameter.rand_skip', index=2, number=7, type=13, cpp_type=3, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='shuffle', full_name='caffe.ImageDataParameter.shuffle', index=3, number=8, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='new_height', full_name='caffe.ImageDataParameter.new_height', index=4, number=9, type=13, cpp_type=3, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='new_width', full_name='caffe.ImageDataParameter.new_width', index=5, number=10, type=13, cpp_type=3, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='is_color', full_name='caffe.ImageDataParameter.is_color', index=6, number=11, type=8, cpp_type=7, label=1, has_default_value=True, default_value=True, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='scale', full_name='caffe.ImageDataParameter.scale', index=7, number=2, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='mean_file', full_name='caffe.ImageDataParameter.mean_file', index=8, number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='crop_size', full_name='caffe.ImageDataParameter.crop_size', index=9, number=5, type=13, cpp_type=3, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='mirror', full_name='caffe.ImageDataParameter.mirror', index=10, number=6, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='root_folder', full_name='caffe.ImageDataParameter.root_folder', index=11, number=12, type=9, cpp_type=9, label=1, has_default_value=True, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=6577, serialized_end=6853, ) _INFOGAINLOSSPARAMETER = _descriptor.Descriptor( name='InfogainLossParameter', full_name='caffe.InfogainLossParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='source', full_name='caffe.InfogainLossParameter.source', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=6855, serialized_end=6894, ) _INNERPRODUCTPARAMETER = _descriptor.Descriptor( name='InnerProductParameter', full_name='caffe.InnerProductParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='num_output', full_name='caffe.InnerProductParameter.num_output', index=0, number=1, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='bias_term', full_name='caffe.InnerProductParameter.bias_term', index=1, number=2, type=8, cpp_type=7, label=1, has_default_value=True, default_value=True, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='weight_filler', full_name='caffe.InnerProductParameter.weight_filler', index=2, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='bias_filler', full_name='caffe.InnerProductParameter.bias_filler', index=3, number=4, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='axis', full_name='caffe.InnerProductParameter.axis', index=4, number=5, type=5, cpp_type=1, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=6897, serialized_end=7074, ) _LOGPARAMETER = _descriptor.Descriptor( name='LogParameter', full_name='caffe.LogParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='base', full_name='caffe.LogParameter.base', index=0, number=1, type=2, cpp_type=6, label=1, has_default_value=True, default_value=-1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='scale', full_name='caffe.LogParameter.scale', index=1, number=2, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='shift', full_name='caffe.LogParameter.shift', index=2, number=3, type=2, cpp_type=6, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=7076, serialized_end=7144, ) _LRNPARAMETER = _descriptor.Descriptor( name='LRNParameter', full_name='caffe.LRNParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='local_size', full_name='caffe.LRNParameter.local_size', index=0, number=1, type=13, cpp_type=3, label=1, has_default_value=True, default_value=5, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='alpha', full_name='caffe.LRNParameter.alpha', index=1, number=2, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='beta', full_name='caffe.LRNParameter.beta', index=2, number=3, type=2, cpp_type=6, label=1, has_default_value=True, default_value=0.75, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='norm_region', full_name='caffe.LRNParameter.norm_region', index=3, number=4, type=14, cpp_type=8, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='k', full_name='caffe.LRNParameter.k', index=4, number=5, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ _LRNPARAMETER_NORMREGION, ], options=None, is_extendable=False, extension_ranges=[], serialized_start=7147, serialized_end=7361, ) _MEMORYDATAPARAMETER = _descriptor.Descriptor( name='MemoryDataParameter', full_name='caffe.MemoryDataParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='batch_size', full_name='caffe.MemoryDataParameter.batch_size', index=0, number=1, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='channels', full_name='caffe.MemoryDataParameter.channels', index=1, number=2, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='height', full_name='caffe.MemoryDataParameter.height', index=2, number=3, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='width', full_name='caffe.MemoryDataParameter.width', index=3, number=4, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=7363, serialized_end=7453, ) _MVNPARAMETER = _descriptor.Descriptor( name='MVNParameter', full_name='caffe.MVNParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='normalize_variance', full_name='caffe.MVNParameter.normalize_variance', index=0, number=1, type=8, cpp_type=7, label=1, has_default_value=True, default_value=True, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='across_channels', full_name='caffe.MVNParameter.across_channels', index=1, number=2, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='eps', full_name='caffe.MVNParameter.eps', index=2, number=3, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1e-09, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=7455, serialized_end=7555, ) _POOLINGPARAMETER = _descriptor.Descriptor( name='PoolingParameter', full_name='caffe.PoolingParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='pool', full_name='caffe.PoolingParameter.pool', index=0, number=1, type=14, cpp_type=8, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='pad', full_name='caffe.PoolingParameter.pad', index=1, number=4, type=13, cpp_type=3, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='pad_h', full_name='caffe.PoolingParameter.pad_h', index=2, number=9, type=13, cpp_type=3, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='pad_w', full_name='caffe.PoolingParameter.pad_w', index=3, number=10, type=13, cpp_type=3, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='kernel_size', full_name='caffe.PoolingParameter.kernel_size', index=4, number=2, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='kernel_h', full_name='caffe.PoolingParameter.kernel_h', index=5, number=5, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='kernel_w', full_name='caffe.PoolingParameter.kernel_w', index=6, number=6, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='stride', full_name='caffe.PoolingParameter.stride', index=7, number=3, type=13, cpp_type=3, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='stride_h', full_name='caffe.PoolingParameter.stride_h', index=8, number=7, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='stride_w', full_name='caffe.PoolingParameter.stride_w', index=9, number=8, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='engine', full_name='caffe.PoolingParameter.engine', index=10, number=11, type=14, cpp_type=8, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='global_pooling', full_name='caffe.PoolingParameter.global_pooling', index=11, number=12, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ _POOLINGPARAMETER_POOLMETHOD, _POOLINGPARAMETER_ENGINE, ], options=None, is_extendable=False, extension_ranges=[], serialized_start=7558, serialized_end=7976, ) _POWERPARAMETER = _descriptor.Descriptor( name='PowerParameter', full_name='caffe.PowerParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='power', full_name='caffe.PowerParameter.power', index=0, number=1, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='scale', full_name='caffe.PowerParameter.scale', index=1, number=2, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='shift', full_name='caffe.PowerParameter.shift', index=2, number=3, type=2, cpp_type=6, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=7978, serialized_end=8048, ) _PYTHONPARAMETER = _descriptor.Descriptor( name='PythonParameter', full_name='caffe.PythonParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='module', full_name='caffe.PythonParameter.module', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='layer', full_name='caffe.PythonParameter.layer', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=8050, serialized_end=8098, ) _REDUCTIONPARAMETER = _descriptor.Descriptor( name='ReductionParameter', full_name='caffe.ReductionParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='operation', full_name='caffe.ReductionParameter.operation', index=0, number=1, type=14, cpp_type=8, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='axis', full_name='caffe.ReductionParameter.axis', index=1, number=2, type=5, cpp_type=1, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='coeff', full_name='caffe.ReductionParameter.coeff', index=2, number=3, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ _REDUCTIONPARAMETER_REDUCTIONOP, ], options=None, is_extendable=False, extension_ranges=[], serialized_start=8101, serialized_end=8274, ) _RELUPARAMETER = _descriptor.Descriptor( name='ReLUParameter', full_name='caffe.ReLUParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='negative_slope', full_name='caffe.ReLUParameter.negative_slope', index=0, number=1, type=2, cpp_type=6, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='engine', full_name='caffe.ReLUParameter.engine', index=1, number=2, type=14, cpp_type=8, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ _RELUPARAMETER_ENGINE, ], options=None, is_extendable=False, extension_ranges=[], serialized_start=8277, serialized_end=8418, ) _RESHAPEPARAMETER = _descriptor.Descriptor( name='ReshapeParameter', full_name='caffe.ReshapeParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='shape', full_name='caffe.ReshapeParameter.shape', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='axis', full_name='caffe.ReshapeParameter.axis', index=1, number=2, type=5, cpp_type=1, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='num_axes', full_name='caffe.ReshapeParameter.num_axes', index=2, number=3, type=5, cpp_type=1, label=1, has_default_value=True, default_value=-1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=8420, serialized_end=8510, ) _SIGMOIDPARAMETER = _descriptor.Descriptor( name='SigmoidParameter', full_name='caffe.SigmoidParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='engine', full_name='caffe.SigmoidParameter.engine', index=0, number=1, type=14, cpp_type=8, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ _SIGMOIDPARAMETER_ENGINE, ], options=None, is_extendable=False, extension_ranges=[], serialized_start=8512, serialized_end=8632, ) _SLICEPARAMETER = _descriptor.Descriptor( name='SliceParameter', full_name='caffe.SliceParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='axis', full_name='caffe.SliceParameter.axis', index=0, number=3, type=5, cpp_type=1, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='slice_point', full_name='caffe.SliceParameter.slice_point', index=1, number=2, type=13, cpp_type=3, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='slice_dim', full_name='caffe.SliceParameter.slice_dim', index=2, number=1, type=13, cpp_type=3, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=8634, serialized_end=8710, ) _SOFTMAXPARAMETER = _descriptor.Descriptor( name='SoftmaxParameter', full_name='caffe.SoftmaxParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='engine', full_name='caffe.SoftmaxParameter.engine', index=0, number=1, type=14, cpp_type=8, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='axis', full_name='caffe.SoftmaxParameter.axis', index=1, number=2, type=5, cpp_type=1, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ _SOFTMAXPARAMETER_ENGINE, ], options=None, is_extendable=False, extension_ranges=[], serialized_start=8713, serialized_end=8850, ) _TANHPARAMETER = _descriptor.Descriptor( name='TanHParameter', full_name='caffe.TanHParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='engine', full_name='caffe.TanHParameter.engine', index=0, number=1, type=14, cpp_type=8, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ _TANHPARAMETER_ENGINE, ], options=None, is_extendable=False, extension_ranges=[], serialized_start=8852, serialized_end=8966, ) _THRESHOLDPARAMETER = _descriptor.Descriptor( name='ThresholdParameter', full_name='caffe.ThresholdParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='threshold', full_name='caffe.ThresholdParameter.threshold', index=0, number=1, type=2, cpp_type=6, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=8968, serialized_end=9010, ) _WINDOWDATAPARAMETER = _descriptor.Descriptor( name='WindowDataParameter', full_name='caffe.WindowDataParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='source', full_name='caffe.WindowDataParameter.source', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='scale', full_name='caffe.WindowDataParameter.scale', index=1, number=2, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='mean_file', full_name='caffe.WindowDataParameter.mean_file', index=2, number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='batch_size', full_name='caffe.WindowDataParameter.batch_size', index=3, number=4, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='crop_size', full_name='caffe.WindowDataParameter.crop_size', index=4, number=5, type=13, cpp_type=3, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='mirror', full_name='caffe.WindowDataParameter.mirror', index=5, number=6, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='fg_threshold', full_name='caffe.WindowDataParameter.fg_threshold', index=6, number=7, type=2, cpp_type=6, label=1, has_default_value=True, default_value=0.5, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='bg_threshold', full_name='caffe.WindowDataParameter.bg_threshold', index=7, number=8, type=2, cpp_type=6, label=1, has_default_value=True, default_value=0.5, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='fg_fraction', full_name='caffe.WindowDataParameter.fg_fraction', index=8, number=9, type=2, cpp_type=6, label=1, has_default_value=True, default_value=0.25, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='context_pad', full_name='caffe.WindowDataParameter.context_pad', index=9, number=10, type=13, cpp_type=3, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='crop_mode', full_name='caffe.WindowDataParameter.crop_mode', index=10, number=11, type=9, cpp_type=9, label=1, has_default_value=True, default_value=unicode("warp", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='cache_images', full_name='caffe.WindowDataParameter.cache_images', index=11, number=12, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='root_folder', full_name='caffe.WindowDataParameter.root_folder', index=12, number=13, type=9, cpp_type=9, label=1, has_default_value=True, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=9013, serialized_end=9334, ) _SPPPARAMETER = _descriptor.Descriptor( name='SPPParameter', full_name='caffe.SPPParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='pyramid_height', full_name='caffe.SPPParameter.pyramid_height', index=0, number=1, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='pool', full_name='caffe.SPPParameter.pool', index=1, number=2, type=14, cpp_type=8, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='engine', full_name='caffe.SPPParameter.engine', index=2, number=6, type=14, cpp_type=8, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ _SPPPARAMETER_POOLMETHOD, _SPPPARAMETER_ENGINE, ], options=None, is_extendable=False, extension_ranges=[], serialized_start=9337, serialized_end=9572, ) _V1LAYERPARAMETER = _descriptor.Descriptor( name='V1LayerParameter', full_name='caffe.V1LayerParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='bottom', full_name='caffe.V1LayerParameter.bottom', index=0, number=2, type=9, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='top', full_name='caffe.V1LayerParameter.top', index=1, number=3, type=9, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='name', full_name='caffe.V1LayerParameter.name', index=2, number=4, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='include', full_name='caffe.V1LayerParameter.include', index=3, number=32, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='exclude', full_name='caffe.V1LayerParameter.exclude', index=4, number=33, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='type', full_name='caffe.V1LayerParameter.type', index=5, number=5, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='blobs', full_name='caffe.V1LayerParameter.blobs', index=6, number=6, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='param', full_name='caffe.V1LayerParameter.param', index=7, number=1001, type=9, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='blob_share_mode', full_name='caffe.V1LayerParameter.blob_share_mode', index=8, number=1002, type=14, cpp_type=8, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='blobs_lr', full_name='caffe.V1LayerParameter.blobs_lr', index=9, number=7, type=2, cpp_type=6, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='weight_decay', full_name='caffe.V1LayerParameter.weight_decay', index=10, number=8, type=2, cpp_type=6, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='loss_weight', full_name='caffe.V1LayerParameter.loss_weight', index=11, number=35, type=2, cpp_type=6, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='accuracy_param', full_name='caffe.V1LayerParameter.accuracy_param', index=12, number=27, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='argmax_param', full_name='caffe.V1LayerParameter.argmax_param', index=13, number=23, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='concat_param', full_name='caffe.V1LayerParameter.concat_param', index=14, number=9, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='contrastive_loss_param', full_name='caffe.V1LayerParameter.contrastive_loss_param', index=15, number=40, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='convolution_param', full_name='caffe.V1LayerParameter.convolution_param', index=16, number=10, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='data_param', full_name='caffe.V1LayerParameter.data_param', index=17, number=11, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='dropout_param', full_name='caffe.V1LayerParameter.dropout_param', index=18, number=12, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='dummy_data_param', full_name='caffe.V1LayerParameter.dummy_data_param', index=19, number=26, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='eltwise_param', full_name='caffe.V1LayerParameter.eltwise_param', index=20, number=24, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='exp_param', full_name='caffe.V1LayerParameter.exp_param', index=21, number=41, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='hdf5_data_param', full_name='caffe.V1LayerParameter.hdf5_data_param', index=22, number=13, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='hdf5_output_param', full_name='caffe.V1LayerParameter.hdf5_output_param', index=23, number=14, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='hinge_loss_param', full_name='caffe.V1LayerParameter.hinge_loss_param', index=24, number=29, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='image_data_param', full_name='caffe.V1LayerParameter.image_data_param', index=25, number=15, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='infogain_loss_param', full_name='caffe.V1LayerParameter.infogain_loss_param', index=26, number=16, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='inner_product_param', full_name='caffe.V1LayerParameter.inner_product_param', index=27, number=17, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='lrn_param', full_name='caffe.V1LayerParameter.lrn_param', index=28, number=18, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='memory_data_param', full_name='caffe.V1LayerParameter.memory_data_param', index=29, number=22, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='mvn_param', full_name='caffe.V1LayerParameter.mvn_param', index=30, number=34, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='pooling_param', full_name='caffe.V1LayerParameter.pooling_param', index=31, number=19, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='power_param', full_name='caffe.V1LayerParameter.power_param', index=32, number=21, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='relu_param', full_name='caffe.V1LayerParameter.relu_param', index=33, number=30, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='sigmoid_param', full_name='caffe.V1LayerParameter.sigmoid_param', index=34, number=38, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='softmax_param', full_name='caffe.V1LayerParameter.softmax_param', index=35, number=39, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='slice_param', full_name='caffe.V1LayerParameter.slice_param', index=36, number=31, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='tanh_param', full_name='caffe.V1LayerParameter.tanh_param', index=37, number=37, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='threshold_param', full_name='caffe.V1LayerParameter.threshold_param', index=38, number=25, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='window_data_param', full_name='caffe.V1LayerParameter.window_data_param', index=39, number=20, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='transform_param', full_name='caffe.V1LayerParameter.transform_param', index=40, number=36, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='loss_param', full_name='caffe.V1LayerParameter.loss_param', index=41, number=42, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='layer', full_name='caffe.V1LayerParameter.layer', index=42, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ _V1LAYERPARAMETER_LAYERTYPE, _V1LAYERPARAMETER_DIMCHECKMODE, ], options=None, is_extendable=False, extension_ranges=[], serialized_start=9575, serialized_end=12103, ) _V0LAYERPARAMETER = _descriptor.Descriptor( name='V0LayerParameter', full_name='caffe.V0LayerParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='name', full_name='caffe.V0LayerParameter.name', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='type', full_name='caffe.V0LayerParameter.type', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='num_output', full_name='caffe.V0LayerParameter.num_output', index=2, number=3, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='biasterm', full_name='caffe.V0LayerParameter.biasterm', index=3, number=4, type=8, cpp_type=7, label=1, has_default_value=True, default_value=True, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='weight_filler', full_name='caffe.V0LayerParameter.weight_filler', index=4, number=5, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='bias_filler', full_name='caffe.V0LayerParameter.bias_filler', index=5, number=6, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='pad', full_name='caffe.V0LayerParameter.pad', index=6, number=7, type=13, cpp_type=3, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='kernelsize', full_name='caffe.V0LayerParameter.kernelsize', index=7, number=8, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='group', full_name='caffe.V0LayerParameter.group', index=8, number=9, type=13, cpp_type=3, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='stride', full_name='caffe.V0LayerParameter.stride', index=9, number=10, type=13, cpp_type=3, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='pool', full_name='caffe.V0LayerParameter.pool', index=10, number=11, type=14, cpp_type=8, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='dropout_ratio', full_name='caffe.V0LayerParameter.dropout_ratio', index=11, number=12, type=2, cpp_type=6, label=1, has_default_value=True, default_value=0.5, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='local_size', full_name='caffe.V0LayerParameter.local_size', index=12, number=13, type=13, cpp_type=3, label=1, has_default_value=True, default_value=5, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='alpha', full_name='caffe.V0LayerParameter.alpha', index=13, number=14, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='beta', full_name='caffe.V0LayerParameter.beta', index=14, number=15, type=2, cpp_type=6, label=1, has_default_value=True, default_value=0.75, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='k', full_name='caffe.V0LayerParameter.k', index=15, number=22, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='source', full_name='caffe.V0LayerParameter.source', index=16, number=16, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='scale', full_name='caffe.V0LayerParameter.scale', index=17, number=17, type=2, cpp_type=6, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='meanfile', full_name='caffe.V0LayerParameter.meanfile', index=18, number=18, type=9, cpp_type=9, label=1, has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='batchsize', full_name='caffe.V0LayerParameter.batchsize', index=19, number=19, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='cropsize', full_name='caffe.V0LayerParameter.cropsize', index=20, number=20, type=13, cpp_type=3, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='mirror', full_name='caffe.V0LayerParameter.mirror', index=21, number=21, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='blobs', full_name='caffe.V0LayerParameter.blobs', index=22, number=50, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='blobs_lr', full_name='caffe.V0LayerParameter.blobs_lr', index=23, number=51, type=2, cpp_type=6, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='weight_decay', full_name='caffe.V0LayerParameter.weight_decay', index=24, number=52, type=2, cpp_type=6, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='rand_skip', full_name='caffe.V0LayerParameter.rand_skip', index=25, number=53, type=13, cpp_type=3, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='det_fg_threshold', full_name='caffe.V0LayerParameter.det_fg_threshold', index=26, number=54, type=2, cpp_type=6, label=1, has_default_value=True, default_value=0.5, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='det_bg_threshold', full_name='caffe.V0LayerParameter.det_bg_threshold', index=27, number=55, type=2, cpp_type=6, label=1, has_default_value=True, default_value=0.5, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='det_fg_fraction', full_name='caffe.V0LayerParameter.det_fg_fraction', index=28, number=56, type=2, cpp_type=6, label=1, has_default_value=True, default_value=0.25, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='det_context_pad', full_name='caffe.V0LayerParameter.det_context_pad', index=29, number=58, type=13, cpp_type=3, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='det_crop_mode', full_name='caffe.V0LayerParameter.det_crop_mode', index=30, number=59, type=9, cpp_type=9, label=1, has_default_value=True, default_value=unicode("warp", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='new_num', full_name='caffe.V0LayerParameter.new_num', index=31, number=60, type=5, cpp_type=1, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='new_channels', full_name='caffe.V0LayerParameter.new_channels', index=32, number=61, type=5, cpp_type=1, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='new_height', full_name='caffe.V0LayerParameter.new_height', index=33, number=62, type=5, cpp_type=1, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='new_width', full_name='caffe.V0LayerParameter.new_width', index=34, number=63, type=5, cpp_type=1, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='shuffle_images', full_name='caffe.V0LayerParameter.shuffle_images', index=35, number=64, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='concat_dim', full_name='caffe.V0LayerParameter.concat_dim', index=36, number=65, type=13, cpp_type=3, label=1, has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='hdf5_output_param', full_name='caffe.V0LayerParameter.hdf5_output_param', index=37, number=1001, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ _V0LAYERPARAMETER_POOLMETHOD, ], options=None, is_extendable=False, extension_ranges=[], serialized_start=12106, serialized_end=13127, ) _PRELUPARAMETER = _descriptor.Descriptor( name='PReLUParameter', full_name='caffe.PReLUParameter', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='filler', full_name='caffe.PReLUParameter.filler', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( name='channel_shared', full_name='caffe.PReLUParameter.channel_shared', index=1, number=2, type=8, cpp_type=7, label=1, has_default_value=True, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, extension_ranges=[], serialized_start=13129, serialized_end=13216, ) _BLOBPROTO.fields_by_name['shape'].message_type = _BLOBSHAPE _BLOBPROTOVECTOR.fields_by_name['blobs'].message_type = _BLOBPROTO _FILLERPARAMETER.fields_by_name['variance_norm'].enum_type = _FILLERPARAMETER_VARIANCENORM _FILLERPARAMETER_VARIANCENORM.containing_type = _FILLERPARAMETER; _NETPARAMETER.fields_by_name['input_shape'].message_type = _BLOBSHAPE _NETPARAMETER.fields_by_name['state'].message_type = _NETSTATE _NETPARAMETER.fields_by_name['layer'].message_type = _LAYERPARAMETER _NETPARAMETER.fields_by_name['layers'].message_type = _V1LAYERPARAMETER _SOLVERPARAMETER.fields_by_name['net_param'].message_type = _NETPARAMETER _SOLVERPARAMETER.fields_by_name['train_net_param'].message_type = _NETPARAMETER _SOLVERPARAMETER.fields_by_name['test_net_param'].message_type = _NETPARAMETER _SOLVERPARAMETER.fields_by_name['train_state'].message_type = _NETSTATE _SOLVERPARAMETER.fields_by_name['test_state'].message_type = _NETSTATE _SOLVERPARAMETER.fields_by_name['solver_mode'].enum_type = _SOLVERPARAMETER_SOLVERMODE _SOLVERPARAMETER.fields_by_name['solver_type'].enum_type = _SOLVERPARAMETER_SOLVERTYPE _SOLVERPARAMETER_SOLVERMODE.containing_type = _SOLVERPARAMETER; _SOLVERPARAMETER_SOLVERTYPE.containing_type = _SOLVERPARAMETER; _SOLVERSTATE.fields_by_name['history'].message_type = _BLOBPROTO _NETSTATE.fields_by_name['phase'].enum_type = _PHASE _NETSTATERULE.fields_by_name['phase'].enum_type = _PHASE _PARAMSPEC.fields_by_name['share_mode'].enum_type = _PARAMSPEC_DIMCHECKMODE _PARAMSPEC_DIMCHECKMODE.containing_type = _PARAMSPEC; _LAYERPARAMETER.fields_by_name['phase'].enum_type = _PHASE _LAYERPARAMETER.fields_by_name['param'].message_type = _PARAMSPEC _LAYERPARAMETER.fields_by_name['blobs'].message_type = _BLOBPROTO _LAYERPARAMETER.fields_by_name['include'].message_type = _NETSTATERULE _LAYERPARAMETER.fields_by_name['exclude'].message_type = _NETSTATERULE _LAYERPARAMETER.fields_by_name['transform_param'].message_type = _TRANSFORMATIONPARAMETER _LAYERPARAMETER.fields_by_name['loss_param'].message_type = _LOSSPARAMETER _LAYERPARAMETER.fields_by_name['accuracy_param'].message_type = _ACCURACYPARAMETER _LAYERPARAMETER.fields_by_name['argmax_param'].message_type = _ARGMAXPARAMETER _LAYERPARAMETER.fields_by_name['concat_param'].message_type = _CONCATPARAMETER _LAYERPARAMETER.fields_by_name['contrastive_loss_param'].message_type = _CONTRASTIVELOSSPARAMETER _LAYERPARAMETER.fields_by_name['convolution_param'].message_type = _CONVOLUTIONPARAMETER _LAYERPARAMETER.fields_by_name['data_param'].message_type = _DATAPARAMETER _LAYERPARAMETER.fields_by_name['dropout_param'].message_type = _DROPOUTPARAMETER _LAYERPARAMETER.fields_by_name['dummy_data_param'].message_type = _DUMMYDATAPARAMETER _LAYERPARAMETER.fields_by_name['eltwise_param'].message_type = _ELTWISEPARAMETER _LAYERPARAMETER.fields_by_name['exp_param'].message_type = _EXPPARAMETER _LAYERPARAMETER.fields_by_name['flatten_param'].message_type = _FLATTENPARAMETER _LAYERPARAMETER.fields_by_name['hdf5_data_param'].message_type = _HDF5DATAPARAMETER _LAYERPARAMETER.fields_by_name['hdf5_output_param'].message_type = _HDF5OUTPUTPARAMETER _LAYERPARAMETER.fields_by_name['hinge_loss_param'].message_type = _HINGELOSSPARAMETER _LAYERPARAMETER.fields_by_name['image_data_param'].message_type = _IMAGEDATAPARAMETER _LAYERPARAMETER.fields_by_name['infogain_loss_param'].message_type = _INFOGAINLOSSPARAMETER _LAYERPARAMETER.fields_by_name['inner_product_param'].message_type = _INNERPRODUCTPARAMETER _LAYERPARAMETER.fields_by_name['log_param'].message_type = _LOGPARAMETER _LAYERPARAMETER.fields_by_name['lrn_param'].message_type = _LRNPARAMETER _LAYERPARAMETER.fields_by_name['memory_data_param'].message_type = _MEMORYDATAPARAMETER _LAYERPARAMETER.fields_by_name['mvn_param'].message_type = _MVNPARAMETER _LAYERPARAMETER.fields_by_name['pooling_param'].message_type = _POOLINGPARAMETER _LAYERPARAMETER.fields_by_name['power_param'].message_type = _POWERPARAMETER _LAYERPARAMETER.fields_by_name['prelu_param'].message_type = _PRELUPARAMETER _LAYERPARAMETER.fields_by_name['python_param'].message_type = _PYTHONPARAMETER _LAYERPARAMETER.fields_by_name['reduction_param'].message_type = _REDUCTIONPARAMETER _LAYERPARAMETER.fields_by_name['relu_param'].message_type = _RELUPARAMETER _LAYERPARAMETER.fields_by_name['reshape_param'].message_type = _RESHAPEPARAMETER _LAYERPARAMETER.fields_by_name['sigmoid_param'].message_type = _SIGMOIDPARAMETER _LAYERPARAMETER.fields_by_name['softmax_param'].message_type = _SOFTMAXPARAMETER _LAYERPARAMETER.fields_by_name['spp_param'].message_type = _SPPPARAMETER _LAYERPARAMETER.fields_by_name['slice_param'].message_type = _SLICEPARAMETER _LAYERPARAMETER.fields_by_name['tanh_param'].message_type = _TANHPARAMETER _LAYERPARAMETER.fields_by_name['threshold_param'].message_type = _THRESHOLDPARAMETER _LAYERPARAMETER.fields_by_name['window_data_param'].message_type = _WINDOWDATAPARAMETER _CONVOLUTIONPARAMETER.fields_by_name['weight_filler'].message_type = _FILLERPARAMETER _CONVOLUTIONPARAMETER.fields_by_name['bias_filler'].message_type = _FILLERPARAMETER _CONVOLUTIONPARAMETER.fields_by_name['engine'].enum_type = _CONVOLUTIONPARAMETER_ENGINE _CONVOLUTIONPARAMETER_ENGINE.containing_type = _CONVOLUTIONPARAMETER; _DATAPARAMETER.fields_by_name['backend'].enum_type = _DATAPARAMETER_DB _DATAPARAMETER_DB.containing_type = _DATAPARAMETER; _DUMMYDATAPARAMETER.fields_by_name['data_filler'].message_type = _FILLERPARAMETER _DUMMYDATAPARAMETER.fields_by_name['shape'].message_type = _BLOBSHAPE _ELTWISEPARAMETER.fields_by_name['operation'].enum_type = _ELTWISEPARAMETER_ELTWISEOP _ELTWISEPARAMETER_ELTWISEOP.containing_type = _ELTWISEPARAMETER; _HINGELOSSPARAMETER.fields_by_name['norm'].enum_type = _HINGELOSSPARAMETER_NORM _HINGELOSSPARAMETER_NORM.containing_type = _HINGELOSSPARAMETER; _INNERPRODUCTPARAMETER.fields_by_name['weight_filler'].message_type = _FILLERPARAMETER _INNERPRODUCTPARAMETER.fields_by_name['bias_filler'].message_type = _FILLERPARAMETER _LRNPARAMETER.fields_by_name['norm_region'].enum_type = _LRNPARAMETER_NORMREGION _LRNPARAMETER_NORMREGION.containing_type = _LRNPARAMETER; _POOLINGPARAMETER.fields_by_name['pool'].enum_type = _POOLINGPARAMETER_POOLMETHOD _POOLINGPARAMETER.fields_by_name['engine'].enum_type = _POOLINGPARAMETER_ENGINE _POOLINGPARAMETER_POOLMETHOD.containing_type = _POOLINGPARAMETER; _POOLINGPARAMETER_ENGINE.containing_type = _POOLINGPARAMETER; _REDUCTIONPARAMETER.fields_by_name['operation'].enum_type = _REDUCTIONPARAMETER_REDUCTIONOP _REDUCTIONPARAMETER_REDUCTIONOP.containing_type = _REDUCTIONPARAMETER; _RELUPARAMETER.fields_by_name['engine'].enum_type = _RELUPARAMETER_ENGINE _RELUPARAMETER_ENGINE.containing_type = _RELUPARAMETER; _RESHAPEPARAMETER.fields_by_name['shape'].message_type = _BLOBSHAPE _SIGMOIDPARAMETER.fields_by_name['engine'].enum_type = _SIGMOIDPARAMETER_ENGINE _SIGMOIDPARAMETER_ENGINE.containing_type = _SIGMOIDPARAMETER; _SOFTMAXPARAMETER.fields_by_name['engine'].enum_type = _SOFTMAXPARAMETER_ENGINE _SOFTMAXPARAMETER_ENGINE.containing_type = _SOFTMAXPARAMETER; _TANHPARAMETER.fields_by_name['engine'].enum_type = _TANHPARAMETER_ENGINE _TANHPARAMETER_ENGINE.containing_type = _TANHPARAMETER; _SPPPARAMETER.fields_by_name['pool'].enum_type = _SPPPARAMETER_POOLMETHOD _SPPPARAMETER.fields_by_name['engine'].enum_type = _SPPPARAMETER_ENGINE _SPPPARAMETER_POOLMETHOD.containing_type = _SPPPARAMETER; _SPPPARAMETER_ENGINE.containing_type = _SPPPARAMETER; _V1LAYERPARAMETER.fields_by_name['include'].message_type = _NETSTATERULE _V1LAYERPARAMETER.fields_by_name['exclude'].message_type = _NETSTATERULE _V1LAYERPARAMETER.fields_by_name['type'].enum_type = _V1LAYERPARAMETER_LAYERTYPE _V1LAYERPARAMETER.fields_by_name['blobs'].message_type = _BLOBPROTO _V1LAYERPARAMETER.fields_by_name['blob_share_mode'].enum_type = _V1LAYERPARAMETER_DIMCHECKMODE _V1LAYERPARAMETER.fields_by_name['accuracy_param'].message_type = _ACCURACYPARAMETER _V1LAYERPARAMETER.fields_by_name['argmax_param'].message_type = _ARGMAXPARAMETER _V1LAYERPARAMETER.fields_by_name['concat_param'].message_type = _CONCATPARAMETER _V1LAYERPARAMETER.fields_by_name['contrastive_loss_param'].message_type = _CONTRASTIVELOSSPARAMETER _V1LAYERPARAMETER.fields_by_name['convolution_param'].message_type = _CONVOLUTIONPARAMETER _V1LAYERPARAMETER.fields_by_name['data_param'].message_type = _DATAPARAMETER _V1LAYERPARAMETER.fields_by_name['dropout_param'].message_type = _DROPOUTPARAMETER _V1LAYERPARAMETER.fields_by_name['dummy_data_param'].message_type = _DUMMYDATAPARAMETER _V1LAYERPARAMETER.fields_by_name['eltwise_param'].message_type = _ELTWISEPARAMETER _V1LAYERPARAMETER.fields_by_name['exp_param'].message_type = _EXPPARAMETER _V1LAYERPARAMETER.fields_by_name['hdf5_data_param'].message_type = _HDF5DATAPARAMETER _V1LAYERPARAMETER.fields_by_name['hdf5_output_param'].message_type = _HDF5OUTPUTPARAMETER _V1LAYERPARAMETER.fields_by_name['hinge_loss_param'].message_type = _HINGELOSSPARAMETER _V1LAYERPARAMETER.fields_by_name['image_data_param'].message_type = _IMAGEDATAPARAMETER _V1LAYERPARAMETER.fields_by_name['infogain_loss_param'].message_type = _INFOGAINLOSSPARAMETER _V1LAYERPARAMETER.fields_by_name['inner_product_param'].message_type = _INNERPRODUCTPARAMETER _V1LAYERPARAMETER.fields_by_name['lrn_param'].message_type = _LRNPARAMETER _V1LAYERPARAMETER.fields_by_name['memory_data_param'].message_type = _MEMORYDATAPARAMETER _V1LAYERPARAMETER.fields_by_name['mvn_param'].message_type = _MVNPARAMETER _V1LAYERPARAMETER.fields_by_name['pooling_param'].message_type = _POOLINGPARAMETER _V1LAYERPARAMETER.fields_by_name['power_param'].message_type = _POWERPARAMETER _V1LAYERPARAMETER.fields_by_name['relu_param'].message_type = _RELUPARAMETER _V1LAYERPARAMETER.fields_by_name['sigmoid_param'].message_type = _SIGMOIDPARAMETER _V1LAYERPARAMETER.fields_by_name['softmax_param'].message_type = _SOFTMAXPARAMETER _V1LAYERPARAMETER.fields_by_name['slice_param'].message_type = _SLICEPARAMETER _V1LAYERPARAMETER.fields_by_name['tanh_param'].message_type = _TANHPARAMETER _V1LAYERPARAMETER.fields_by_name['threshold_param'].message_type = _THRESHOLDPARAMETER _V1LAYERPARAMETER.fields_by_name['window_data_param'].message_type = _WINDOWDATAPARAMETER _V1LAYERPARAMETER.fields_by_name['transform_param'].message_type = _TRANSFORMATIONPARAMETER _V1LAYERPARAMETER.fields_by_name['loss_param'].message_type = _LOSSPARAMETER _V1LAYERPARAMETER.fields_by_name['layer'].message_type = _V0LAYERPARAMETER _V1LAYERPARAMETER_LAYERTYPE.containing_type = _V1LAYERPARAMETER; _V1LAYERPARAMETER_DIMCHECKMODE.containing_type = _V1LAYERPARAMETER; _V0LAYERPARAMETER.fields_by_name['weight_filler'].message_type = _FILLERPARAMETER _V0LAYERPARAMETER.fields_by_name['bias_filler'].message_type = _FILLERPARAMETER _V0LAYERPARAMETER.fields_by_name['pool'].enum_type = _V0LAYERPARAMETER_POOLMETHOD _V0LAYERPARAMETER.fields_by_name['blobs'].message_type = _BLOBPROTO _V0LAYERPARAMETER.fields_by_name['hdf5_output_param'].message_type = _HDF5OUTPUTPARAMETER _V0LAYERPARAMETER_POOLMETHOD.containing_type = _V0LAYERPARAMETER; _PRELUPARAMETER.fields_by_name['filler'].message_type = _FILLERPARAMETER DESCRIPTOR.message_types_by_name['BlobShape'] = _BLOBSHAPE DESCRIPTOR.message_types_by_name['BlobProto'] = _BLOBPROTO DESCRIPTOR.message_types_by_name['BlobProtoVector'] = _BLOBPROTOVECTOR DESCRIPTOR.message_types_by_name['Datum'] = _DATUM DESCRIPTOR.message_types_by_name['FillerParameter'] = _FILLERPARAMETER DESCRIPTOR.message_types_by_name['NetParameter'] = _NETPARAMETER DESCRIPTOR.message_types_by_name['SolverParameter'] = _SOLVERPARAMETER DESCRIPTOR.message_types_by_name['SolverState'] = _SOLVERSTATE DESCRIPTOR.message_types_by_name['NetState'] = _NETSTATE DESCRIPTOR.message_types_by_name['NetStateRule'] = _NETSTATERULE DESCRIPTOR.message_types_by_name['ParamSpec'] = _PARAMSPEC DESCRIPTOR.message_types_by_name['LayerParameter'] = _LAYERPARAMETER DESCRIPTOR.message_types_by_name['TransformationParameter'] = _TRANSFORMATIONPARAMETER DESCRIPTOR.message_types_by_name['LossParameter'] = _LOSSPARAMETER DESCRIPTOR.message_types_by_name['AccuracyParameter'] = _ACCURACYPARAMETER DESCRIPTOR.message_types_by_name['ArgMaxParameter'] = _ARGMAXPARAMETER DESCRIPTOR.message_types_by_name['ConcatParameter'] = _CONCATPARAMETER DESCRIPTOR.message_types_by_name['ContrastiveLossParameter'] = _CONTRASTIVELOSSPARAMETER DESCRIPTOR.message_types_by_name['ConvolutionParameter'] = _CONVOLUTIONPARAMETER DESCRIPTOR.message_types_by_name['DataParameter'] = _DATAPARAMETER DESCRIPTOR.message_types_by_name['DropoutParameter'] = _DROPOUTPARAMETER DESCRIPTOR.message_types_by_name['DummyDataParameter'] = _DUMMYDATAPARAMETER DESCRIPTOR.message_types_by_name['EltwiseParameter'] = _ELTWISEPARAMETER DESCRIPTOR.message_types_by_name['ExpParameter'] = _EXPPARAMETER DESCRIPTOR.message_types_by_name['FlattenParameter'] = _FLATTENPARAMETER DESCRIPTOR.message_types_by_name['HDF5DataParameter'] = _HDF5DATAPARAMETER DESCRIPTOR.message_types_by_name['HDF5OutputParameter'] = _HDF5OUTPUTPARAMETER DESCRIPTOR.message_types_by_name['HingeLossParameter'] = _HINGELOSSPARAMETER DESCRIPTOR.message_types_by_name['ImageDataParameter'] = _IMAGEDATAPARAMETER DESCRIPTOR.message_types_by_name['InfogainLossParameter'] = _INFOGAINLOSSPARAMETER DESCRIPTOR.message_types_by_name['InnerProductParameter'] = _INNERPRODUCTPARAMETER DESCRIPTOR.message_types_by_name['LogParameter'] = _LOGPARAMETER DESCRIPTOR.message_types_by_name['LRNParameter'] = _LRNPARAMETER DESCRIPTOR.message_types_by_name['MemoryDataParameter'] = _MEMORYDATAPARAMETER DESCRIPTOR.message_types_by_name['MVNParameter'] = _MVNPARAMETER DESCRIPTOR.message_types_by_name['PoolingParameter'] = _POOLINGPARAMETER DESCRIPTOR.message_types_by_name['PowerParameter'] = _POWERPARAMETER DESCRIPTOR.message_types_by_name['PythonParameter'] = _PYTHONPARAMETER DESCRIPTOR.message_types_by_name['ReductionParameter'] = _REDUCTIONPARAMETER DESCRIPTOR.message_types_by_name['ReLUParameter'] = _RELUPARAMETER DESCRIPTOR.message_types_by_name['ReshapeParameter'] = _RESHAPEPARAMETER DESCRIPTOR.message_types_by_name['SigmoidParameter'] = _SIGMOIDPARAMETER DESCRIPTOR.message_types_by_name['SliceParameter'] = _SLICEPARAMETER DESCRIPTOR.message_types_by_name['SoftmaxParameter'] = _SOFTMAXPARAMETER DESCRIPTOR.message_types_by_name['TanHParameter'] = _TANHPARAMETER DESCRIPTOR.message_types_by_name['ThresholdParameter'] = _THRESHOLDPARAMETER DESCRIPTOR.message_types_by_name['WindowDataParameter'] = _WINDOWDATAPARAMETER DESCRIPTOR.message_types_by_name['SPPParameter'] = _SPPPARAMETER DESCRIPTOR.message_types_by_name['V1LayerParameter'] = _V1LAYERPARAMETER DESCRIPTOR.message_types_by_name['V0LayerParameter'] = _V0LAYERPARAMETER DESCRIPTOR.message_types_by_name['PReLUParameter'] = _PRELUPARAMETER class BlobShape(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _BLOBSHAPE # @@protoc_insertion_point(class_scope:caffe.BlobShape) class BlobProto(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _BLOBPROTO # @@protoc_insertion_point(class_scope:caffe.BlobProto) class BlobProtoVector(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _BLOBPROTOVECTOR # @@protoc_insertion_point(class_scope:caffe.BlobProtoVector) class Datum(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _DATUM # @@protoc_insertion_point(class_scope:caffe.Datum) class FillerParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _FILLERPARAMETER # @@protoc_insertion_point(class_scope:caffe.FillerParameter) class NetParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _NETPARAMETER # @@protoc_insertion_point(class_scope:caffe.NetParameter) class SolverParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _SOLVERPARAMETER # @@protoc_insertion_point(class_scope:caffe.SolverParameter) class SolverState(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _SOLVERSTATE # @@protoc_insertion_point(class_scope:caffe.SolverState) class NetState(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _NETSTATE # @@protoc_insertion_point(class_scope:caffe.NetState) class NetStateRule(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _NETSTATERULE # @@protoc_insertion_point(class_scope:caffe.NetStateRule) class ParamSpec(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _PARAMSPEC # @@protoc_insertion_point(class_scope:caffe.ParamSpec) class LayerParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _LAYERPARAMETER # @@protoc_insertion_point(class_scope:caffe.LayerParameter) class TransformationParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _TRANSFORMATIONPARAMETER # @@protoc_insertion_point(class_scope:caffe.TransformationParameter) class LossParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _LOSSPARAMETER # @@protoc_insertion_point(class_scope:caffe.LossParameter) class AccuracyParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _ACCURACYPARAMETER # @@protoc_insertion_point(class_scope:caffe.AccuracyParameter) class ArgMaxParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _ARGMAXPARAMETER # @@protoc_insertion_point(class_scope:caffe.ArgMaxParameter) class ConcatParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _CONCATPARAMETER # @@protoc_insertion_point(class_scope:caffe.ConcatParameter) class ContrastiveLossParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _CONTRASTIVELOSSPARAMETER # @@protoc_insertion_point(class_scope:caffe.ContrastiveLossParameter) class ConvolutionParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _CONVOLUTIONPARAMETER # @@protoc_insertion_point(class_scope:caffe.ConvolutionParameter) class DataParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _DATAPARAMETER # @@protoc_insertion_point(class_scope:caffe.DataParameter) class DropoutParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _DROPOUTPARAMETER # @@protoc_insertion_point(class_scope:caffe.DropoutParameter) class DummyDataParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _DUMMYDATAPARAMETER # @@protoc_insertion_point(class_scope:caffe.DummyDataParameter) class EltwiseParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _ELTWISEPARAMETER # @@protoc_insertion_point(class_scope:caffe.EltwiseParameter) class ExpParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _EXPPARAMETER # @@protoc_insertion_point(class_scope:caffe.ExpParameter) class FlattenParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _FLATTENPARAMETER # @@protoc_insertion_point(class_scope:caffe.FlattenParameter) class HDF5DataParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _HDF5DATAPARAMETER # @@protoc_insertion_point(class_scope:caffe.HDF5DataParameter) class HDF5OutputParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _HDF5OUTPUTPARAMETER # @@protoc_insertion_point(class_scope:caffe.HDF5OutputParameter) class HingeLossParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _HINGELOSSPARAMETER # @@protoc_insertion_point(class_scope:caffe.HingeLossParameter) class ImageDataParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _IMAGEDATAPARAMETER # @@protoc_insertion_point(class_scope:caffe.ImageDataParameter) class InfogainLossParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _INFOGAINLOSSPARAMETER # @@protoc_insertion_point(class_scope:caffe.InfogainLossParameter) class InnerProductParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _INNERPRODUCTPARAMETER # @@protoc_insertion_point(class_scope:caffe.InnerProductParameter) class LogParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _LOGPARAMETER # @@protoc_insertion_point(class_scope:caffe.LogParameter) class LRNParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _LRNPARAMETER # @@protoc_insertion_point(class_scope:caffe.LRNParameter) class MemoryDataParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _MEMORYDATAPARAMETER # @@protoc_insertion_point(class_scope:caffe.MemoryDataParameter) class MVNParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _MVNPARAMETER # @@protoc_insertion_point(class_scope:caffe.MVNParameter) class PoolingParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _POOLINGPARAMETER # @@protoc_insertion_point(class_scope:caffe.PoolingParameter) class PowerParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _POWERPARAMETER # @@protoc_insertion_point(class_scope:caffe.PowerParameter) class PythonParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _PYTHONPARAMETER # @@protoc_insertion_point(class_scope:caffe.PythonParameter) class ReductionParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _REDUCTIONPARAMETER # @@protoc_insertion_point(class_scope:caffe.ReductionParameter) class ReLUParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _RELUPARAMETER # @@protoc_insertion_point(class_scope:caffe.ReLUParameter) class ReshapeParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _RESHAPEPARAMETER # @@protoc_insertion_point(class_scope:caffe.ReshapeParameter) class SigmoidParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _SIGMOIDPARAMETER # @@protoc_insertion_point(class_scope:caffe.SigmoidParameter) class SliceParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _SLICEPARAMETER # @@protoc_insertion_point(class_scope:caffe.SliceParameter) class SoftmaxParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _SOFTMAXPARAMETER # @@protoc_insertion_point(class_scope:caffe.SoftmaxParameter) class TanHParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _TANHPARAMETER # @@protoc_insertion_point(class_scope:caffe.TanHParameter) class ThresholdParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _THRESHOLDPARAMETER # @@protoc_insertion_point(class_scope:caffe.ThresholdParameter) class WindowDataParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _WINDOWDATAPARAMETER # @@protoc_insertion_point(class_scope:caffe.WindowDataParameter) class SPPParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _SPPPARAMETER # @@protoc_insertion_point(class_scope:caffe.SPPParameter) class V1LayerParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _V1LAYERPARAMETER # @@protoc_insertion_point(class_scope:caffe.V1LayerParameter) class V0LayerParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _V0LAYERPARAMETER # @@protoc_insertion_point(class_scope:caffe.V0LayerParameter) class PReLUParameter(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _PRELUPARAMETER # @@protoc_insertion_point(class_scope:caffe.PReLUParameter) _BLOBSHAPE.fields_by_name['dim'].has_options = True _BLOBSHAPE.fields_by_name['dim']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), '\020\001') _BLOBPROTO.fields_by_name['data'].has_options = True _BLOBPROTO.fields_by_name['data']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), '\020\001') _BLOBPROTO.fields_by_name['diff'].has_options = True _BLOBPROTO.fields_by_name['diff']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), '\020\001') # @@protoc_insertion_point(module_scope)
mit
[ 3, 17065, 701, 314, 4113, 3335, 6365, 14, 221, 3506, 2845, 24981, 1, 199, 3, 1350, 26, 1704, 2026, 14, 2625, 199, 199, 504, 6233, 14, 7204, 14, 4672, 492, 4952, 63, 466, 63, 5029, 199, 504, 6233, 14, 7204, 492, 5872, 465, 485, 4120, 199, 504, 6233, 14, 7204, 492, 1245, 465, 485, 1188, 199, 504, 6233, 14, 7204, 492, 25572, 465, 485, 14906, 199, 504, 6233, 14, 7204, 492, 5872, 63, 3317, 18, 199, 3, 13365, 16311, 63, 14739, 63, 1403, 8, 12775, 9, 6905, 199, 7580, 275, 485, 4120, 14, 23859, 8, 523, 536, 534, 18260, 14, 2625, 297, 523, 2559, 534, 18260, 297, 523, 6380, 63, 3317, 17115, 78, 60, 88, 16, 66, 60, 88, 2766, 60, 88, 2976, 60, 88, 1272, 60, 88, 1272, 60, 88, 2182, 14, 2625, 60, 88, 713, 60, 88, 1717, 60, 88, 2766, 60, 88, 2976, 60, 88, 1272, 60, 88, 1272, 60, 88, 2182, 13356, 88, 17, 67, 60, 78, 60, 84, 16799, 7238, 60, 88, 713, 60, 88, 16, 70, 60, 78, 60, 88, 1644, 60, 88, 772, 1017, 60, 88, 1085, 60, 88, 614, 971, 88, 1644, 2961, 88, 1644, 60, 88, 2260, 60, 88, 996, 60, 88, 709, 60, 88, 614, 13356, 88, 25, 65, 60, 88, 614, 60, 78, 60, 84, 16799, 8548, 60, 88, 713, 60, 88, 17, 70, 60, 78, 60, 88, 1717, 1392, 60, 88, 1085, 60, 88, 1780, 971, 88, 614, 2961, 88, 16, 66, 60, 88, 708, 60, 88, 709, 14, 18260, 14, 16799, 7238, 60, 88, 713, 60, 88, 709, 60, 78, 60, 88, 966, 60, 88, 772, 60, 88, 2976, 502, 60, 88, 1085, 60, 88, 1717, 971, 88, 1644, 2961, 88, 996, 60, 88, 2260, 60, 88, 996, 60, 88, 709, 60, 88, 614, 60, 88, 713, 60, 88, 709, 60, 78, 60, 88, 966, 60, 88, 772, 15126, 60, 88, 1085, 60, 88, 1690, 971, 88, 1644, 2961, 88, 996, 60, 88, 2260, 60, 88, 996, 60, 88, 709, 60, 88, 614, 60, 88, 713, 60, 88, 16, 69, 60, 78, 60, 88, 1644, 1507, 60, 88, 1085, 60, 88, 614, 971, 88, 614, 2961, 88, 1717, 3427, 88, 614, 60, 88, 1216, 60, 88, 713, 60, 88, 969, 60, 78, 60, 88, 2036, 60, 88, 2766, 72, 1723, 83, 60, 88, 1085, 60, 88, 996, 971, 88, 614, 2961, 88, 1717, 3427, 88, 614, 60, 88, 1216, 60, 88, 713, 60, 88, 845, 60, 78, 60, 88, 1690, 3333, 60, 88, 1085, 60, 88, 1644, 971, 88, 614, 2961, 88, 1717, 3427, 88, 614, 60, 88, 1216, 60, 88, 713, 60, 88, 709, 60, 78, 60, 88, 1717, 2063, 60, 88, 1085, 60, 88, 966, 971, 88, 614, 2961, 88, 1717, 3427, 88, 614, 60, 88, 1216, 4451, 18, 60, 78, 60, 88, 16, 70, 60, 88, 2260, 1191, 8548, 3646, 60, 88, 713, 60, 88, 17, 70, 60, 78, 60, 88, 1717, 60, 88, 2789, 1191, 83, 60, 88, 1085, 60, 88, 614, 971, 88, 1644, 2961, 88, 16, 66, 60, 88, 708, 60, 88, 709, 14, 18260, 14, 16799, 8548, 13356, 88, 2835, 60, 88, 614, 60, 78, 60, 88, 1717, 60, 88, 1602, 60, 88, 2976, 84, 453, 60, 88, 713, 60, 88, 709, 60, 78, 60, 88, 2036, 60, 88, 2766, 72, 1723, 83, 60, 88, 1085, 60, 88, 614, 971, 88, 614, 2961, 88, 1717, 60, 88, 713, 60, 88, 16, 69, 60, 78, 60, 88, 1690, 3333, 60, 88, 1085, 60, 88, 996, 971, 88, 614, 2961, 88, 1717, 60, 88, 713, 60, 82, 60, 78, 60, 88, 1717, 2063, 60, 88, 1085, 60, 88, 1644, 971, 88, 614, 2961, 88, 1717, 60, 88, 713, 60, 88, 16, 67, 60, 78, 60, 88, 966, 60, 88, 772, 60, 88, 2976, 502, 60, 88, 1085, 60, 88, 966, 971, 88, 614, 2961, 88, 16, 67, 60, 88, 713, 60, 82, 60, 78, 60, 88, 1717, 1302, 60, 88, 1085, 60, 88, 1717, 971, 88, 614, 2961, 88, 1717, 60, 88, 713, 60, 88, 713, 60, 78, 60, 78, 1609, 63, 576, 60, 88, 1085, 60, 88, 1690, 971, 88, 1644, 2961, 88, 996, 60, 88, 713, 60, 88, 975, 60, 78, 60, 88, 1780, 60, 88, 2182, 78, 15282, 60, 88, 1085, 60, 88, 1780, 971, 88, 614, 2961, 88, 2036, 3427, 88, 1717, 60, 88, 1272, 60, 88, 2976, 76, 261, 13356, 88, 24, 65, 60, 88, 996, 60, 78, 60, 88, 16, 70, 60, 88, 2466, 19576, 4720, 60, 88, 713, 60, 88, 975, 60, 78, 60, 88, 966, 466, 60, 88, 1085, 60, 88, 614, 971, 88, 614, 2961, 84, 3427, 88, 2036, 60, 88, 2766, 265, 4715, 60, 88, 713, 60, 88, 709, 60, 78, 60, 88, 1717, 585, 60, 88, 1085, 60, 88, 996, 971, 88, 614, 2961, 88, 996, 3427, 88, 614, 60, 88, 1216, 60, 88, 713, 60, 88, 16, 69, 60, 78, 60, 88, 1644, 827, 60, 88, 1085, 60, 88, 1644, 971, 88, 614, 2961, 88, 996, 3427, 88, 614, 60, 88, 1216, 60, 88, 713, 60, 88, 16, 69, 60, 78, 60, 88, 1644, 988, 60, 88, 1085, 60, 88, 966, 971, 88, 614, 2961, 88, 996, 3427, 88, 614, 60, 88, 2192, 60, 88, 713, 60, 88, 16, 70, 60, 78, 60, 88, 966, 3670, 60, 88, 1085, 60, 88, 1717, 971, 88, 614, 2961, 88, 996, 3427, 88, 614, 60, 88, 1216, 60, 88, 713, 60, 88, 16, 69, 60, 78, 60, 88, 1644, 1516, 60, 88, 1085, 60, 88, 1690, 971, 88, 614, 2961, 88, 996, 3427, 88, 614, 60, 88, 2192, 60, 88, 713, 60, 88, 713, 60, 78, 60, 88, 1690, 4421, 60, 88, 1085, 60, 88, 1780, 971, 88, 614, 2961, 88, 1717, 3427, 88, 996, 13, 17, 60, 88, 713, 60, 88, 2260, 60, 78, 60, 82, 6221, 63, 4791, 60, 88, 1085, 60, 88, 2036, 971, 88, 614, 2961, 88, 16, 69, 60, 88, 708, 31827, 18260, 14, 13079, 1435, 4720, 14, 31805, 15548, 3427, 88, 1690, 60, 88, 2466, 60, 88, 2953, 46, 63, 568, 4451, 20, 60, 78, 60, 88, 16, 67, 31805, 15548 ]
[ 17065, 701, 314, 4113, 3335, 6365, 14, 221, 3506, 2845, 24981, 1, 199, 3, 1350, 26, 1704, 2026, 14, 2625, 199, 199, 504, 6233, 14, 7204, 14, 4672, 492, 4952, 63, 466, 63, 5029, 199, 504, 6233, 14, 7204, 492, 5872, 465, 485, 4120, 199, 504, 6233, 14, 7204, 492, 1245, 465, 485, 1188, 199, 504, 6233, 14, 7204, 492, 25572, 465, 485, 14906, 199, 504, 6233, 14, 7204, 492, 5872, 63, 3317, 18, 199, 3, 13365, 16311, 63, 14739, 63, 1403, 8, 12775, 9, 6905, 199, 7580, 275, 485, 4120, 14, 23859, 8, 523, 536, 534, 18260, 14, 2625, 297, 523, 2559, 534, 18260, 297, 523, 6380, 63, 3317, 17115, 78, 60, 88, 16, 66, 60, 88, 2766, 60, 88, 2976, 60, 88, 1272, 60, 88, 1272, 60, 88, 2182, 14, 2625, 60, 88, 713, 60, 88, 1717, 60, 88, 2766, 60, 88, 2976, 60, 88, 1272, 60, 88, 1272, 60, 88, 2182, 13356, 88, 17, 67, 60, 78, 60, 84, 16799, 7238, 60, 88, 713, 60, 88, 16, 70, 60, 78, 60, 88, 1644, 60, 88, 772, 1017, 60, 88, 1085, 60, 88, 614, 971, 88, 1644, 2961, 88, 1644, 60, 88, 2260, 60, 88, 996, 60, 88, 709, 60, 88, 614, 13356, 88, 25, 65, 60, 88, 614, 60, 78, 60, 84, 16799, 8548, 60, 88, 713, 60, 88, 17, 70, 60, 78, 60, 88, 1717, 1392, 60, 88, 1085, 60, 88, 1780, 971, 88, 614, 2961, 88, 16, 66, 60, 88, 708, 60, 88, 709, 14, 18260, 14, 16799, 7238, 60, 88, 713, 60, 88, 709, 60, 78, 60, 88, 966, 60, 88, 772, 60, 88, 2976, 502, 60, 88, 1085, 60, 88, 1717, 971, 88, 1644, 2961, 88, 996, 60, 88, 2260, 60, 88, 996, 60, 88, 709, 60, 88, 614, 60, 88, 713, 60, 88, 709, 60, 78, 60, 88, 966, 60, 88, 772, 15126, 60, 88, 1085, 60, 88, 1690, 971, 88, 1644, 2961, 88, 996, 60, 88, 2260, 60, 88, 996, 60, 88, 709, 60, 88, 614, 60, 88, 713, 60, 88, 16, 69, 60, 78, 60, 88, 1644, 1507, 60, 88, 1085, 60, 88, 614, 971, 88, 614, 2961, 88, 1717, 3427, 88, 614, 60, 88, 1216, 60, 88, 713, 60, 88, 969, 60, 78, 60, 88, 2036, 60, 88, 2766, 72, 1723, 83, 60, 88, 1085, 60, 88, 996, 971, 88, 614, 2961, 88, 1717, 3427, 88, 614, 60, 88, 1216, 60, 88, 713, 60, 88, 845, 60, 78, 60, 88, 1690, 3333, 60, 88, 1085, 60, 88, 1644, 971, 88, 614, 2961, 88, 1717, 3427, 88, 614, 60, 88, 1216, 60, 88, 713, 60, 88, 709, 60, 78, 60, 88, 1717, 2063, 60, 88, 1085, 60, 88, 966, 971, 88, 614, 2961, 88, 1717, 3427, 88, 614, 60, 88, 1216, 4451, 18, 60, 78, 60, 88, 16, 70, 60, 88, 2260, 1191, 8548, 3646, 60, 88, 713, 60, 88, 17, 70, 60, 78, 60, 88, 1717, 60, 88, 2789, 1191, 83, 60, 88, 1085, 60, 88, 614, 971, 88, 1644, 2961, 88, 16, 66, 60, 88, 708, 60, 88, 709, 14, 18260, 14, 16799, 8548, 13356, 88, 2835, 60, 88, 614, 60, 78, 60, 88, 1717, 60, 88, 1602, 60, 88, 2976, 84, 453, 60, 88, 713, 60, 88, 709, 60, 78, 60, 88, 2036, 60, 88, 2766, 72, 1723, 83, 60, 88, 1085, 60, 88, 614, 971, 88, 614, 2961, 88, 1717, 60, 88, 713, 60, 88, 16, 69, 60, 78, 60, 88, 1690, 3333, 60, 88, 1085, 60, 88, 996, 971, 88, 614, 2961, 88, 1717, 60, 88, 713, 60, 82, 60, 78, 60, 88, 1717, 2063, 60, 88, 1085, 60, 88, 1644, 971, 88, 614, 2961, 88, 1717, 60, 88, 713, 60, 88, 16, 67, 60, 78, 60, 88, 966, 60, 88, 772, 60, 88, 2976, 502, 60, 88, 1085, 60, 88, 966, 971, 88, 614, 2961, 88, 16, 67, 60, 88, 713, 60, 82, 60, 78, 60, 88, 1717, 1302, 60, 88, 1085, 60, 88, 1717, 971, 88, 614, 2961, 88, 1717, 60, 88, 713, 60, 88, 713, 60, 78, 60, 78, 1609, 63, 576, 60, 88, 1085, 60, 88, 1690, 971, 88, 1644, 2961, 88, 996, 60, 88, 713, 60, 88, 975, 60, 78, 60, 88, 1780, 60, 88, 2182, 78, 15282, 60, 88, 1085, 60, 88, 1780, 971, 88, 614, 2961, 88, 2036, 3427, 88, 1717, 60, 88, 1272, 60, 88, 2976, 76, 261, 13356, 88, 24, 65, 60, 88, 996, 60, 78, 60, 88, 16, 70, 60, 88, 2466, 19576, 4720, 60, 88, 713, 60, 88, 975, 60, 78, 60, 88, 966, 466, 60, 88, 1085, 60, 88, 614, 971, 88, 614, 2961, 84, 3427, 88, 2036, 60, 88, 2766, 265, 4715, 60, 88, 713, 60, 88, 709, 60, 78, 60, 88, 1717, 585, 60, 88, 1085, 60, 88, 996, 971, 88, 614, 2961, 88, 996, 3427, 88, 614, 60, 88, 1216, 60, 88, 713, 60, 88, 16, 69, 60, 78, 60, 88, 1644, 827, 60, 88, 1085, 60, 88, 1644, 971, 88, 614, 2961, 88, 996, 3427, 88, 614, 60, 88, 1216, 60, 88, 713, 60, 88, 16, 69, 60, 78, 60, 88, 1644, 988, 60, 88, 1085, 60, 88, 966, 971, 88, 614, 2961, 88, 996, 3427, 88, 614, 60, 88, 2192, 60, 88, 713, 60, 88, 16, 70, 60, 78, 60, 88, 966, 3670, 60, 88, 1085, 60, 88, 1717, 971, 88, 614, 2961, 88, 996, 3427, 88, 614, 60, 88, 1216, 60, 88, 713, 60, 88, 16, 69, 60, 78, 60, 88, 1644, 1516, 60, 88, 1085, 60, 88, 1690, 971, 88, 614, 2961, 88, 996, 3427, 88, 614, 60, 88, 2192, 60, 88, 713, 60, 88, 713, 60, 78, 60, 88, 1690, 4421, 60, 88, 1085, 60, 88, 1780, 971, 88, 614, 2961, 88, 1717, 3427, 88, 996, 13, 17, 60, 88, 713, 60, 88, 2260, 60, 78, 60, 82, 6221, 63, 4791, 60, 88, 1085, 60, 88, 2036, 971, 88, 614, 2961, 88, 16, 69, 60, 88, 708, 31827, 18260, 14, 13079, 1435, 4720, 14, 31805, 15548, 3427, 88, 1690, 60, 88, 2466, 60, 88, 2953, 46, 63, 568, 4451, 20, 60, 78, 60, 88, 16, 67, 31805, 15548, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
zenodo/invenio
invenio/legacy/webalert/htmlparser.py
11
6799
# This file is part of Invenio. # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 CERN. # # Invenio is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # Invenio is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Invenio; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """HTML parser for records.""" __revision__ = "$Id$" import re from HTMLParser import HTMLParser import textwrap from six.moves import html_entities from invenio.config import \ CFG_WEBALERT_MAX_NUM_OF_CHARS_PER_LINE_IN_ALERT_EMAIL, \ CFG_SITE_LANG from invenio.modules.formatter import format_record from invenio.utils.html import remove_html_markup from invenio.base.i18n import gettext_set_language whitespaces_pattern = re.compile(r'[ \t]+') def wrap(text): """Limits the number of characters per line in given text. The function does not preserve new lines. """ lines = textwrap.wrap(text, CFG_WEBALERT_MAX_NUM_OF_CHARS_PER_LINE_IN_ALERT_EMAIL) r = '' for l in lines: r += l + '\n' return r def wrap_records(text): """Limits the number of characters per line in given text. The function preserves new lines. """ lines = text.split('\n') result_lines = [] for l in lines: newlines = textwrap.wrap(l, CFG_WEBALERT_MAX_NUM_OF_CHARS_PER_LINE_IN_ALERT_EMAIL) for ll in newlines: result_lines.append(ll) return '\n'.join(result_lines) class RecordHTMLParser(HTMLParser): """A parser for the HTML returned by invenio.legacy.search_engine.print_record. The parser provides methods to transform the HTML returned by invenio.legacy.search_engine.print_record into plain text, with some minor formatting. """ silent = False new_line = True # Are we at the beginning of a new line? (after # <br/>, </p> or at the beginning of the text) def __init__(self): HTMLParser.__init__(self) self.result = '' def handle_starttag(self, tag, attrs): if tag == 'strong': # self.result += '*' pass elif tag == 'a': self.printURL = 0 self.unclosedBracket = 0 for f in attrs: #if f[1] == 'note': # self.result += 'Fulltext : <' # self.unclosedBracket = 1 if f[1] == 'moreinfo': self.result += 'Detailed record : ' self.printURL = 1 if (self.printURL == 1) and (f[0] == 'href'): self.result += '<' + f[1] + '>' elif tag == 'br': self.result += '\n' elif tag == 'style' or tag == 'script': self.silent = True elif tag == 'p': if not self.new_line: self.result += '\n' self.new_line = True def handle_startendtag(self, tag, attrs): if tag == 'br': self.result += '\n' self.new_line = True def handle_endtag(self, tag): if tag == 'strong': # self.result += '\n' pass elif tag == 'a': if self.unclosedBracket == 1: self.result += '>' self.unclosedBracket = 0 elif tag == 'style' or tag == 'script': self.silent = False elif tag == 'p': self.result += '\n' self.new_line = True def handle_data(self, data): if data.lower() in ['detailed record', 'similar record', 'cited by']: pass elif self.silent == False: if self.new_line: # Remove unnecessary trailing whitespace at the # beginning of a line data = data.lstrip() # Merge all consecutive whitespaces into a single one self.result += data self.new_line = False def handle_comment(self, data): if 'START_NOT_FOR_TEXT' == data.upper().strip(): self.silent = True elif 'END_NOT_FOR_TEXT' == data.upper().strip(): self.silent = False def handle_charref(self, name): """Process character references of the form "&#ref;". Transform to text whenever possible.""" try: self.result += unichr(int(name)).encode("utf-8") except: return def handle_entityref(self, name): """Process a general entity reference of the form "&name;". Transform to text whenever possible.""" if name == 'nbsp': # Keep them for the moment. Will be processed at the end. # It is needed to consider them separately, as all # consecutive whitespaces will be merged into a single one # at the end. It should not be the case of non breakable # space. Note that because of this trick, input # &amp;nbsp; will be considered as a &nbsp; self.result += '&nbsp;' return char_code = html_entities.name2codepoint.get(name, None) if char_code is not None: try: self.result += unichr(char_code).encode("utf-8") except: return def get_as_text(record_id=0, xml_record=None, ln=CFG_SITE_LANG): """Return the record in a textual format""" _ = gettext_set_language(ln) out = "" if record_id != 0: rec_in_hb = format_record(record_id, of="hb") elif xml_record: rec_in_hb = format_record(0, of="hb", xml_record=xml_record) rec_in_hb = rec_in_hb.replace('\n', ' ') htparser = RecordHTMLParser() try: htparser.feed(rec_in_hb) htparser.close() out = htparser.result except: out = remove_html_markup(rec_in_hb) # Remove trailing whitespace and linefeeds out = out.strip('\n').strip() # Merge consecutive whitespaces. Must be done here, once all HTML # tags have been removed out = whitespaces_pattern.sub(' ', out) # Now consider non-breakable spaces out = out.replace('&nbsp;', ' ') out = re.sub(r"[\-:]?\s*%s\s*[\-:]?" % _("Detailed record"), "", out) out = re.sub(r"[\-:]?\s*%s\s*[\-:]?" % _("Similar records"), "", out) out = re.sub(r"[\-:]?\s*%s\s*[\-:]?" % _("Cited by"), "", out) return out.strip()
gpl-2.0
[ 3, 961, 570, 365, 1777, 402, 12235, 14, 199, 3, 1898, 334, 35, 9, 13004, 12, 8353, 12, 11811, 12, 8315, 12, 10219, 12, 9079, 12, 8937, 12, 7129, 12, 7760, 24354, 14, 199, 3, 199, 3, 12235, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 199, 3, 2811, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 199, 3, 3267, 701, 314, 2868, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 199, 3, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 12235, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 199, 3, 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, 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, 12235, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 2752, 12, 3277, 2020, 199, 3, 8155, 15630, 10902, 12, 14453, 13540, 12, 8226, 12, 4828, 15673, 13, 13421, 12, 8217, 14, 199, 199, 624, 4943, 1798, 367, 5767, 1041, 199, 199, 363, 5792, 363, 275, 7880, 1304, 17351, 199, 199, 646, 295, 199, 504, 24581, 492, 24581, 199, 646, 13390, 199, 504, 3816, 14, 4912, 492, 3517, 63, 8327, 199, 199, 504, 13640, 14, 888, 492, 971, 1362, 10974, 63, 13166, 748, 5397, 63, 4283, 63, 7125, 63, 3359, 63, 16326, 63, 4227, 63, 6174, 63, 568, 63, 748, 5397, 63, 10089, 12, 971, 1362, 10974, 63, 7917, 63, 7442, 199, 504, 13640, 14, 3112, 14, 8911, 492, 1475, 63, 3059, 199, 504, 13640, 14, 1208, 14, 1360, 492, 2813, 63, 1360, 63, 10131, 199, 504, 13640, 14, 1095, 14, 73, 1085, 78, 492, 9796, 63, 409, 63, 3671, 199, 199, 2191, 31926, 63, 3401, 275, 295, 14, 2014, 8, 82, 3894, 971, 84, 2807, 358, 199, 199, 318, 4816, 8, 505, 304, 272, 408, 24480, 314, 1329, 402, 4110, 1126, 1004, 315, 1627, 1318, 14, 272, 710, 805, 1630, 440, 11211, 892, 2385, 14, 272, 408, 272, 2385, 275, 13390, 14, 3823, 8, 505, 12, 10974, 63, 13166, 748, 5397, 63, 4283, 63, 7125, 63, 3359, 63, 16326, 63, 4227, 63, 6174, 63, 568, 63, 748, 5397, 63, 10089, 9, 272, 519, 275, 2125, 272, 367, 634, 315, 2385, 26, 267, 519, 847, 634, 435, 1557, 78, 7, 272, 372, 519, 199, 199, 318, 4816, 63, 6502, 8, 505, 304, 272, 408, 24480, 314, 1329, 402, 4110, 1126, 1004, 315, 1627, 1318, 14, 272, 710, 805, 876, 20603, 892, 2385, 14, 272, 408, 272, 2385, 275, 1318, 14, 1294, 2258, 78, 358, 272, 754, 63, 1278, 275, 942, 272, 367, 634, 315, 2385, 26, 267, 14930, 275, 13390, 14, 3823, 8, 76, 12, 10974, 63, 13166, 748, 5397, 63, 4283, 63, 7125, 63, 3359, 63, 16326, 63, 4227, 63, 6174, 63, 568, 63, 748, 5397, 63, 10089, 9, 267, 367, 18338, 315, 14930, 26, 288, 754, 63, 1278, 14, 740, 8, 914, 9, 272, 372, 1557, 78, 1370, 904, 8, 1099, 63, 1278, 9, 199, 199, 533, 12651, 27375, 8, 27375, 304, 272, 408, 33, 1798, 367, 314, 4163, 2138, 701, 13640, 14, 10000, 14, 1733, 63, 3908, 14, 1361, 63, 3059, 14, 339, 710, 1798, 6571, 3102, 370, 5793, 314, 4163, 2138, 701, 272, 13640, 14, 10000, 14, 1733, 63, 3908, 14, 1361, 63, 3059, 1901, 8971, 1318, 12, 543, 2005, 272, 12612, 10803, 14, 272, 408, 339, 10866, 275, 756, 272, 892, 63, 604, 275, 715, 327, 23889, 781, 737, 314, 9608, 402, 282, 892, 1004, 31, 334, 4399, 490, 327, 665, 3289, 3133, 12, 3068, 80, 30, 503, 737, 314, 9608, 402, 314, 1318, 9, 339, 347, 636, 826, 721, 277, 304, 267, 24581, 855, 826, 721, 277, 9, 267, 291, 14, 1099, 275, 2125, 339, 347, 2429, 63, 15234, 8, 277, 12, 1947, 12, 3290, 304, 267, 340, 1947, 508, 283, 9370, 356, 288, 327, 291, 14, 1099, 847, 13626, 288, 986, 267, 916, 1947, 508, 283, 65, 356, 288, 291, 14, 1361, 2632, 275, 378, 288, 291, 14, 1097, 320, 939, 29418, 275, 378, 288, 367, 289, 315, 3290, 26, 355, 327, 692, 289, 59, 17, 61, 508, 283, 4610, 356, 355, 327, 259, 291, 14, 1099, 847, 283, 9042, 505, 520, 665, 7, 355, 327, 259, 291, 14, 1097, 320, 939, 29418, 275, 413, 355, 340, 289, 59, 17, 61, 508, 283, 6878, 815, 356, 490, 291, 14, 1099, 847, 283, 36, 1841, 1672, 2777, 520, 283, 490, 291, 14, 1361, 2632, 275, 413, 355, 340, 334, 277, 14, 1361, 2632, 508, 413, 9, 436, 334, 70, 59, 16, 61, 508, 283, 6399, 735, 490, 291, 14, 1099, 847, 24958, 435, 289, 59, 17, 61, 435, 21770, 267, 916, 1947, 508, 283, 3289, 356, 288, 291, 14, 1099, 847, 1557, 78, 7, 267, 916, 1947, 508, 283, 2487, 7, 503, 1947, 508, 283, 1579, 356, 288, 291, 14, 14434, 275, 715, 267, 916, 1947, 508, 283, 80, 356, 288, 340, 440, 291, 14, 1222, 63, 604, 26, 355, 291, 14, 1099, 847, 1557, 78, 7, 355, 291, 14, 1222, 63, 604, 275, 715, 339, 347, 2429, 63, 7848, 7169, 1450, 8, 277, 12, 1947, 12, 3290, 304, 267, 340, 1947, 508, 283, 3289, 356, 288, 291, 14, 1099, 847, 1557, 78, 7, 288, 291, 14, 1222, 63, 604, 275, 715, 339, 347, 2429, 63, 25765, 8, 277, 12, 1947, 304, 267, 340, 1947, 508, 283, 9370, 356, 288, 327, 291, 14, 1099, 847, 1557, 78, 7, 288, 986, 267, 916, 1947, 508, 283, 65, 356, 288, 340, 291, 14, 1097, 320, 939, 29418, 508, 413, 26, 355, 291, 14, 1099, 847, 21770, 355, 291, 14, 1097, 320, 939, 29418, 275, 378, 267, 916, 1947, 508, 283, 2487, 7, 503, 1947, 508, 283, 1579, 356, 288, 291, 14, 14434, 275, 756, 267, 916, 1947, 508, 283, 80, 356, 288, 291, 14, 1099, 847, 1557, 78, 7, 288, 291, 14, 1222, 63, 604, 275, 715, 339, 347, 2429, 63, 576, 8, 277, 12, 666, 304 ]
[ 961, 570, 365, 1777, 402, 12235, 14, 199, 3, 1898, 334, 35, 9, 13004, 12, 8353, 12, 11811, 12, 8315, 12, 10219, 12, 9079, 12, 8937, 12, 7129, 12, 7760, 24354, 14, 199, 3, 199, 3, 12235, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 199, 3, 2811, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 199, 3, 3267, 701, 314, 2868, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 199, 3, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 12235, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 199, 3, 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, 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, 12235, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 2752, 12, 3277, 2020, 199, 3, 8155, 15630, 10902, 12, 14453, 13540, 12, 8226, 12, 4828, 15673, 13, 13421, 12, 8217, 14, 199, 199, 624, 4943, 1798, 367, 5767, 1041, 199, 199, 363, 5792, 363, 275, 7880, 1304, 17351, 199, 199, 646, 295, 199, 504, 24581, 492, 24581, 199, 646, 13390, 199, 504, 3816, 14, 4912, 492, 3517, 63, 8327, 199, 199, 504, 13640, 14, 888, 492, 971, 1362, 10974, 63, 13166, 748, 5397, 63, 4283, 63, 7125, 63, 3359, 63, 16326, 63, 4227, 63, 6174, 63, 568, 63, 748, 5397, 63, 10089, 12, 971, 1362, 10974, 63, 7917, 63, 7442, 199, 504, 13640, 14, 3112, 14, 8911, 492, 1475, 63, 3059, 199, 504, 13640, 14, 1208, 14, 1360, 492, 2813, 63, 1360, 63, 10131, 199, 504, 13640, 14, 1095, 14, 73, 1085, 78, 492, 9796, 63, 409, 63, 3671, 199, 199, 2191, 31926, 63, 3401, 275, 295, 14, 2014, 8, 82, 3894, 971, 84, 2807, 358, 199, 199, 318, 4816, 8, 505, 304, 272, 408, 24480, 314, 1329, 402, 4110, 1126, 1004, 315, 1627, 1318, 14, 272, 710, 805, 1630, 440, 11211, 892, 2385, 14, 272, 408, 272, 2385, 275, 13390, 14, 3823, 8, 505, 12, 10974, 63, 13166, 748, 5397, 63, 4283, 63, 7125, 63, 3359, 63, 16326, 63, 4227, 63, 6174, 63, 568, 63, 748, 5397, 63, 10089, 9, 272, 519, 275, 2125, 272, 367, 634, 315, 2385, 26, 267, 519, 847, 634, 435, 1557, 78, 7, 272, 372, 519, 199, 199, 318, 4816, 63, 6502, 8, 505, 304, 272, 408, 24480, 314, 1329, 402, 4110, 1126, 1004, 315, 1627, 1318, 14, 272, 710, 805, 876, 20603, 892, 2385, 14, 272, 408, 272, 2385, 275, 1318, 14, 1294, 2258, 78, 358, 272, 754, 63, 1278, 275, 942, 272, 367, 634, 315, 2385, 26, 267, 14930, 275, 13390, 14, 3823, 8, 76, 12, 10974, 63, 13166, 748, 5397, 63, 4283, 63, 7125, 63, 3359, 63, 16326, 63, 4227, 63, 6174, 63, 568, 63, 748, 5397, 63, 10089, 9, 267, 367, 18338, 315, 14930, 26, 288, 754, 63, 1278, 14, 740, 8, 914, 9, 272, 372, 1557, 78, 1370, 904, 8, 1099, 63, 1278, 9, 199, 199, 533, 12651, 27375, 8, 27375, 304, 272, 408, 33, 1798, 367, 314, 4163, 2138, 701, 13640, 14, 10000, 14, 1733, 63, 3908, 14, 1361, 63, 3059, 14, 339, 710, 1798, 6571, 3102, 370, 5793, 314, 4163, 2138, 701, 272, 13640, 14, 10000, 14, 1733, 63, 3908, 14, 1361, 63, 3059, 1901, 8971, 1318, 12, 543, 2005, 272, 12612, 10803, 14, 272, 408, 339, 10866, 275, 756, 272, 892, 63, 604, 275, 715, 327, 23889, 781, 737, 314, 9608, 402, 282, 892, 1004, 31, 334, 4399, 490, 327, 665, 3289, 3133, 12, 3068, 80, 30, 503, 737, 314, 9608, 402, 314, 1318, 9, 339, 347, 636, 826, 721, 277, 304, 267, 24581, 855, 826, 721, 277, 9, 267, 291, 14, 1099, 275, 2125, 339, 347, 2429, 63, 15234, 8, 277, 12, 1947, 12, 3290, 304, 267, 340, 1947, 508, 283, 9370, 356, 288, 327, 291, 14, 1099, 847, 13626, 288, 986, 267, 916, 1947, 508, 283, 65, 356, 288, 291, 14, 1361, 2632, 275, 378, 288, 291, 14, 1097, 320, 939, 29418, 275, 378, 288, 367, 289, 315, 3290, 26, 355, 327, 692, 289, 59, 17, 61, 508, 283, 4610, 356, 355, 327, 259, 291, 14, 1099, 847, 283, 9042, 505, 520, 665, 7, 355, 327, 259, 291, 14, 1097, 320, 939, 29418, 275, 413, 355, 340, 289, 59, 17, 61, 508, 283, 6878, 815, 356, 490, 291, 14, 1099, 847, 283, 36, 1841, 1672, 2777, 520, 283, 490, 291, 14, 1361, 2632, 275, 413, 355, 340, 334, 277, 14, 1361, 2632, 508, 413, 9, 436, 334, 70, 59, 16, 61, 508, 283, 6399, 735, 490, 291, 14, 1099, 847, 24958, 435, 289, 59, 17, 61, 435, 21770, 267, 916, 1947, 508, 283, 3289, 356, 288, 291, 14, 1099, 847, 1557, 78, 7, 267, 916, 1947, 508, 283, 2487, 7, 503, 1947, 508, 283, 1579, 356, 288, 291, 14, 14434, 275, 715, 267, 916, 1947, 508, 283, 80, 356, 288, 340, 440, 291, 14, 1222, 63, 604, 26, 355, 291, 14, 1099, 847, 1557, 78, 7, 355, 291, 14, 1222, 63, 604, 275, 715, 339, 347, 2429, 63, 7848, 7169, 1450, 8, 277, 12, 1947, 12, 3290, 304, 267, 340, 1947, 508, 283, 3289, 356, 288, 291, 14, 1099, 847, 1557, 78, 7, 288, 291, 14, 1222, 63, 604, 275, 715, 339, 347, 2429, 63, 25765, 8, 277, 12, 1947, 304, 267, 340, 1947, 508, 283, 9370, 356, 288, 327, 291, 14, 1099, 847, 1557, 78, 7, 288, 986, 267, 916, 1947, 508, 283, 65, 356, 288, 340, 291, 14, 1097, 320, 939, 29418, 508, 413, 26, 355, 291, 14, 1099, 847, 21770, 355, 291, 14, 1097, 320, 939, 29418, 275, 378, 267, 916, 1947, 508, 283, 2487, 7, 503, 1947, 508, 283, 1579, 356, 288, 291, 14, 14434, 275, 756, 267, 916, 1947, 508, 283, 80, 356, 288, 291, 14, 1099, 847, 1557, 78, 7, 288, 291, 14, 1222, 63, 604, 275, 715, 339, 347, 2429, 63, 576, 8, 277, 12, 666, 304, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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 ]
BFriedland/UserDataBase-Heroku
venv/Lib/encodings/hp_roman8.py
134
13447
""" Python Character Mapping Codec generated from 'hp_roman8.txt' with gencodec.py. Based on data from ftp://dkuug.dk/i18n/charmaps/HP-ROMAN8 (Keld Simonsen) Original source: LaserJet IIP Printer User's Manual HP part no 33471-90901, Hewlet-Packard, June 1989. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_table) def decode(self,input,errors='strict'): return codecs.charmap_decode(input,errors,decoding_table) class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input, final=False): return codecs.charmap_encode(input,self.errors,encoding_table)[0] class IncrementalDecoder(codecs.IncrementalDecoder): def decode(self, input, final=False): return codecs.charmap_decode(input,self.errors,decoding_table)[0] class StreamWriter(Codec,codecs.StreamWriter): pass class StreamReader(Codec,codecs.StreamReader): pass ### encodings module API def getregentry(): return codecs.CodecInfo( name='hp-roman8', encode=Codec().encode, decode=Codec().decode, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamwriter=StreamWriter, streamreader=StreamReader, ) ### Decoding Table decoding_table = ( '\x00' # 0x00 -> NULL '\x01' # 0x01 -> START OF HEADING '\x02' # 0x02 -> START OF TEXT '\x03' # 0x03 -> END OF TEXT '\x04' # 0x04 -> END OF TRANSMISSION '\x05' # 0x05 -> ENQUIRY '\x06' # 0x06 -> ACKNOWLEDGE '\x07' # 0x07 -> BELL '\x08' # 0x08 -> BACKSPACE '\t' # 0x09 -> HORIZONTAL TABULATION '\n' # 0x0A -> LINE FEED '\x0b' # 0x0B -> VERTICAL TABULATION '\x0c' # 0x0C -> FORM FEED '\r' # 0x0D -> CARRIAGE RETURN '\x0e' # 0x0E -> SHIFT OUT '\x0f' # 0x0F -> SHIFT IN '\x10' # 0x10 -> DATA LINK ESCAPE '\x11' # 0x11 -> DEVICE CONTROL ONE '\x12' # 0x12 -> DEVICE CONTROL TWO '\x13' # 0x13 -> DEVICE CONTROL THREE '\x14' # 0x14 -> DEVICE CONTROL FOUR '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE '\x16' # 0x16 -> SYNCHRONOUS IDLE '\x17' # 0x17 -> END OF TRANSMISSION BLOCK '\x18' # 0x18 -> CANCEL '\x19' # 0x19 -> END OF MEDIUM '\x1a' # 0x1A -> SUBSTITUTE '\x1b' # 0x1B -> ESCAPE '\x1c' # 0x1C -> FILE SEPARATOR '\x1d' # 0x1D -> GROUP SEPARATOR '\x1e' # 0x1E -> RECORD SEPARATOR '\x1f' # 0x1F -> UNIT SEPARATOR ' ' # 0x20 -> SPACE '!' # 0x21 -> EXCLAMATION MARK '"' # 0x22 -> QUOTATION MARK '#' # 0x23 -> NUMBER SIGN '$' # 0x24 -> DOLLAR SIGN '%' # 0x25 -> PERCENT SIGN '&' # 0x26 -> AMPERSAND "'" # 0x27 -> APOSTROPHE '(' # 0x28 -> LEFT PARENTHESIS ')' # 0x29 -> RIGHT PARENTHESIS '*' # 0x2A -> ASTERISK '+' # 0x2B -> PLUS SIGN ',' # 0x2C -> COMMA '-' # 0x2D -> HYPHEN-MINUS '.' # 0x2E -> FULL STOP '/' # 0x2F -> SOLIDUS '0' # 0x30 -> DIGIT ZERO '1' # 0x31 -> DIGIT ONE '2' # 0x32 -> DIGIT TWO '3' # 0x33 -> DIGIT THREE '4' # 0x34 -> DIGIT FOUR '5' # 0x35 -> DIGIT FIVE '6' # 0x36 -> DIGIT SIX '7' # 0x37 -> DIGIT SEVEN '8' # 0x38 -> DIGIT EIGHT '9' # 0x39 -> DIGIT NINE ':' # 0x3A -> COLON ';' # 0x3B -> SEMICOLON '<' # 0x3C -> LESS-THAN SIGN '=' # 0x3D -> EQUALS SIGN '>' # 0x3E -> GREATER-THAN SIGN '?' # 0x3F -> QUESTION MARK '@' # 0x40 -> COMMERCIAL AT 'A' # 0x41 -> LATIN CAPITAL LETTER A 'B' # 0x42 -> LATIN CAPITAL LETTER B 'C' # 0x43 -> LATIN CAPITAL LETTER C 'D' # 0x44 -> LATIN CAPITAL LETTER D 'E' # 0x45 -> LATIN CAPITAL LETTER E 'F' # 0x46 -> LATIN CAPITAL LETTER F 'G' # 0x47 -> LATIN CAPITAL LETTER G 'H' # 0x48 -> LATIN CAPITAL LETTER H 'I' # 0x49 -> LATIN CAPITAL LETTER I 'J' # 0x4A -> LATIN CAPITAL LETTER J 'K' # 0x4B -> LATIN CAPITAL LETTER K 'L' # 0x4C -> LATIN CAPITAL LETTER L 'M' # 0x4D -> LATIN CAPITAL LETTER M 'N' # 0x4E -> LATIN CAPITAL LETTER N 'O' # 0x4F -> LATIN CAPITAL LETTER O 'P' # 0x50 -> LATIN CAPITAL LETTER P 'Q' # 0x51 -> LATIN CAPITAL LETTER Q 'R' # 0x52 -> LATIN CAPITAL LETTER R 'S' # 0x53 -> LATIN CAPITAL LETTER S 'T' # 0x54 -> LATIN CAPITAL LETTER T 'U' # 0x55 -> LATIN CAPITAL LETTER U 'V' # 0x56 -> LATIN CAPITAL LETTER V 'W' # 0x57 -> LATIN CAPITAL LETTER W 'X' # 0x58 -> LATIN CAPITAL LETTER X 'Y' # 0x59 -> LATIN CAPITAL LETTER Y 'Z' # 0x5A -> LATIN CAPITAL LETTER Z '[' # 0x5B -> LEFT SQUARE BRACKET '\\' # 0x5C -> REVERSE SOLIDUS ']' # 0x5D -> RIGHT SQUARE BRACKET '^' # 0x5E -> CIRCUMFLEX ACCENT '_' # 0x5F -> LOW LINE '`' # 0x60 -> GRAVE ACCENT 'a' # 0x61 -> LATIN SMALL LETTER A 'b' # 0x62 -> LATIN SMALL LETTER B 'c' # 0x63 -> LATIN SMALL LETTER C 'd' # 0x64 -> LATIN SMALL LETTER D 'e' # 0x65 -> LATIN SMALL LETTER E 'f' # 0x66 -> LATIN SMALL LETTER F 'g' # 0x67 -> LATIN SMALL LETTER G 'h' # 0x68 -> LATIN SMALL LETTER H 'i' # 0x69 -> LATIN SMALL LETTER I 'j' # 0x6A -> LATIN SMALL LETTER J 'k' # 0x6B -> LATIN SMALL LETTER K 'l' # 0x6C -> LATIN SMALL LETTER L 'm' # 0x6D -> LATIN SMALL LETTER M 'n' # 0x6E -> LATIN SMALL LETTER N 'o' # 0x6F -> LATIN SMALL LETTER O 'p' # 0x70 -> LATIN SMALL LETTER P 'q' # 0x71 -> LATIN SMALL LETTER Q 'r' # 0x72 -> LATIN SMALL LETTER R 's' # 0x73 -> LATIN SMALL LETTER S 't' # 0x74 -> LATIN SMALL LETTER T 'u' # 0x75 -> LATIN SMALL LETTER U 'v' # 0x76 -> LATIN SMALL LETTER V 'w' # 0x77 -> LATIN SMALL LETTER W 'x' # 0x78 -> LATIN SMALL LETTER X 'y' # 0x79 -> LATIN SMALL LETTER Y 'z' # 0x7A -> LATIN SMALL LETTER Z '{' # 0x7B -> LEFT CURLY BRACKET '|' # 0x7C -> VERTICAL LINE '}' # 0x7D -> RIGHT CURLY BRACKET '~' # 0x7E -> TILDE '\x7f' # 0x7F -> DELETE '\x80' # 0x80 -> <control> '\x81' # 0x81 -> <control> '\x82' # 0x82 -> <control> '\x83' # 0x83 -> <control> '\x84' # 0x84 -> <control> '\x85' # 0x85 -> <control> '\x86' # 0x86 -> <control> '\x87' # 0x87 -> <control> '\x88' # 0x88 -> <control> '\x89' # 0x89 -> <control> '\x8a' # 0x8A -> <control> '\x8b' # 0x8B -> <control> '\x8c' # 0x8C -> <control> '\x8d' # 0x8D -> <control> '\x8e' # 0x8E -> <control> '\x8f' # 0x8F -> <control> '\x90' # 0x90 -> <control> '\x91' # 0x91 -> <control> '\x92' # 0x92 -> <control> '\x93' # 0x93 -> <control> '\x94' # 0x94 -> <control> '\x95' # 0x95 -> <control> '\x96' # 0x96 -> <control> '\x97' # 0x97 -> <control> '\x98' # 0x98 -> <control> '\x99' # 0x99 -> <control> '\x9a' # 0x9A -> <control> '\x9b' # 0x9B -> <control> '\x9c' # 0x9C -> <control> '\x9d' # 0x9D -> <control> '\x9e' # 0x9E -> <control> '\x9f' # 0x9F -> <control> '\xa0' # 0xA0 -> NO-BREAK SPACE '\xc0' # 0xA1 -> LATIN CAPITAL LETTER A WITH GRAVE '\xc2' # 0xA2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX '\xc8' # 0xA3 -> LATIN CAPITAL LETTER E WITH GRAVE '\xca' # 0xA4 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX '\xcb' # 0xA5 -> LATIN CAPITAL LETTER E WITH DIAERESIS '\xce' # 0xA6 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX '\xcf' # 0xA7 -> LATIN CAPITAL LETTER I WITH DIAERESIS '\xb4' # 0xA8 -> ACUTE ACCENT '\u02cb' # 0xA9 -> MODIFIER LETTER GRAVE ACCENT (MANDARIN CHINESE FOURTH TONE) '\u02c6' # 0xAA -> MODIFIER LETTER CIRCUMFLEX ACCENT '\xa8' # 0xAB -> DIAERESIS '\u02dc' # 0xAC -> SMALL TILDE '\xd9' # 0xAD -> LATIN CAPITAL LETTER U WITH GRAVE '\xdb' # 0xAE -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX '\u20a4' # 0xAF -> LIRA SIGN '\xaf' # 0xB0 -> MACRON '\xdd' # 0xB1 -> LATIN CAPITAL LETTER Y WITH ACUTE '\xfd' # 0xB2 -> LATIN SMALL LETTER Y WITH ACUTE '\xb0' # 0xB3 -> DEGREE SIGN '\xc7' # 0xB4 -> LATIN CAPITAL LETTER C WITH CEDILLA '\xe7' # 0xB5 -> LATIN SMALL LETTER C WITH CEDILLA '\xd1' # 0xB6 -> LATIN CAPITAL LETTER N WITH TILDE '\xf1' # 0xB7 -> LATIN SMALL LETTER N WITH TILDE '\xa1' # 0xB8 -> INVERTED EXCLAMATION MARK '\xbf' # 0xB9 -> INVERTED QUESTION MARK '\xa4' # 0xBA -> CURRENCY SIGN '\xa3' # 0xBB -> POUND SIGN '\xa5' # 0xBC -> YEN SIGN '\xa7' # 0xBD -> SECTION SIGN '\u0192' # 0xBE -> LATIN SMALL LETTER F WITH HOOK '\xa2' # 0xBF -> CENT SIGN '\xe2' # 0xC0 -> LATIN SMALL LETTER A WITH CIRCUMFLEX '\xea' # 0xC1 -> LATIN SMALL LETTER E WITH CIRCUMFLEX '\xf4' # 0xC2 -> LATIN SMALL LETTER O WITH CIRCUMFLEX '\xfb' # 0xC3 -> LATIN SMALL LETTER U WITH CIRCUMFLEX '\xe1' # 0xC4 -> LATIN SMALL LETTER A WITH ACUTE '\xe9' # 0xC5 -> LATIN SMALL LETTER E WITH ACUTE '\xf3' # 0xC6 -> LATIN SMALL LETTER O WITH ACUTE '\xfa' # 0xC7 -> LATIN SMALL LETTER U WITH ACUTE '\xe0' # 0xC8 -> LATIN SMALL LETTER A WITH GRAVE '\xe8' # 0xC9 -> LATIN SMALL LETTER E WITH GRAVE '\xf2' # 0xCA -> LATIN SMALL LETTER O WITH GRAVE '\xf9' # 0xCB -> LATIN SMALL LETTER U WITH GRAVE '\xe4' # 0xCC -> LATIN SMALL LETTER A WITH DIAERESIS '\xeb' # 0xCD -> LATIN SMALL LETTER E WITH DIAERESIS '\xf6' # 0xCE -> LATIN SMALL LETTER O WITH DIAERESIS '\xfc' # 0xCF -> LATIN SMALL LETTER U WITH DIAERESIS '\xc5' # 0xD0 -> LATIN CAPITAL LETTER A WITH RING ABOVE '\xee' # 0xD1 -> LATIN SMALL LETTER I WITH CIRCUMFLEX '\xd8' # 0xD2 -> LATIN CAPITAL LETTER O WITH STROKE '\xc6' # 0xD3 -> LATIN CAPITAL LETTER AE '\xe5' # 0xD4 -> LATIN SMALL LETTER A WITH RING ABOVE '\xed' # 0xD5 -> LATIN SMALL LETTER I WITH ACUTE '\xf8' # 0xD6 -> LATIN SMALL LETTER O WITH STROKE '\xe6' # 0xD7 -> LATIN SMALL LETTER AE '\xc4' # 0xD8 -> LATIN CAPITAL LETTER A WITH DIAERESIS '\xec' # 0xD9 -> LATIN SMALL LETTER I WITH GRAVE '\xd6' # 0xDA -> LATIN CAPITAL LETTER O WITH DIAERESIS '\xdc' # 0xDB -> LATIN CAPITAL LETTER U WITH DIAERESIS '\xc9' # 0xDC -> LATIN CAPITAL LETTER E WITH ACUTE '\xef' # 0xDD -> LATIN SMALL LETTER I WITH DIAERESIS '\xdf' # 0xDE -> LATIN SMALL LETTER SHARP S (GERMAN) '\xd4' # 0xDF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX '\xc1' # 0xE0 -> LATIN CAPITAL LETTER A WITH ACUTE '\xc3' # 0xE1 -> LATIN CAPITAL LETTER A WITH TILDE '\xe3' # 0xE2 -> LATIN SMALL LETTER A WITH TILDE '\xd0' # 0xE3 -> LATIN CAPITAL LETTER ETH (ICELANDIC) '\xf0' # 0xE4 -> LATIN SMALL LETTER ETH (ICELANDIC) '\xcd' # 0xE5 -> LATIN CAPITAL LETTER I WITH ACUTE '\xcc' # 0xE6 -> LATIN CAPITAL LETTER I WITH GRAVE '\xd3' # 0xE7 -> LATIN CAPITAL LETTER O WITH ACUTE '\xd2' # 0xE8 -> LATIN CAPITAL LETTER O WITH GRAVE '\xd5' # 0xE9 -> LATIN CAPITAL LETTER O WITH TILDE '\xf5' # 0xEA -> LATIN SMALL LETTER O WITH TILDE '\u0160' # 0xEB -> LATIN CAPITAL LETTER S WITH CARON '\u0161' # 0xEC -> LATIN SMALL LETTER S WITH CARON '\xda' # 0xED -> LATIN CAPITAL LETTER U WITH ACUTE '\u0178' # 0xEE -> LATIN CAPITAL LETTER Y WITH DIAERESIS '\xff' # 0xEF -> LATIN SMALL LETTER Y WITH DIAERESIS '\xde' # 0xF0 -> LATIN CAPITAL LETTER THORN (ICELANDIC) '\xfe' # 0xF1 -> LATIN SMALL LETTER THORN (ICELANDIC) '\xb7' # 0xF2 -> MIDDLE DOT '\xb5' # 0xF3 -> MICRO SIGN '\xb6' # 0xF4 -> PILCROW SIGN '\xbe' # 0xF5 -> VULGAR FRACTION THREE QUARTERS '\u2014' # 0xF6 -> EM DASH '\xbc' # 0xF7 -> VULGAR FRACTION ONE QUARTER '\xbd' # 0xF8 -> VULGAR FRACTION ONE HALF '\xaa' # 0xF9 -> FEMININE ORDINAL INDICATOR '\xba' # 0xFA -> MASCULINE ORDINAL INDICATOR '\xab' # 0xFB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK '\u25a0' # 0xFC -> BLACK SQUARE '\xbb' # 0xFD -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK '\xb1' # 0xFE -> PLUS-MINUS SIGN '\ufffe' ) ### Encoding table encoding_table=codecs.charmap_build(decoding_table)
mit
[ 624, 2018, 17660, 12340, 13732, 4046, 687, 283, 12025, 63, 20971, 24, 14, 2424, 7, 543, 486, 2143, 67, 14, 647, 14, 339, 21311, 641, 666, 687, 14904, 921, 6341, 85, 1518, 14, 6341, 15, 73, 1085, 78, 15, 1560, 8919, 15, 18635, 13, 3810, 879, 24, 334, 43, 457, 10751, 265, 2464, 9, 339, 12769, 1350, 26, 7964, 332, 42, 386, 473, 1772, 25716, 1058, 2876, 1159, 30247, 869, 48, 1777, 949, 272, 650, 1082, 3172, 13, 26578, 614, 12, 869, 546, 2723, 13, 29471, 12, 1603, 11474, 5851, 1407, 14, 199, 199, 624, 23662, 199, 199, 646, 6010, 199, 199, 5680, 13732, 15913, 199, 199, 533, 13732, 8, 8933, 14, 8818, 304, 339, 347, 3752, 8, 277, 12, 1210, 12, 2550, 534, 4768, 735, 267, 372, 6010, 14, 13391, 63, 2143, 8, 1210, 12, 2550, 12, 2991, 63, 1224, 9, 339, 347, 4849, 8, 277, 12, 1210, 12, 2550, 534, 4768, 735, 267, 372, 6010, 14, 13391, 63, 2708, 8, 1210, 12, 2550, 12, 12796, 63, 1224, 9, 199, 199, 533, 24350, 8, 8933, 14, 17016, 304, 272, 347, 3752, 8, 277, 12, 1324, 12, 4242, 29, 797, 304, 267, 372, 6010, 14, 13391, 63, 2143, 8, 1210, 12, 277, 14, 2550, 12, 2991, 63, 1224, 2788, 16, 61, 199, 199, 533, 24385, 8, 8933, 14, 16703, 304, 272, 347, 4849, 8, 277, 12, 1324, 12, 4242, 29, 797, 304, 267, 372, 6010, 14, 13391, 63, 2708, 8, 1210, 12, 277, 14, 2550, 12, 12796, 63, 1224, 2788, 16, 61, 199, 199, 533, 24163, 8, 8818, 12, 8933, 14, 16551, 304, 272, 986, 199, 199, 533, 22970, 8, 8818, 12, 8933, 14, 16132, 304, 272, 986, 199, 199, 5680, 14134, 859, 3261, 199, 199, 318, 26116, 837, 272, 372, 6010, 14, 26375, 8, 267, 536, 534, 12025, 13, 20971, 24, 297, 267, 3752, 29, 8818, 1252, 2143, 12, 267, 4849, 29, 8818, 1252, 2708, 12, 267, 26329, 29, 17016, 12, 267, 26317, 29, 16703, 12, 267, 26112, 29, 16551, 12, 267, 26101, 29, 16132, 12, 272, 776, 421, 199, 5680, 27368, 6957, 199, 199, 12796, 63, 1224, 275, 334, 272, 1557, 88, 383, 7, 258, 327, 221, 378, 88, 383, 1035, 5962, 272, 1557, 88, 614, 7, 258, 327, 221, 378, 88, 614, 1035, 13910, 1634, 32674, 272, 1557, 88, 996, 7, 258, 327, 221, 378, 88, 996, 1035, 13910, 1634, 11951, 272, 1557, 88, 1644, 7, 258, 327, 221, 378, 88, 1644, 1035, 7729, 1634, 11951, 272, 1557, 88, 966, 7, 258, 327, 221, 378, 88, 966, 1035, 7729, 1634, 22499, 272, 1557, 88, 1717, 7, 258, 327, 221, 378, 88, 1717, 1035, 5070, 31115, 57, 272, 1557, 88, 1690, 7, 258, 327, 221, 378, 88, 1690, 1035, 22549, 272, 1557, 88, 1780, 7, 258, 327, 221, 378, 88, 1780, 1035, 699, 14952, 272, 1557, 88, 2036, 7, 258, 327, 221, 378, 88, 2036, 1035, 22658, 11658, 272, 1557, 84, 7, 755, 327, 221, 378, 88, 1643, 1035, 8724, 22450, 272, 1557, 78, 7, 755, 327, 221, 378, 88, 16, 33, 1035, 13587, 21567, 272, 1557, 88, 16, 66, 7, 258, 327, 221, 378, 88, 16, 34, 1035, 8267, 22450, 272, 1557, 88, 16, 67, 7, 258, 327, 221, 378, 88, 16, 35, 1035, 11295, 21567, 272, 1557, 82, 7, 755, 327, 221, 378, 88, 16, 36, 1035, 445, 32622, 24646, 272, 1557, 88, 16, 69, 7, 258, 327, 221, 378, 88, 16, 37, 1035, 20754, 5738, 272, 1557, 88, 16, 70, 7, 258, 327, 221, 378, 88, 16, 38, 1035, 20754, 1621, 272, 1557, 88, 709, 7, 258, 327, 221, 378, 88, 709, 1035, 7126, 19774, 17682, 272, 1557, 88, 845, 7, 258, 327, 221, 378, 88, 845, 1035, 11643, 8098, 13051, 272, 1557, 88, 713, 7, 258, 327, 221, 378, 88, 713, 1035, 11643, 8098, 16562, 272, 1557, 88, 969, 7, 258, 327, 221, 378, 88, 969, 1035, 11643, 8098, 16296, 272, 1557, 88, 1079, 7, 258, 327, 221, 378, 88, 1079, 1035, 11643, 8098, 14473, 272, 1557, 88, 1046, 7, 258, 327, 221, 378, 88, 1046, 1035, 29837, 22549, 272, 1557, 88, 975, 7, 258, 327, 221, 378, 88, 975, 1035, 10046, 30782, 23240, 272, 1557, 88, 1196, 7, 258, 327, 221, 378, 88, 1196, 1035, 7729, 1634, 22499, 8068, 272, 1557, 88, 1085, 7, 258, 327, 221, 378, 88, 1085, 1035, 27385, 272, 1557, 88, 1167, 7, 258, 327, 221, 378, 88, 1167, 1035, 7729, 1634, 22650, 272, 1557, 88, 17, 65, 7, 258, 327, 221, 378, 88, 17, 33, 1035, 9103, 272, 1557, 88, 17, 66, 7, 258, 327, 221, 378, 88, 17, 34, 1035, 17682, 272, 1557, 88, 17, 67, 7, 258, 327, 221, 378, 88, 17, 35, 1035, 13024, 14782, 272, 1557, 88, 17, 68, 7, 258, 327, 221, 378, 88, 17, 36, 1035, 15443, 14782, 272, 1557, 88, 17, 69, 7, 258, 327, 221, 378, 88, 17, 37, 1035, 24973, 14782, 272, 1557, 88, 17, 70, 7, 258, 327, 221, 378, 88, 17, 38, 1035, 25836, 14782, 272, 283, 283, 263, 327, 221, 378, 88, 1165, 1035, 16796, 272, 29376, 263, 327, 221, 378, 88, 2025, 1035, 24232, 8132, 272, 14788, 263, 327, 221, 378, 88, 1081, 1035, 11830, 8132, 272, 19619, 263, 327, 221, 378, 88, 1789, 1035, 18122, 5056, 272, 25271, 263, 327, 221, 378, 88, 1194, 1035, 30857, 5056, 272, 26386, 263, 327, 221, 378, 88, 821, 1035, 26684, 5056, 272, 29285, 263, 327, 221, 378, 88, 1479, 1035, 30602, 272, 21673, 263, 327, 221, 378, 88, 1465, 1035, 30876, 272, 16746, 263, 327, 221, 378, 88, 1651, 1035, 6578, 20570, 272, 16107, 263, 327, 221, 378, 88, 1398, 1035, 7052, 20570, 272, 13626, 263, 327, 221, 378, 88, 18, 33, 1035, 29725, 272, 20246, 263, 327, 221, 378, 88, 18, 34, 1035, 18807, 5056, 272, 13647, 263, 327, 221, 378, 88, 18, 35, 1035, 22849, 272, 10791, 263, 327, 221, 378, 88, 18, 36, 1035, 22553, 13, 18004, 272, 7815, 263, 327, 221, 378, 88, 18, 37, 1035, 18530, 22348, 272, 7324, 263, 327, 221, 378, 88, 18, 38, 1035, 20585, 272, 283, 16, 7, 263, 327, 221, 378, 88, 1216, 1035, 7298, 20348, 272, 283, 17, 7, 263 ]
[ 2018, 17660, 12340, 13732, 4046, 687, 283, 12025, 63, 20971, 24, 14, 2424, 7, 543, 486, 2143, 67, 14, 647, 14, 339, 21311, 641, 666, 687, 14904, 921, 6341, 85, 1518, 14, 6341, 15, 73, 1085, 78, 15, 1560, 8919, 15, 18635, 13, 3810, 879, 24, 334, 43, 457, 10751, 265, 2464, 9, 339, 12769, 1350, 26, 7964, 332, 42, 386, 473, 1772, 25716, 1058, 2876, 1159, 30247, 869, 48, 1777, 949, 272, 650, 1082, 3172, 13, 26578, 614, 12, 869, 546, 2723, 13, 29471, 12, 1603, 11474, 5851, 1407, 14, 199, 199, 624, 23662, 199, 199, 646, 6010, 199, 199, 5680, 13732, 15913, 199, 199, 533, 13732, 8, 8933, 14, 8818, 304, 339, 347, 3752, 8, 277, 12, 1210, 12, 2550, 534, 4768, 735, 267, 372, 6010, 14, 13391, 63, 2143, 8, 1210, 12, 2550, 12, 2991, 63, 1224, 9, 339, 347, 4849, 8, 277, 12, 1210, 12, 2550, 534, 4768, 735, 267, 372, 6010, 14, 13391, 63, 2708, 8, 1210, 12, 2550, 12, 12796, 63, 1224, 9, 199, 199, 533, 24350, 8, 8933, 14, 17016, 304, 272, 347, 3752, 8, 277, 12, 1324, 12, 4242, 29, 797, 304, 267, 372, 6010, 14, 13391, 63, 2143, 8, 1210, 12, 277, 14, 2550, 12, 2991, 63, 1224, 2788, 16, 61, 199, 199, 533, 24385, 8, 8933, 14, 16703, 304, 272, 347, 4849, 8, 277, 12, 1324, 12, 4242, 29, 797, 304, 267, 372, 6010, 14, 13391, 63, 2708, 8, 1210, 12, 277, 14, 2550, 12, 12796, 63, 1224, 2788, 16, 61, 199, 199, 533, 24163, 8, 8818, 12, 8933, 14, 16551, 304, 272, 986, 199, 199, 533, 22970, 8, 8818, 12, 8933, 14, 16132, 304, 272, 986, 199, 199, 5680, 14134, 859, 3261, 199, 199, 318, 26116, 837, 272, 372, 6010, 14, 26375, 8, 267, 536, 534, 12025, 13, 20971, 24, 297, 267, 3752, 29, 8818, 1252, 2143, 12, 267, 4849, 29, 8818, 1252, 2708, 12, 267, 26329, 29, 17016, 12, 267, 26317, 29, 16703, 12, 267, 26112, 29, 16551, 12, 267, 26101, 29, 16132, 12, 272, 776, 421, 199, 5680, 27368, 6957, 199, 199, 12796, 63, 1224, 275, 334, 272, 1557, 88, 383, 7, 258, 327, 221, 378, 88, 383, 1035, 5962, 272, 1557, 88, 614, 7, 258, 327, 221, 378, 88, 614, 1035, 13910, 1634, 32674, 272, 1557, 88, 996, 7, 258, 327, 221, 378, 88, 996, 1035, 13910, 1634, 11951, 272, 1557, 88, 1644, 7, 258, 327, 221, 378, 88, 1644, 1035, 7729, 1634, 11951, 272, 1557, 88, 966, 7, 258, 327, 221, 378, 88, 966, 1035, 7729, 1634, 22499, 272, 1557, 88, 1717, 7, 258, 327, 221, 378, 88, 1717, 1035, 5070, 31115, 57, 272, 1557, 88, 1690, 7, 258, 327, 221, 378, 88, 1690, 1035, 22549, 272, 1557, 88, 1780, 7, 258, 327, 221, 378, 88, 1780, 1035, 699, 14952, 272, 1557, 88, 2036, 7, 258, 327, 221, 378, 88, 2036, 1035, 22658, 11658, 272, 1557, 84, 7, 755, 327, 221, 378, 88, 1643, 1035, 8724, 22450, 272, 1557, 78, 7, 755, 327, 221, 378, 88, 16, 33, 1035, 13587, 21567, 272, 1557, 88, 16, 66, 7, 258, 327, 221, 378, 88, 16, 34, 1035, 8267, 22450, 272, 1557, 88, 16, 67, 7, 258, 327, 221, 378, 88, 16, 35, 1035, 11295, 21567, 272, 1557, 82, 7, 755, 327, 221, 378, 88, 16, 36, 1035, 445, 32622, 24646, 272, 1557, 88, 16, 69, 7, 258, 327, 221, 378, 88, 16, 37, 1035, 20754, 5738, 272, 1557, 88, 16, 70, 7, 258, 327, 221, 378, 88, 16, 38, 1035, 20754, 1621, 272, 1557, 88, 709, 7, 258, 327, 221, 378, 88, 709, 1035, 7126, 19774, 17682, 272, 1557, 88, 845, 7, 258, 327, 221, 378, 88, 845, 1035, 11643, 8098, 13051, 272, 1557, 88, 713, 7, 258, 327, 221, 378, 88, 713, 1035, 11643, 8098, 16562, 272, 1557, 88, 969, 7, 258, 327, 221, 378, 88, 969, 1035, 11643, 8098, 16296, 272, 1557, 88, 1079, 7, 258, 327, 221, 378, 88, 1079, 1035, 11643, 8098, 14473, 272, 1557, 88, 1046, 7, 258, 327, 221, 378, 88, 1046, 1035, 29837, 22549, 272, 1557, 88, 975, 7, 258, 327, 221, 378, 88, 975, 1035, 10046, 30782, 23240, 272, 1557, 88, 1196, 7, 258, 327, 221, 378, 88, 1196, 1035, 7729, 1634, 22499, 8068, 272, 1557, 88, 1085, 7, 258, 327, 221, 378, 88, 1085, 1035, 27385, 272, 1557, 88, 1167, 7, 258, 327, 221, 378, 88, 1167, 1035, 7729, 1634, 22650, 272, 1557, 88, 17, 65, 7, 258, 327, 221, 378, 88, 17, 33, 1035, 9103, 272, 1557, 88, 17, 66, 7, 258, 327, 221, 378, 88, 17, 34, 1035, 17682, 272, 1557, 88, 17, 67, 7, 258, 327, 221, 378, 88, 17, 35, 1035, 13024, 14782, 272, 1557, 88, 17, 68, 7, 258, 327, 221, 378, 88, 17, 36, 1035, 15443, 14782, 272, 1557, 88, 17, 69, 7, 258, 327, 221, 378, 88, 17, 37, 1035, 24973, 14782, 272, 1557, 88, 17, 70, 7, 258, 327, 221, 378, 88, 17, 38, 1035, 25836, 14782, 272, 283, 283, 263, 327, 221, 378, 88, 1165, 1035, 16796, 272, 29376, 263, 327, 221, 378, 88, 2025, 1035, 24232, 8132, 272, 14788, 263, 327, 221, 378, 88, 1081, 1035, 11830, 8132, 272, 19619, 263, 327, 221, 378, 88, 1789, 1035, 18122, 5056, 272, 25271, 263, 327, 221, 378, 88, 1194, 1035, 30857, 5056, 272, 26386, 263, 327, 221, 378, 88, 821, 1035, 26684, 5056, 272, 29285, 263, 327, 221, 378, 88, 1479, 1035, 30602, 272, 21673, 263, 327, 221, 378, 88, 1465, 1035, 30876, 272, 16746, 263, 327, 221, 378, 88, 1651, 1035, 6578, 20570, 272, 16107, 263, 327, 221, 378, 88, 1398, 1035, 7052, 20570, 272, 13626, 263, 327, 221, 378, 88, 18, 33, 1035, 29725, 272, 20246, 263, 327, 221, 378, 88, 18, 34, 1035, 18807, 5056, 272, 13647, 263, 327, 221, 378, 88, 18, 35, 1035, 22849, 272, 10791, 263, 327, 221, 378, 88, 18, 36, 1035, 22553, 13, 18004, 272, 7815, 263, 327, 221, 378, 88, 18, 37, 1035, 18530, 22348, 272, 7324, 263, 327, 221, 378, 88, 18, 38, 1035, 20585, 272, 283, 16, 7, 263, 327, 221, 378, 88, 1216, 1035, 7298, 20348, 272, 283, 17, 7, 263, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
HuaweiSwitch/ansible
lib/ansible/plugins/connection/jail.py
35
8225
# Based on local.py (c) 2012, Michael DeHaan <michael.dehaan@gmail.com> # and chroot.py (c) 2013, Maykel Moya <mmoya@speedyrails.com> # (c) 2013, Michael Scherer <misc@zarb.org> # (c) 2015, Toshio Kuratomi <tkuratomi@ansible.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. from __future__ import (absolute_import, division, print_function) __metaclass__ = type import distutils.spawn import os import os.path import subprocess import traceback from ansible.errors import AnsibleError from ansible.module_utils.six.moves import shlex_quote from ansible.module_utils._text import to_bytes from ansible.plugins.connection import ConnectionBase, BUFSIZE try: from __main__ import display except ImportError: from ansible.utils.display import Display display = Display() class Connection(ConnectionBase): ''' Local BSD Jail based connections ''' modified_jailname_key = 'conn_jail_name' transport = 'jail' # Pipelining may work. Someone needs to test by setting this to True and # having pipelining=True in their ansible.cfg has_pipelining = True # Some become_methods may work in v2 (sudo works for other chroot-based # plugins while su seems to be failing). If some work, check chroot.py to # see how to disable just some methods. become_methods = frozenset() def __init__(self, play_context, new_stdin, *args, **kwargs): super(Connection, self).__init__(play_context, new_stdin, *args, **kwargs) self.jail = self._play_context.remote_addr if self.modified_jailname_key in kwargs : self.jail = kwargs[self.modified_jailname_key] if os.geteuid() != 0: raise AnsibleError("jail connection requires running as root") self.jls_cmd = self._search_executable('jls') self.jexec_cmd = self._search_executable('jexec') if self.jail not in self.list_jails(): raise AnsibleError("incorrect jail name %s" % self.jail) @staticmethod def _search_executable(executable): cmd = distutils.spawn.find_executable(executable) if not cmd: raise AnsibleError("%s command not found in PATH" % executable) return cmd def list_jails(self): p = subprocess.Popen([self.jls_cmd, '-q', 'name'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p.communicate() return stdout.split() def get_jail_path(self): p = subprocess.Popen([self.jls_cmd, '-j', to_bytes(self.jail), '-q', 'path'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p.communicate() # remove \n return stdout[:-1] def _connect(self): ''' connect to the jail; nothing to do here ''' super(Connection, self)._connect() if not self._connected: display.vvv(u"ESTABLISH JAIL CONNECTION FOR USER: {0}".format(self._play_context.remote_user), host=self.jail) self._connected = True def _buffered_exec_command(self, cmd, stdin=subprocess.PIPE): ''' run a command on the jail. This is only needed for implementing put_file() get_file() so that we don't have to read the whole file into memory. compared to exec_command() it looses some niceties like being able to return the process's exit code immediately. ''' local_cmd = [self.jexec_cmd] set_env = '' if self._play_context.remote_user is not None: local_cmd += ['-U', self._play_context.remote_user] # update HOME since -U does not update the jail environment set_env = 'HOME=~' + self._play_context.remote_user + ' ' local_cmd += [self.jail, self._play_context.executable, '-c', set_env + cmd] display.vvv("EXEC %s" % (local_cmd,), host=self.jail) local_cmd = [to_bytes(i, errors='surrogate_or_strict') for i in local_cmd] p = subprocess.Popen(local_cmd, shell=False, stdin=stdin, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return p def exec_command(self, cmd, in_data=None, sudoable=False): ''' run a command on the jail ''' super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable) p = self._buffered_exec_command(cmd) stdout, stderr = p.communicate(in_data) return (p.returncode, stdout, stderr) def _prefix_login_path(self, remote_path): ''' Make sure that we put files into a standard path If a path is relative, then we need to choose where to put it. ssh chooses $HOME but we aren't guaranteed that a home dir will exist in any given chroot. So for now we're choosing "/" instead. This also happens to be the former default. Can revisit using $HOME instead if it's a problem ''' if not remote_path.startswith(os.path.sep): remote_path = os.path.join(os.path.sep, remote_path) return os.path.normpath(remote_path) def put_file(self, in_path, out_path): ''' transfer a file from local to jail ''' super(Connection, self).put_file(in_path, out_path) display.vvv("PUT %s TO %s" % (in_path, out_path), host=self.jail) out_path = shlex_quote(self._prefix_login_path(out_path)) try: with open(to_bytes(in_path, errors='surrogate_or_strict'), 'rb') as in_file: try: p = self._buffered_exec_command('dd of=%s bs=%s' % (out_path, BUFSIZE), stdin=in_file) except OSError: raise AnsibleError("jail connection requires dd command in the jail") try: stdout, stderr = p.communicate() except: traceback.print_exc() raise AnsibleError("failed to transfer file %s to %s" % (in_path, out_path)) if p.returncode != 0: raise AnsibleError("failed to transfer file %s to %s:\n%s\n%s" % (in_path, out_path, stdout, stderr)) except IOError: raise AnsibleError("file or module does not exist at: %s" % in_path) def fetch_file(self, in_path, out_path): ''' fetch a file from jail to local ''' super(Connection, self).fetch_file(in_path, out_path) display.vvv("FETCH %s TO %s" % (in_path, out_path), host=self.jail) in_path = shlex_quote(self._prefix_login_path(in_path)) try: p = self._buffered_exec_command('dd if=%s bs=%s' % (in_path, BUFSIZE)) except OSError: raise AnsibleError("jail connection requires dd command in the jail") with open(to_bytes(out_path, errors='surrogate_or_strict'), 'wb+') as out_file: try: chunk = p.stdout.read(BUFSIZE) while chunk: out_file.write(chunk) chunk = p.stdout.read(BUFSIZE) except: traceback.print_exc() raise AnsibleError("failed to transfer file %s to %s" % (in_path, out_path)) stdout, stderr = p.communicate() if p.returncode != 0: raise AnsibleError("failed to transfer file %s to %s:\n%s\n%s" % (in_path, out_path, stdout, stderr)) def close(self): ''' terminate the connection; nothing to do here ''' super(Connection, self).close() self._connected = False
gpl-3.0
[ 3, 21311, 641, 2257, 14, 647, 334, 67, 9, 6029, 12, 16922, 22453, 665, 22333, 14, 24247, 32, 6799, 14, 957, 30, 199, 3, 436, 32028, 14, 647, 258, 334, 67, 9, 6171, 12, 10162, 75, 352, 3930, 11552, 665, 77, 573, 11552, 32, 7625, 89, 345, 17841, 14, 957, 30, 199, 3, 334, 67, 9, 6171, 12, 16922, 428, 595, 3859, 665, 9923, 32, 90, 10325, 14, 1308, 30, 199, 3, 334, 67, 9, 6900, 12, 4005, 609, 2308, 1804, 300, 4188, 73, 665, 2663, 300, 4188, 73, 32, 4853, 14, 957, 30, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 2622, 199, 3, 199, 3, 2622, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 2622, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 2622, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 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, 7065, 14, 10212, 199, 646, 747, 199, 646, 747, 14, 515, 199, 646, 3873, 199, 646, 5190, 199, 199, 504, 3242, 14, 2550, 492, 13358, 199, 504, 3242, 14, 578, 63, 1208, 14, 4174, 14, 4912, 492, 16701, 63, 3513, 199, 504, 3242, 14, 578, 63, 1208, 423, 505, 492, 370, 63, 2394, 199, 504, 3242, 14, 5265, 14, 2105, 492, 8113, 1563, 12, 16331, 38, 4305, 199, 199, 893, 26, 272, 687, 636, 973, 363, 492, 2929, 199, 2590, 3545, 26, 272, 687, 3242, 14, 1208, 14, 2918, 492, 12175, 272, 2929, 275, 12175, 342, 421, 199, 533, 8113, 8, 3225, 1563, 304, 272, 1449, 10111, 6289, 1603, 1054, 4079, 6947, 1449, 339, 6042, 63, 74, 1054, 354, 63, 498, 275, 283, 1631, 63, 74, 1054, 63, 354, 7, 339, 7773, 275, 283, 74, 1054, 7, 272, 327, 16850, 30176, 1443, 1736, 14, 221, 6601, 368, 4839, 370, 511, 701, 4260, 642, 370, 715, 436, 272, 327, 9445, 5200, 30176, 29, 549, 315, 3932, 3242, 14, 4128, 272, 965, 63, 4990, 30176, 275, 715, 272, 327, 6601, 8649, 63, 2474, 1443, 1736, 315, 373, 18, 334, 12095, 5419, 367, 1163, 32028, 13, 6788, 272, 327, 8963, 1830, 18741, 12237, 370, 506, 18648, 680, 221, 982, 2005, 1736, 12, 1104, 32028, 14, 647, 370, 272, 327, 1937, 4212, 370, 3507, 2951, 2005, 3102, 14, 272, 8649, 63, 2474, 275, 9522, 342, 339, 347, 636, 826, 721, 277, 12, 5232, 63, 1100, 12, 892, 63, 6626, 12, 627, 589, 12, 1011, 958, 304, 267, 1613, 8, 3225, 12, 291, 2843, 826, 721, 2802, 63, 1100, 12, 892, 63, 6626, 12, 627, 589, 12, 1011, 958, 9, 398, 291, 14, 74, 1054, 275, 291, 423, 2802, 63, 1100, 14, 3846, 63, 2697, 267, 340, 291, 14, 5540, 63, 74, 1054, 354, 63, 498, 315, 2074, 520, 288, 291, 14, 74, 1054, 275, 2074, 59, 277, 14, 5540, 63, 74, 1054, 354, 63, 498, 61, 398, 340, 747, 14, 31508, 1535, 342, 1137, 378, 26, 288, 746, 13358, 480, 74, 1054, 1950, 5074, 3879, 465, 1738, 531, 398, 291, 14, 74, 478, 63, 1760, 275, 291, 423, 1733, 63, 5904, 360, 74, 478, 358, 267, 291, 14, 74, 1628, 63, 1760, 275, 291, 423, 1733, 63, 5904, 360, 74, 1628, 358, 398, 340, 291, 14, 74, 1054, 440, 315, 291, 14, 513, 63, 74, 1054, 83, 837, 288, 746, 13358, 480, 15448, 1335, 1054, 536, 450, 83, 2, 450, 291, 14, 74, 1054, 9, 339, 768, 4639, 272, 347, 485, 1733, 63, 5904, 8, 5904, 304, 267, 2088, 275, 7065, 14, 10212, 14, 1623, 63, 5904, 8, 5904, 9, 267, 340, 440, 2088, 26, 288, 746, 13358, 3647, 83, 1414, 440, 1911, 315, 15097, 2, 450, 7286, 9, 267, 372, 2088, 339, 347, 769, 63, 74, 1054, 83, 8, 277, 304, 267, 299, 275, 3873, 14, 7942, 779, 277, 14, 74, 478, 63, 1760, 12, 2475, 81, 297, 283, 354, 995, 2490, 9009, 29, 5781, 14, 6089, 12, 2490, 3839, 29, 5781, 14, 6089, 12, 4635, 29, 5781, 14, 6089, 9, 398, 3839, 12, 4635, 275, 299, 14, 10664, 342, 398, 372, 3839, 14, 1294, 342, 339, 347, 664, 63, 74, 1054, 63, 515, 8, 277, 304, 267, 299, 275, 3873, 14, 7942, 779, 277, 14, 74, 478, 63, 1760, 12, 2475, 74, 297, 370, 63, 2394, 8, 277, 14, 74, 1054, 395, 2475, 81, 297, 283, 515, 995, 2490, 9009, 29, 5781, 14, 6089, 12, 2490, 3839, 29, 5781, 14, 6089, 12, 4635, 29, 5781, 14, 6089, 9, 398, 3839, 12, 4635, 275, 299, 14, 10664, 342, 267, 327, 2813, 971, 78, 267, 372, 3839, 4439, 17, 61, 339, 347, 485, 2242, 8, 277, 304, 267, 1449, 4907, 370, 314, 1335, 1054, 27, 6548, 370, 886, 2348, 1449, 267, 1613, 8, 3225, 12, 291, 10445, 2242, 342, 267, 340, 440, 291, 423, 7113, 26, 288, 2929, 14, 24622, 8, 85, 2, 1719, 1217, 44, 13898, 1603, 6593, 11287, 2381, 13044, 26, 469, 16, 5469, 908, 8, 277, 423, 2802, 63, 1100, 14, 3846, 63, 751, 395, 1591, 29, 277, 14, 74, 1054, 9, 288, 291, 423, 7113, 275, 715, 339, 347, 485, 17605, 63, 1628, 63, 1531, 8, 277, 12, 2088, 12, 9009, 29, 5781, 14, 6089, 304, 267, 1449, 1255, 282, 1414, 641, 314, 1335, 1054, 14, 221, 961, 365, 1454, 4346, 367, 18234, 267, 5324, 63, 493, 342, 664, 63, 493, 342, 880, 626, 781, 2793, 1133, 1172, 370, 1586, 314, 8852, 570, 267, 1901, 4402 ]
[ 21311, 641, 2257, 14, 647, 334, 67, 9, 6029, 12, 16922, 22453, 665, 22333, 14, 24247, 32, 6799, 14, 957, 30, 199, 3, 436, 32028, 14, 647, 258, 334, 67, 9, 6171, 12, 10162, 75, 352, 3930, 11552, 665, 77, 573, 11552, 32, 7625, 89, 345, 17841, 14, 957, 30, 199, 3, 334, 67, 9, 6171, 12, 16922, 428, 595, 3859, 665, 9923, 32, 90, 10325, 14, 1308, 30, 199, 3, 334, 67, 9, 6900, 12, 4005, 609, 2308, 1804, 300, 4188, 73, 665, 2663, 300, 4188, 73, 32, 4853, 14, 957, 30, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 2622, 199, 3, 199, 3, 2622, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 2622, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 2622, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 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, 7065, 14, 10212, 199, 646, 747, 199, 646, 747, 14, 515, 199, 646, 3873, 199, 646, 5190, 199, 199, 504, 3242, 14, 2550, 492, 13358, 199, 504, 3242, 14, 578, 63, 1208, 14, 4174, 14, 4912, 492, 16701, 63, 3513, 199, 504, 3242, 14, 578, 63, 1208, 423, 505, 492, 370, 63, 2394, 199, 504, 3242, 14, 5265, 14, 2105, 492, 8113, 1563, 12, 16331, 38, 4305, 199, 199, 893, 26, 272, 687, 636, 973, 363, 492, 2929, 199, 2590, 3545, 26, 272, 687, 3242, 14, 1208, 14, 2918, 492, 12175, 272, 2929, 275, 12175, 342, 421, 199, 533, 8113, 8, 3225, 1563, 304, 272, 1449, 10111, 6289, 1603, 1054, 4079, 6947, 1449, 339, 6042, 63, 74, 1054, 354, 63, 498, 275, 283, 1631, 63, 74, 1054, 63, 354, 7, 339, 7773, 275, 283, 74, 1054, 7, 272, 327, 16850, 30176, 1443, 1736, 14, 221, 6601, 368, 4839, 370, 511, 701, 4260, 642, 370, 715, 436, 272, 327, 9445, 5200, 30176, 29, 549, 315, 3932, 3242, 14, 4128, 272, 965, 63, 4990, 30176, 275, 715, 272, 327, 6601, 8649, 63, 2474, 1443, 1736, 315, 373, 18, 334, 12095, 5419, 367, 1163, 32028, 13, 6788, 272, 327, 8963, 1830, 18741, 12237, 370, 506, 18648, 680, 221, 982, 2005, 1736, 12, 1104, 32028, 14, 647, 370, 272, 327, 1937, 4212, 370, 3507, 2951, 2005, 3102, 14, 272, 8649, 63, 2474, 275, 9522, 342, 339, 347, 636, 826, 721, 277, 12, 5232, 63, 1100, 12, 892, 63, 6626, 12, 627, 589, 12, 1011, 958, 304, 267, 1613, 8, 3225, 12, 291, 2843, 826, 721, 2802, 63, 1100, 12, 892, 63, 6626, 12, 627, 589, 12, 1011, 958, 9, 398, 291, 14, 74, 1054, 275, 291, 423, 2802, 63, 1100, 14, 3846, 63, 2697, 267, 340, 291, 14, 5540, 63, 74, 1054, 354, 63, 498, 315, 2074, 520, 288, 291, 14, 74, 1054, 275, 2074, 59, 277, 14, 5540, 63, 74, 1054, 354, 63, 498, 61, 398, 340, 747, 14, 31508, 1535, 342, 1137, 378, 26, 288, 746, 13358, 480, 74, 1054, 1950, 5074, 3879, 465, 1738, 531, 398, 291, 14, 74, 478, 63, 1760, 275, 291, 423, 1733, 63, 5904, 360, 74, 478, 358, 267, 291, 14, 74, 1628, 63, 1760, 275, 291, 423, 1733, 63, 5904, 360, 74, 1628, 358, 398, 340, 291, 14, 74, 1054, 440, 315, 291, 14, 513, 63, 74, 1054, 83, 837, 288, 746, 13358, 480, 15448, 1335, 1054, 536, 450, 83, 2, 450, 291, 14, 74, 1054, 9, 339, 768, 4639, 272, 347, 485, 1733, 63, 5904, 8, 5904, 304, 267, 2088, 275, 7065, 14, 10212, 14, 1623, 63, 5904, 8, 5904, 9, 267, 340, 440, 2088, 26, 288, 746, 13358, 3647, 83, 1414, 440, 1911, 315, 15097, 2, 450, 7286, 9, 267, 372, 2088, 339, 347, 769, 63, 74, 1054, 83, 8, 277, 304, 267, 299, 275, 3873, 14, 7942, 779, 277, 14, 74, 478, 63, 1760, 12, 2475, 81, 297, 283, 354, 995, 2490, 9009, 29, 5781, 14, 6089, 12, 2490, 3839, 29, 5781, 14, 6089, 12, 4635, 29, 5781, 14, 6089, 9, 398, 3839, 12, 4635, 275, 299, 14, 10664, 342, 398, 372, 3839, 14, 1294, 342, 339, 347, 664, 63, 74, 1054, 63, 515, 8, 277, 304, 267, 299, 275, 3873, 14, 7942, 779, 277, 14, 74, 478, 63, 1760, 12, 2475, 74, 297, 370, 63, 2394, 8, 277, 14, 74, 1054, 395, 2475, 81, 297, 283, 515, 995, 2490, 9009, 29, 5781, 14, 6089, 12, 2490, 3839, 29, 5781, 14, 6089, 12, 4635, 29, 5781, 14, 6089, 9, 398, 3839, 12, 4635, 275, 299, 14, 10664, 342, 267, 327, 2813, 971, 78, 267, 372, 3839, 4439, 17, 61, 339, 347, 485, 2242, 8, 277, 304, 267, 1449, 4907, 370, 314, 1335, 1054, 27, 6548, 370, 886, 2348, 1449, 267, 1613, 8, 3225, 12, 291, 10445, 2242, 342, 267, 340, 440, 291, 423, 7113, 26, 288, 2929, 14, 24622, 8, 85, 2, 1719, 1217, 44, 13898, 1603, 6593, 11287, 2381, 13044, 26, 469, 16, 5469, 908, 8, 277, 423, 2802, 63, 1100, 14, 3846, 63, 751, 395, 1591, 29, 277, 14, 74, 1054, 9, 288, 291, 423, 7113, 275, 715, 339, 347, 485, 17605, 63, 1628, 63, 1531, 8, 277, 12, 2088, 12, 9009, 29, 5781, 14, 6089, 304, 267, 1449, 1255, 282, 1414, 641, 314, 1335, 1054, 14, 221, 961, 365, 1454, 4346, 367, 18234, 267, 5324, 63, 493, 342, 664, 63, 493, 342, 880, 626, 781, 2793, 1133, 1172, 370, 1586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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
crobinso/virt-manager
virtinst/devices/hostdev.py
2
4651
# # Copyright 2009, 2013 Red Hat, Inc. # # This work is licensed under the GNU GPLv2 or later. # See the COPYING file in the top-level directory. import re from ..logger import log from .device import Device from ..nodedev import NodeDevice from ..xmlbuilder import XMLProperty class DeviceHostdev(Device): XML_NAME = "hostdev" def set_from_nodedev(self, nodedev): log.debug("set_from_nodedev xml=\n%s", nodedev.get_xml()) if nodedev.device_type == NodeDevice.CAPABILITY_TYPE_PCI: self.type = "pci" self.domain = nodedev.domain self.bus = nodedev.bus self.slot = nodedev.slot self.function = nodedev.function elif nodedev.device_type == NodeDevice.CAPABILITY_TYPE_USBDEV: self.type = "usb" self.vendor = nodedev.vendor_id self.product = nodedev.product_id count = 0 for dev in self.conn.fetch_all_nodedevs(): if (dev.device_type == NodeDevice.CAPABILITY_TYPE_USBDEV and dev.vendor_id == self.vendor and dev.product_id == self.product): count += 1 if count > 1: self.bus = nodedev.bus self.device = nodedev.device elif nodedev.device_type == nodedev.CAPABILITY_TYPE_NET: founddev = None for checkdev in self.conn.fetch_all_nodedevs(): if checkdev.name == nodedev.parent: founddev = checkdev break self.set_from_nodedev(founddev) elif nodedev.device_type == nodedev.CAPABILITY_TYPE_SCSIDEV: self.type = "scsi" self.scsi_adapter = "scsi_host%s" % nodedev.host self.scsi_bus = nodedev.bus self.scsi_target = nodedev.target self.scsi_unit = nodedev.lun self.managed = False elif nodedev.device_type == nodedev.CAPABILITY_TYPE_MDEV: self.type = "mdev" if nodedev.type_id == "vfio_ccw-io": self.model = "vfio-ccw" self.managed = "no" elif nodedev.type_id == "vfio_ap-passthrough": self.model = "vfio-ap" self.managed = "no" elif (re.match("^nvidia-[0-9]{2}", nodedev.type_id) or re.match("^i915-GVTg_V[0-9]_[0-9]", nodedev.type_id)): self.model = "vfio-pci" self.managed = "yes" self.display = "off" self.ramfb = "off" else: raise ValueError( # pragma: no cover _("Don't know how to generate nodedev for mdev type id '%s'") % nodedev.type_id) self.uuid = nodedev.get_mdev_uuid() else: raise ValueError(_("Unknown node device type %s") % nodedev) _XML_PROP_ORDER = ["mode", "type", "managed", "vendor", "product", "domain", "bus", "slot", "function", "model", "display", "ramfb"] mode = XMLProperty("./@mode") type = XMLProperty("./@type") managed = XMLProperty("./@managed", is_yesno=True) model = XMLProperty("./@model") display = XMLProperty("./@display") ramfb = XMLProperty("./@ramfb") vendor = XMLProperty("./source/vendor/@id") product = XMLProperty("./source/product/@id") device = XMLProperty("./source/address/@device") bus = XMLProperty("./source/address/@bus") domain = XMLProperty("./source/address/@domain") function = XMLProperty("./source/address/@function") slot = XMLProperty("./source/address/@slot") driver_name = XMLProperty("./driver/@name") rom_bar = XMLProperty("./rom/@bar", is_onoff=True) # type=scsi handling scsi_adapter = XMLProperty("./source/adapter/@name") scsi_bus = XMLProperty("./source/address/@bus", is_int=True) scsi_target = XMLProperty("./source/address/@target", is_int=True) scsi_unit = XMLProperty("./source/address/@unit", is_int=True) # type=net handling net_interface = XMLProperty("./source/interface") # type=misc handling misc_char = XMLProperty("./source/char") # type=misc handling storage_block = XMLProperty("./source/block") # type=mdev uuid = XMLProperty("./source/address/@uuid") ################## # Default config # ################## def set_defaults(self, guest): if self.managed is None: self.managed = self.conn.is_xen() and "no" or "yes" if not self.mode: self.mode = "subsystem"
gpl-2.0
[ 3, 199, 3, 1898, 8937, 12, 6171, 9572, 13002, 12, 3277, 14, 199, 3, 199, 3, 961, 1736, 365, 18233, 1334, 314, 1664, 14629, 86, 18, 503, 2945, 14, 199, 3, 1666, 314, 9685, 570, 315, 314, 2746, 13, 1896, 2082, 14, 199, 199, 646, 295, 199, 199, 504, 2508, 2921, 492, 943, 199, 199, 504, 1275, 1782, 492, 12272, 199, 504, 2508, 932, 2374, 492, 5013, 2510, 199, 504, 2508, 1652, 5649, 492, 4692, 3697, 421, 199, 533, 12272, 4965, 2374, 8, 2510, 304, 272, 4692, 63, 2339, 275, 298, 1102, 2374, 2, 339, 347, 663, 63, 504, 63, 932, 2374, 8, 277, 12, 1031, 2374, 304, 267, 943, 14, 1757, 480, 409, 63, 504, 63, 932, 2374, 2748, 9529, 78, 5, 83, 401, 1031, 2374, 14, 362, 63, 1652, 1012, 398, 340, 1031, 2374, 14, 1782, 63, 466, 508, 5013, 2510, 14, 8549, 2477, 63, 2711, 63, 23905, 26, 288, 291, 14, 466, 275, 298, 12024, 2, 288, 291, 14, 2261, 275, 1031, 2374, 14, 2261, 288, 291, 14, 5610, 275, 1031, 2374, 14, 5610, 288, 291, 14, 7998, 275, 1031, 2374, 14, 7998, 288, 291, 14, 1593, 275, 1031, 2374, 14, 1593, 398, 916, 1031, 2374, 14, 1782, 63, 466, 508, 5013, 2510, 14, 8549, 2477, 63, 2711, 63, 19919, 13260, 26, 288, 291, 14, 466, 275, 298, 17411, 2, 288, 291, 14, 9884, 275, 1031, 2374, 14, 9884, 63, 344, 288, 291, 14, 2558, 275, 1031, 2374, 14, 2558, 63, 344, 953, 2338, 275, 378, 288, 367, 4866, 315, 291, 14, 1631, 14, 3535, 63, 452, 63, 932, 18804, 837, 355, 340, 334, 2374, 14, 1782, 63, 466, 508, 5013, 2510, 14, 8549, 2477, 63, 2711, 63, 19919, 13260, 436, 490, 4866, 14, 9884, 63, 344, 508, 291, 14, 9884, 436, 490, 4866, 14, 2558, 63, 344, 508, 291, 14, 2558, 304, 490, 2338, 847, 413, 953, 340, 2338, 690, 413, 26, 355, 291, 14, 5610, 275, 1031, 2374, 14, 5610, 355, 291, 14, 1782, 275, 1031, 2374, 14, 1782, 398, 916, 1031, 2374, 14, 1782, 63, 466, 508, 1031, 2374, 14, 8549, 2477, 63, 2711, 63, 7278, 26, 288, 1911, 2374, 275, 488, 288, 367, 1104, 2374, 315, 291, 14, 1631, 14, 3535, 63, 452, 63, 932, 18804, 837, 355, 340, 1104, 2374, 14, 354, 508, 1031, 2374, 14, 1708, 26, 490, 1911, 2374, 275, 1104, 2374, 490, 2059, 953, 291, 14, 409, 63, 504, 63, 932, 2374, 8, 4214, 2374, 9, 398, 916, 1031, 2374, 14, 1782, 63, 466, 508, 1031, 2374, 14, 8549, 2477, 63, 2711, 63, 14897, 11259, 54, 26, 288, 291, 14, 466, 275, 298, 15873, 2, 288, 291, 14, 15873, 63, 10394, 275, 298, 15873, 63, 1102, 5, 83, 2, 450, 1031, 2374, 14, 1102, 288, 291, 14, 15873, 63, 5610, 275, 1031, 2374, 14, 5610, 288, 291, 14, 15873, 63, 1375, 275, 1031, 2374, 14, 1375, 288, 291, 14, 15873, 63, 3248, 275, 1031, 2374, 14, 13542, 288, 291, 14, 11122, 275, 756, 398, 916, 1031, 2374, 14, 1782, 63, 466, 508, 1031, 2374, 14, 8549, 2477, 63, 2711, 63, 45, 13260, 26, 288, 291, 14, 466, 275, 298, 77, 2374, 2, 953, 340, 1031, 2374, 14, 466, 63, 344, 508, 298, 86, 329, 79, 63, 2055, 87, 13, 2308, 582, 355, 291, 14, 1238, 275, 298, 86, 329, 79, 13, 2055, 87, 2, 355, 291, 14, 11122, 275, 298, 889, 2, 953, 916, 1031, 2374, 14, 466, 63, 344, 508, 298, 86, 329, 79, 63, 439, 13, 27197, 582, 355, 291, 14, 1238, 275, 298, 86, 329, 79, 13, 439, 2, 355, 291, 14, 11122, 275, 298, 889, 2, 953, 916, 334, 264, 14, 1431, 18523, 78, 433, 2391, 13, 59, 16, 13, 25, 8194, 18, 10750, 1031, 2374, 14, 466, 63, 344, 9, 503, 2116, 295, 14, 1431, 18523, 73, 32532, 13, 39, 8156, 71, 63, 54, 59, 16, 13, 25, 61, 9925, 16, 13, 25, 11472, 1031, 2374, 14, 466, 63, 344, 2298, 355, 291, 14, 1238, 275, 298, 86, 329, 79, 13, 12024, 2, 355, 291, 14, 11122, 275, 298, 5066, 2, 355, 291, 14, 2918, 275, 298, 1997, 2, 355, 291, 14, 5975, 4675, 275, 298, 1997, 2, 953, 587, 26, 355, 746, 1722, 8, 221, 327, 11942, 26, 949, 8486, 717, 3824, 16932, 1133, 5715, 4212, 370, 3550, 1031, 2374, 367, 333, 2374, 730, 1305, 1543, 83, 9859, 450, 717, 1031, 2374, 14, 466, 63, 344, 9, 953, 291, 14, 2580, 275, 1031, 2374, 14, 362, 63, 77, 2374, 63, 2580, 342, 398, 587, 26, 288, 746, 1722, 6115, 5912, 1031, 2243, 730, 450, 83, 531, 450, 1031, 2374, 9, 2378, 485, 4317, 63, 19926, 63, 12125, 275, 2097, 632, 401, 298, 466, 401, 298, 11122, 401, 298, 9884, 401, 298, 2558, 401, 2432, 298, 2261, 401, 298, 5610, 401, 298, 7998, 401, 298, 1593, 401, 298, 1238, 401, 2432, 298, 2918, 401, 298, 5975, 4675, 937, 339, 818, 275, 4692, 3697, 28615, 32, 632, 531, 272, 730, 275, 4692, 3697, 28615, 32, 466, 531, 272, 12883, 275, 4692, 3697, 28615, 32, 11122, 401, 365, 63, 5066, 889, 29, 549, 9, 272, 1402, 275, 4692, 3697, 28615, 32, 1238, 531, 272, 2929, 275, 4692, 3697, 28615, 32, 2918, 531, 272, 21394, 4675, 275, 4692, 3697, 28615, 32, 5975, 4675, 531, 339, 20868, 275, 4692, 3697, 28615, 1365, 15, 9884, 15, 32, 344, 531, 272, 3336, 275, 4692, 3697, 28615, 1365, 15, 2558, 15, 32, 344, 531, 339, 2243, 275, 4692, 3697, 28615, 1365, 15, 1562, 15, 32, 1782, 531, 272, 10414, 275, 4692, 3697, 28615, 1365, 15, 1562, 15, 32, 5610, 531, 339, 2881, 275, 4692, 3697, 28615, 1365, 15, 1562, 15, 32, 2261, 531, 272, 805, 275, 4692, 3697, 28615, 1365, 15, 1562, 15, 32, 1593, 531, 272, 9348, 275, 4692, 3697, 28615, 1365, 15, 1562, 15, 32, 7998, 531, 339, 5253, 63, 354, 275, 4692, 3697, 28615, 3090, 15, 32, 354, 531, 272, 221, 417, 63, 1700, 275, 4692, 3697, 28615, 417, 15, 32, 1700, 401, 365, 63, 265, 1997, 29, 549, 9, 339, 327, 730, 29, 15873, 7252, 272, 4061, 338, 63, 10394, 275, 4692, 3697, 28615, 1365, 15, 10394, 15, 32, 354, 531 ]
[ 199, 3, 1898, 8937, 12, 6171, 9572, 13002, 12, 3277, 14, 199, 3, 199, 3, 961, 1736, 365, 18233, 1334, 314, 1664, 14629, 86, 18, 503, 2945, 14, 199, 3, 1666, 314, 9685, 570, 315, 314, 2746, 13, 1896, 2082, 14, 199, 199, 646, 295, 199, 199, 504, 2508, 2921, 492, 943, 199, 199, 504, 1275, 1782, 492, 12272, 199, 504, 2508, 932, 2374, 492, 5013, 2510, 199, 504, 2508, 1652, 5649, 492, 4692, 3697, 421, 199, 533, 12272, 4965, 2374, 8, 2510, 304, 272, 4692, 63, 2339, 275, 298, 1102, 2374, 2, 339, 347, 663, 63, 504, 63, 932, 2374, 8, 277, 12, 1031, 2374, 304, 267, 943, 14, 1757, 480, 409, 63, 504, 63, 932, 2374, 2748, 9529, 78, 5, 83, 401, 1031, 2374, 14, 362, 63, 1652, 1012, 398, 340, 1031, 2374, 14, 1782, 63, 466, 508, 5013, 2510, 14, 8549, 2477, 63, 2711, 63, 23905, 26, 288, 291, 14, 466, 275, 298, 12024, 2, 288, 291, 14, 2261, 275, 1031, 2374, 14, 2261, 288, 291, 14, 5610, 275, 1031, 2374, 14, 5610, 288, 291, 14, 7998, 275, 1031, 2374, 14, 7998, 288, 291, 14, 1593, 275, 1031, 2374, 14, 1593, 398, 916, 1031, 2374, 14, 1782, 63, 466, 508, 5013, 2510, 14, 8549, 2477, 63, 2711, 63, 19919, 13260, 26, 288, 291, 14, 466, 275, 298, 17411, 2, 288, 291, 14, 9884, 275, 1031, 2374, 14, 9884, 63, 344, 288, 291, 14, 2558, 275, 1031, 2374, 14, 2558, 63, 344, 953, 2338, 275, 378, 288, 367, 4866, 315, 291, 14, 1631, 14, 3535, 63, 452, 63, 932, 18804, 837, 355, 340, 334, 2374, 14, 1782, 63, 466, 508, 5013, 2510, 14, 8549, 2477, 63, 2711, 63, 19919, 13260, 436, 490, 4866, 14, 9884, 63, 344, 508, 291, 14, 9884, 436, 490, 4866, 14, 2558, 63, 344, 508, 291, 14, 2558, 304, 490, 2338, 847, 413, 953, 340, 2338, 690, 413, 26, 355, 291, 14, 5610, 275, 1031, 2374, 14, 5610, 355, 291, 14, 1782, 275, 1031, 2374, 14, 1782, 398, 916, 1031, 2374, 14, 1782, 63, 466, 508, 1031, 2374, 14, 8549, 2477, 63, 2711, 63, 7278, 26, 288, 1911, 2374, 275, 488, 288, 367, 1104, 2374, 315, 291, 14, 1631, 14, 3535, 63, 452, 63, 932, 18804, 837, 355, 340, 1104, 2374, 14, 354, 508, 1031, 2374, 14, 1708, 26, 490, 1911, 2374, 275, 1104, 2374, 490, 2059, 953, 291, 14, 409, 63, 504, 63, 932, 2374, 8, 4214, 2374, 9, 398, 916, 1031, 2374, 14, 1782, 63, 466, 508, 1031, 2374, 14, 8549, 2477, 63, 2711, 63, 14897, 11259, 54, 26, 288, 291, 14, 466, 275, 298, 15873, 2, 288, 291, 14, 15873, 63, 10394, 275, 298, 15873, 63, 1102, 5, 83, 2, 450, 1031, 2374, 14, 1102, 288, 291, 14, 15873, 63, 5610, 275, 1031, 2374, 14, 5610, 288, 291, 14, 15873, 63, 1375, 275, 1031, 2374, 14, 1375, 288, 291, 14, 15873, 63, 3248, 275, 1031, 2374, 14, 13542, 288, 291, 14, 11122, 275, 756, 398, 916, 1031, 2374, 14, 1782, 63, 466, 508, 1031, 2374, 14, 8549, 2477, 63, 2711, 63, 45, 13260, 26, 288, 291, 14, 466, 275, 298, 77, 2374, 2, 953, 340, 1031, 2374, 14, 466, 63, 344, 508, 298, 86, 329, 79, 63, 2055, 87, 13, 2308, 582, 355, 291, 14, 1238, 275, 298, 86, 329, 79, 13, 2055, 87, 2, 355, 291, 14, 11122, 275, 298, 889, 2, 953, 916, 1031, 2374, 14, 466, 63, 344, 508, 298, 86, 329, 79, 63, 439, 13, 27197, 582, 355, 291, 14, 1238, 275, 298, 86, 329, 79, 13, 439, 2, 355, 291, 14, 11122, 275, 298, 889, 2, 953, 916, 334, 264, 14, 1431, 18523, 78, 433, 2391, 13, 59, 16, 13, 25, 8194, 18, 10750, 1031, 2374, 14, 466, 63, 344, 9, 503, 2116, 295, 14, 1431, 18523, 73, 32532, 13, 39, 8156, 71, 63, 54, 59, 16, 13, 25, 61, 9925, 16, 13, 25, 11472, 1031, 2374, 14, 466, 63, 344, 2298, 355, 291, 14, 1238, 275, 298, 86, 329, 79, 13, 12024, 2, 355, 291, 14, 11122, 275, 298, 5066, 2, 355, 291, 14, 2918, 275, 298, 1997, 2, 355, 291, 14, 5975, 4675, 275, 298, 1997, 2, 953, 587, 26, 355, 746, 1722, 8, 221, 327, 11942, 26, 949, 8486, 717, 3824, 16932, 1133, 5715, 4212, 370, 3550, 1031, 2374, 367, 333, 2374, 730, 1305, 1543, 83, 9859, 450, 717, 1031, 2374, 14, 466, 63, 344, 9, 953, 291, 14, 2580, 275, 1031, 2374, 14, 362, 63, 77, 2374, 63, 2580, 342, 398, 587, 26, 288, 746, 1722, 6115, 5912, 1031, 2243, 730, 450, 83, 531, 450, 1031, 2374, 9, 2378, 485, 4317, 63, 19926, 63, 12125, 275, 2097, 632, 401, 298, 466, 401, 298, 11122, 401, 298, 9884, 401, 298, 2558, 401, 2432, 298, 2261, 401, 298, 5610, 401, 298, 7998, 401, 298, 1593, 401, 298, 1238, 401, 2432, 298, 2918, 401, 298, 5975, 4675, 937, 339, 818, 275, 4692, 3697, 28615, 32, 632, 531, 272, 730, 275, 4692, 3697, 28615, 32, 466, 531, 272, 12883, 275, 4692, 3697, 28615, 32, 11122, 401, 365, 63, 5066, 889, 29, 549, 9, 272, 1402, 275, 4692, 3697, 28615, 32, 1238, 531, 272, 2929, 275, 4692, 3697, 28615, 32, 2918, 531, 272, 21394, 4675, 275, 4692, 3697, 28615, 32, 5975, 4675, 531, 339, 20868, 275, 4692, 3697, 28615, 1365, 15, 9884, 15, 32, 344, 531, 272, 3336, 275, 4692, 3697, 28615, 1365, 15, 2558, 15, 32, 344, 531, 339, 2243, 275, 4692, 3697, 28615, 1365, 15, 1562, 15, 32, 1782, 531, 272, 10414, 275, 4692, 3697, 28615, 1365, 15, 1562, 15, 32, 5610, 531, 339, 2881, 275, 4692, 3697, 28615, 1365, 15, 1562, 15, 32, 2261, 531, 272, 805, 275, 4692, 3697, 28615, 1365, 15, 1562, 15, 32, 1593, 531, 272, 9348, 275, 4692, 3697, 28615, 1365, 15, 1562, 15, 32, 7998, 531, 339, 5253, 63, 354, 275, 4692, 3697, 28615, 3090, 15, 32, 354, 531, 272, 221, 417, 63, 1700, 275, 4692, 3697, 28615, 417, 15, 32, 1700, 401, 365, 63, 265, 1997, 29, 549, 9, 339, 327, 730, 29, 15873, 7252, 272, 4061, 338, 63, 10394, 275, 4692, 3697, 28615, 1365, 15, 10394, 15, 32, 354, 531, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
litong01/python-monasca
kiloeyes/openstack/common/eventlet_backdoor.py
1
4777
# Copyright (c) 2012 OpenStack Foundation. # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from __future__ import print_function import errno import gc import os import pprint import socket import sys import traceback import eventlet import eventlet.backdoor import greenlet from oslo_config import cfg from kiloeyes.openstack.common.gettextutils import _LI from kiloeyes.openstack.common import log as logging help_for_backdoor_port = ( "Acceptable values are 0, <port>, and <start>:<end>, where 0 results " "in listening on a random tcp port number; <port> results in listening " "on the specified port number (and not enabling backdoor if that port " "is in use); and <start>:<end> results in listening on the smallest " "unused port number within the specified range of port numbers. The " "chosen port is displayed in the service's log file.") eventlet_backdoor_opts = [ cfg.StrOpt('backdoor_port', help="Enable eventlet backdoor. %s" % help_for_backdoor_port) ] CONF = cfg.CONF CONF.register_opts(eventlet_backdoor_opts) LOG = logging.getLogger(__name__) class EventletBackdoorConfigValueError(Exception): def __init__(self, port_range, help_msg, ex): msg = ('Invalid backdoor_port configuration %(range)s: %(ex)s. ' '%(help)s' % {'range': port_range, 'ex': ex, 'help': help_msg}) super(EventletBackdoorConfigValueError, self).__init__(msg) self.port_range = port_range def _dont_use_this(): print("Don't use this, just disconnect instead") def _find_objects(t): return [o for o in gc.get_objects() if isinstance(o, t)] def _print_greenthreads(): for i, gt in enumerate(_find_objects(greenlet.greenlet)): print(i, gt) traceback.print_stack(gt.gr_frame) print() def _print_nativethreads(): for threadId, stack in sys._current_frames().items(): print(threadId) traceback.print_stack(stack) print() def _parse_port_range(port_range): if ':' not in port_range: start, end = port_range, port_range else: start, end = port_range.split(':', 1) try: start, end = int(start), int(end) if end < start: raise ValueError return start, end except ValueError as ex: raise EventletBackdoorConfigValueError(port_range, ex, help_for_backdoor_port) def _listen(host, start_port, end_port, listen_func): try_port = start_port while True: try: return listen_func((host, try_port)) except socket.error as exc: if (exc.errno != errno.EADDRINUSE or try_port >= end_port): raise try_port += 1 def initialize_if_enabled(): backdoor_locals = { 'exit': _dont_use_this, # So we don't exit the entire process 'quit': _dont_use_this, # So we don't exit the entire process 'fo': _find_objects, 'pgt': _print_greenthreads, 'pnt': _print_nativethreads, } if CONF.backdoor_port is None: return None start_port, end_port = _parse_port_range(str(CONF.backdoor_port)) # NOTE(johannes): The standard sys.displayhook will print the value of # the last expression and set it to __builtin__._, which overwrites # the __builtin__._ that gettext sets. Let's switch to using pprint # since it won't interact poorly with gettext, and it's easier to # read the output too. def displayhook(val): if val is not None: pprint.pprint(val) sys.displayhook = displayhook sock = _listen('localhost', start_port, end_port, eventlet.listen) # In the case of backdoor port being zero, a port number is assigned by # listen(). In any case, pull the port number out here. port = sock.getsockname()[1] LOG.info( _LI('Eventlet backdoor listening on %(port)s for process %(pid)d') % {'port': port, 'pid': os.getpid()} ) eventlet.spawn_n(eventlet.backdoor.backdoor_server, sock, locals=backdoor_locals) return port
apache-2.0
[ 3, 1898, 334, 67, 9, 6029, 14260, 2752, 14, 199, 3, 30660, 402, 314, 20548, 437, 281, 265, 3844, 7769, 436, 19326, 9516, 4633, 14, 199, 3, 2900, 5924, 5702, 14, 199, 3, 199, 3, 259, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 259, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 259, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 260, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 259, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 259, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 259, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 259, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 259, 1334, 314, 844, 14, 199, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 646, 7554, 199, 646, 9486, 199, 646, 747, 199, 646, 10933, 199, 646, 2838, 199, 646, 984, 199, 646, 5190, 199, 199, 646, 21819, 199, 646, 21819, 14, 894, 20842, 199, 646, 12431, 2723, 199, 504, 11258, 63, 888, 492, 4810, 199, 199, 504, 1022, 11737, 69, 5066, 14, 8512, 14, 2330, 14, 5152, 1208, 492, 485, 2673, 199, 504, 1022, 11737, 69, 5066, 14, 8512, 14, 2330, 492, 943, 465, 2050, 199, 199, 3437, 63, 509, 63, 894, 20842, 63, 719, 275, 334, 272, 298, 8422, 461, 1338, 787, 378, 12, 665, 719, 6244, 436, 665, 928, 30, 16875, 500, 6244, 2382, 378, 2058, 298, 272, 298, 262, 22721, 641, 282, 2196, 14719, 1844, 1329, 27, 665, 719, 30, 2058, 315, 22721, 298, 272, 298, 265, 314, 2013, 1844, 1329, 334, 460, 440, 29310, 1771, 20842, 340, 626, 1844, 298, 272, 298, 374, 315, 675, 2736, 436, 665, 928, 30, 16875, 500, 30, 2058, 315, 22721, 641, 314, 18604, 298, 272, 298, 8618, 1844, 1329, 4453, 314, 2013, 1425, 402, 1844, 5579, 14, 221, 710, 298, 272, 298, 29671, 1844, 365, 9080, 315, 314, 2435, 1159, 943, 570, 2685, 199, 1430, 2723, 63, 894, 20842, 63, 3291, 275, 359, 272, 4810, 14, 19340, 360, 894, 20842, 63, 719, 297, 2049, 1720, 628, 6476, 21819, 1771, 20842, 14, 221, 450, 83, 2, 450, 1720, 63, 509, 63, 894, 20842, 63, 719, 9, 199, 61, 199, 199, 3103, 275, 4810, 14, 3103, 199, 3103, 14, 2683, 63, 3291, 8, 1430, 2723, 63, 894, 20842, 63, 3291, 9, 199, 4947, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 533, 6763, 2723, 4540, 20842, 2028, 3393, 8, 1726, 304, 272, 347, 636, 826, 721, 277, 12, 1844, 63, 1842, 12, 1720, 63, 1328, 12, 444, 304, 267, 1499, 275, 661, 3364, 1771, 20842, 63, 719, 2897, 2818, 1842, 9, 83, 26, 2818, 476, 9, 83, 14, 283, 2049, 9487, 3437, 9, 83, 7, 450, 2049, 791, 1842, 356, 1844, 63, 1842, 12, 283, 476, 356, 444, 12, 283, 3437, 356, 1720, 63, 1328, 1552, 267, 1613, 8, 2390, 2723, 4540, 20842, 2028, 3393, 12, 291, 2843, 826, 721, 1328, 9, 267, 291, 14, 719, 63, 1842, 275, 1844, 63, 1842, 421, 199, 318, 485, 18671, 63, 1180, 63, 3749, 837, 272, 870, 480, 16932, 1133, 675, 642, 12, 2951, 17639, 3140, 531, 421, 199, 318, 485, 1623, 63, 1462, 8, 84, 304, 272, 372, 359, 79, 367, 312, 315, 9486, 14, 362, 63, 1462, 342, 340, 1228, 8, 79, 12, 307, 1874, 421, 199, 318, 485, 1361, 63, 7731, 6962, 837, 272, 367, 284, 12, 16484, 315, 3874, 1547, 1623, 63, 1462, 8, 7731, 2723, 14, 7731, 2723, 2298, 267, 870, 8, 73, 12, 16484, 9, 267, 5190, 14, 1361, 63, 2340, 8, 3308, 14, 2587, 63, 1943, 9, 267, 870, 342, 421, 199, 318, 485, 1361, 63, 6106, 6962, 837, 272, 367, 2462, 1304, 12, 3464, 315, 984, 423, 1818, 63, 8444, 1252, 1744, 837, 267, 870, 8, 2671, 1304, 9, 267, 5190, 14, 1361, 63, 2340, 8, 2340, 9, 267, 870, 342, 421, 199, 318, 485, 1122, 63, 719, 63, 1842, 8, 719, 63, 1842, 304, 272, 340, 10871, 440, 315, 1844, 63, 1842, 26, 267, 1343, 12, 1284, 275, 1844, 63, 1842, 12, 1844, 63, 1842, 272, 587, 26, 267, 1343, 12, 1284, 275, 1844, 63, 1842, 14, 1294, 16451, 413, 9, 272, 862, 26, 267, 1343, 12, 1284, 275, 1109, 8, 928, 395, 1109, 8, 500, 9, 267, 340, 1284, 665, 1343, 26, 288, 746, 1722, 267, 372, 1343, 12, 1284, 272, 871, 1722, 465, 444, 26, 267, 746, 6763, 2723, 4540, 20842, 2028, 3393, 8, 719, 63, 1842, 12, 444, 12, 6901, 1720, 63, 509, 63, 894, 20842, 63, 719, 9, 421, 199, 318, 485, 5859, 8, 1102, 12, 1343, 63, 719, 12, 1284, 63, 719, 12, 6938, 63, 1532, 304, 272, 862, 63, 719, 275, 1343, 63, 719, 272, 1830, 715, 26, 267, 862, 26, 288, 372, 6938, 63, 1532, 1332, 1102, 12, 862, 63, 719, 430, 267, 871, 2838, 14, 705, 465, 3178, 26, 288, 340, 334, 2804, 14, 7931, 1137, 7554, 14, 37, 7803, 568, 4701, 503, 2049, 862, 63, 719, 2356, 1284, 63, 719, 304, 355, 746, 288, 862, 63, 719, 847, 413, 421, 199, 318, 8265, 63, 692, 63, 3827, 837, 272, 1771, 20842, 63, 9350, 275, 469, 267, 283, 2224, 356, 485, 18671, 63, 1180, 63, 3749, 12, 420, 327, 2002, 781, 2793, 1133, 4458, 314, 8039, 2112, 267, 283, 10589, 356, 485, 18671, 63, 1180, 63, 3749, 12, 420, 327, 2002, 781, 2793, 1133, 4458, 314, 8039, 2112, 267, 283, 545, 356, 485, 1623, 63, 1462, 12, 267, 283, 80, 3308, 356, 485, 1361, 63, 7731, 6962, 12, 267, 283, 24519, 356, 485, 1361, 63, 6106, 6962, 12, 272, 789, 339, 340, 6392, 14, 894, 20842, 63, 719, 365, 488, 26, 267, 372, 488, 339, 1343, 63, 719, 12, 1284, 63, 719, 275, 485, 1122, 63, 719, 63, 1842, 8, 495, 8, 3103, 14, 894, 20842, 63, 719, 430, 339, 327, 6944 ]
[ 1898, 334, 67, 9, 6029, 14260, 2752, 14, 199, 3, 30660, 402, 314, 20548, 437, 281, 265, 3844, 7769, 436, 19326, 9516, 4633, 14, 199, 3, 2900, 5924, 5702, 14, 199, 3, 199, 3, 259, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 259, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 259, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 260, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 259, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 259, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 259, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 259, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 259, 1334, 314, 844, 14, 199, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 646, 7554, 199, 646, 9486, 199, 646, 747, 199, 646, 10933, 199, 646, 2838, 199, 646, 984, 199, 646, 5190, 199, 199, 646, 21819, 199, 646, 21819, 14, 894, 20842, 199, 646, 12431, 2723, 199, 504, 11258, 63, 888, 492, 4810, 199, 199, 504, 1022, 11737, 69, 5066, 14, 8512, 14, 2330, 14, 5152, 1208, 492, 485, 2673, 199, 504, 1022, 11737, 69, 5066, 14, 8512, 14, 2330, 492, 943, 465, 2050, 199, 199, 3437, 63, 509, 63, 894, 20842, 63, 719, 275, 334, 272, 298, 8422, 461, 1338, 787, 378, 12, 665, 719, 6244, 436, 665, 928, 30, 16875, 500, 6244, 2382, 378, 2058, 298, 272, 298, 262, 22721, 641, 282, 2196, 14719, 1844, 1329, 27, 665, 719, 30, 2058, 315, 22721, 298, 272, 298, 265, 314, 2013, 1844, 1329, 334, 460, 440, 29310, 1771, 20842, 340, 626, 1844, 298, 272, 298, 374, 315, 675, 2736, 436, 665, 928, 30, 16875, 500, 30, 2058, 315, 22721, 641, 314, 18604, 298, 272, 298, 8618, 1844, 1329, 4453, 314, 2013, 1425, 402, 1844, 5579, 14, 221, 710, 298, 272, 298, 29671, 1844, 365, 9080, 315, 314, 2435, 1159, 943, 570, 2685, 199, 1430, 2723, 63, 894, 20842, 63, 3291, 275, 359, 272, 4810, 14, 19340, 360, 894, 20842, 63, 719, 297, 2049, 1720, 628, 6476, 21819, 1771, 20842, 14, 221, 450, 83, 2, 450, 1720, 63, 509, 63, 894, 20842, 63, 719, 9, 199, 61, 199, 199, 3103, 275, 4810, 14, 3103, 199, 3103, 14, 2683, 63, 3291, 8, 1430, 2723, 63, 894, 20842, 63, 3291, 9, 199, 4947, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 533, 6763, 2723, 4540, 20842, 2028, 3393, 8, 1726, 304, 272, 347, 636, 826, 721, 277, 12, 1844, 63, 1842, 12, 1720, 63, 1328, 12, 444, 304, 267, 1499, 275, 661, 3364, 1771, 20842, 63, 719, 2897, 2818, 1842, 9, 83, 26, 2818, 476, 9, 83, 14, 283, 2049, 9487, 3437, 9, 83, 7, 450, 2049, 791, 1842, 356, 1844, 63, 1842, 12, 283, 476, 356, 444, 12, 283, 3437, 356, 1720, 63, 1328, 1552, 267, 1613, 8, 2390, 2723, 4540, 20842, 2028, 3393, 12, 291, 2843, 826, 721, 1328, 9, 267, 291, 14, 719, 63, 1842, 275, 1844, 63, 1842, 421, 199, 318, 485, 18671, 63, 1180, 63, 3749, 837, 272, 870, 480, 16932, 1133, 675, 642, 12, 2951, 17639, 3140, 531, 421, 199, 318, 485, 1623, 63, 1462, 8, 84, 304, 272, 372, 359, 79, 367, 312, 315, 9486, 14, 362, 63, 1462, 342, 340, 1228, 8, 79, 12, 307, 1874, 421, 199, 318, 485, 1361, 63, 7731, 6962, 837, 272, 367, 284, 12, 16484, 315, 3874, 1547, 1623, 63, 1462, 8, 7731, 2723, 14, 7731, 2723, 2298, 267, 870, 8, 73, 12, 16484, 9, 267, 5190, 14, 1361, 63, 2340, 8, 3308, 14, 2587, 63, 1943, 9, 267, 870, 342, 421, 199, 318, 485, 1361, 63, 6106, 6962, 837, 272, 367, 2462, 1304, 12, 3464, 315, 984, 423, 1818, 63, 8444, 1252, 1744, 837, 267, 870, 8, 2671, 1304, 9, 267, 5190, 14, 1361, 63, 2340, 8, 2340, 9, 267, 870, 342, 421, 199, 318, 485, 1122, 63, 719, 63, 1842, 8, 719, 63, 1842, 304, 272, 340, 10871, 440, 315, 1844, 63, 1842, 26, 267, 1343, 12, 1284, 275, 1844, 63, 1842, 12, 1844, 63, 1842, 272, 587, 26, 267, 1343, 12, 1284, 275, 1844, 63, 1842, 14, 1294, 16451, 413, 9, 272, 862, 26, 267, 1343, 12, 1284, 275, 1109, 8, 928, 395, 1109, 8, 500, 9, 267, 340, 1284, 665, 1343, 26, 288, 746, 1722, 267, 372, 1343, 12, 1284, 272, 871, 1722, 465, 444, 26, 267, 746, 6763, 2723, 4540, 20842, 2028, 3393, 8, 719, 63, 1842, 12, 444, 12, 6901, 1720, 63, 509, 63, 894, 20842, 63, 719, 9, 421, 199, 318, 485, 5859, 8, 1102, 12, 1343, 63, 719, 12, 1284, 63, 719, 12, 6938, 63, 1532, 304, 272, 862, 63, 719, 275, 1343, 63, 719, 272, 1830, 715, 26, 267, 862, 26, 288, 372, 6938, 63, 1532, 1332, 1102, 12, 862, 63, 719, 430, 267, 871, 2838, 14, 705, 465, 3178, 26, 288, 340, 334, 2804, 14, 7931, 1137, 7554, 14, 37, 7803, 568, 4701, 503, 2049, 862, 63, 719, 2356, 1284, 63, 719, 304, 355, 746, 288, 862, 63, 719, 847, 413, 421, 199, 318, 8265, 63, 692, 63, 3827, 837, 272, 1771, 20842, 63, 9350, 275, 469, 267, 283, 2224, 356, 485, 18671, 63, 1180, 63, 3749, 12, 420, 327, 2002, 781, 2793, 1133, 4458, 314, 8039, 2112, 267, 283, 10589, 356, 485, 18671, 63, 1180, 63, 3749, 12, 420, 327, 2002, 781, 2793, 1133, 4458, 314, 8039, 2112, 267, 283, 545, 356, 485, 1623, 63, 1462, 12, 267, 283, 80, 3308, 356, 485, 1361, 63, 7731, 6962, 12, 267, 283, 24519, 356, 485, 1361, 63, 6106, 6962, 12, 272, 789, 339, 340, 6392, 14, 894, 20842, 63, 719, 365, 488, 26, 267, 372, 488, 339, 1343, 63, 719, 12, 1284, 63, 719, 275, 485, 1122, 63, 719, 63, 1842, 8, 495, 8, 3103, 14, 894, 20842, 63, 719, 430, 339, 327, 6944, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
chuan9/chromium-crosswalk
base/allocator/prep_libc.py
50
2407
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # # This script takes libcmt.lib for VS2013 and removes the allocation related # functions from it. # # Usage: prep_libc.py <VCLibDir> <OutputDir> <arch> # # VCLibDir is the path where VC is installed, something like: # C:\Program Files\Microsoft Visual Studio 8\VC\lib # OutputDir is the directory where the modified libcmt file should be stored. # arch is one of: 'ia32', 'x86' or 'x64'. ia32 and x86 are synonyms. import os import shutil import subprocess import sys def run(command): """Run |command|. If any lines that match an error condition then terminate.""" error = 'cannot find member object' popen = subprocess.Popen( command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) out, _ = popen.communicate() for line in out.splitlines(): print line if error and line.find(error) != -1: print 'prep_libc.py: Error stripping object from C runtime.' sys.exit(1) def main(): bindir = 'SELF_X86' objdir = 'INTEL' vs_install_dir = sys.argv[1] outdir = sys.argv[2] if "x64" in sys.argv[3]: bindir = 'SELF_64_amd64' objdir = 'amd64' vs_install_dir = os.path.join(vs_install_dir, 'amd64') output_lib = os.path.join(outdir, 'libcmt.lib') shutil.copyfile(os.path.join(vs_install_dir, 'libcmt.lib'), output_lib) shutil.copyfile(os.path.join(vs_install_dir, 'libcmt.pdb'), os.path.join(outdir, 'libcmt.pdb')) cvspath = 'f:\\binaries\\Intermediate\\vctools\\crt_bld\\' + bindir + \ '\\crt\\prebuild\\build\\' + objdir + '\\mt_obj\\nativec\\\\'; cppvspath = 'f:\\binaries\\Intermediate\\vctools\\crt_bld\\' + bindir + \ '\\crt\\prebuild\\build\\' + objdir + '\\mt_obj\\nativecpp\\\\'; cobjfiles = ['malloc', 'free', 'realloc', 'heapinit', 'calloc', 'recalloc', 'calloc_impl'] cppobjfiles = ['new', 'new2', 'delete', 'delete2', 'new_mode', 'newopnt', 'newaopnt'] for obj in cobjfiles: cmd = ('lib /nologo /ignore:4006,4221 /remove:%s%s.obj %s' % (cvspath, obj, output_lib)) run(cmd) for obj in cppobjfiles: cmd = ('lib /nologo /ignore:4006,4221 /remove:%s%s.obj %s' % (cppvspath, obj, output_lib)) run(cmd) if __name__ == "__main__": sys.exit(main())
bsd-3-clause
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 1898, 334, 67, 9, 6029, 710, 12051, 6642, 14, 2900, 4481, 4644, 14, 199, 3, 3645, 402, 642, 1350, 1233, 365, 10413, 701, 282, 6289, 13, 2487, 4190, 626, 883, 506, 199, 3, 1911, 315, 314, 5113, 570, 14, 199, 3, 199, 3, 961, 2884, 6181, 1973, 67, 2037, 14, 773, 367, 21685, 6965, 436, 14185, 314, 18723, 4048, 199, 3, 3423, 687, 652, 14, 199, 3, 199, 3, 11028, 26, 19986, 63, 20217, 14, 647, 665, 24177, 1892, 3567, 30, 665, 2959, 3567, 30, 665, 1047, 30, 199, 3, 199, 3, 812, 1981, 1892, 3567, 365, 314, 931, 2382, 24955, 365, 4903, 12, 6020, 2839, 26, 199, 3, 259, 445, 3427, 9184, 16920, 60, 12940, 14702, 13225, 1695, 60, 9454, 60, 773, 199, 3, 7242, 3567, 365, 314, 2082, 2382, 314, 6042, 1973, 67, 2037, 570, 1077, 506, 5489, 14, 199, 3, 3819, 365, 1373, 402, 26, 283, 4674, 708, 297, 283, 88, 1184, 7, 503, 283, 88, 772, 1370, 284, 65, 708, 436, 671, 1184, 787, 9560, 5220, 706, 14, 199, 199, 646, 747, 199, 646, 5145, 199, 646, 3873, 199, 646, 984, 199, 199, 318, 1255, 8, 1531, 304, 523, 408, 2540, 1204, 1531, 18257, 221, 982, 1263, 2385, 626, 1336, 376, 1125, 5558, 2066, 489, 15095, 1041, 523, 1125, 275, 283, 11250, 2342, 3653, 909, 7, 523, 17758, 275, 3873, 14, 7942, 8, 489, 1414, 12, 3839, 29, 5781, 14, 6089, 12, 4635, 29, 5781, 14, 13850, 9, 523, 734, 12, 485, 275, 17758, 14, 10664, 342, 523, 367, 1004, 315, 734, 14, 7644, 837, 272, 870, 1004, 272, 340, 1125, 436, 1004, 14, 1623, 8, 705, 9, 1137, 446, 17, 26, 489, 870, 283, 10837, 63, 20217, 14, 647, 26, 4520, 4024, 3637, 909, 687, 445, 8836, 3530, 489, 984, 14, 2224, 8, 17, 9, 199, 199, 318, 2446, 837, 523, 2517, 694, 275, 283, 899, 15965, 63, 56, 1184, 7, 523, 1559, 694, 275, 283, 28859, 7, 523, 8118, 63, 3174, 63, 694, 275, 984, 14, 3020, 59, 17, 61, 523, 24670, 275, 984, 14, 3020, 59, 18, 61, 523, 340, 298, 88, 772, 2, 315, 984, 14, 3020, 59, 19, 2189, 272, 2517, 694, 275, 283, 899, 15965, 63, 772, 63, 21778, 772, 7, 272, 1559, 694, 275, 283, 21778, 772, 7, 272, 8118, 63, 3174, 63, 694, 275, 747, 14, 515, 14, 904, 8, 3122, 63, 3174, 63, 694, 12, 283, 21778, 772, 358, 523, 1072, 63, 773, 275, 747, 14, 515, 14, 904, 8, 18091, 12, 283, 20217, 2037, 14, 773, 358, 523, 5145, 14, 21997, 8, 736, 14, 515, 14, 904, 8, 3122, 63, 3174, 63, 694, 12, 283, 20217, 2037, 14, 773, 659, 1072, 63, 773, 9, 523, 5145, 14, 21997, 8, 736, 14, 515, 14, 904, 8, 3122, 63, 3174, 63, 694, 12, 283, 20217, 2037, 14, 10511, 659, 2116, 747, 14, 515, 14, 904, 8, 18091, 12, 283, 20217, 2037, 14, 10511, 1333, 523, 286, 3122, 515, 275, 283, 70, 18589, 27542, 1103, 2620, 5050, 1103, 86, 319, 5998, 1103, 16617, 63, 14341, 1103, 7, 435, 2517, 694, 435, 971, 489, 6468, 16617, 1103, 657, 1506, 1103, 1506, 1103, 7, 435, 1559, 694, 435, 6468, 2037, 63, 1113, 1103, 6106, 67, 8712, 13619, 523, 7246, 3122, 515, 275, 283, 70, 18589, 27542, 1103, 2620, 5050, 1103, 86, 319, 5998, 1103, 16617, 63, 14341, 1103, 7, 435, 2517, 694, 435, 971, 489, 6468, 16617, 1103, 657, 1506, 1103, 1506, 1103, 7, 435, 1559, 694, 435, 6468, 2037, 63, 1113, 1103, 6106, 5910, 8712, 13619, 819, 512, 468, 1725, 275, 788, 23981, 297, 283, 4624, 297, 283, 3093, 2102, 297, 283, 12492, 826, 297, 283, 915, 2102, 297, 283, 264, 915, 2102, 297, 489, 283, 915, 2102, 63, 5472, 418, 523, 7667, 555, 468, 1725, 275, 788, 1222, 297, 283, 1222, 18, 297, 283, 1807, 297, 283, 1807, 18, 297, 283, 1222, 63, 632, 297, 283, 1222, 411, 343, 297, 489, 283, 1222, 65, 411, 343, 418, 523, 367, 1559, 315, 512, 468, 1725, 26, 272, 2088, 275, 661, 773, 1182, 889, 9733, 1182, 4247, 26, 5303, 22, 12, 20, 11564, 1182, 2168, 2689, 83, 5, 83, 14, 1113, 450, 83, 7, 450, 1779, 334, 28151, 515, 12, 1559, 12, 1072, 63, 773, 430, 272, 1255, 8, 1760, 9, 523, 367, 1559, 315, 7667, 555, 468, 1725, 26, 272, 2088, 275, 661, 773, 1182, 889, 9733, 1182, 4247, 26, 5303, 22, 12, 20, 11564, 1182, 2168, 2689, 83, 5, 83, 14, 1113, 450, 83, 7, 450, 1779, 334, 5910, 3122, 515, 12, 1559, 12, 1072, 63, 773, 430, 272, 1255, 8, 1760, 9, 199, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 523, 984, 14, 2224, 8, 973, 1012, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 1898, 334, 67, 9, 6029, 710, 12051, 6642, 14, 2900, 4481, 4644, 14, 199, 3, 3645, 402, 642, 1350, 1233, 365, 10413, 701, 282, 6289, 13, 2487, 4190, 626, 883, 506, 199, 3, 1911, 315, 314, 5113, 570, 14, 199, 3, 199, 3, 961, 2884, 6181, 1973, 67, 2037, 14, 773, 367, 21685, 6965, 436, 14185, 314, 18723, 4048, 199, 3, 3423, 687, 652, 14, 199, 3, 199, 3, 11028, 26, 19986, 63, 20217, 14, 647, 665, 24177, 1892, 3567, 30, 665, 2959, 3567, 30, 665, 1047, 30, 199, 3, 199, 3, 812, 1981, 1892, 3567, 365, 314, 931, 2382, 24955, 365, 4903, 12, 6020, 2839, 26, 199, 3, 259, 445, 3427, 9184, 16920, 60, 12940, 14702, 13225, 1695, 60, 9454, 60, 773, 199, 3, 7242, 3567, 365, 314, 2082, 2382, 314, 6042, 1973, 67, 2037, 570, 1077, 506, 5489, 14, 199, 3, 3819, 365, 1373, 402, 26, 283, 4674, 708, 297, 283, 88, 1184, 7, 503, 283, 88, 772, 1370, 284, 65, 708, 436, 671, 1184, 787, 9560, 5220, 706, 14, 199, 199, 646, 747, 199, 646, 5145, 199, 646, 3873, 199, 646, 984, 199, 199, 318, 1255, 8, 1531, 304, 523, 408, 2540, 1204, 1531, 18257, 221, 982, 1263, 2385, 626, 1336, 376, 1125, 5558, 2066, 489, 15095, 1041, 523, 1125, 275, 283, 11250, 2342, 3653, 909, 7, 523, 17758, 275, 3873, 14, 7942, 8, 489, 1414, 12, 3839, 29, 5781, 14, 6089, 12, 4635, 29, 5781, 14, 13850, 9, 523, 734, 12, 485, 275, 17758, 14, 10664, 342, 523, 367, 1004, 315, 734, 14, 7644, 837, 272, 870, 1004, 272, 340, 1125, 436, 1004, 14, 1623, 8, 705, 9, 1137, 446, 17, 26, 489, 870, 283, 10837, 63, 20217, 14, 647, 26, 4520, 4024, 3637, 909, 687, 445, 8836, 3530, 489, 984, 14, 2224, 8, 17, 9, 199, 199, 318, 2446, 837, 523, 2517, 694, 275, 283, 899, 15965, 63, 56, 1184, 7, 523, 1559, 694, 275, 283, 28859, 7, 523, 8118, 63, 3174, 63, 694, 275, 984, 14, 3020, 59, 17, 61, 523, 24670, 275, 984, 14, 3020, 59, 18, 61, 523, 340, 298, 88, 772, 2, 315, 984, 14, 3020, 59, 19, 2189, 272, 2517, 694, 275, 283, 899, 15965, 63, 772, 63, 21778, 772, 7, 272, 1559, 694, 275, 283, 21778, 772, 7, 272, 8118, 63, 3174, 63, 694, 275, 747, 14, 515, 14, 904, 8, 3122, 63, 3174, 63, 694, 12, 283, 21778, 772, 358, 523, 1072, 63, 773, 275, 747, 14, 515, 14, 904, 8, 18091, 12, 283, 20217, 2037, 14, 773, 358, 523, 5145, 14, 21997, 8, 736, 14, 515, 14, 904, 8, 3122, 63, 3174, 63, 694, 12, 283, 20217, 2037, 14, 773, 659, 1072, 63, 773, 9, 523, 5145, 14, 21997, 8, 736, 14, 515, 14, 904, 8, 3122, 63, 3174, 63, 694, 12, 283, 20217, 2037, 14, 10511, 659, 2116, 747, 14, 515, 14, 904, 8, 18091, 12, 283, 20217, 2037, 14, 10511, 1333, 523, 286, 3122, 515, 275, 283, 70, 18589, 27542, 1103, 2620, 5050, 1103, 86, 319, 5998, 1103, 16617, 63, 14341, 1103, 7, 435, 2517, 694, 435, 971, 489, 6468, 16617, 1103, 657, 1506, 1103, 1506, 1103, 7, 435, 1559, 694, 435, 6468, 2037, 63, 1113, 1103, 6106, 67, 8712, 13619, 523, 7246, 3122, 515, 275, 283, 70, 18589, 27542, 1103, 2620, 5050, 1103, 86, 319, 5998, 1103, 16617, 63, 14341, 1103, 7, 435, 2517, 694, 435, 971, 489, 6468, 16617, 1103, 657, 1506, 1103, 1506, 1103, 7, 435, 1559, 694, 435, 6468, 2037, 63, 1113, 1103, 6106, 5910, 8712, 13619, 819, 512, 468, 1725, 275, 788, 23981, 297, 283, 4624, 297, 283, 3093, 2102, 297, 283, 12492, 826, 297, 283, 915, 2102, 297, 283, 264, 915, 2102, 297, 489, 283, 915, 2102, 63, 5472, 418, 523, 7667, 555, 468, 1725, 275, 788, 1222, 297, 283, 1222, 18, 297, 283, 1807, 297, 283, 1807, 18, 297, 283, 1222, 63, 632, 297, 283, 1222, 411, 343, 297, 489, 283, 1222, 65, 411, 343, 418, 523, 367, 1559, 315, 512, 468, 1725, 26, 272, 2088, 275, 661, 773, 1182, 889, 9733, 1182, 4247, 26, 5303, 22, 12, 20, 11564, 1182, 2168, 2689, 83, 5, 83, 14, 1113, 450, 83, 7, 450, 1779, 334, 28151, 515, 12, 1559, 12, 1072, 63, 773, 430, 272, 1255, 8, 1760, 9, 523, 367, 1559, 315, 7667, 555, 468, 1725, 26, 272, 2088, 275, 661, 773, 1182, 889, 9733, 1182, 4247, 26, 5303, 22, 12, 20, 11564, 1182, 2168, 2689, 83, 5, 83, 14, 1113, 450, 83, 7, 450, 1779, 334, 5910, 3122, 515, 12, 1559, 12, 1072, 63, 773, 430, 272, 1255, 8, 1760, 9, 199, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 523, 984, 14, 2224, 8, 973, 1012, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
felliott/osf.io
api_tests/providers/preprints/views/test_preprint_provider_request_list.py
15
2781
import pytest from api.base.settings.defaults import API_BASE from api_tests.requests.mixins import PreprintRequestTestMixin @pytest.mark.django_db class TestPreprintProviderWithdrawalRequstList(PreprintRequestTestMixin): def url(self, provider): return '/{}providers/preprints/{}/withdraw_requests/'.format(API_BASE, provider._id) def test_list(self, app, admin, moderator, write_contrib, noncontrib, pre_mod_provider, post_mod_provider, pre_mod_preprint, post_mod_preprint, pre_request, post_request): # test_no_perms res = app.get(self.url(pre_mod_provider), auth=admin.auth, expect_errors=True) # preprint admin, not reviews admin assert res.status_code == 403 res = app.get(self.url(pre_mod_provider), auth=write_contrib.auth, expect_errors=True) assert res.status_code == 403 res = app.get(self.url(pre_mod_provider), auth=noncontrib.auth, expect_errors=True) assert res.status_code == 403 res = app.get(self.url(pre_mod_provider), expect_errors=True) assert res.status_code == 401 # test_moderator_can_view res = app.get(self.url(pre_mod_provider), auth=moderator.auth) assert res.status_code == 200 assert len(res.json['data']) == 1 assert res.json['data'][0]['id'] == pre_request._id res = app.get(self.url(post_mod_provider), auth=moderator.auth) assert res.status_code == 200 assert len(res.json['data']) == 1 assert res.json['data'][0]['id'] == post_request._id # test_embed res = app.get('{}?embed=target'.format(self.url(pre_mod_provider)), auth=moderator.auth) assert res.status_code == 200 assert len(res.json['data']) == 1 assert res.json['data'][0]['id'] == pre_request._id assert res.json['data'][0]['embeds']['target']['data']['id'] == pre_mod_preprint._id res = app.get('{}?embed=target'.format(self.url(post_mod_provider)), auth=moderator.auth) assert res.status_code == 200 assert len(res.json['data']) == 1 assert res.json['data'][0]['id'] == post_request._id assert res.json['data'][0]['embeds']['target']['data']['id'] == post_mod_preprint._id # test_filter res = app.get('{}?filter[target]={}'.format(self.url(pre_mod_provider), pre_mod_preprint._id), auth=moderator.auth) assert res.status_code == 200 assert len(res.json['data']) == 1 assert res.json['data'][0]['id'] == pre_request._id res = app.get('{}?filter[target]={}'.format(self.url(post_mod_provider), post_mod_preprint._id), auth=moderator.auth) assert res.status_code == 200 assert len(res.json['data']) == 1 assert res.json['data'][0]['id'] == post_request._id
apache-2.0
[ 646, 4613, 199, 199, 504, 2986, 14, 1095, 14, 1751, 14, 4322, 492, 3261, 63, 5825, 199, 504, 2986, 63, 2219, 14, 6615, 14, 30192, 492, 510, 1155, 672, 2017, 22060, 199, 199, 32, 4462, 14, 1657, 14, 1176, 63, 697, 199, 533, 1379, 24001, 672, 6663, 3007, 5485, 279, 497, 392, 270, 1296, 8, 24001, 672, 2017, 22060, 304, 272, 347, 1166, 8, 277, 12, 5022, 304, 267, 372, 1994, 2440, 9710, 15, 657, 29593, 19655, 1045, 5485, 63, 6615, 15, 1370, 908, 8, 3735, 63, 5825, 12, 5022, 423, 344, 9, 339, 347, 511, 63, 513, 8, 277, 12, 1145, 12, 4628, 12, 818, 9043, 12, 2218, 63, 2828, 12, 2222, 2828, 12, 876, 63, 1494, 63, 3780, 12, 2963, 63, 1494, 63, 3780, 12, 876, 63, 1494, 63, 657, 1361, 12, 2963, 63, 1494, 63, 657, 1361, 12, 876, 63, 1069, 12, 2963, 63, 1069, 304, 267, 327, 511, 63, 889, 63, 12068, 267, 522, 275, 1145, 14, 362, 8, 277, 14, 633, 8, 657, 63, 1494, 63, 3780, 395, 1790, 29, 2113, 14, 1178, 12, 4282, 63, 2550, 29, 549, 9, 221, 327, 876, 1361, 4628, 12, 440, 295, 4196, 4628, 267, 702, 522, 14, 1205, 63, 600, 508, 13269, 267, 522, 275, 1145, 14, 362, 8, 277, 14, 633, 8, 657, 63, 1494, 63, 3780, 395, 1790, 29, 952, 63, 2828, 14, 1178, 12, 4282, 63, 2550, 29, 549, 9, 267, 702, 522, 14, 1205, 63, 600, 508, 13269, 267, 522, 275, 1145, 14, 362, 8, 277, 14, 633, 8, 657, 63, 1494, 63, 3780, 395, 1790, 29, 2865, 2828, 14, 1178, 12, 4282, 63, 2550, 29, 549, 9, 267, 702, 522, 14, 1205, 63, 600, 508, 13269, 267, 522, 275, 1145, 14, 362, 8, 277, 14, 633, 8, 657, 63, 1494, 63, 3780, 395, 4282, 63, 2550, 29, 549, 9, 267, 702, 522, 14, 1205, 63, 600, 508, 13952, 398, 327, 511, 63, 25597, 63, 2425, 63, 1345, 267, 522, 275, 1145, 14, 362, 8, 277, 14, 633, 8, 657, 63, 1494, 63, 3780, 395, 1790, 29, 25597, 14, 1178, 9, 267, 702, 522, 14, 1205, 63, 600, 508, 1926, 267, 702, 822, 8, 470, 14, 1001, 459, 576, 1105, 508, 413, 267, 702, 522, 14, 1001, 459, 576, 3488, 16, 2733, 344, 418, 508, 876, 63, 1069, 423, 344, 398, 522, 275, 1145, 14, 362, 8, 277, 14, 633, 8, 1932, 63, 1494, 63, 3780, 395, 1790, 29, 25597, 14, 1178, 9, 267, 702, 522, 14, 1205, 63, 600, 508, 1926, 267, 702, 822, 8, 470, 14, 1001, 459, 576, 1105, 508, 413, 267, 702, 522, 14, 1001, 459, 576, 3488, 16, 2733, 344, 418, 508, 2963, 63, 1069, 423, 344, 398, 327, 511, 63, 6427, 267, 522, 275, 1145, 14, 362, 17519, 31, 6427, 29, 1375, 1370, 908, 8, 277, 14, 633, 8, 657, 63, 1494, 63, 3780, 1826, 1790, 29, 25597, 14, 1178, 9, 267, 702, 522, 14, 1205, 63, 600, 508, 1926, 267, 702, 822, 8, 470, 14, 1001, 459, 576, 1105, 508, 413, 267, 702, 522, 14, 1001, 459, 576, 3488, 16, 2733, 344, 418, 508, 876, 63, 1069, 423, 344, 267, 702, 522, 14, 1001, 459, 576, 3488, 16, 2733, 6427, 83, 2545, 1375, 2545, 576, 2545, 344, 418, 508, 876, 63, 1494, 63, 657, 1361, 423, 344, 398, 522, 275, 1145, 14, 362, 17519, 31, 6427, 29, 1375, 1370, 908, 8, 277, 14, 633, 8, 1932, 63, 1494, 63, 3780, 1826, 1790, 29, 25597, 14, 1178, 9, 267, 702, 522, 14, 1205, 63, 600, 508, 1926, 267, 702, 822, 8, 470, 14, 1001, 459, 576, 1105, 508, 413, 267, 702, 522, 14, 1001, 459, 576, 3488, 16, 2733, 344, 418, 508, 2963, 63, 1069, 423, 344, 267, 702, 522, 14, 1001, 459, 576, 3488, 16, 2733, 6427, 83, 2545, 1375, 2545, 576, 2545, 344, 418, 508, 2963, 63, 1494, 63, 657, 1361, 423, 344, 398, 327, 511, 63, 1541, 267, 522, 275, 1145, 14, 362, 17519, 31, 1541, 59, 1375, 61, 27244, 908, 8, 277, 14, 633, 8, 657, 63, 1494, 63, 3780, 395, 876, 63, 1494, 63, 657, 1361, 423, 344, 395, 1790, 29, 25597, 14, 1178, 9, 267, 702, 522, 14, 1205, 63, 600, 508, 1926, 267, 702, 822, 8, 470, 14, 1001, 459, 576, 1105, 508, 413, 267, 702, 522, 14, 1001, 459, 576, 3488, 16, 2733, 344, 418, 508, 876, 63, 1069, 423, 344, 398, 522, 275, 1145, 14, 362, 17519, 31, 1541, 59, 1375, 61, 27244, 908, 8, 277, 14, 633, 8, 1932, 63, 1494, 63, 3780, 395, 2963, 63, 1494, 63, 657, 1361, 423, 344, 395, 1790, 29, 25597, 14, 1178, 9, 267, 702, 522, 14, 1205, 63, 600, 508, 1926, 267, 702, 822, 8, 470, 14, 1001, 459, 576, 1105, 508, 413, 267, 702, 522, 14, 1001, 459, 576, 3488, 16, 2733, 344, 418, 508, 2963, 63, 1069, 423, 344, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 4613, 199, 199, 504, 2986, 14, 1095, 14, 1751, 14, 4322, 492, 3261, 63, 5825, 199, 504, 2986, 63, 2219, 14, 6615, 14, 30192, 492, 510, 1155, 672, 2017, 22060, 199, 199, 32, 4462, 14, 1657, 14, 1176, 63, 697, 199, 533, 1379, 24001, 672, 6663, 3007, 5485, 279, 497, 392, 270, 1296, 8, 24001, 672, 2017, 22060, 304, 272, 347, 1166, 8, 277, 12, 5022, 304, 267, 372, 1994, 2440, 9710, 15, 657, 29593, 19655, 1045, 5485, 63, 6615, 15, 1370, 908, 8, 3735, 63, 5825, 12, 5022, 423, 344, 9, 339, 347, 511, 63, 513, 8, 277, 12, 1145, 12, 4628, 12, 818, 9043, 12, 2218, 63, 2828, 12, 2222, 2828, 12, 876, 63, 1494, 63, 3780, 12, 2963, 63, 1494, 63, 3780, 12, 876, 63, 1494, 63, 657, 1361, 12, 2963, 63, 1494, 63, 657, 1361, 12, 876, 63, 1069, 12, 2963, 63, 1069, 304, 267, 327, 511, 63, 889, 63, 12068, 267, 522, 275, 1145, 14, 362, 8, 277, 14, 633, 8, 657, 63, 1494, 63, 3780, 395, 1790, 29, 2113, 14, 1178, 12, 4282, 63, 2550, 29, 549, 9, 221, 327, 876, 1361, 4628, 12, 440, 295, 4196, 4628, 267, 702, 522, 14, 1205, 63, 600, 508, 13269, 267, 522, 275, 1145, 14, 362, 8, 277, 14, 633, 8, 657, 63, 1494, 63, 3780, 395, 1790, 29, 952, 63, 2828, 14, 1178, 12, 4282, 63, 2550, 29, 549, 9, 267, 702, 522, 14, 1205, 63, 600, 508, 13269, 267, 522, 275, 1145, 14, 362, 8, 277, 14, 633, 8, 657, 63, 1494, 63, 3780, 395, 1790, 29, 2865, 2828, 14, 1178, 12, 4282, 63, 2550, 29, 549, 9, 267, 702, 522, 14, 1205, 63, 600, 508, 13269, 267, 522, 275, 1145, 14, 362, 8, 277, 14, 633, 8, 657, 63, 1494, 63, 3780, 395, 4282, 63, 2550, 29, 549, 9, 267, 702, 522, 14, 1205, 63, 600, 508, 13952, 398, 327, 511, 63, 25597, 63, 2425, 63, 1345, 267, 522, 275, 1145, 14, 362, 8, 277, 14, 633, 8, 657, 63, 1494, 63, 3780, 395, 1790, 29, 25597, 14, 1178, 9, 267, 702, 522, 14, 1205, 63, 600, 508, 1926, 267, 702, 822, 8, 470, 14, 1001, 459, 576, 1105, 508, 413, 267, 702, 522, 14, 1001, 459, 576, 3488, 16, 2733, 344, 418, 508, 876, 63, 1069, 423, 344, 398, 522, 275, 1145, 14, 362, 8, 277, 14, 633, 8, 1932, 63, 1494, 63, 3780, 395, 1790, 29, 25597, 14, 1178, 9, 267, 702, 522, 14, 1205, 63, 600, 508, 1926, 267, 702, 822, 8, 470, 14, 1001, 459, 576, 1105, 508, 413, 267, 702, 522, 14, 1001, 459, 576, 3488, 16, 2733, 344, 418, 508, 2963, 63, 1069, 423, 344, 398, 327, 511, 63, 6427, 267, 522, 275, 1145, 14, 362, 17519, 31, 6427, 29, 1375, 1370, 908, 8, 277, 14, 633, 8, 657, 63, 1494, 63, 3780, 1826, 1790, 29, 25597, 14, 1178, 9, 267, 702, 522, 14, 1205, 63, 600, 508, 1926, 267, 702, 822, 8, 470, 14, 1001, 459, 576, 1105, 508, 413, 267, 702, 522, 14, 1001, 459, 576, 3488, 16, 2733, 344, 418, 508, 876, 63, 1069, 423, 344, 267, 702, 522, 14, 1001, 459, 576, 3488, 16, 2733, 6427, 83, 2545, 1375, 2545, 576, 2545, 344, 418, 508, 876, 63, 1494, 63, 657, 1361, 423, 344, 398, 522, 275, 1145, 14, 362, 17519, 31, 6427, 29, 1375, 1370, 908, 8, 277, 14, 633, 8, 1932, 63, 1494, 63, 3780, 1826, 1790, 29, 25597, 14, 1178, 9, 267, 702, 522, 14, 1205, 63, 600, 508, 1926, 267, 702, 822, 8, 470, 14, 1001, 459, 576, 1105, 508, 413, 267, 702, 522, 14, 1001, 459, 576, 3488, 16, 2733, 344, 418, 508, 2963, 63, 1069, 423, 344, 267, 702, 522, 14, 1001, 459, 576, 3488, 16, 2733, 6427, 83, 2545, 1375, 2545, 576, 2545, 344, 418, 508, 2963, 63, 1494, 63, 657, 1361, 423, 344, 398, 327, 511, 63, 1541, 267, 522, 275, 1145, 14, 362, 17519, 31, 1541, 59, 1375, 61, 27244, 908, 8, 277, 14, 633, 8, 657, 63, 1494, 63, 3780, 395, 876, 63, 1494, 63, 657, 1361, 423, 344, 395, 1790, 29, 25597, 14, 1178, 9, 267, 702, 522, 14, 1205, 63, 600, 508, 1926, 267, 702, 822, 8, 470, 14, 1001, 459, 576, 1105, 508, 413, 267, 702, 522, 14, 1001, 459, 576, 3488, 16, 2733, 344, 418, 508, 876, 63, 1069, 423, 344, 398, 522, 275, 1145, 14, 362, 17519, 31, 1541, 59, 1375, 61, 27244, 908, 8, 277, 14, 633, 8, 1932, 63, 1494, 63, 3780, 395, 2963, 63, 1494, 63, 657, 1361, 423, 344, 395, 1790, 29, 25597, 14, 1178, 9, 267, 702, 522, 14, 1205, 63, 600, 508, 1926, 267, 702, 822, 8, 470, 14, 1001, 459, 576, 1105, 508, 413, 267, 702, 522, 14, 1001, 459, 576, 3488, 16, 2733, 344, 418, 508, 2963, 63, 1069, 423, 344, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
southpaw94/MachineLearning
Perceptron/Iris.py
1
1993
import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap from Perceptron import Perceptron def plotRawData(): plt.scatter(X[:50, 0], X[:50, 1], color='red', marker='o', label='setosa') plt.scatter(X[50:100, 0], X[50:100, 1], color='blue', marker='x', label='versicolor') plt.xlabel('petal length') plt.ylabel('sepal length') plt.legend(loc='upper left') plt.show() plt.cla() def plotErrors(): plt.plot(range(1, len(ppn.errors_) + 1), ppn.errors_, marker='o') plt.xlabel('Epochs') plt.ylabel('Number of misclassifications') plt.show() plt.cla() def plot_decision_regions(X, y, classifier, resolution=0.02): # setup marker generator and color map markers = ('s', 'x', 'o', '^', 'v') colors=('red', 'blue', 'lightgreen', 'gray', 'cyan') cmap = ListedColormap(colors[:len(np.unique(y))]) # plot the decision surface x1_min, x1_max = X[:, 0].min() - 1, X[:, 0].max() + 1 x2_min, x2_max = X[:, 1].min() - 1, X[:, 1].max() + 1 xx1, xx2 = np.meshgrid(np.arange(x1_min, x1_max, resolution), np.arange(x2_min, x2_max, resolution)) Z = classifier.predict(np.array([xx1.ravel(), xx2.ravel()]).T) Z = Z.reshape(xx1.shape) plt.contourf(xx1, xx2, Z, alpha=0.4, cmap=cmap) plt.xlim(xx1.min(), xx1.max()) plt.ylim(xx2.min(), xx2.max()) # plot class samples for idx, cl in enumerate(np.unique(y)): plt.scatter(x=X[y ==cl, 0], y=X[y == cl, 1], alpha=0.8, c=cmap(idx), marker=markers[idx], label=cl) plt.xlabel('sepal length [cm]') plt.ylabel('petal length [cm]') plt.legend(loc='upper left') df = pd.read_csv('https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data', header=None) # print(df.tail()) y = df.iloc[0:100, 4].values y = np.where(y == 'Iris-setosa', -1, 1) X = df.iloc[0:100, [0, 2]].values ppn = Perceptron(eta=0.1, n_iter=10) ppn.fit(X, y) plot_decision_regions(X, y, ppn) plt.cla()
gpl-2.0
[ 646, 10634, 465, 6454, 199, 646, 2680, 465, 980, 199, 646, 8027, 14, 13563, 465, 4488, 199, 504, 8027, 14, 7120, 492, 491, 4957, 4117, 1130, 199, 199, 504, 3492, 301, 4695, 265, 492, 3492, 301, 4695, 265, 199, 199, 318, 5137, 7963, 1451, 837, 272, 4488, 14, 13512, 8, 56, 1491, 1400, 12, 378, 467, 1323, 1491, 1400, 12, 413, 467, 3164, 534, 581, 297, 3608, 534, 79, 297, 1768, 534, 409, 29295, 358, 272, 4488, 14, 13512, 8, 56, 59, 1400, 26, 1960, 12, 378, 467, 1323, 59, 1400, 26, 1960, 12, 413, 467, 3164, 534, 6304, 297, 3608, 534, 88, 297, 1768, 534, 422, 338, 2326, 358, 272, 4488, 14, 14168, 360, 8096, 279, 2582, 358, 272, 4488, 14, 13849, 360, 4127, 279, 2582, 358, 272, 4488, 14, 10231, 8, 2102, 534, 4142, 3602, 358, 272, 4488, 14, 2384, 342, 272, 4488, 14, 3995, 342, 199, 199, 318, 5137, 9298, 837, 272, 4488, 14, 2798, 8, 1842, 8, 17, 12, 822, 8, 802, 78, 14, 2550, 4602, 435, 413, 395, 299, 4812, 14, 2550, 3131, 3608, 534, 79, 358, 272, 4488, 14, 14168, 360, 29322, 83, 358, 272, 4488, 14, 13849, 360, 3259, 402, 3201, 14368, 83, 358, 272, 4488, 14, 2384, 342, 272, 4488, 14, 3995, 342, 199, 199, 318, 5137, 63, 16622, 63, 11963, 8, 56, 12, 612, 12, 12429, 12, 12401, 29, 16, 14, 996, 304, 272, 327, 3272, 3608, 4306, 436, 3164, 2341, 272, 14327, 275, 661, 83, 297, 283, 88, 297, 283, 79, 297, 14452, 297, 283, 86, 358, 272, 9229, 7782, 581, 297, 283, 6304, 297, 283, 4040, 7731, 297, 283, 12150, 297, 283, 28291, 358, 272, 14920, 275, 491, 4957, 4117, 1130, 8, 7120, 1491, 552, 8, 1590, 14, 3235, 8, 89, 18229, 339, 327, 5137, 314, 14692, 13195, 272, 671, 17, 63, 827, 12, 671, 17, 63, 988, 275, 1323, 3981, 378, 1055, 827, 342, 446, 413, 12, 1323, 3981, 378, 1055, 988, 342, 435, 413, 272, 671, 18, 63, 827, 12, 671, 18, 63, 988, 275, 1323, 3981, 413, 1055, 827, 342, 446, 413, 12, 1323, 3981, 413, 1055, 988, 342, 435, 413, 272, 19379, 17, 12, 19379, 18, 275, 980, 14, 6480, 3825, 8, 1590, 14, 5605, 8, 88, 17, 63, 827, 12, 671, 17, 63, 988, 12, 12401, 395, 980, 14, 5605, 8, 88, 18, 63, 827, 12, 671, 18, 63, 988, 12, 12401, 430, 272, 3107, 275, 12429, 14, 6892, 8, 1590, 14, 1144, 779, 2154, 17, 14, 11186, 1062, 19379, 18, 14, 11186, 342, 6575, 52, 9, 272, 3107, 275, 3107, 14, 5217, 8, 2154, 17, 14, 1392, 9, 272, 4488, 14, 17798, 70, 8, 2154, 17, 12, 19379, 18, 12, 3107, 12, 5131, 29, 16, 14, 20, 12, 14920, 29, 16513, 9, 272, 4488, 14, 18512, 8, 2154, 17, 14, 827, 1062, 19379, 17, 14, 988, 1012, 272, 4488, 14, 18123, 8, 2154, 18, 14, 827, 1062, 19379, 18, 14, 988, 1012, 339, 327, 5137, 1021, 5845, 272, 367, 4280, 12, 824, 315, 3874, 8, 1590, 14, 3235, 8, 89, 2298, 267, 4488, 14, 13512, 8, 88, 29, 56, 59, 89, 508, 429, 12, 378, 467, 612, 29, 56, 59, 89, 508, 824, 12, 413, 467, 5131, 29, 16, 14, 24, 12, 286, 29, 16513, 8, 2996, 395, 3608, 29, 16835, 59, 2996, 467, 1768, 29, 429, 9, 272, 4488, 14, 14168, 360, 4127, 279, 2582, 359, 4400, 10374, 272, 4488, 14, 13849, 360, 8096, 279, 2582, 359, 4400, 10374, 272, 4488, 14, 10231, 8, 2102, 534, 4142, 3602, 358, 199, 199, 1587, 275, 6454, 14, 739, 63, 4737, 360, 2859, 921, 6404, 14, 2932, 14, 85, 559, 14, 8654, 15, 757, 15, 6744, 13, 10546, 13, 17439, 15, 11885, 15, 11885, 14, 576, 297, 1406, 29, 403, 9, 199, 199, 3, 870, 8, 1587, 14, 1521, 1012, 199, 199, 89, 275, 4051, 14, 21104, 59, 16, 26, 1960, 12, 841, 1055, 1459, 199, 89, 275, 980, 14, 4509, 8, 89, 508, 283, 41, 5719, 13, 409, 29295, 297, 446, 17, 12, 413, 9, 199, 56, 275, 4051, 14, 21104, 59, 16, 26, 1960, 12, 359, 16, 12, 499, 20230, 1459, 199, 199, 802, 78, 275, 3492, 301, 4695, 265, 8, 1841, 29, 16, 14, 17, 12, 302, 63, 1661, 29, 709, 9, 199, 802, 78, 14, 3269, 8, 56, 12, 612, 9, 199, 199, 2798, 63, 16622, 63, 11963, 8, 56, 12, 612, 12, 299, 4812, 9, 199, 6003, 14, 3995, 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 ]
[ 10634, 465, 6454, 199, 646, 2680, 465, 980, 199, 646, 8027, 14, 13563, 465, 4488, 199, 504, 8027, 14, 7120, 492, 491, 4957, 4117, 1130, 199, 199, 504, 3492, 301, 4695, 265, 492, 3492, 301, 4695, 265, 199, 199, 318, 5137, 7963, 1451, 837, 272, 4488, 14, 13512, 8, 56, 1491, 1400, 12, 378, 467, 1323, 1491, 1400, 12, 413, 467, 3164, 534, 581, 297, 3608, 534, 79, 297, 1768, 534, 409, 29295, 358, 272, 4488, 14, 13512, 8, 56, 59, 1400, 26, 1960, 12, 378, 467, 1323, 59, 1400, 26, 1960, 12, 413, 467, 3164, 534, 6304, 297, 3608, 534, 88, 297, 1768, 534, 422, 338, 2326, 358, 272, 4488, 14, 14168, 360, 8096, 279, 2582, 358, 272, 4488, 14, 13849, 360, 4127, 279, 2582, 358, 272, 4488, 14, 10231, 8, 2102, 534, 4142, 3602, 358, 272, 4488, 14, 2384, 342, 272, 4488, 14, 3995, 342, 199, 199, 318, 5137, 9298, 837, 272, 4488, 14, 2798, 8, 1842, 8, 17, 12, 822, 8, 802, 78, 14, 2550, 4602, 435, 413, 395, 299, 4812, 14, 2550, 3131, 3608, 534, 79, 358, 272, 4488, 14, 14168, 360, 29322, 83, 358, 272, 4488, 14, 13849, 360, 3259, 402, 3201, 14368, 83, 358, 272, 4488, 14, 2384, 342, 272, 4488, 14, 3995, 342, 199, 199, 318, 5137, 63, 16622, 63, 11963, 8, 56, 12, 612, 12, 12429, 12, 12401, 29, 16, 14, 996, 304, 272, 327, 3272, 3608, 4306, 436, 3164, 2341, 272, 14327, 275, 661, 83, 297, 283, 88, 297, 283, 79, 297, 14452, 297, 283, 86, 358, 272, 9229, 7782, 581, 297, 283, 6304, 297, 283, 4040, 7731, 297, 283, 12150, 297, 283, 28291, 358, 272, 14920, 275, 491, 4957, 4117, 1130, 8, 7120, 1491, 552, 8, 1590, 14, 3235, 8, 89, 18229, 339, 327, 5137, 314, 14692, 13195, 272, 671, 17, 63, 827, 12, 671, 17, 63, 988, 275, 1323, 3981, 378, 1055, 827, 342, 446, 413, 12, 1323, 3981, 378, 1055, 988, 342, 435, 413, 272, 671, 18, 63, 827, 12, 671, 18, 63, 988, 275, 1323, 3981, 413, 1055, 827, 342, 446, 413, 12, 1323, 3981, 413, 1055, 988, 342, 435, 413, 272, 19379, 17, 12, 19379, 18, 275, 980, 14, 6480, 3825, 8, 1590, 14, 5605, 8, 88, 17, 63, 827, 12, 671, 17, 63, 988, 12, 12401, 395, 980, 14, 5605, 8, 88, 18, 63, 827, 12, 671, 18, 63, 988, 12, 12401, 430, 272, 3107, 275, 12429, 14, 6892, 8, 1590, 14, 1144, 779, 2154, 17, 14, 11186, 1062, 19379, 18, 14, 11186, 342, 6575, 52, 9, 272, 3107, 275, 3107, 14, 5217, 8, 2154, 17, 14, 1392, 9, 272, 4488, 14, 17798, 70, 8, 2154, 17, 12, 19379, 18, 12, 3107, 12, 5131, 29, 16, 14, 20, 12, 14920, 29, 16513, 9, 272, 4488, 14, 18512, 8, 2154, 17, 14, 827, 1062, 19379, 17, 14, 988, 1012, 272, 4488, 14, 18123, 8, 2154, 18, 14, 827, 1062, 19379, 18, 14, 988, 1012, 339, 327, 5137, 1021, 5845, 272, 367, 4280, 12, 824, 315, 3874, 8, 1590, 14, 3235, 8, 89, 2298, 267, 4488, 14, 13512, 8, 88, 29, 56, 59, 89, 508, 429, 12, 378, 467, 612, 29, 56, 59, 89, 508, 824, 12, 413, 467, 5131, 29, 16, 14, 24, 12, 286, 29, 16513, 8, 2996, 395, 3608, 29, 16835, 59, 2996, 467, 1768, 29, 429, 9, 272, 4488, 14, 14168, 360, 4127, 279, 2582, 359, 4400, 10374, 272, 4488, 14, 13849, 360, 8096, 279, 2582, 359, 4400, 10374, 272, 4488, 14, 10231, 8, 2102, 534, 4142, 3602, 358, 199, 199, 1587, 275, 6454, 14, 739, 63, 4737, 360, 2859, 921, 6404, 14, 2932, 14, 85, 559, 14, 8654, 15, 757, 15, 6744, 13, 10546, 13, 17439, 15, 11885, 15, 11885, 14, 576, 297, 1406, 29, 403, 9, 199, 199, 3, 870, 8, 1587, 14, 1521, 1012, 199, 199, 89, 275, 4051, 14, 21104, 59, 16, 26, 1960, 12, 841, 1055, 1459, 199, 89, 275, 980, 14, 4509, 8, 89, 508, 283, 41, 5719, 13, 409, 29295, 297, 446, 17, 12, 413, 9, 199, 56, 275, 4051, 14, 21104, 59, 16, 26, 1960, 12, 359, 16, 12, 499, 20230, 1459, 199, 199, 802, 78, 275, 3492, 301, 4695, 265, 8, 1841, 29, 16, 14, 17, 12, 302, 63, 1661, 29, 709, 9, 199, 802, 78, 14, 3269, 8, 56, 12, 612, 9, 199, 199, 2798, 63, 16622, 63, 11963, 8, 56, 12, 612, 12, 299, 4812, 9, 199, 6003, 14, 3995, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
srus/django-kickstartvenv
boot/ipython/ipython_config.py
3
19804
# Configuration file for ipython. c = get_config() #------------------------------------------------------------------------------ # InteractiveShellApp configuration #------------------------------------------------------------------------------ # A Mixin for applications that start InteractiveShell instances. # # Provides configurables for loading extensions and executing files as part of # configuring a Shell environment. # # The following methods should be called by the :meth:`initialize` method of the # subclass: # # - :meth:`init_path` # - :meth:`init_shell` (to be implemented by the subclass) # - :meth:`init_gui_pylab` # - :meth:`init_extensions` # - :meth:`init_code` # Execute the given command string. # c.InteractiveShellApp.code_to_run = '' # Run the file referenced by the PYTHONSTARTUP environment variable at IPython # startup. # c.InteractiveShellApp.exec_PYTHONSTARTUP = True # lines of code to run at IPython startup. c.InteractiveShellApp.exec_lines = [ 'from __future__ import unicode_literals, print_function, absolute_import, division' ] # Enable GUI event loop integration with any of ('glut', 'gtk', 'gtk3', 'none', # 'osx', 'pyglet', 'qt', 'qt4', 'tk', 'wx'). # c.InteractiveShellApp.gui = None # Pre-load matplotlib and numpy for interactive use, selecting a particular # matplotlib backend and loop integration. # c.InteractiveShellApp.pylab = None # Configure matplotlib for interactive use with the default matplotlib backend. # c.InteractiveShellApp.matplotlib = None # If true, IPython will populate the user namespace with numpy, pylab, etc. and # an ``import *`` is done from numpy and pylab, when using pylab mode. # # When False, pylab mode should not import any names into the user namespace. # c.InteractiveShellApp.pylab_import_all = True # A list of dotted module names of IPython extensions to load. # c.InteractiveShellApp.extensions = [] # Run the module as a script. # c.InteractiveShellApp.module_to_run = '' # Should variables loaded at startup (by startup files, exec_lines, etc.) be # hidden from tools like %who? # c.InteractiveShellApp.hide_initial_ns = True # dotted module name of an IPython extension to load. # c.InteractiveShellApp.extra_extension = '' # List of files to run at IPython startup. # c.InteractiveShellApp.exec_files = [] # A file to be run # c.InteractiveShellApp.file_to_run = '' #------------------------------------------------------------------------------ # TerminalIPythonApp configuration #------------------------------------------------------------------------------ # TerminalIPythonApp will inherit config from: BaseIPythonApplication, # Application, InteractiveShellApp # Run the file referenced by the PYTHONSTARTUP environment variable at IPython # startup. # c.TerminalIPythonApp.exec_PYTHONSTARTUP = True # Pre-load matplotlib and numpy for interactive use, selecting a particular # matplotlib backend and loop integration. # c.TerminalIPythonApp.pylab = None # Create a massive crash report when IPython encounters what may be an internal # error. The default is to append a short message to the usual traceback # c.TerminalIPythonApp.verbose_crash = False # Run the module as a script. # c.TerminalIPythonApp.module_to_run = '' # The date format used by logging formatters for %(asctime)s # c.TerminalIPythonApp.log_datefmt = '%Y-%m-%d %H:%M:%S' # Whether to overwrite existing config files when copying # c.TerminalIPythonApp.overwrite = False # Execute the given command string. # c.TerminalIPythonApp.code_to_run = '' # Set the log level by value or name. # c.TerminalIPythonApp.log_level = 30 # lines of code to run at IPython startup. # c.TerminalIPythonApp.exec_lines = [] # Suppress warning messages about legacy config files # c.TerminalIPythonApp.ignore_old_config = False # Path to an extra config file to load. # # If specified, load this config file in addition to any other IPython config. # c.TerminalIPythonApp.extra_config_file = u'' # Should variables loaded at startup (by startup files, exec_lines, etc.) be # hidden from tools like %who? # c.TerminalIPythonApp.hide_initial_ns = True # dotted module name of an IPython extension to load. # c.TerminalIPythonApp.extra_extension = '' # A file to be run # c.TerminalIPythonApp.file_to_run = '' # The IPython profile to use. # c.TerminalIPythonApp.profile = u'default' # Configure matplotlib for interactive use with the default matplotlib backend. # c.TerminalIPythonApp.matplotlib = None # If a command or file is given via the command-line, e.g. 'ipython foo.py', # start an interactive shell after executing the file or command. # c.TerminalIPythonApp.force_interact = False # If true, IPython will populate the user namespace with numpy, pylab, etc. and # an ``import *`` is done from numpy and pylab, when using pylab mode. # # When False, pylab mode should not import any names into the user namespace. # c.TerminalIPythonApp.pylab_import_all = True # The name of the IPython directory. This directory is used for logging # configuration (through profiles), history storage, etc. The default is usually # $HOME/.ipython. This options can also be specified through the environment # variable IPYTHONDIR. # c.TerminalIPythonApp.ipython_dir = u'' # Whether to display a banner upon starting IPython. # c.TerminalIPythonApp.display_banner = True # Whether to install the default config files into the profile dir. If a new # profile is being created, and IPython contains config files for that profile, # then they will be staged into the new directory. Otherwise, default config # files will be automatically generated. # c.TerminalIPythonApp.copy_config_files = False # List of files to run at IPython startup. # c.TerminalIPythonApp.exec_files = [] # Enable GUI event loop integration with any of ('glut', 'gtk', 'gtk3', 'none', # 'osx', 'pyglet', 'qt', 'qt4', 'tk', 'wx'). # c.TerminalIPythonApp.gui = None # A list of dotted module names of IPython extensions to load. # c.TerminalIPythonApp.extensions = [] # Start IPython quickly by skipping the loading of config files. # c.TerminalIPythonApp.quick = False # The Logging format template # c.TerminalIPythonApp.log_format = '[%(name)s]%(highlevel)s %(message)s' #------------------------------------------------------------------------------ # TerminalInteractiveShell configuration #------------------------------------------------------------------------------ # TerminalInteractiveShell will inherit config from: InteractiveShell # auto editing of files with syntax errors. # c.TerminalInteractiveShell.autoedit_syntax = False # Use colors for displaying information about objects. Because this information # is passed through a pager (like 'less'), and some pagers get confused with # color codes, this capability can be turned off. # c.TerminalInteractiveShell.color_info = True # A list of ast.NodeTransformer subclass instances, which will be applied to # user input before code is run. # c.TerminalInteractiveShell.ast_transformers = [] # # c.TerminalInteractiveShell.history_length = 10000 # Don't call post-execute functions that have failed in the past. # c.TerminalInteractiveShell.disable_failing_post_execute = False # Show rewritten input, e.g. for autocall. # c.TerminalInteractiveShell.show_rewritten_input = True # Set the color scheme (NoColor, Linux, or LightBG). # c.TerminalInteractiveShell.colors = 'Linux' # Autoindent IPython code entered interactively. # c.TerminalInteractiveShell.autoindent = True # # c.TerminalInteractiveShell.separate_in = '\n' # Deprecated, use PromptManager.in2_template # c.TerminalInteractiveShell.prompt_in2 = ' .\\D.: ' # # c.TerminalInteractiveShell.separate_out = '' # Deprecated, use PromptManager.in_template # c.TerminalInteractiveShell.prompt_in1 = 'In [\\#]: ' # Make IPython automatically call any callable object even if you didn't type # explicit parentheses. For example, 'str 43' becomes 'str(43)' automatically. # The value can be '0' to disable the feature, '1' for 'smart' autocall, where # it is not applied if there are no more arguments on the line, and '2' for # 'full' autocall, where all callable objects are automatically called (even if # no arguments are present). # c.TerminalInteractiveShell.autocall = 0 # Number of lines of your screen, used to control printing of very long strings. # Strings longer than this number of lines will be sent through a pager instead # of directly printed. The default value for this is 0, which means IPython # will auto-detect your screen size every time it needs to print certain # potentially long strings (this doesn't change the behavior of the 'print' # keyword, it's only triggered internally). If for some reason this isn't # working well (it needs curses support), specify it yourself. Otherwise don't # change the default. # c.TerminalInteractiveShell.screen_length = 0 # Set the editor used by IPython (default to $EDITOR/vi/notepad). # c.TerminalInteractiveShell.editor = 'vi' # Deprecated, use PromptManager.justify # c.TerminalInteractiveShell.prompts_pad_left = True # The part of the banner to be printed before the profile # c.TerminalInteractiveShell.banner1 = 'Python 2.7.3 (default, Feb 27 2014, 19:58:35) \nType "copyright", "credits" or "license" for more information.\n\nIPython 2.2.0 -- An enhanced Interactive Python.\n? -> Introduction and overview of IPython\'s features.\n%quickref -> Quick reference.\nhelp -> Python\'s own help system.\nobject? -> Details about \'object\', use \'object??\' for extra details.\n' # # c.TerminalInteractiveShell.readline_parse_and_bind = ['tab: complete', '"\\C-l": clear-screen', 'set show-all-if-ambiguous on', '"\\C-o": tab-insert', '"\\C-r": reverse-search-history', '"\\C-s": forward-search-history', '"\\C-p": history-search-backward', '"\\C-n": history-search-forward', '"\\e[A": history-search-backward', '"\\e[B": history-search-forward', '"\\C-k": kill-line', '"\\C-u": unix-line-discard'] # The part of the banner to be printed after the profile # c.TerminalInteractiveShell.banner2 = '' # # c.TerminalInteractiveShell.separate_out2 = '' # # c.TerminalInteractiveShell.wildcards_case_sensitive = True # # c.TerminalInteractiveShell.debug = False # Set to confirm when you try to exit IPython with an EOF (Control-D in Unix, # Control-Z/Enter in Windows). By typing 'exit' or 'quit', you can force a # direct exit without any confirmation. # c.TerminalInteractiveShell.confirm_exit = True # # c.TerminalInteractiveShell.ipython_dir = '' # # c.TerminalInteractiveShell.readline_remove_delims = '-/~' # Start logging to the default log file. # c.TerminalInteractiveShell.logstart = False # The name of the logfile to use. # c.TerminalInteractiveShell.logfile = '' # The shell program to be used for paging. # c.TerminalInteractiveShell.pager = 'less' # Enable magic commands to be called without the leading %. # c.TerminalInteractiveShell.automagic = True # Save multi-line entries as one entry in readline history # c.TerminalInteractiveShell.multiline_history = True # # c.TerminalInteractiveShell.readline_use = True # Enable deep (recursive) reloading by default. IPython can use the deep_reload # module which reloads changes in modules recursively (it replaces the reload() # function, so you don't need to change anything to use it). deep_reload() # forces a full reload of modules whose code may have changed, which the default # reload() function does not. When deep_reload is off, IPython will use the # normal reload(), but deep_reload will still be available as dreload(). # c.TerminalInteractiveShell.deep_reload = False # Start logging to the given file in append mode. # c.TerminalInteractiveShell.logappend = '' # # c.TerminalInteractiveShell.xmode = 'Context' # # c.TerminalInteractiveShell.quiet = False # Enable auto setting the terminal title. # c.TerminalInteractiveShell.term_title = False # # c.TerminalInteractiveShell.object_info_string_level = 0 # Deprecated, use PromptManager.out_template # c.TerminalInteractiveShell.prompt_out = 'Out[\\#]: ' # Set the size of the output cache. The default is 1000, you can change it # permanently in your config file. Setting it to 0 completely disables the # caching system, and the minimum value accepted is 20 (if you provide a value # less than 20, it is reset to 0 and a warning is issued). This limit is # defined because otherwise you'll spend more time re-flushing a too small cache # than working # c.TerminalInteractiveShell.cache_size = 1000 # 'all', 'last', 'last_expr' or 'none', specifying which nodes should be run # interactively (displaying output from expressions). # c.TerminalInteractiveShell.ast_node_interactivity = 'last_expr' # Automatically call the pdb debugger after every exception. # c.TerminalInteractiveShell.pdb = False #------------------------------------------------------------------------------ # PromptManager configuration #------------------------------------------------------------------------------ # This is the primary interface for producing IPython's prompts. # Output prompt. '\#' will be transformed to the prompt number # c.PromptManager.out_template = 'Out[\\#]: ' # Continuation prompt. # c.PromptManager.in2_template = ' .\\D.: ' # If True (default), each prompt will be right-aligned with the preceding one. # c.PromptManager.justify = True # Input prompt. '\#' will be transformed to the prompt number # c.PromptManager.in_template = 'In [\\#]: ' # # c.PromptManager.color_scheme = 'Linux' #------------------------------------------------------------------------------ # HistoryManager configuration #------------------------------------------------------------------------------ # A class to organize all history-related functionality in one place. # HistoryManager will inherit config from: HistoryAccessor # Should the history database include output? (default: no) # c.HistoryManager.db_log_output = False # Write to database every x commands (higher values save disk access & power). # Values of 1 or less effectively disable caching. # c.HistoryManager.db_cache_size = 0 # Path to file to use for SQLite history database. # # By default, IPython will put the history database in the IPython profile # directory. If you would rather share one history among profiles, you can set # this value in each, so that they are consistent. # # Due to an issue with fcntl, SQLite is known to misbehave on some NFS mounts. # If you see IPython hanging, try setting this to something on a local disk, # e.g:: # # ipython --HistoryManager.hist_file=/tmp/ipython_hist.sqlite # c.HistoryManager.hist_file = u'' # Options for configuring the SQLite connection # # These options are passed as keyword args to sqlite3.connect when establishing # database conenctions. # c.HistoryManager.connection_options = {} # enable the SQLite history # # set enabled=False to disable the SQLite history, in which case there will be # no stored history, no SQLite connection, and no background saving thread. # This may be necessary in some threaded environments where IPython is embedded. # c.HistoryManager.enabled = True #------------------------------------------------------------------------------ # ProfileDir configuration #------------------------------------------------------------------------------ # An object to manage the profile directory and its resources. # # The profile directory is used by all IPython applications, to manage # configuration, logging and security. # # This object knows how to find, create and manage these directories. This # should be used by any code that wants to handle profiles. # Set the profile location directly. This overrides the logic used by the # `profile` option. # c.ProfileDir.location = u'' #------------------------------------------------------------------------------ # PlainTextFormatter configuration #------------------------------------------------------------------------------ # The default pretty-printer. # # This uses :mod:`IPython.lib.pretty` to compute the format data of the object. # If the object cannot be pretty printed, :func:`repr` is used. See the # documentation of :mod:`IPython.lib.pretty` for details on how to write pretty # printers. Here is a simple example:: # # def dtype_pprinter(obj, p, cycle): # if cycle: # return p.text('dtype(...)') # if hasattr(obj, 'fields'): # if obj.fields is None: # p.text(repr(obj)) # else: # p.begin_group(7, 'dtype([') # for i, field in enumerate(obj.descr): # if i > 0: # p.text(',') # p.breakable() # p.pretty(field) # p.end_group(7, '])') # PlainTextFormatter will inherit config from: BaseFormatter # # c.PlainTextFormatter.type_printers = {} # # c.PlainTextFormatter.newline = '\n' # # c.PlainTextFormatter.float_precision = '' # # c.PlainTextFormatter.verbose = False # # c.PlainTextFormatter.deferred_printers = {} # # c.PlainTextFormatter.pprint = True # # c.PlainTextFormatter.max_width = 79 # # c.PlainTextFormatter.singleton_printers = {} #------------------------------------------------------------------------------ # IPCompleter configuration #------------------------------------------------------------------------------ # Extension of the completer class with IPython-specific features # IPCompleter will inherit config from: Completer # Instruct the completer to omit private method names # # Specifically, when completing on ``object.<tab>``. # # When 2 [default]: all names that start with '_' will be excluded. # # When 1: all 'magic' names (``__foo__``) will be excluded. # # When 0: nothing will be excluded. # c.IPCompleter.omit__names = 2 # Whether to merge completion results into a single list # # If False, only the completion results from the first non-empty completer will # be returned. # c.IPCompleter.merge_completions = True # Instruct the completer to use __all__ for the completion # # Specifically, when completing on ``object.<tab>``. # # When True: only those names in obj.__all__ will be included. # # When False [default]: the __all__ attribute is ignored # c.IPCompleter.limit_to__all__ = False # Activate greedy completion # # This will enable completion on elements of lists, results of function calls, # etc., but can be unsafe because the code is actually evaluated on TAB. # c.IPCompleter.greedy = False #------------------------------------------------------------------------------ # ScriptMagics configuration #------------------------------------------------------------------------------ # Magics for talking to scripts # # This defines a base `%%script` cell magic for running a cell with a program in # a subprocess, and registers a few top-level magics that call %%script with # common interpreters. # Extra script cell magics to define # # This generates simple wrappers of `%%script foo` as `%%foo`. # # If you want to add script magics that aren't on your path, specify them in # script_paths # c.ScriptMagics.script_magics = [] # Dict mapping short 'ruby' names to full paths, such as '/opt/secret/bin/ruby' # # Only necessary for items in script_magics where the default path will not find # the right interpreter. # c.ScriptMagics.script_paths = {} #------------------------------------------------------------------------------ # StoreMagics configuration #------------------------------------------------------------------------------ # Lightweight persistence for python variables. # # Provides the %store magic. # If True, any %store-d variables will be automatically restored when IPython # starts. # c.StoreMagics.autorestore = False
mit
[ 3, 11595, 570, 367, 284, 1548, 14, 199, 199, 67, 275, 664, 63, 888, 342, 199, 199, 20974, 199, 3, 1010, 7502, 8529, 2640, 2897, 199, 20974, 199, 199, 3, 437, 28438, 367, 13103, 626, 1343, 1010, 7502, 8529, 4454, 14, 199, 3, 199, 3, 21552, 1101, 300, 5921, 367, 8697, 5478, 436, 14043, 1584, 465, 1777, 402, 199, 3, 1101, 4039, 282, 24599, 3734, 14, 199, 3, 199, 3, 710, 2569, 3102, 1077, 506, 2797, 701, 314, 520, 5247, 1705, 8489, 64, 1083, 402, 314, 199, 3, 5516, 26, 199, 3, 199, 3, 257, 446, 520, 5247, 1705, 826, 63, 515, 64, 199, 3, 257, 446, 520, 5247, 1705, 826, 63, 5641, 64, 334, 475, 506, 6366, 701, 314, 5516, 9, 199, 3, 257, 446, 520, 5247, 1705, 826, 63, 5885, 63, 32538, 64, 199, 3, 257, 446, 520, 5247, 1705, 826, 63, 5359, 64, 199, 3, 257, 446, 520, 5247, 1705, 826, 63, 600, 64, 199, 199, 3, 17009, 314, 1627, 1414, 1059, 14, 199, 3, 286, 14, 23879, 8529, 2640, 14, 600, 63, 475, 63, 1065, 275, 2125, 199, 199, 3, 3378, 314, 570, 11812, 701, 314, 18280, 7363, 2160, 3734, 1750, 737, 16243, 199, 3, 14210, 14, 199, 3, 286, 14, 23879, 8529, 2640, 14, 1628, 63, 11720, 7363, 2160, 275, 715, 199, 199, 3, 2385, 402, 1233, 370, 1255, 737, 16243, 14210, 14, 199, 67, 14, 23879, 8529, 2640, 14, 1628, 63, 1278, 275, 359, 272, 283, 504, 636, 2443, 363, 492, 2649, 63, 5955, 12, 870, 63, 1593, 12, 3679, 63, 646, 12, 4629, 7, 199, 61, 199, 199, 3, 12030, 17160, 1566, 4438, 13150, 543, 1263, 402, 661, 3528, 337, 297, 283, 12275, 297, 283, 12275, 19, 297, 283, 3592, 297, 199, 3, 283, 28197, 297, 283, 647, 18678, 297, 283, 8440, 297, 283, 8440, 20, 297, 283, 2663, 297, 283, 6323, 1959, 199, 3, 286, 14, 23879, 8529, 2640, 14, 5885, 275, 488, 199, 199, 3, 5543, 13, 912, 8027, 436, 2680, 367, 12777, 675, 12, 30090, 282, 6770, 199, 3, 8027, 4865, 436, 4438, 13150, 14, 199, 3, 286, 14, 23879, 8529, 2640, 14, 32538, 275, 488, 199, 199, 3, 15453, 8027, 367, 12777, 675, 543, 314, 849, 8027, 4865, 14, 199, 3, 286, 14, 23879, 8529, 2640, 14, 16440, 275, 488, 199, 199, 3, 982, 2549, 12, 16243, 911, 13904, 314, 922, 3231, 543, 2680, 12, 19199, 12, 5423, 14, 436, 199, 3, 376, 1124, 646, 627, 1040, 365, 4224, 687, 2680, 436, 19199, 12, 1380, 1808, 19199, 818, 14, 199, 3, 199, 3, 3979, 756, 12, 19199, 818, 1077, 440, 492, 1263, 1561, 1901, 314, 922, 3231, 14, 199, 3, 286, 14, 23879, 8529, 2640, 14, 32538, 63, 646, 63, 452, 275, 715, 199, 199, 3, 437, 769, 402, 18947, 859, 1561, 402, 16243, 5478, 370, 2248, 14, 199, 3, 286, 14, 23879, 8529, 2640, 14, 5359, 275, 942, 199, 199, 3, 3378, 314, 859, 465, 282, 2884, 14, 199, 3, 286, 14, 23879, 8529, 2640, 14, 578, 63, 475, 63, 1065, 275, 2125, 199, 199, 3, 7719, 2860, 6511, 737, 14210, 334, 991, 14210, 1584, 12, 2146, 63, 1278, 12, 5423, 4959, 506, 199, 3, 8752, 687, 7249, 2839, 450, 11345, 31, 199, 3, 286, 14, 23879, 8529, 2640, 14, 8191, 63, 2747, 63, 561, 275, 715, 199, 199, 3, 18947, 859, 536, 402, 376, 16243, 3329, 370, 2248, 14, 199, 3, 286, 14, 23879, 8529, 2640, 14, 2911, 63, 3435, 275, 2125, 199, 199, 3, 3820, 402, 1584, 370, 1255, 737, 16243, 14210, 14, 199, 3, 286, 14, 23879, 8529, 2640, 14, 1628, 63, 1725, 275, 942, 199, 199, 3, 437, 570, 370, 506, 1255, 199, 3, 286, 14, 23879, 8529, 2640, 14, 493, 63, 475, 63, 1065, 275, 2125, 199, 199, 20974, 199, 3, 20429, 279, 1772, 11361, 2640, 2897, 199, 20974, 199, 199, 3, 20429, 279, 1772, 11361, 2640, 911, 8287, 1101, 687, 26, 3523, 1772, 11361, 5039, 12, 199, 3, 13515, 12, 1010, 7502, 8529, 2640, 199, 199, 3, 3378, 314, 570, 11812, 701, 314, 18280, 7363, 2160, 3734, 1750, 737, 16243, 199, 3, 14210, 14, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 1628, 63, 11720, 7363, 2160, 275, 715, 199, 199, 3, 5543, 13, 912, 8027, 436, 2680, 367, 12777, 675, 12, 30090, 282, 6770, 199, 3, 8027, 4865, 436, 4438, 13150, 14, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 32538, 275, 488, 199, 199, 3, 2790, 282, 333, 13202, 12420, 3622, 1380, 16243, 655, 16558, 4052, 1443, 506, 376, 5007, 199, 3, 1125, 14, 221, 710, 849, 365, 370, 5666, 282, 3974, 1245, 370, 314, 20195, 5190, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 3832, 63, 14807, 275, 756, 199, 199, 3, 3378, 314, 859, 465, 282, 2884, 14, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 578, 63, 475, 63, 1065, 275, 2125, 199, 199, 3, 710, 1434, 1475, 1202, 701, 2050, 30514, 367, 2818, 18331, 9, 83, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 793, 63, 602, 5045, 275, 1543, 57, 3295, 77, 3295, 68, 450, 40, 2689, 45, 2689, 51, 7, 199, 199, 3, 7480, 370, 8970, 3411, 1101, 1584, 1380, 16743, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 14658, 275, 756, 199, 199, 3, 17009, 314, 1627, 1414, 1059, 14, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 600, 63, 475, 63, 1065, 275, 2125, 199, 199, 3, 2494, 314, 943, 2166, 701, 574, 503, 536, 14, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 793, 63, 1896, 275, 4233, 199, 199, 3, 2385, 402, 1233, 370, 1255, 737, 16243, 14210, 14, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 1628, 63, 1278, 275, 942, 199, 199, 3, 26602, 5721, 3788, 3595, 12139, 1101, 1584, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 4247, 63, 1753, 63, 888, 275, 756, 199, 199, 3, 6912, 370, 376, 2402, 1101, 570, 370, 2248, 14, 199, 3, 199, 3, 982, 2013, 12, 2248, 642, 1101, 570, 315, 10234, 370, 1263, 1163, 16243, 1101, 14, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 2911, 63, 888, 63, 493, 275, 399 ]
[ 11595, 570, 367, 284, 1548, 14, 199, 199, 67, 275, 664, 63, 888, 342, 199, 199, 20974, 199, 3, 1010, 7502, 8529, 2640, 2897, 199, 20974, 199, 199, 3, 437, 28438, 367, 13103, 626, 1343, 1010, 7502, 8529, 4454, 14, 199, 3, 199, 3, 21552, 1101, 300, 5921, 367, 8697, 5478, 436, 14043, 1584, 465, 1777, 402, 199, 3, 1101, 4039, 282, 24599, 3734, 14, 199, 3, 199, 3, 710, 2569, 3102, 1077, 506, 2797, 701, 314, 520, 5247, 1705, 8489, 64, 1083, 402, 314, 199, 3, 5516, 26, 199, 3, 199, 3, 257, 446, 520, 5247, 1705, 826, 63, 515, 64, 199, 3, 257, 446, 520, 5247, 1705, 826, 63, 5641, 64, 334, 475, 506, 6366, 701, 314, 5516, 9, 199, 3, 257, 446, 520, 5247, 1705, 826, 63, 5885, 63, 32538, 64, 199, 3, 257, 446, 520, 5247, 1705, 826, 63, 5359, 64, 199, 3, 257, 446, 520, 5247, 1705, 826, 63, 600, 64, 199, 199, 3, 17009, 314, 1627, 1414, 1059, 14, 199, 3, 286, 14, 23879, 8529, 2640, 14, 600, 63, 475, 63, 1065, 275, 2125, 199, 199, 3, 3378, 314, 570, 11812, 701, 314, 18280, 7363, 2160, 3734, 1750, 737, 16243, 199, 3, 14210, 14, 199, 3, 286, 14, 23879, 8529, 2640, 14, 1628, 63, 11720, 7363, 2160, 275, 715, 199, 199, 3, 2385, 402, 1233, 370, 1255, 737, 16243, 14210, 14, 199, 67, 14, 23879, 8529, 2640, 14, 1628, 63, 1278, 275, 359, 272, 283, 504, 636, 2443, 363, 492, 2649, 63, 5955, 12, 870, 63, 1593, 12, 3679, 63, 646, 12, 4629, 7, 199, 61, 199, 199, 3, 12030, 17160, 1566, 4438, 13150, 543, 1263, 402, 661, 3528, 337, 297, 283, 12275, 297, 283, 12275, 19, 297, 283, 3592, 297, 199, 3, 283, 28197, 297, 283, 647, 18678, 297, 283, 8440, 297, 283, 8440, 20, 297, 283, 2663, 297, 283, 6323, 1959, 199, 3, 286, 14, 23879, 8529, 2640, 14, 5885, 275, 488, 199, 199, 3, 5543, 13, 912, 8027, 436, 2680, 367, 12777, 675, 12, 30090, 282, 6770, 199, 3, 8027, 4865, 436, 4438, 13150, 14, 199, 3, 286, 14, 23879, 8529, 2640, 14, 32538, 275, 488, 199, 199, 3, 15453, 8027, 367, 12777, 675, 543, 314, 849, 8027, 4865, 14, 199, 3, 286, 14, 23879, 8529, 2640, 14, 16440, 275, 488, 199, 199, 3, 982, 2549, 12, 16243, 911, 13904, 314, 922, 3231, 543, 2680, 12, 19199, 12, 5423, 14, 436, 199, 3, 376, 1124, 646, 627, 1040, 365, 4224, 687, 2680, 436, 19199, 12, 1380, 1808, 19199, 818, 14, 199, 3, 199, 3, 3979, 756, 12, 19199, 818, 1077, 440, 492, 1263, 1561, 1901, 314, 922, 3231, 14, 199, 3, 286, 14, 23879, 8529, 2640, 14, 32538, 63, 646, 63, 452, 275, 715, 199, 199, 3, 437, 769, 402, 18947, 859, 1561, 402, 16243, 5478, 370, 2248, 14, 199, 3, 286, 14, 23879, 8529, 2640, 14, 5359, 275, 942, 199, 199, 3, 3378, 314, 859, 465, 282, 2884, 14, 199, 3, 286, 14, 23879, 8529, 2640, 14, 578, 63, 475, 63, 1065, 275, 2125, 199, 199, 3, 7719, 2860, 6511, 737, 14210, 334, 991, 14210, 1584, 12, 2146, 63, 1278, 12, 5423, 4959, 506, 199, 3, 8752, 687, 7249, 2839, 450, 11345, 31, 199, 3, 286, 14, 23879, 8529, 2640, 14, 8191, 63, 2747, 63, 561, 275, 715, 199, 199, 3, 18947, 859, 536, 402, 376, 16243, 3329, 370, 2248, 14, 199, 3, 286, 14, 23879, 8529, 2640, 14, 2911, 63, 3435, 275, 2125, 199, 199, 3, 3820, 402, 1584, 370, 1255, 737, 16243, 14210, 14, 199, 3, 286, 14, 23879, 8529, 2640, 14, 1628, 63, 1725, 275, 942, 199, 199, 3, 437, 570, 370, 506, 1255, 199, 3, 286, 14, 23879, 8529, 2640, 14, 493, 63, 475, 63, 1065, 275, 2125, 199, 199, 20974, 199, 3, 20429, 279, 1772, 11361, 2640, 2897, 199, 20974, 199, 199, 3, 20429, 279, 1772, 11361, 2640, 911, 8287, 1101, 687, 26, 3523, 1772, 11361, 5039, 12, 199, 3, 13515, 12, 1010, 7502, 8529, 2640, 199, 199, 3, 3378, 314, 570, 11812, 701, 314, 18280, 7363, 2160, 3734, 1750, 737, 16243, 199, 3, 14210, 14, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 1628, 63, 11720, 7363, 2160, 275, 715, 199, 199, 3, 5543, 13, 912, 8027, 436, 2680, 367, 12777, 675, 12, 30090, 282, 6770, 199, 3, 8027, 4865, 436, 4438, 13150, 14, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 32538, 275, 488, 199, 199, 3, 2790, 282, 333, 13202, 12420, 3622, 1380, 16243, 655, 16558, 4052, 1443, 506, 376, 5007, 199, 3, 1125, 14, 221, 710, 849, 365, 370, 5666, 282, 3974, 1245, 370, 314, 20195, 5190, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 3832, 63, 14807, 275, 756, 199, 199, 3, 3378, 314, 859, 465, 282, 2884, 14, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 578, 63, 475, 63, 1065, 275, 2125, 199, 199, 3, 710, 1434, 1475, 1202, 701, 2050, 30514, 367, 2818, 18331, 9, 83, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 793, 63, 602, 5045, 275, 1543, 57, 3295, 77, 3295, 68, 450, 40, 2689, 45, 2689, 51, 7, 199, 199, 3, 7480, 370, 8970, 3411, 1101, 1584, 1380, 16743, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 14658, 275, 756, 199, 199, 3, 17009, 314, 1627, 1414, 1059, 14, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 600, 63, 475, 63, 1065, 275, 2125, 199, 199, 3, 2494, 314, 943, 2166, 701, 574, 503, 536, 14, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 793, 63, 1896, 275, 4233, 199, 199, 3, 2385, 402, 1233, 370, 1255, 737, 16243, 14210, 14, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 1628, 63, 1278, 275, 942, 199, 199, 3, 26602, 5721, 3788, 3595, 12139, 1101, 1584, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 4247, 63, 1753, 63, 888, 275, 756, 199, 199, 3, 6912, 370, 376, 2402, 1101, 570, 370, 2248, 14, 199, 3, 199, 3, 982, 2013, 12, 2248, 642, 1101, 570, 315, 10234, 370, 1263, 1163, 16243, 1101, 14, 199, 3, 286, 14, 22015, 1772, 11361, 2640, 14, 2911, 63, 888, 63, 493, 275, 399, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
Serag8/Bachelor
google_appengine/lib/django-1.2/django/contrib/gis/gdal/prototypes/ds.py
311
4244
""" This module houses the ctypes function prototypes for OGR DataSource related data structures. OGR_Dr_*, OGR_DS_*, OGR_L_*, OGR_F_*, OGR_Fld_* routines are relevant here. """ from ctypes import c_char_p, c_double, c_int, c_long, c_void_p, POINTER from django.contrib.gis.gdal.envelope import OGREnvelope from django.contrib.gis.gdal.libgdal import lgdal from django.contrib.gis.gdal.prototypes.generation import \ const_string_output, double_output, geom_output, int_output, \ srs_output, void_output, voidptr_output c_int_p = POINTER(c_int) # shortcut type ### Driver Routines ### register_all = void_output(lgdal.OGRRegisterAll, [], errcheck=False) cleanup_all = void_output(lgdal.OGRCleanupAll, [], errcheck=False) get_driver = voidptr_output(lgdal.OGRGetDriver, [c_int]) get_driver_by_name = voidptr_output(lgdal.OGRGetDriverByName, [c_char_p]) get_driver_count = int_output(lgdal.OGRGetDriverCount, []) get_driver_name = const_string_output(lgdal.OGR_Dr_GetName, [c_void_p]) ### DataSource ### open_ds = voidptr_output(lgdal.OGROpen, [c_char_p, c_int, POINTER(c_void_p)]) destroy_ds = void_output(lgdal.OGR_DS_Destroy, [c_void_p], errcheck=False) release_ds = void_output(lgdal.OGRReleaseDataSource, [c_void_p]) get_ds_name = const_string_output(lgdal.OGR_DS_GetName, [c_void_p]) get_layer = voidptr_output(lgdal.OGR_DS_GetLayer, [c_void_p, c_int]) get_layer_by_name = voidptr_output(lgdal.OGR_DS_GetLayerByName, [c_void_p, c_char_p]) get_layer_count = int_output(lgdal.OGR_DS_GetLayerCount, [c_void_p]) ### Layer Routines ### get_extent = void_output(lgdal.OGR_L_GetExtent, [c_void_p, POINTER(OGREnvelope), c_int]) get_feature = voidptr_output(lgdal.OGR_L_GetFeature, [c_void_p, c_long]) get_feature_count = int_output(lgdal.OGR_L_GetFeatureCount, [c_void_p, c_int]) get_layer_defn = voidptr_output(lgdal.OGR_L_GetLayerDefn, [c_void_p]) get_layer_srs = srs_output(lgdal.OGR_L_GetSpatialRef, [c_void_p]) get_next_feature = voidptr_output(lgdal.OGR_L_GetNextFeature, [c_void_p]) reset_reading = void_output(lgdal.OGR_L_ResetReading, [c_void_p], errcheck=False) test_capability = int_output(lgdal.OGR_L_TestCapability, [c_void_p, c_char_p]) get_spatial_filter = geom_output(lgdal.OGR_L_GetSpatialFilter, [c_void_p]) set_spatial_filter = void_output(lgdal.OGR_L_SetSpatialFilter, [c_void_p, c_void_p], errcheck=False) set_spatial_filter_rect = void_output(lgdal.OGR_L_SetSpatialFilterRect, [c_void_p, c_double, c_double, c_double, c_double], errcheck=False) ### Feature Definition Routines ### get_fd_geom_type = int_output(lgdal.OGR_FD_GetGeomType, [c_void_p]) get_fd_name = const_string_output(lgdal.OGR_FD_GetName, [c_void_p]) get_feat_name = const_string_output(lgdal.OGR_FD_GetName, [c_void_p]) get_field_count = int_output(lgdal.OGR_FD_GetFieldCount, [c_void_p]) get_field_defn = voidptr_output(lgdal.OGR_FD_GetFieldDefn, [c_void_p, c_int]) ### Feature Routines ### clone_feature = voidptr_output(lgdal.OGR_F_Clone, [c_void_p]) destroy_feature = void_output(lgdal.OGR_F_Destroy, [c_void_p], errcheck=False) feature_equal = int_output(lgdal.OGR_F_Equal, [c_void_p, c_void_p]) get_feat_geom_ref = geom_output(lgdal.OGR_F_GetGeometryRef, [c_void_p]) get_feat_field_count = int_output(lgdal.OGR_F_GetFieldCount, [c_void_p]) get_feat_field_defn = voidptr_output(lgdal.OGR_F_GetFieldDefnRef, [c_void_p, c_int]) get_fid = int_output(lgdal.OGR_F_GetFID, [c_void_p]) get_field_as_datetime = int_output(lgdal.OGR_F_GetFieldAsDateTime, [c_void_p, c_int, c_int_p, c_int_p, c_int_p, c_int_p, c_int_p, c_int_p]) get_field_as_double = double_output(lgdal.OGR_F_GetFieldAsDouble, [c_void_p, c_int]) get_field_as_integer = int_output(lgdal.OGR_F_GetFieldAsInteger, [c_void_p, c_int]) get_field_as_string = const_string_output(lgdal.OGR_F_GetFieldAsString, [c_void_p, c_int]) get_field_index = int_output(lgdal.OGR_F_GetFieldIndex, [c_void_p, c_char_p]) ### Field Routines ### get_field_name = const_string_output(lgdal.OGR_Fld_GetNameRef, [c_void_p]) get_field_precision = int_output(lgdal.OGR_Fld_GetPrecision, [c_void_p]) get_field_type = int_output(lgdal.OGR_Fld_GetType, [c_void_p]) get_field_type_name = const_string_output(lgdal.OGR_GetFieldTypeName, [c_int]) get_field_width = int_output(lgdal.OGR_Fld_GetWidth, [c_void_p])
mit
[ 624, 199, 961, 859, 394, 810, 874, 314, 5577, 805, 19393, 83, 367, 10904, 24300, 199, 4048, 666, 13955, 14, 10904, 63, 21733, 63, 10381, 10904, 63, 3177, 63, 10381, 10904, 63, 44, 63, 10381, 10904, 63, 38, 63, 10381, 9948, 10904, 63, 38, 1447, 15192, 14975, 787, 12082, 2348, 14, 199, 624, 199, 504, 5577, 492, 286, 63, 1560, 63, 80, 12, 286, 63, 3157, 12, 286, 63, 442, 12, 286, 63, 2809, 12, 286, 63, 1647, 63, 80, 12, 6569, 199, 504, 1639, 14, 2828, 14, 5668, 14, 11600, 14, 19707, 492, 19746, 907, 78, 10658, 199, 504, 1639, 14, 2828, 14, 5668, 14, 11600, 14, 773, 11600, 492, 634, 11600, 199, 504, 1639, 14, 2828, 14, 5668, 14, 11600, 14, 16141, 83, 14, 15043, 492, 971, 272, 950, 63, 875, 63, 1199, 12, 4270, 63, 1199, 12, 9671, 63, 1199, 12, 1109, 63, 1199, 12, 971, 272, 16191, 63, 1199, 12, 2309, 63, 1199, 12, 2309, 4695, 63, 1199, 199, 199, 67, 63, 442, 63, 80, 275, 6569, 8, 67, 63, 442, 9, 327, 17522, 730, 199, 199, 5680, 19447, 30790, 3746, 6754, 199, 2683, 63, 452, 275, 2309, 63, 1199, 8, 21935, 14, 17275, 7099, 2422, 12, 990, 2329, 1074, 29, 797, 9, 199, 7661, 63, 452, 275, 2309, 63, 1199, 8, 21935, 14, 17275, 7891, 2422, 12, 990, 2329, 1074, 29, 797, 9, 199, 362, 63, 3090, 275, 2309, 4695, 63, 1199, 8, 21935, 14, 17275, 1002, 6158, 12, 359, 67, 63, 442, 566, 199, 362, 63, 3090, 63, 991, 63, 354, 275, 2309, 4695, 63, 1199, 8, 21935, 14, 17275, 1002, 6158, 11190, 12, 359, 67, 63, 1560, 63, 80, 566, 199, 362, 63, 3090, 63, 835, 275, 1109, 63, 1199, 8, 21935, 14, 17275, 1002, 6158, 2353, 12, 3073, 199, 362, 63, 3090, 63, 354, 275, 950, 63, 875, 63, 1199, 8, 21935, 14, 17275, 63, 21733, 63, 21266, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 199, 5680, 24300, 6754, 199, 1490, 63, 795, 275, 2309, 4695, 63, 1199, 8, 21935, 14, 14008, 1092, 897, 12, 359, 67, 63, 1560, 63, 80, 12, 286, 63, 442, 12, 6569, 8, 67, 63, 1647, 63, 80, 3948, 199, 7237, 63, 795, 275, 2309, 63, 1199, 8, 21935, 14, 17275, 63, 3177, 63, 14704, 12, 359, 67, 63, 1647, 63, 80, 467, 2329, 1074, 29, 797, 9, 199, 3221, 63, 795, 275, 2309, 63, 1199, 8, 21935, 14, 17275, 9625, 16693, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 362, 63, 795, 63, 354, 275, 950, 63, 875, 63, 1199, 8, 21935, 14, 17275, 63, 3177, 63, 21266, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 362, 63, 1897, 275, 2309, 4695, 63, 1199, 8, 21935, 14, 17275, 63, 3177, 63, 1002, 5003, 12, 359, 67, 63, 1647, 63, 80, 12, 286, 63, 442, 566, 199, 362, 63, 1897, 63, 991, 63, 354, 275, 2309, 4695, 63, 1199, 8, 21935, 14, 17275, 63, 3177, 63, 1002, 5003, 11190, 12, 359, 67, 63, 1647, 63, 80, 12, 286, 63, 1560, 63, 80, 566, 199, 362, 63, 1897, 63, 835, 275, 1109, 63, 1199, 8, 21935, 14, 17275, 63, 3177, 63, 1002, 5003, 2353, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 199, 5680, 11915, 30790, 3746, 6754, 199, 362, 63, 11599, 275, 2309, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 1002, 19808, 12, 359, 67, 63, 1647, 63, 80, 12, 6569, 8, 14008, 907, 78, 10658, 395, 286, 63, 442, 566, 199, 362, 63, 4445, 275, 2309, 4695, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 1002, 5968, 12, 359, 67, 63, 1647, 63, 80, 12, 286, 63, 2809, 566, 199, 362, 63, 4445, 63, 835, 275, 1109, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 1002, 5968, 2353, 12, 359, 67, 63, 1647, 63, 80, 12, 286, 63, 442, 566, 199, 362, 63, 1897, 63, 27950, 275, 2309, 4695, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 1002, 5003, 872, 2324, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 362, 63, 1897, 63, 12722, 275, 16191, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 17526, 9491, 2891, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 362, 63, 2184, 63, 4445, 275, 2309, 4695, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 20079, 5968, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 3958, 63, 19332, 275, 2309, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 9637, 20568, 12, 359, 67, 63, 1647, 63, 80, 467, 2329, 1074, 29, 797, 9, 199, 396, 63, 21181, 275, 1109, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 774, 24512, 12, 359, 67, 63, 1647, 63, 80, 12, 286, 63, 1560, 63, 80, 566, 199, 362, 63, 11679, 63, 1541, 275, 9671, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 17526, 9491, 4131, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 409, 63, 11679, 63, 1541, 275, 2309, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 1084, 18075, 4131, 12, 359, 67, 63, 1647, 63, 80, 12, 286, 63, 1647, 63, 80, 467, 2329, 1074, 29, 797, 9, 199, 409, 63, 11679, 63, 1541, 63, 1201, 275, 2309, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 1084, 18075, 4131, 8252, 12, 359, 67, 63, 1647, 63, 80, 12, 286, 63, 3157, 12, 286, 63, 3157, 12, 286, 63, 3157, 12, 286, 63, 3157, 467, 2329, 1074, 29, 797, 9, 199, 199, 5680, 13407, 29398, 30790, 3746, 6754, 199, 362, 63, 2592, 63, 6481, 63, 466, 275, 1109, 63, 1199, 8, 21935, 14, 17275, 63, 7902, 63, 1002, 22702, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 362, 63, 2592, 63, 354, 275, 950, 63, 875, 63, 1199, 8, 21935, 14, 17275, 63, 7902, 63, 21266, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 362, 63, 11873, 63, 354, 275, 950, 63, 875, 63, 1199, 8, 21935, 14, 17275, 63, 7902, 63, 21266, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 362, 63, 698, 63, 835, 275, 1109, 63, 1199, 8, 21935, 14, 17275, 63, 7902, 63, 1002, 792, 2353, 12, 359 ]
[ 199, 961, 859, 394, 810, 874, 314, 5577, 805, 19393, 83, 367, 10904, 24300, 199, 4048, 666, 13955, 14, 10904, 63, 21733, 63, 10381, 10904, 63, 3177, 63, 10381, 10904, 63, 44, 63, 10381, 10904, 63, 38, 63, 10381, 9948, 10904, 63, 38, 1447, 15192, 14975, 787, 12082, 2348, 14, 199, 624, 199, 504, 5577, 492, 286, 63, 1560, 63, 80, 12, 286, 63, 3157, 12, 286, 63, 442, 12, 286, 63, 2809, 12, 286, 63, 1647, 63, 80, 12, 6569, 199, 504, 1639, 14, 2828, 14, 5668, 14, 11600, 14, 19707, 492, 19746, 907, 78, 10658, 199, 504, 1639, 14, 2828, 14, 5668, 14, 11600, 14, 773, 11600, 492, 634, 11600, 199, 504, 1639, 14, 2828, 14, 5668, 14, 11600, 14, 16141, 83, 14, 15043, 492, 971, 272, 950, 63, 875, 63, 1199, 12, 4270, 63, 1199, 12, 9671, 63, 1199, 12, 1109, 63, 1199, 12, 971, 272, 16191, 63, 1199, 12, 2309, 63, 1199, 12, 2309, 4695, 63, 1199, 199, 199, 67, 63, 442, 63, 80, 275, 6569, 8, 67, 63, 442, 9, 327, 17522, 730, 199, 199, 5680, 19447, 30790, 3746, 6754, 199, 2683, 63, 452, 275, 2309, 63, 1199, 8, 21935, 14, 17275, 7099, 2422, 12, 990, 2329, 1074, 29, 797, 9, 199, 7661, 63, 452, 275, 2309, 63, 1199, 8, 21935, 14, 17275, 7891, 2422, 12, 990, 2329, 1074, 29, 797, 9, 199, 362, 63, 3090, 275, 2309, 4695, 63, 1199, 8, 21935, 14, 17275, 1002, 6158, 12, 359, 67, 63, 442, 566, 199, 362, 63, 3090, 63, 991, 63, 354, 275, 2309, 4695, 63, 1199, 8, 21935, 14, 17275, 1002, 6158, 11190, 12, 359, 67, 63, 1560, 63, 80, 566, 199, 362, 63, 3090, 63, 835, 275, 1109, 63, 1199, 8, 21935, 14, 17275, 1002, 6158, 2353, 12, 3073, 199, 362, 63, 3090, 63, 354, 275, 950, 63, 875, 63, 1199, 8, 21935, 14, 17275, 63, 21733, 63, 21266, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 199, 5680, 24300, 6754, 199, 1490, 63, 795, 275, 2309, 4695, 63, 1199, 8, 21935, 14, 14008, 1092, 897, 12, 359, 67, 63, 1560, 63, 80, 12, 286, 63, 442, 12, 6569, 8, 67, 63, 1647, 63, 80, 3948, 199, 7237, 63, 795, 275, 2309, 63, 1199, 8, 21935, 14, 17275, 63, 3177, 63, 14704, 12, 359, 67, 63, 1647, 63, 80, 467, 2329, 1074, 29, 797, 9, 199, 3221, 63, 795, 275, 2309, 63, 1199, 8, 21935, 14, 17275, 9625, 16693, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 362, 63, 795, 63, 354, 275, 950, 63, 875, 63, 1199, 8, 21935, 14, 17275, 63, 3177, 63, 21266, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 362, 63, 1897, 275, 2309, 4695, 63, 1199, 8, 21935, 14, 17275, 63, 3177, 63, 1002, 5003, 12, 359, 67, 63, 1647, 63, 80, 12, 286, 63, 442, 566, 199, 362, 63, 1897, 63, 991, 63, 354, 275, 2309, 4695, 63, 1199, 8, 21935, 14, 17275, 63, 3177, 63, 1002, 5003, 11190, 12, 359, 67, 63, 1647, 63, 80, 12, 286, 63, 1560, 63, 80, 566, 199, 362, 63, 1897, 63, 835, 275, 1109, 63, 1199, 8, 21935, 14, 17275, 63, 3177, 63, 1002, 5003, 2353, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 199, 5680, 11915, 30790, 3746, 6754, 199, 362, 63, 11599, 275, 2309, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 1002, 19808, 12, 359, 67, 63, 1647, 63, 80, 12, 6569, 8, 14008, 907, 78, 10658, 395, 286, 63, 442, 566, 199, 362, 63, 4445, 275, 2309, 4695, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 1002, 5968, 12, 359, 67, 63, 1647, 63, 80, 12, 286, 63, 2809, 566, 199, 362, 63, 4445, 63, 835, 275, 1109, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 1002, 5968, 2353, 12, 359, 67, 63, 1647, 63, 80, 12, 286, 63, 442, 566, 199, 362, 63, 1897, 63, 27950, 275, 2309, 4695, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 1002, 5003, 872, 2324, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 362, 63, 1897, 63, 12722, 275, 16191, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 17526, 9491, 2891, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 362, 63, 2184, 63, 4445, 275, 2309, 4695, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 20079, 5968, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 3958, 63, 19332, 275, 2309, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 9637, 20568, 12, 359, 67, 63, 1647, 63, 80, 467, 2329, 1074, 29, 797, 9, 199, 396, 63, 21181, 275, 1109, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 774, 24512, 12, 359, 67, 63, 1647, 63, 80, 12, 286, 63, 1560, 63, 80, 566, 199, 362, 63, 11679, 63, 1541, 275, 9671, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 17526, 9491, 4131, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 409, 63, 11679, 63, 1541, 275, 2309, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 1084, 18075, 4131, 12, 359, 67, 63, 1647, 63, 80, 12, 286, 63, 1647, 63, 80, 467, 2329, 1074, 29, 797, 9, 199, 409, 63, 11679, 63, 1541, 63, 1201, 275, 2309, 63, 1199, 8, 21935, 14, 17275, 63, 44, 63, 1084, 18075, 4131, 8252, 12, 359, 67, 63, 1647, 63, 80, 12, 286, 63, 3157, 12, 286, 63, 3157, 12, 286, 63, 3157, 12, 286, 63, 3157, 467, 2329, 1074, 29, 797, 9, 199, 199, 5680, 13407, 29398, 30790, 3746, 6754, 199, 362, 63, 2592, 63, 6481, 63, 466, 275, 1109, 63, 1199, 8, 21935, 14, 17275, 63, 7902, 63, 1002, 22702, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 362, 63, 2592, 63, 354, 275, 950, 63, 875, 63, 1199, 8, 21935, 14, 17275, 63, 7902, 63, 21266, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 362, 63, 11873, 63, 354, 275, 950, 63, 875, 63, 1199, 8, 21935, 14, 17275, 63, 7902, 63, 21266, 12, 359, 67, 63, 1647, 63, 80, 566, 199, 362, 63, 698, 63, 835, 275, 1109, 63, 1199, 8, 21935, 14, 17275, 63, 7902, 63, 1002, 792, 2353, 12, 359, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
peak6/st2
st2reactor/st2reactor/rules/datatransform.py
2
2532
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import copy from st2common.constants.keyvalue import SYSTEM_SCOPE, FULL_SYSTEM_SCOPE, DATASTORE_PARENT_SCOPE from st2common.constants.rules import TRIGGER_PAYLOAD_PREFIX from st2common.services.keyvalues import KeyValueLookup from st2common.util import jinja as jinja_utils class Jinja2BasedTransformer(object): def __init__(self, payload): self._payload_context = Jinja2BasedTransformer.\ _construct_context(TRIGGER_PAYLOAD_PREFIX, payload, {}) def __call__(self, mapping): context = copy.copy(self._payload_context) context[SYSTEM_SCOPE] = KeyValueLookup(scope=SYSTEM_SCOPE) context.update({ DATASTORE_PARENT_SCOPE: { SYSTEM_SCOPE: KeyValueLookup(scope=FULL_SYSTEM_SCOPE) } }) return jinja_utils.render_values(mapping=mapping, context=context) @staticmethod def _construct_context(prefix, data, context): if data is None: return context context = context or {} context[SYSTEM_SCOPE] = KeyValueLookup(scope=SYSTEM_SCOPE) context.update({ DATASTORE_PARENT_SCOPE: { SYSTEM_SCOPE: KeyValueLookup(scope=FULL_SYSTEM_SCOPE) } }) # add in the data in the context without any processing. Payload may # contain renderable keys however those are often due to nature of the # events being posted e.g. ActionTrigger with template variables. Rendering # these values would lead to bugs in the data so best to avoid. if prefix not in context: context[prefix] = {} context[prefix].update(data) return context def get_transformer(payload): return Jinja2BasedTransformer(payload)
apache-2.0
[ 3, 3909, 370, 314, 13894, 933, 1025, 12, 3277, 661, 4851, 933, 1025, 358, 1334, 1373, 503, 1655, 199, 3, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 1854, 543, 199, 3, 642, 1736, 367, 4722, 2556, 12602, 4248, 12715, 14, 199, 3, 710, 14857, 12378, 642, 570, 370, 2047, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 199, 3, 334, 1589, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 199, 3, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 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, 1331, 199, 199, 504, 410, 18, 2330, 14, 5559, 14, 498, 585, 492, 20859, 63, 17998, 12, 18530, 63, 12711, 63, 17998, 12, 7126, 16169, 63, 20562, 63, 17998, 199, 504, 410, 18, 2330, 14, 5559, 14, 4423, 492, 9074, 25703, 63, 24647, 63, 6351, 199, 504, 410, 18, 2330, 14, 5950, 14, 498, 1459, 492, 2606, 1110, 7521, 199, 504, 410, 18, 2330, 14, 1974, 492, 10321, 465, 10321, 63, 1208, 421, 199, 533, 17300, 18, 20409, 19761, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 4886, 304, 267, 291, 423, 4749, 63, 1100, 275, 17300, 18, 20409, 19761, 3134, 288, 485, 8514, 63, 1100, 8, 30073, 63, 24647, 63, 6351, 12, 4886, 12, 5009, 339, 347, 636, 1250, 721, 277, 12, 4412, 304, 267, 1067, 275, 1331, 14, 1574, 8, 277, 423, 4749, 63, 1100, 9, 267, 1067, 59, 12711, 63, 17998, 61, 275, 2606, 1110, 7521, 8, 2645, 29, 12711, 63, 17998, 9, 267, 1067, 14, 873, 2561, 288, 7126, 16169, 63, 20562, 63, 17998, 26, 469, 355, 20859, 63, 17998, 26, 2606, 1110, 7521, 8, 2645, 29, 14742, 63, 12711, 63, 17998, 9, 288, 789, 267, 3828, 267, 372, 10321, 63, 1208, 14, 3352, 63, 1459, 8, 4745, 29, 4745, 12, 1067, 29, 1100, 9, 339, 768, 4639, 272, 347, 485, 8514, 63, 1100, 8, 1861, 12, 666, 12, 1067, 304, 267, 340, 666, 365, 488, 26, 288, 372, 1067, 398, 1067, 275, 1067, 503, 1052, 267, 1067, 59, 12711, 63, 17998, 61, 275, 2606, 1110, 7521, 8, 2645, 29, 12711, 63, 17998, 9, 267, 1067, 14, 873, 2561, 288, 7126, 16169, 63, 20562, 63, 17998, 26, 469, 355, 20859, 63, 17998, 26, 2606, 1110, 7521, 8, 2645, 29, 14742, 63, 12711, 63, 17998, 9, 288, 789, 267, 3828, 267, 327, 1050, 315, 314, 666, 315, 314, 1067, 1928, 1263, 6661, 14, 15911, 912, 1443, 267, 327, 1395, 2903, 271, 6842, 2883, 13432, 5204, 787, 14115, 7037, 370, 302, 1463, 402, 314, 267, 327, 4474, 3769, 22752, 325, 14, 71, 14, 10033, 16276, 543, 1978, 2860, 14, 17769, 316, 267, 327, 3520, 1338, 3955, 12690, 370, 18227, 315, 314, 666, 880, 5526, 370, 5126, 14, 267, 340, 2403, 440, 315, 1067, 26, 288, 1067, 59, 1861, 61, 275, 1052, 267, 1067, 59, 1861, 1055, 873, 8, 576, 9, 267, 372, 1067, 421, 199, 318, 664, 63, 19754, 8, 4749, 304, 272, 372, 17300, 18, 20409, 19761, 8, 4749, 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 ]
[ 3909, 370, 314, 13894, 933, 1025, 12, 3277, 661, 4851, 933, 1025, 358, 1334, 1373, 503, 1655, 199, 3, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 1854, 543, 199, 3, 642, 1736, 367, 4722, 2556, 12602, 4248, 12715, 14, 199, 3, 710, 14857, 12378, 642, 570, 370, 2047, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 199, 3, 334, 1589, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 199, 3, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 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, 1331, 199, 199, 504, 410, 18, 2330, 14, 5559, 14, 498, 585, 492, 20859, 63, 17998, 12, 18530, 63, 12711, 63, 17998, 12, 7126, 16169, 63, 20562, 63, 17998, 199, 504, 410, 18, 2330, 14, 5559, 14, 4423, 492, 9074, 25703, 63, 24647, 63, 6351, 199, 504, 410, 18, 2330, 14, 5950, 14, 498, 1459, 492, 2606, 1110, 7521, 199, 504, 410, 18, 2330, 14, 1974, 492, 10321, 465, 10321, 63, 1208, 421, 199, 533, 17300, 18, 20409, 19761, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 4886, 304, 267, 291, 423, 4749, 63, 1100, 275, 17300, 18, 20409, 19761, 3134, 288, 485, 8514, 63, 1100, 8, 30073, 63, 24647, 63, 6351, 12, 4886, 12, 5009, 339, 347, 636, 1250, 721, 277, 12, 4412, 304, 267, 1067, 275, 1331, 14, 1574, 8, 277, 423, 4749, 63, 1100, 9, 267, 1067, 59, 12711, 63, 17998, 61, 275, 2606, 1110, 7521, 8, 2645, 29, 12711, 63, 17998, 9, 267, 1067, 14, 873, 2561, 288, 7126, 16169, 63, 20562, 63, 17998, 26, 469, 355, 20859, 63, 17998, 26, 2606, 1110, 7521, 8, 2645, 29, 14742, 63, 12711, 63, 17998, 9, 288, 789, 267, 3828, 267, 372, 10321, 63, 1208, 14, 3352, 63, 1459, 8, 4745, 29, 4745, 12, 1067, 29, 1100, 9, 339, 768, 4639, 272, 347, 485, 8514, 63, 1100, 8, 1861, 12, 666, 12, 1067, 304, 267, 340, 666, 365, 488, 26, 288, 372, 1067, 398, 1067, 275, 1067, 503, 1052, 267, 1067, 59, 12711, 63, 17998, 61, 275, 2606, 1110, 7521, 8, 2645, 29, 12711, 63, 17998, 9, 267, 1067, 14, 873, 2561, 288, 7126, 16169, 63, 20562, 63, 17998, 26, 469, 355, 20859, 63, 17998, 26, 2606, 1110, 7521, 8, 2645, 29, 14742, 63, 12711, 63, 17998, 9, 288, 789, 267, 3828, 267, 327, 1050, 315, 314, 666, 315, 314, 1067, 1928, 1263, 6661, 14, 15911, 912, 1443, 267, 327, 1395, 2903, 271, 6842, 2883, 13432, 5204, 787, 14115, 7037, 370, 302, 1463, 402, 314, 267, 327, 4474, 3769, 22752, 325, 14, 71, 14, 10033, 16276, 543, 1978, 2860, 14, 17769, 316, 267, 327, 3520, 1338, 3955, 12690, 370, 18227, 315, 314, 666, 880, 5526, 370, 5126, 14, 267, 340, 2403, 440, 315, 1067, 26, 288, 1067, 59, 1861, 61, 275, 1052, 267, 1067, 59, 1861, 1055, 873, 8, 576, 9, 267, 372, 1067, 421, 199, 318, 664, 63, 19754, 8, 4749, 304, 272, 372, 17300, 18, 20409, 19761, 8, 4749, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
andela-bojengwa/pleft
plapp/views.py
6
13418
# Copyright 2009, 2010 Sander Dijkhuis <sander.dijkhuis@gmail.com> # # This file is part of Pleft. # # Pleft 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. # # Pleft 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 Pleft. If not, see <http://www.gnu.org/licenses/>. import datetime import email.utils from django.core.cache import cache from django.core import exceptions from django import http from django.shortcuts import render_to_response from django.template.context import RequestContext from django.template.loader import render_to_string from django.utils import dateformat from django.utils import html from django.utils import simplejson from django.utils.translation import ugettext as _ from django.views.decorators.cache import never_cache import plauth import plauth.models import plapp from plapp import forms from plapp import models def _get_appointment_or_404(request): if request.method == 'POST': params = request.POST else: params = request.GET if not 'id' in params: raise http.Http404 appointment = models.Appointment.objects.all().get(id=int(params['id'])) if not appointment or not appointment.visible: raise http.Http404 user = plauth.models.User.get_signed_in(request) if not user: raise exceptions.PermissionDenied invitee = models.Invitee.objects.all().get(appointment=appointment, user=user) if not invitee: raise http.Http404 return (appointment, user, invitee) def create(request): form = forms.AppointmentForm(request.POST) if form.is_valid(): # Create the appointment user = plauth.models.User.get_or_create(form.cleaned_data['email']) appointment = models.Appointment(initiator=user) appointment.description = form.cleaned_data['description'] appointment.propose_more = form.cleaned_data['propose_more'] signed_in = plauth.models.User.get_signed_in(request) if signed_in: if signed_in == user: validate = False appointment.visible = True else: plauth.models.User.sign_out(request) validate = True appointment.visible = False else: validate = True appointment.visible = False appointment.save() owner = models.Invitee(user=user, appointment=appointment) owner.name = form.cleaned_data['name'] owner.save() for invitee in form.cleaned_data['invitees']: iuser = plauth.models.User.get_or_create(invitee[1]) inv = models.Invitee.get_or_create(iuser, appointment) inv.name = invitee[0] inv.save() if form.cleaned_data['dates'][0] != '': for input in form.cleaned_data['dates']: date = models.Date(appointment=appointment) date.date_time = datetime.datetime.strptime(input, '%Y-%m-%dT%H:%M:%S') date.invitee = owner date.save() avail = models.Availability() avail.date = date avail.invitee = owner avail.possible = 1 avail.save() if validate == True: plapp.send_mail( subject='%s: %s' % (_('Verification'), appointment.get_title()), template='plapp/mail/verification.txt', address=user.email, name=owner.get_name(), title=appointment.get_title(), url=appointment.get_url(user.email, user.password, True)) else: appointment.send_overview_mail(request) appointment.send_invitations(request) return http.HttpResponse(appointment.get_url()) return http.HttpResponse() else: raise http.Http404 def appointment(request): if 'id' in request.GET: return http.HttpResponsePermanentRedirect('/a#id=%s' % request.GET['id']) user = plauth.models.User.get_signed_in(request) if not user: return render_to_response('plauth/not-signed-in.html', context_instance=RequestContext(request)) return render_to_response('plapp/appointment.html', context_instance=RequestContext(request)) @never_cache def appointment_data(request): appointment, user, invitee = _get_appointment_or_404(request) user_id = user.id invitee_id = invitee.id appt_id = appointment.id data = {'user': user_id, 'invitee': invitee_id} metadata_key = plapp.get_cache_key('metadata', appointment=appt_id) metadata = cache.get(metadata_key) if not metadata: appt = appointment metadata = appt.get_metadata() cache.set(metadata_key, metadata) data['meta'] = metadata invitees_key = plapp.get_cache_key('invitees', appointment=appt_id) invitees = cache.get(invitees_key) if not invitees: instances = appointment.invitee_set.all() invitees = [{'name': i.get_name(), 'id': i.id} for i in instances] cache.set(invitees_key, invitees) data['people'] = invitees if metadata['initiator'] == user_id: addresses_key = plapp.get_cache_key('addresses', appointment=appt_id) addresses = cache.get(addresses_key) if not addresses: instances = appointment.invitee_set.all() addresses = {} for i in instances: if i.user.id == user_id: continue addresses[i.id] = i.user.email cache.set(addresses_key, addresses) data['addresses'] = addresses dates_key = plapp.get_cache_key('dates', appointment=appt_id) dates = cache.get(dates_key) if not dates: def _local_short_date(date): return dateformat.format(date, _('D M d, G:i')) instances = appointment.date_set.order_by('date_time').all() dates = [] for d in instances: dates.append({'id': d.id, 's': _local_short_date(d.date_time), 'd': d.date_time.strftime('%Y-%m-%dT%H:%M:%S')}) cache.set(dates_key, dates) data['dates'] = dates availability = {} for invitee in invitees: avail_key = plapp.get_cache_key('availability', appointment=appt_id, invitee=invitee['id']) avail = cache.get(avail_key) if not avail: invitee_instance = plapp.models.Invitee.objects.all().get(id=int(invitee['id'])) instances = invitee_instance.availability_set.all() avail = {} for a in instances: avail[a.date.id] = [a.possible, a.comment] cache.set(avail_key, avail) availability[invitee['id']] = avail data['availability'] = availability s = simplejson.dumps(data, separators=(',', ':')) return http.HttpResponse(s, mimetype='application/javascript') def appointment_list(request): user = plauth.models.User.get_signed_in(request) inviteeships = models.Invitee.objects.all(). \ filter(user=user, appointment__visible=True).order_by('-id') return render_to_response('plapp/list.html', { 'inviteeships': inviteeships, }, context_instance=RequestContext(request)) @never_cache def appointment_menu(request): user = plauth.models.User.get_signed_in(request) if not user: raise exceptions.PermissionDenied memkey = plapp.get_menu_cache_key(user) data = cache.get(memkey) if not data: appts = plapp.models.Appointment.get_unarchived_for_user(user) data = ','.join(['[%s,"%s"]' % (app.id, html.escape(app.get_title())) for app in appts]) data = '[%s]' % data cache.set(memkey, data, 60*60*24*7) return http.HttpResponse('{"a":%s}' % data, mimetype='application/javascript') def archive(request): appointment, user, invitee = _get_appointment_or_404(request) invitee.archived = not 'undo' in request.GET invitee.save() plapp.clear_menu_cache(user) return http.HttpResponseRedirect('/appointments') def verify(request): import logging if not 'id' in request.GET: raise http.Http404 appointment = models.Appointment.objects.all().get(id=int(request.GET['id'])) if not appointment: raise http.Http404 user = plauth.models.User.get_signed_in(request) if not user: raise http.Http404 if appointment.initiator != user: return http.Http404 if not appointment.visible: appointment.visible = True appointment.save() appointment.send_overview_mail(request) appointment.send_invitations(request) return http.HttpResponseRedirect(appointment.get_url()) def resend_invitation(request): appointment = models.Appointment.objects.all().get(id=int(request.POST['id'])) user = plauth.models.User.get_signed_in(request) if (not user or not appointment or not appointment.visible or appointment.initiator != user): raise http.Http404 invitee = models.Invitee.objects.all().get(id=int(request.POST['invitee'])) if invitee.appointment != appointment: raise http.Http404 initiator = models.Invitee.objects.all().get(user=user, appointment=appointment) appointment.send_invitation(invitee, initiator, request) return http.HttpResponse() def add_invitees(request): appointment = models.Appointment.objects.all().get(id=int(request.POST['id'])) user = plauth.models.User.get_signed_in(request) if (not user or not appointment or not appointment.visible or appointment.initiator != user): raise http.Http404 name, address = email.utils.getaddresses([request.POST['a']])[0] iuser = plauth.models.User.get_or_create(address) inv = models.Invitee.get_or_create(iuser, appointment) inv.name = name inv.save() initiator = models.Invitee.objects.all().get(user=appointment.initiator, appointment=appointment) appointment.send_invitation(inv, initiator, request) invitees_key = plapp.get_cache_key('invitees', appointment=appointment.id) invitees = cache.get(invitees_key) if invitees: cache.delete(invitees_key) """ invitees.append({'name': inv.get_name(), 'id': inv.id}) cache.set(invitees_key, invitees) """ addresses_key = plapp.get_cache_key('addresses', appointment=appointment.id) addresses = cache.get(addresses_key) if addresses: cache.delete(addresses_key) """ addresses[inv.id] = inv.user.email cache.set(addresses_key, addresses) """ return http.HttpResponse() def add_dates(request): appointment, user, invitee = _get_appointment_or_404(request) if (appointment.initiator != user and not appointment.propose_more): raise http.Http404 date = models.Date(appointment=appointment) date.date_time = datetime.datetime.strptime(request.POST['d'], '%Y-%m-%dT%H:%M:%S') date.invitee = invitee date.save() avail = models.Availability() avail.date = date avail.invitee = invitee avail.possible = 1 avail.save() # Remove dates from cache. Would be nicer to add the current date, but that would need re-ordering. dates_key = plapp.get_cache_key('dates', appointment=appointment.id) cache.set(dates_key, None) availability_key = plapp.get_cache_key('availability', appointment=appointment.id, invitee=invitee.id) availability = cache.get(availability_key) if availability: availability[date.id] = [1, ''] cache.set(availability_key, availability) return http.HttpResponse() def set_availability(request): appointment, user, invitee = _get_appointment_or_404(request) key = plapp.get_cache_key('availability', appointment=appointment.id, invitee=invitee.id) cached = cache.get(key) i = 0 for line in request.POST['a'].splitlines(): [datestring, possible, comment] = line.split(':', 2) date = models.Date.objects.all().get(id=int(datestring)) i += 1 try: avail = models.Availability.objects.all().get(date=date, invitee=invitee) except exceptions.ObjectDoesNotExist: avail = models.Availability(date=date, invitee=invitee) avail.possible = int(possible) avail.comment = comment avail.save() if cached: cached[date.id] = [int(possible), comment] if cached: cache.set(key, cached) return http.HttpResponse()
gpl-3.0
[ 3, 1898, 8937, 12, 7129, 428, 11438, 3757, 17421, 10616, 374, 665, 83, 11438, 14, 328, 17421, 10616, 374, 32, 6799, 14, 957, 30, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 510, 3039, 14, 199, 3, 199, 3, 510, 3039, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 652, 199, 3, 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, 510, 3039, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 199, 3, 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, 510, 3039, 14, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 646, 2197, 199, 646, 3031, 14, 1208, 199, 199, 504, 1639, 14, 1018, 14, 1637, 492, 2581, 199, 504, 1639, 14, 1018, 492, 4967, 199, 504, 1639, 492, 1455, 199, 504, 1639, 14, 17469, 492, 3795, 63, 475, 63, 1310, 199, 504, 1639, 14, 1160, 14, 1100, 492, 22538, 199, 504, 1639, 14, 1160, 14, 3422, 492, 3795, 63, 475, 63, 875, 199, 504, 1639, 14, 1208, 492, 1434, 908, 199, 504, 1639, 14, 1208, 492, 3517, 199, 504, 1639, 14, 1208, 492, 13804, 199, 504, 1639, 14, 1208, 14, 6893, 492, 10366, 465, 485, 199, 504, 1639, 14, 4196, 14, 11582, 14, 1637, 492, 7078, 63, 1637, 199, 199, 646, 299, 416, 762, 199, 646, 299, 416, 762, 14, 992, 199, 199, 646, 299, 416, 802, 199, 504, 299, 416, 802, 492, 4513, 199, 504, 299, 416, 802, 492, 1709, 199, 199, 318, 485, 362, 63, 439, 29594, 63, 269, 63, 5188, 8, 1069, 304, 272, 340, 1056, 14, 765, 508, 283, 4030, 356, 267, 1862, 275, 1056, 14, 4030, 272, 587, 26, 267, 1862, 275, 1056, 14, 2970, 339, 340, 440, 283, 344, 7, 315, 1862, 26, 267, 746, 1455, 14, 5779, 5188, 339, 2771, 29594, 275, 1709, 14, 13117, 29594, 14, 1462, 14, 452, 1252, 362, 8, 344, 29, 442, 8, 1162, 459, 344, 5156, 272, 340, 440, 2771, 29594, 503, 440, 2771, 29594, 14, 6604, 26, 267, 746, 1455, 14, 5779, 5188, 339, 922, 275, 299, 416, 762, 14, 992, 14, 1899, 14, 362, 63, 1737, 63, 262, 8, 1069, 9, 272, 340, 440, 922, 26, 267, 746, 4967, 14, 7980, 15729, 339, 24542, 69, 275, 1709, 14, 607, 13187, 69, 14, 1462, 14, 452, 1252, 362, 8, 439, 29594, 29, 439, 29594, 12, 922, 29, 751, 9, 272, 340, 440, 24542, 69, 26, 267, 746, 1455, 14, 5779, 5188, 339, 372, 334, 439, 29594, 12, 922, 12, 24542, 69, 9, 199, 199, 318, 1218, 8, 1069, 304, 272, 1824, 275, 4513, 14, 13117, 29594, 2821, 8, 1069, 14, 4030, 9, 272, 340, 1824, 14, 374, 63, 1078, 837, 267, 327, 2790, 314, 2771, 29594, 398, 922, 275, 299, 416, 762, 14, 992, 14, 1899, 14, 362, 63, 269, 63, 981, 8, 964, 14, 8275, 63, 576, 459, 2123, 1105, 398, 2771, 29594, 275, 1709, 14, 13117, 29594, 8, 17974, 29, 751, 9, 267, 2771, 29594, 14, 1802, 275, 1824, 14, 8275, 63, 576, 459, 1802, 418, 267, 2771, 29594, 14, 496, 4070, 63, 6878, 275, 1824, 14, 8275, 63, 576, 459, 496, 4070, 63, 6878, 418, 267, 10514, 63, 262, 275, 299, 416, 762, 14, 992, 14, 1899, 14, 362, 63, 1737, 63, 262, 8, 1069, 9, 267, 340, 10514, 63, 262, 26, 288, 340, 10514, 63, 262, 508, 922, 26, 355, 4107, 275, 756, 355, 2771, 29594, 14, 6604, 275, 715, 288, 587, 26, 355, 299, 416, 762, 14, 992, 14, 1899, 14, 1037, 63, 548, 8, 1069, 9, 355, 4107, 275, 715, 355, 2771, 29594, 14, 6604, 275, 756, 267, 587, 26, 288, 4107, 275, 715, 288, 2771, 29594, 14, 6604, 275, 756, 267, 2771, 29594, 14, 2117, 342, 398, 5771, 275, 1709, 14, 607, 13187, 69, 8, 751, 29, 751, 12, 2771, 29594, 29, 439, 29594, 9, 267, 5771, 14, 354, 275, 1824, 14, 8275, 63, 576, 459, 354, 418, 267, 5771, 14, 2117, 342, 398, 367, 24542, 69, 315, 1824, 14, 8275, 63, 576, 459, 19061, 397, 2565, 288, 284, 751, 275, 299, 416, 762, 14, 992, 14, 1899, 14, 362, 63, 269, 63, 981, 8, 19061, 69, 59, 17, 566, 953, 4572, 275, 1709, 14, 607, 13187, 69, 14, 362, 63, 269, 63, 981, 8, 73, 751, 12, 2771, 29594, 9, 288, 4572, 14, 354, 275, 24542, 69, 59, 16, 61, 288, 4572, 14, 2117, 342, 398, 340, 1824, 14, 8275, 63, 576, 459, 9356, 3488, 16, 61, 1137, 8061, 288, 367, 1324, 315, 1824, 14, 8275, 63, 576, 459, 9356, 2565, 355, 1434, 275, 1709, 14, 2506, 8, 439, 29594, 29, 439, 29594, 9, 355, 1434, 14, 602, 63, 521, 275, 2197, 14, 2083, 14, 9866, 8, 1210, 12, 14663, 1543, 57, 3295, 77, 3295, 19772, 5, 40, 2689, 45, 2689, 51, 358, 355, 1434, 14, 19061, 69, 275, 5771, 355, 1434, 14, 2117, 342, 2234, 21006, 275, 1709, 14, 26462, 342, 355, 21006, 14, 602, 275, 1434, 355, 21006, 14, 19061, 69, 275, 5771, 355, 21006, 14, 13893, 275, 413, 8892, 21006, 14, 2117, 342, 398, 340, 4107, 508, 715, 26, 288, 299, 416, 802, 14, 2254, 63, 1198, 8, 355, 5420, 9569, 83, 26, 450, 83, 7, 450, 21790, 22595, 659, 2771, 29594, 14, 362, 63, 1213, 4000, 355, 1978, 534, 80, 416, 802, 15, 1198, 15, 16257, 14, 2424, 297, 355, 2287, 29, 751, 14, 2123, 12, 355, 536, 29, 4597, 14, 362, 63, 354, 1062, 355, 2538, 29, 439, 29594, 14, 362, 63, 1213, 1062, 355, 1166, 29, 439, 29594, 14, 362, 63, 633, 8, 751, 14, 2123, 12, 922, 14, 2060, 12, 715, 430, 267, 587, 26, 288, 2771, 29594, 14 ]
[ 1898, 8937, 12, 7129, 428, 11438, 3757, 17421, 10616, 374, 665, 83, 11438, 14, 328, 17421, 10616, 374, 32, 6799, 14, 957, 30, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 510, 3039, 14, 199, 3, 199, 3, 510, 3039, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 652, 199, 3, 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, 510, 3039, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 199, 3, 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, 510, 3039, 14, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 646, 2197, 199, 646, 3031, 14, 1208, 199, 199, 504, 1639, 14, 1018, 14, 1637, 492, 2581, 199, 504, 1639, 14, 1018, 492, 4967, 199, 504, 1639, 492, 1455, 199, 504, 1639, 14, 17469, 492, 3795, 63, 475, 63, 1310, 199, 504, 1639, 14, 1160, 14, 1100, 492, 22538, 199, 504, 1639, 14, 1160, 14, 3422, 492, 3795, 63, 475, 63, 875, 199, 504, 1639, 14, 1208, 492, 1434, 908, 199, 504, 1639, 14, 1208, 492, 3517, 199, 504, 1639, 14, 1208, 492, 13804, 199, 504, 1639, 14, 1208, 14, 6893, 492, 10366, 465, 485, 199, 504, 1639, 14, 4196, 14, 11582, 14, 1637, 492, 7078, 63, 1637, 199, 199, 646, 299, 416, 762, 199, 646, 299, 416, 762, 14, 992, 199, 199, 646, 299, 416, 802, 199, 504, 299, 416, 802, 492, 4513, 199, 504, 299, 416, 802, 492, 1709, 199, 199, 318, 485, 362, 63, 439, 29594, 63, 269, 63, 5188, 8, 1069, 304, 272, 340, 1056, 14, 765, 508, 283, 4030, 356, 267, 1862, 275, 1056, 14, 4030, 272, 587, 26, 267, 1862, 275, 1056, 14, 2970, 339, 340, 440, 283, 344, 7, 315, 1862, 26, 267, 746, 1455, 14, 5779, 5188, 339, 2771, 29594, 275, 1709, 14, 13117, 29594, 14, 1462, 14, 452, 1252, 362, 8, 344, 29, 442, 8, 1162, 459, 344, 5156, 272, 340, 440, 2771, 29594, 503, 440, 2771, 29594, 14, 6604, 26, 267, 746, 1455, 14, 5779, 5188, 339, 922, 275, 299, 416, 762, 14, 992, 14, 1899, 14, 362, 63, 1737, 63, 262, 8, 1069, 9, 272, 340, 440, 922, 26, 267, 746, 4967, 14, 7980, 15729, 339, 24542, 69, 275, 1709, 14, 607, 13187, 69, 14, 1462, 14, 452, 1252, 362, 8, 439, 29594, 29, 439, 29594, 12, 922, 29, 751, 9, 272, 340, 440, 24542, 69, 26, 267, 746, 1455, 14, 5779, 5188, 339, 372, 334, 439, 29594, 12, 922, 12, 24542, 69, 9, 199, 199, 318, 1218, 8, 1069, 304, 272, 1824, 275, 4513, 14, 13117, 29594, 2821, 8, 1069, 14, 4030, 9, 272, 340, 1824, 14, 374, 63, 1078, 837, 267, 327, 2790, 314, 2771, 29594, 398, 922, 275, 299, 416, 762, 14, 992, 14, 1899, 14, 362, 63, 269, 63, 981, 8, 964, 14, 8275, 63, 576, 459, 2123, 1105, 398, 2771, 29594, 275, 1709, 14, 13117, 29594, 8, 17974, 29, 751, 9, 267, 2771, 29594, 14, 1802, 275, 1824, 14, 8275, 63, 576, 459, 1802, 418, 267, 2771, 29594, 14, 496, 4070, 63, 6878, 275, 1824, 14, 8275, 63, 576, 459, 496, 4070, 63, 6878, 418, 267, 10514, 63, 262, 275, 299, 416, 762, 14, 992, 14, 1899, 14, 362, 63, 1737, 63, 262, 8, 1069, 9, 267, 340, 10514, 63, 262, 26, 288, 340, 10514, 63, 262, 508, 922, 26, 355, 4107, 275, 756, 355, 2771, 29594, 14, 6604, 275, 715, 288, 587, 26, 355, 299, 416, 762, 14, 992, 14, 1899, 14, 1037, 63, 548, 8, 1069, 9, 355, 4107, 275, 715, 355, 2771, 29594, 14, 6604, 275, 756, 267, 587, 26, 288, 4107, 275, 715, 288, 2771, 29594, 14, 6604, 275, 756, 267, 2771, 29594, 14, 2117, 342, 398, 5771, 275, 1709, 14, 607, 13187, 69, 8, 751, 29, 751, 12, 2771, 29594, 29, 439, 29594, 9, 267, 5771, 14, 354, 275, 1824, 14, 8275, 63, 576, 459, 354, 418, 267, 5771, 14, 2117, 342, 398, 367, 24542, 69, 315, 1824, 14, 8275, 63, 576, 459, 19061, 397, 2565, 288, 284, 751, 275, 299, 416, 762, 14, 992, 14, 1899, 14, 362, 63, 269, 63, 981, 8, 19061, 69, 59, 17, 566, 953, 4572, 275, 1709, 14, 607, 13187, 69, 14, 362, 63, 269, 63, 981, 8, 73, 751, 12, 2771, 29594, 9, 288, 4572, 14, 354, 275, 24542, 69, 59, 16, 61, 288, 4572, 14, 2117, 342, 398, 340, 1824, 14, 8275, 63, 576, 459, 9356, 3488, 16, 61, 1137, 8061, 288, 367, 1324, 315, 1824, 14, 8275, 63, 576, 459, 9356, 2565, 355, 1434, 275, 1709, 14, 2506, 8, 439, 29594, 29, 439, 29594, 9, 355, 1434, 14, 602, 63, 521, 275, 2197, 14, 2083, 14, 9866, 8, 1210, 12, 14663, 1543, 57, 3295, 77, 3295, 19772, 5, 40, 2689, 45, 2689, 51, 358, 355, 1434, 14, 19061, 69, 275, 5771, 355, 1434, 14, 2117, 342, 2234, 21006, 275, 1709, 14, 26462, 342, 355, 21006, 14, 602, 275, 1434, 355, 21006, 14, 19061, 69, 275, 5771, 355, 21006, 14, 13893, 275, 413, 8892, 21006, 14, 2117, 342, 398, 340, 4107, 508, 715, 26, 288, 299, 416, 802, 14, 2254, 63, 1198, 8, 355, 5420, 9569, 83, 26, 450, 83, 7, 450, 21790, 22595, 659, 2771, 29594, 14, 362, 63, 1213, 4000, 355, 1978, 534, 80, 416, 802, 15, 1198, 15, 16257, 14, 2424, 297, 355, 2287, 29, 751, 14, 2123, 12, 355, 536, 29, 4597, 14, 362, 63, 354, 1062, 355, 2538, 29, 439, 29594, 14, 362, 63, 1213, 1062, 355, 1166, 29, 439, 29594, 14, 362, 63, 633, 8, 751, 14, 2123, 12, 922, 14, 2060, 12, 715, 430, 267, 587, 26, 288, 2771, 29594, 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,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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 ]
fhartwig/adhocracy3.mercator
src/adhocracy_core/adhocracy_core/test_interfaces.py
4
2797
import unittest from adhocracy_core.interfaces import ISheet class SheetToSheetUnitTests(unittest.TestCase): def test_create_valid(self): from adhocracy_core.interfaces import SheetToSheet as Reference # substanced standard tagged values assert Reference.getTaggedValue('source_integrity') is False assert Reference.getTaggedValue('target_integrity') is False assert Reference.getTaggedValue('source_ordered') is False assert Reference.getTaggedValue('target_ordered') is False # extra tagged values assert Reference.getTaggedValue('source_isheet') is ISheet assert Reference.getTaggedValue('source_isheet_field') == u'' assert Reference.getTaggedValue('target_isheet') is ISheet def test_create_valid_custom_values(self): from adhocracy_core.interfaces import SheetToSheet from adhocracy_core.interfaces import ISheet class IA(ISheet): pass class Reference(SheetToSheet): source_integrity = True target_integrity = True target_ordered = True source_ordered = True source_isheet = IA source_isheet_field = u'' target_isheet = IA # substanced standard tagged values assert Reference.getTaggedValue('source_integrity') assert Reference.getTaggedValue('target_integrity') assert Reference.getTaggedValue('source_ordered') assert Reference.getTaggedValue('target_ordered') # extra tagged values assert Reference.getTaggedValue('source_isheet') is IA assert Reference.getTaggedValue('source_isheet_field') == u'' assert Reference.getTaggedValue('target_isheet') is IA class TestNamedTuple: class ISample: pass class ISampleSheetA: pass class ISampleSheetB: pass def call_fut(self, typename, field_names, verbose=False, rename=False): from .interfaces import namedtuple return namedtuple(typename, field_names, verbose, rename) def make_one(self): meta_class = self.call_fut('ResourceMetadata', ['extended_sheets', 'after_creation']) meta = meta_class(extended_sheets=(self.ISampleSheetA,), after_creation=()) return meta def test_namedtuple(self): def after_creation_sample(self): pass meta = self.make_one() new_meta = meta._add(extended_sheets=(self.ISampleSheetB,), after_creation=(after_creation_sample,)) assert new_meta.extended_sheets == (self.ISampleSheetA, self.ISampleSheetB) assert new_meta.after_creation == (after_creation_sample,)
agpl-3.0
[ 646, 2882, 199, 199, 504, 1503, 20402, 345, 1480, 63, 1018, 14, 7436, 492, 2281, 3797, 421, 199, 533, 428, 3797, 1378, 16715, 5072, 2925, 8, 2796, 14, 1746, 304, 339, 347, 511, 63, 981, 63, 1078, 8, 277, 304, 267, 687, 1503, 20402, 345, 1480, 63, 1018, 14, 7436, 492, 428, 3797, 1378, 16715, 465, 10944, 267, 327, 1007, 611, 68, 4465, 20018, 1338, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1365, 63, 5707, 12997, 358, 365, 756, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1375, 63, 5707, 12997, 358, 365, 756, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1365, 63, 8235, 358, 365, 756, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1375, 63, 8235, 358, 365, 756, 267, 327, 2402, 20018, 1338, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1365, 63, 374, 3797, 358, 365, 2281, 3797, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1365, 63, 374, 3797, 63, 698, 358, 508, 399, 891, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1375, 63, 374, 3797, 358, 365, 2281, 3797, 339, 347, 511, 63, 981, 63, 1078, 63, 4229, 63, 1459, 8, 277, 304, 267, 687, 1503, 20402, 345, 1480, 63, 1018, 14, 7436, 492, 428, 3797, 1378, 16715, 267, 687, 1503, 20402, 345, 1480, 63, 1018, 14, 7436, 492, 2281, 3797, 398, 1021, 473, 33, 8, 1311, 3797, 304, 288, 986, 398, 1021, 10944, 8, 16715, 1378, 16715, 304, 288, 1350, 63, 5707, 12997, 275, 715, 288, 1347, 63, 5707, 12997, 275, 715, 288, 1347, 63, 8235, 275, 715, 288, 1350, 63, 8235, 275, 715, 288, 1350, 63, 374, 3797, 275, 473, 33, 288, 1350, 63, 374, 3797, 63, 698, 275, 399, 891, 288, 1347, 63, 374, 3797, 275, 473, 33, 398, 327, 1007, 611, 68, 4465, 20018, 1338, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1365, 63, 5707, 12997, 358, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1375, 63, 5707, 12997, 358, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1365, 63, 8235, 358, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1375, 63, 8235, 358, 267, 327, 2402, 20018, 1338, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1365, 63, 374, 3797, 358, 365, 473, 33, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1365, 63, 374, 3797, 63, 698, 358, 508, 399, 891, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1375, 63, 374, 3797, 358, 365, 473, 33, 421, 199, 533, 1379, 7989, 7075, 26, 339, 1021, 2281, 865, 26, 267, 986, 339, 1021, 2281, 865, 16715, 33, 26, 267, 986, 339, 1021, 2281, 865, 16715, 34, 26, 267, 986, 339, 347, 1240, 63, 70, 337, 8, 277, 12, 19151, 12, 901, 63, 1247, 12, 3376, 29, 797, 12, 11441, 29, 797, 304, 267, 687, 1275, 7436, 492, 12863, 267, 372, 12863, 8, 18596, 12, 901, 63, 1247, 12, 3376, 12, 11441, 9, 339, 347, 1852, 63, 368, 8, 277, 304, 267, 3404, 63, 533, 275, 291, 14, 1250, 63, 70, 337, 360, 4031, 5142, 297, 788, 10525, 63, 24376, 297, 9144, 283, 4399, 63, 8782, 1105, 267, 3404, 275, 3404, 63, 533, 8, 10525, 63, 24376, 2687, 277, 14, 1311, 865, 16715, 33, 4706, 2079, 2410, 63, 8782, 29, 1012, 267, 372, 3404, 2378, 347, 511, 63, 18921, 8, 277, 304, 267, 347, 2410, 63, 8782, 63, 3271, 8, 277, 304, 288, 986, 398, 3404, 275, 291, 14, 1875, 63, 368, 342, 267, 892, 63, 2024, 275, 3404, 423, 525, 8, 10525, 63, 24376, 2687, 277, 14, 1311, 865, 16715, 34, 4706, 2490, 2410, 63, 8782, 2687, 4399, 63, 8782, 63, 3271, 4641, 267, 702, 892, 63, 2024, 14, 10525, 63, 24376, 508, 334, 277, 14, 1311, 865, 16715, 33, 12, 291, 14, 1311, 865, 16715, 34, 9, 267, 702, 892, 63, 2024, 14, 4399, 63, 8782, 508, 334, 4399, 63, 8782, 63, 3271, 4258, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2882, 199, 199, 504, 1503, 20402, 345, 1480, 63, 1018, 14, 7436, 492, 2281, 3797, 421, 199, 533, 428, 3797, 1378, 16715, 5072, 2925, 8, 2796, 14, 1746, 304, 339, 347, 511, 63, 981, 63, 1078, 8, 277, 304, 267, 687, 1503, 20402, 345, 1480, 63, 1018, 14, 7436, 492, 428, 3797, 1378, 16715, 465, 10944, 267, 327, 1007, 611, 68, 4465, 20018, 1338, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1365, 63, 5707, 12997, 358, 365, 756, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1375, 63, 5707, 12997, 358, 365, 756, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1365, 63, 8235, 358, 365, 756, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1375, 63, 8235, 358, 365, 756, 267, 327, 2402, 20018, 1338, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1365, 63, 374, 3797, 358, 365, 2281, 3797, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1365, 63, 374, 3797, 63, 698, 358, 508, 399, 891, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1375, 63, 374, 3797, 358, 365, 2281, 3797, 339, 347, 511, 63, 981, 63, 1078, 63, 4229, 63, 1459, 8, 277, 304, 267, 687, 1503, 20402, 345, 1480, 63, 1018, 14, 7436, 492, 428, 3797, 1378, 16715, 267, 687, 1503, 20402, 345, 1480, 63, 1018, 14, 7436, 492, 2281, 3797, 398, 1021, 473, 33, 8, 1311, 3797, 304, 288, 986, 398, 1021, 10944, 8, 16715, 1378, 16715, 304, 288, 1350, 63, 5707, 12997, 275, 715, 288, 1347, 63, 5707, 12997, 275, 715, 288, 1347, 63, 8235, 275, 715, 288, 1350, 63, 8235, 275, 715, 288, 1350, 63, 374, 3797, 275, 473, 33, 288, 1350, 63, 374, 3797, 63, 698, 275, 399, 891, 288, 1347, 63, 374, 3797, 275, 473, 33, 398, 327, 1007, 611, 68, 4465, 20018, 1338, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1365, 63, 5707, 12997, 358, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1375, 63, 5707, 12997, 358, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1365, 63, 8235, 358, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1375, 63, 8235, 358, 267, 327, 2402, 20018, 1338, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1365, 63, 374, 3797, 358, 365, 473, 33, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1365, 63, 374, 3797, 63, 698, 358, 508, 399, 891, 267, 702, 10944, 14, 362, 26403, 1110, 360, 1375, 63, 374, 3797, 358, 365, 473, 33, 421, 199, 533, 1379, 7989, 7075, 26, 339, 1021, 2281, 865, 26, 267, 986, 339, 1021, 2281, 865, 16715, 33, 26, 267, 986, 339, 1021, 2281, 865, 16715, 34, 26, 267, 986, 339, 347, 1240, 63, 70, 337, 8, 277, 12, 19151, 12, 901, 63, 1247, 12, 3376, 29, 797, 12, 11441, 29, 797, 304, 267, 687, 1275, 7436, 492, 12863, 267, 372, 12863, 8, 18596, 12, 901, 63, 1247, 12, 3376, 12, 11441, 9, 339, 347, 1852, 63, 368, 8, 277, 304, 267, 3404, 63, 533, 275, 291, 14, 1250, 63, 70, 337, 360, 4031, 5142, 297, 788, 10525, 63, 24376, 297, 9144, 283, 4399, 63, 8782, 1105, 267, 3404, 275, 3404, 63, 533, 8, 10525, 63, 24376, 2687, 277, 14, 1311, 865, 16715, 33, 4706, 2079, 2410, 63, 8782, 29, 1012, 267, 372, 3404, 2378, 347, 511, 63, 18921, 8, 277, 304, 267, 347, 2410, 63, 8782, 63, 3271, 8, 277, 304, 288, 986, 398, 3404, 275, 291, 14, 1875, 63, 368, 342, 267, 892, 63, 2024, 275, 3404, 423, 525, 8, 10525, 63, 24376, 2687, 277, 14, 1311, 865, 16715, 34, 4706, 2490, 2410, 63, 8782, 2687, 4399, 63, 8782, 63, 3271, 4641, 267, 702, 892, 63, 2024, 14, 10525, 63, 24376, 508, 334, 277, 14, 1311, 865, 16715, 33, 12, 291, 14, 1311, 865, 16715, 34, 9, 267, 702, 892, 63, 2024, 14, 4399, 63, 8782, 508, 334, 4399, 63, 8782, 63, 3271, 4258, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 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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 ]
kangkot/arangodb
3rdParty/V8-4.3.61/third_party/python_26/Lib/distutils/tests/test_sdist.py
47
4905
"""Tests for distutils.command.sdist.""" import os import unittest import shutil import zipfile from os.path import join import sys from distutils.command.sdist import sdist from distutils.core import Distribution from distutils.tests.test_config import PyPIRCCommandTestCase from distutils.errors import DistutilsExecError from distutils.spawn import find_executable CURDIR = os.path.dirname(__file__) TEMP_PKG = join(CURDIR, 'temppkg') SETUP_PY = """ from distutils.core import setup import somecode setup(name='fake') """ MANIFEST_IN = """ recursive-include somecode * """ class sdistTestCase(PyPIRCCommandTestCase): def setUp(self): PyPIRCCommandTestCase.setUp(self) self.old_path = os.getcwd() def tearDown(self): os.chdir(self.old_path) if os.path.exists(TEMP_PKG): shutil.rmtree(TEMP_PKG) PyPIRCCommandTestCase.tearDown(self) def _init_tmp_pkg(self): if os.path.exists(TEMP_PKG): shutil.rmtree(TEMP_PKG) os.mkdir(TEMP_PKG) os.mkdir(join(TEMP_PKG, 'somecode')) os.mkdir(join(TEMP_PKG, 'dist')) # creating a MANIFEST, a package, and a README self._write(join(TEMP_PKG, 'MANIFEST.in'), MANIFEST_IN) self._write(join(TEMP_PKG, 'README'), 'xxx') self._write(join(TEMP_PKG, 'somecode', '__init__.py'), '#') self._write(join(TEMP_PKG, 'setup.py'), SETUP_PY) os.chdir(TEMP_PKG) def _write(self, path, content): f = open(path, 'w') try: f.write(content) finally: f.close() def test_prune_file_list(self): # this test creates a package with some vcs dirs in it # and launch sdist to make sure they get pruned # on all systems self._init_tmp_pkg() # creating VCS directories with some files in them os.mkdir(join(TEMP_PKG, 'somecode', '.svn')) self._write(join(TEMP_PKG, 'somecode', '.svn', 'ok.py'), 'xxx') os.mkdir(join(TEMP_PKG, 'somecode', '.hg')) self._write(join(TEMP_PKG, 'somecode', '.hg', 'ok'), 'xxx') os.mkdir(join(TEMP_PKG, 'somecode', '.git')) self._write(join(TEMP_PKG, 'somecode', '.git', 'ok'), 'xxx') # now building a sdist dist = Distribution() dist.script_name = 'setup.py' dist.metadata.name = 'fake' dist.metadata.version = '1.0' dist.metadata.url = 'http://xxx' dist.metadata.author = dist.metadata.author_email = 'xxx' dist.packages = ['somecode'] dist.include_package_data = True cmd = sdist(dist) cmd.manifest = 'MANIFEST' cmd.template = 'MANIFEST.in' cmd.dist_dir = 'dist' # zip is available universally # (tar might not be installed under win32) cmd.formats = ['zip'] cmd.run() # now let's check what we have dist_folder = join(TEMP_PKG, 'dist') files = os.listdir(dist_folder) self.assertEquals(files, ['fake-1.0.zip']) zip_file = zipfile.ZipFile(join(dist_folder, 'fake-1.0.zip')) try: content = zip_file.namelist() finally: zip_file.close() # making sure everything has been pruned correctly self.assertEquals(len(content), 4) def test_make_distribution(self): # check if tar and gzip are installed if (find_executable('tar') is None or find_executable('gzip') is None): return self._init_tmp_pkg() # now building a sdist dist = Distribution() dist.script_name = 'setup.py' dist.metadata.name = 'fake' dist.metadata.version = '1.0' dist.metadata.url = 'http://xxx' dist.metadata.author = dist.metadata.author_email = 'xxx' dist.packages = ['somecode'] dist.include_package_data = True cmd = sdist(dist) cmd.manifest = 'MANIFEST' cmd.template = 'MANIFEST.in' cmd.dist_dir = 'dist' # creating a gztar then a tar cmd.formats = ['gztar', 'tar'] cmd.run() # making sure we have two files dist_folder = join(TEMP_PKG, 'dist') result = os.listdir(dist_folder) result.sort() self.assertEquals(result, ['fake-1.0.tar', 'fake-1.0.tar.gz'] ) os.remove(join(dist_folder, 'fake-1.0.tar')) os.remove(join(dist_folder, 'fake-1.0.tar.gz')) # now trying a tar then a gztar cmd.formats = ['tar', 'gztar'] cmd.run() result = os.listdir(dist_folder) result.sort() self.assertEquals(result, ['fake-1.0.tar', 'fake-1.0.tar.gz']) def test_suite(): return unittest.makeSuite(sdistTestCase) if __name__ == "__main__": unittest.main(defaultTest="test_suite")
apache-2.0
[ 624, 2925, 367, 7065, 14, 1531, 14, 25147, 1041, 199, 646, 747, 199, 646, 2882, 199, 646, 5145, 199, 646, 10392, 199, 504, 747, 14, 515, 492, 4263, 199, 646, 984, 199, 199, 504, 7065, 14, 1531, 14, 25147, 492, 26644, 199, 504, 7065, 14, 1018, 492, 11839, 199, 504, 7065, 14, 2219, 14, 396, 63, 888, 492, 24330, 8205, 3110, 1746, 199, 504, 7065, 14, 2550, 492, 12577, 4858, 547, 199, 504, 7065, 14, 10212, 492, 2342, 63, 5904, 199, 199, 7013, 3022, 275, 747, 14, 515, 14, 3475, 3460, 493, 3368, 199, 12510, 63, 18150, 275, 4263, 8, 7013, 3022, 12, 283, 808, 4600, 358, 199, 199, 20836, 63, 4521, 275, 408, 199, 504, 7065, 14, 1018, 492, 3272, 199, 646, 2005, 600, 199, 199, 2758, 8, 354, 534, 3183, 358, 199, 624, 199, 199, 24067, 63, 568, 275, 408, 199, 9931, 13, 2613, 2005, 600, 627, 199, 624, 199, 199, 533, 26644, 1746, 8, 2713, 2252, 8205, 3110, 1746, 304, 339, 347, 3613, 8, 277, 304, 267, 24330, 8205, 3110, 1746, 14, 5996, 8, 277, 9, 267, 291, 14, 1753, 63, 515, 275, 747, 14, 9458, 342, 339, 347, 6766, 8, 277, 304, 267, 747, 14, 8563, 8, 277, 14, 1753, 63, 515, 9, 267, 340, 747, 14, 515, 14, 2444, 8, 12510, 63, 18150, 304, 288, 5145, 14, 9242, 8, 12510, 63, 18150, 9, 267, 24330, 8205, 3110, 1746, 14, 12336, 8, 277, 9, 339, 347, 485, 826, 63, 2791, 63, 4600, 8, 277, 304, 267, 340, 747, 14, 515, 14, 2444, 8, 12510, 63, 18150, 304, 288, 5145, 14, 9242, 8, 12510, 63, 18150, 9, 267, 747, 14, 8215, 8, 12510, 63, 18150, 9, 267, 747, 14, 8215, 8, 904, 8, 12510, 63, 18150, 12, 283, 3972, 600, 1333, 267, 747, 14, 8215, 8, 904, 8, 12510, 63, 18150, 12, 283, 2686, 1333, 267, 327, 6425, 282, 26688, 20649, 12, 282, 2559, 12, 436, 282, 27781, 267, 291, 423, 952, 8, 904, 8, 12510, 63, 18150, 12, 283, 24067, 14, 262, 659, 26688, 20649, 63, 568, 9, 267, 291, 423, 952, 8, 904, 8, 12510, 63, 18150, 12, 283, 18195, 659, 283, 10013, 358, 267, 291, 423, 952, 8, 904, 8, 12510, 63, 18150, 12, 283, 3972, 600, 297, 2560, 826, 4343, 647, 659, 3943, 358, 267, 291, 423, 952, 8, 904, 8, 12510, 63, 18150, 12, 283, 2758, 14, 647, 659, 11543, 2160, 63, 4521, 9, 267, 747, 14, 8563, 8, 12510, 63, 18150, 9, 339, 347, 485, 952, 8, 277, 12, 931, 12, 1564, 304, 267, 289, 275, 1551, 8, 515, 12, 283, 87, 358, 267, 862, 26, 288, 289, 14, 952, 8, 1317, 9, 267, 3753, 26, 288, 289, 14, 1600, 342, 339, 347, 511, 63, 22268, 63, 493, 63, 513, 8, 277, 304, 267, 327, 642, 511, 8491, 282, 2559, 543, 2005, 19827, 7606, 315, 652, 267, 327, 436, 10623, 26644, 370, 1852, 3238, 2985, 664, 29501, 379, 267, 327, 641, 1006, 10460, 267, 291, 423, 826, 63, 2791, 63, 4600, 342, 398, 327, 6425, 23563, 6602, 543, 2005, 1584, 315, 3062, 267, 747, 14, 8215, 8, 904, 8, 12510, 63, 18150, 12, 283, 3972, 600, 297, 1987, 6836, 1333, 267, 291, 423, 952, 8, 904, 8, 12510, 63, 18150, 12, 283, 3972, 600, 297, 1987, 6836, 297, 283, 745, 14, 647, 659, 283, 10013, 358, 398, 747, 14, 8215, 8, 904, 8, 12510, 63, 18150, 12, 283, 3972, 600, 297, 1987, 9208, 1333, 267, 291, 423, 952, 8, 904, 8, 12510, 63, 18150, 12, 283, 3972, 600, 297, 1987, 9208, 297, 586, 283, 745, 659, 283, 10013, 358, 398, 747, 14, 8215, 8, 904, 8, 12510, 63, 18150, 12, 283, 3972, 600, 297, 1987, 3187, 1333, 267, 291, 423, 952, 8, 904, 8, 12510, 63, 18150, 12, 283, 3972, 600, 297, 1987, 3187, 297, 586, 283, 745, 659, 283, 10013, 358, 398, 327, 3063, 10015, 282, 26644, 267, 2917, 275, 11839, 342, 267, 2917, 14, 1579, 63, 354, 275, 283, 2758, 14, 647, 7, 267, 2917, 14, 2343, 14, 354, 275, 283, 3183, 7, 267, 2917, 14, 2343, 14, 1023, 275, 283, 17, 14, 16, 7, 267, 2917, 14, 2343, 14, 633, 275, 283, 1014, 921, 10013, 7, 267, 2917, 14, 2343, 14, 2502, 275, 2917, 14, 2343, 14, 2502, 63, 2123, 275, 283, 10013, 7, 267, 2917, 14, 5154, 275, 788, 3972, 600, 418, 267, 2917, 14, 2613, 63, 2491, 63, 576, 275, 715, 267, 2088, 275, 26644, 8, 2686, 9, 267, 2088, 14, 6418, 275, 283, 24067, 7, 267, 2088, 14, 1160, 275, 283, 24067, 14, 262, 7, 267, 2088, 14, 2686, 63, 694, 275, 283, 2686, 7, 398, 327, 3482, 365, 2808, 625, 4380, 83, 1183, 267, 327, 334, 5369, 5594, 440, 506, 4903, 1334, 4747, 708, 9, 267, 2088, 14, 6321, 275, 788, 3065, 418, 267, 2088, 14, 1065, 342, 398, 327, 3063, 4691, 1159, 1104, 4052, 781, 1172, 267, 2917, 63, 3741, 275, 4263, 8, 12510, 63, 18150, 12, 283, 2686, 358, 267, 1584, 275, 747, 14, 7374, 8, 2686, 63, 3741, 9, 267, 291, 14, 2947, 8, 1725, 12, 788, 3183, 13, 17, 14, 16, 14, 3065, 1105, 398, 3482, 63, 493, 275, 10392, 14, 15016, 8, 904, 8, 2686, 63, 3741, 12, 283, 3183, 13, 17, 14, 16, 14, 3065, 1333, 267, 862, 26, 288, 1564, 275, 3482, 63, 493, 14, 23841, 342, 267, 3753, 26, 288, 3482, 63, 493, 14, 1600, 342, 398, 327, 10663, 3238, 8137, 965, 2757, 29501, 379, 6657, 267, 291, 14, 2947, 8, 552, 8, 1317, 395, 841, 9, 339, 347, 511, 63, 1875, 63, 4972, 8, 277, 304, 398, 327, 1104, 340, 5330, 436, 11756, 787, 4903, 267, 340, 334, 1623, 63, 5904, 360, 5369, 358, 365, 488, 503, 288, 2342, 63, 5904, 360, 12256, 358, 365, 488, 304, 288, 372, 398, 291, 423, 826, 63, 2791, 63, 4600, 342, 398, 327, 3063, 10015, 282, 26644, 267, 2917, 275, 11839, 342, 267, 2917, 14, 1579, 63, 354, 275, 283, 2758, 14, 647, 7, 267, 2917, 14, 2343, 14, 354, 275, 283, 3183, 7, 267, 2917, 14, 2343, 14, 1023, 275, 283, 17, 14, 16, 7, 267, 2917, 14, 2343, 14, 633 ]
[ 2925, 367, 7065, 14, 1531, 14, 25147, 1041, 199, 646, 747, 199, 646, 2882, 199, 646, 5145, 199, 646, 10392, 199, 504, 747, 14, 515, 492, 4263, 199, 646, 984, 199, 199, 504, 7065, 14, 1531, 14, 25147, 492, 26644, 199, 504, 7065, 14, 1018, 492, 11839, 199, 504, 7065, 14, 2219, 14, 396, 63, 888, 492, 24330, 8205, 3110, 1746, 199, 504, 7065, 14, 2550, 492, 12577, 4858, 547, 199, 504, 7065, 14, 10212, 492, 2342, 63, 5904, 199, 199, 7013, 3022, 275, 747, 14, 515, 14, 3475, 3460, 493, 3368, 199, 12510, 63, 18150, 275, 4263, 8, 7013, 3022, 12, 283, 808, 4600, 358, 199, 199, 20836, 63, 4521, 275, 408, 199, 504, 7065, 14, 1018, 492, 3272, 199, 646, 2005, 600, 199, 199, 2758, 8, 354, 534, 3183, 358, 199, 624, 199, 199, 24067, 63, 568, 275, 408, 199, 9931, 13, 2613, 2005, 600, 627, 199, 624, 199, 199, 533, 26644, 1746, 8, 2713, 2252, 8205, 3110, 1746, 304, 339, 347, 3613, 8, 277, 304, 267, 24330, 8205, 3110, 1746, 14, 5996, 8, 277, 9, 267, 291, 14, 1753, 63, 515, 275, 747, 14, 9458, 342, 339, 347, 6766, 8, 277, 304, 267, 747, 14, 8563, 8, 277, 14, 1753, 63, 515, 9, 267, 340, 747, 14, 515, 14, 2444, 8, 12510, 63, 18150, 304, 288, 5145, 14, 9242, 8, 12510, 63, 18150, 9, 267, 24330, 8205, 3110, 1746, 14, 12336, 8, 277, 9, 339, 347, 485, 826, 63, 2791, 63, 4600, 8, 277, 304, 267, 340, 747, 14, 515, 14, 2444, 8, 12510, 63, 18150, 304, 288, 5145, 14, 9242, 8, 12510, 63, 18150, 9, 267, 747, 14, 8215, 8, 12510, 63, 18150, 9, 267, 747, 14, 8215, 8, 904, 8, 12510, 63, 18150, 12, 283, 3972, 600, 1333, 267, 747, 14, 8215, 8, 904, 8, 12510, 63, 18150, 12, 283, 2686, 1333, 267, 327, 6425, 282, 26688, 20649, 12, 282, 2559, 12, 436, 282, 27781, 267, 291, 423, 952, 8, 904, 8, 12510, 63, 18150, 12, 283, 24067, 14, 262, 659, 26688, 20649, 63, 568, 9, 267, 291, 423, 952, 8, 904, 8, 12510, 63, 18150, 12, 283, 18195, 659, 283, 10013, 358, 267, 291, 423, 952, 8, 904, 8, 12510, 63, 18150, 12, 283, 3972, 600, 297, 2560, 826, 4343, 647, 659, 3943, 358, 267, 291, 423, 952, 8, 904, 8, 12510, 63, 18150, 12, 283, 2758, 14, 647, 659, 11543, 2160, 63, 4521, 9, 267, 747, 14, 8563, 8, 12510, 63, 18150, 9, 339, 347, 485, 952, 8, 277, 12, 931, 12, 1564, 304, 267, 289, 275, 1551, 8, 515, 12, 283, 87, 358, 267, 862, 26, 288, 289, 14, 952, 8, 1317, 9, 267, 3753, 26, 288, 289, 14, 1600, 342, 339, 347, 511, 63, 22268, 63, 493, 63, 513, 8, 277, 304, 267, 327, 642, 511, 8491, 282, 2559, 543, 2005, 19827, 7606, 315, 652, 267, 327, 436, 10623, 26644, 370, 1852, 3238, 2985, 664, 29501, 379, 267, 327, 641, 1006, 10460, 267, 291, 423, 826, 63, 2791, 63, 4600, 342, 398, 327, 6425, 23563, 6602, 543, 2005, 1584, 315, 3062, 267, 747, 14, 8215, 8, 904, 8, 12510, 63, 18150, 12, 283, 3972, 600, 297, 1987, 6836, 1333, 267, 291, 423, 952, 8, 904, 8, 12510, 63, 18150, 12, 283, 3972, 600, 297, 1987, 6836, 297, 283, 745, 14, 647, 659, 283, 10013, 358, 398, 747, 14, 8215, 8, 904, 8, 12510, 63, 18150, 12, 283, 3972, 600, 297, 1987, 9208, 1333, 267, 291, 423, 952, 8, 904, 8, 12510, 63, 18150, 12, 283, 3972, 600, 297, 1987, 9208, 297, 586, 283, 745, 659, 283, 10013, 358, 398, 747, 14, 8215, 8, 904, 8, 12510, 63, 18150, 12, 283, 3972, 600, 297, 1987, 3187, 1333, 267, 291, 423, 952, 8, 904, 8, 12510, 63, 18150, 12, 283, 3972, 600, 297, 1987, 3187, 297, 586, 283, 745, 659, 283, 10013, 358, 398, 327, 3063, 10015, 282, 26644, 267, 2917, 275, 11839, 342, 267, 2917, 14, 1579, 63, 354, 275, 283, 2758, 14, 647, 7, 267, 2917, 14, 2343, 14, 354, 275, 283, 3183, 7, 267, 2917, 14, 2343, 14, 1023, 275, 283, 17, 14, 16, 7, 267, 2917, 14, 2343, 14, 633, 275, 283, 1014, 921, 10013, 7, 267, 2917, 14, 2343, 14, 2502, 275, 2917, 14, 2343, 14, 2502, 63, 2123, 275, 283, 10013, 7, 267, 2917, 14, 5154, 275, 788, 3972, 600, 418, 267, 2917, 14, 2613, 63, 2491, 63, 576, 275, 715, 267, 2088, 275, 26644, 8, 2686, 9, 267, 2088, 14, 6418, 275, 283, 24067, 7, 267, 2088, 14, 1160, 275, 283, 24067, 14, 262, 7, 267, 2088, 14, 2686, 63, 694, 275, 283, 2686, 7, 398, 327, 3482, 365, 2808, 625, 4380, 83, 1183, 267, 327, 334, 5369, 5594, 440, 506, 4903, 1334, 4747, 708, 9, 267, 2088, 14, 6321, 275, 788, 3065, 418, 267, 2088, 14, 1065, 342, 398, 327, 3063, 4691, 1159, 1104, 4052, 781, 1172, 267, 2917, 63, 3741, 275, 4263, 8, 12510, 63, 18150, 12, 283, 2686, 358, 267, 1584, 275, 747, 14, 7374, 8, 2686, 63, 3741, 9, 267, 291, 14, 2947, 8, 1725, 12, 788, 3183, 13, 17, 14, 16, 14, 3065, 1105, 398, 3482, 63, 493, 275, 10392, 14, 15016, 8, 904, 8, 2686, 63, 3741, 12, 283, 3183, 13, 17, 14, 16, 14, 3065, 1333, 267, 862, 26, 288, 1564, 275, 3482, 63, 493, 14, 23841, 342, 267, 3753, 26, 288, 3482, 63, 493, 14, 1600, 342, 398, 327, 10663, 3238, 8137, 965, 2757, 29501, 379, 6657, 267, 291, 14, 2947, 8, 552, 8, 1317, 395, 841, 9, 339, 347, 511, 63, 1875, 63, 4972, 8, 277, 304, 398, 327, 1104, 340, 5330, 436, 11756, 787, 4903, 267, 340, 334, 1623, 63, 5904, 360, 5369, 358, 365, 488, 503, 288, 2342, 63, 5904, 360, 12256, 358, 365, 488, 304, 288, 372, 398, 291, 423, 826, 63, 2791, 63, 4600, 342, 398, 327, 3063, 10015, 282, 26644, 267, 2917, 275, 11839, 342, 267, 2917, 14, 1579, 63, 354, 275, 283, 2758, 14, 647, 7, 267, 2917, 14, 2343, 14, 354, 275, 283, 3183, 7, 267, 2917, 14, 2343, 14, 1023, 275, 283, 17, 14, 16, 7, 267, 2917, 14, 2343, 14, 633, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
Shenmolu/rosalind
sample.py
1
3913
def LCSBACKTRACK(v, w,u): global score m=len(v)+1 n=len(w)+1 l=len(u)+1 Backtrack=[[[0 for x in range(l)]for y in range(m)]for z in range(n)] s=[[[0 for x in range(l)]for y in range(m)]for z in range(n)] for i in range(n): s[i][0][0]= -i Backtrack[i][0][0] = 0 for i in range(m): s[0][i][0] = -i Backtrack[0][i][0] = 1 for i in range(l): s[0][0][i]= -i Backtrack[0][0][i] = 2 for k in range(1, len(u)+1): for i in range(1,len(w) + 1): for j in range(1,len(v) + 1): if(u[k-1]==v[j-1])and(v[j-1]==w[i-1]): f=1 else: f=0 s[i][j][k] = max(s[i-1][j][k], s[i][j-1][k], s[i][j][k-1],s[i-1][j-1][k],s[i-1][j][k-1], s[i][j-1][k-1],s[i-1][j-1][k-1] + f) if s[i][j][k] == s[i-1][j][k]: Backtrack[i][j][k] = 0 if s[i][j][k] == s[i][j-1][k]: Backtrack[i][j][k] = 1 if s[i][j][k] == s[i][j][k-1]: Backtrack[i][j][k] = 2 if s[i][j][k] == s[i-1][j-1][k]: Backtrack[i][j][k] = 3 if s[i][j][k] == s[i-1][j][k-1]: Backtrack[i][j][k] = 4 if s[i][j][k] == s[i][j-1][k-1]: Backtrack[i][j][k] = 5 if s[i][j][k] == s[i-1][j-1][k-1] + f: Backtrack[i][j][k] = 6 fout.write(str(s[len(w)][len(v)][len(u)])+'\n') print(s) print(Backtrack) return(Backtrack) def OUTPUTAligm(Backtrack, j, i, k): ans1 = "" ans2 = "" ans3 = '' while((i!=0)and(j!=0)and(k!=0)): if Backtrack[i][j][k] == 0: ans1 = ans1 + '-' ans2 = ans2 + str(w[i-1]) ans3 = ans3 + '-' i -= 1 else: if Backtrack[i][j][k] == 1: ans1 = ans1 + str(v[j-1]) ans2 = ans2 + '-' ans3 = ans3 + '-' j -= 1 else: if Backtrack[i][j][k] == 2: ans1 = ans1 + '-' ans2 = ans2 + '-' ans3 = ans3 + str(u[k-1]) k -= 1 else: if Backtrack[i][j][k] == 4: ans1 = ans1 + '-' ans2 = ans2 + str(w[i-1]) ans3 = ans3 + str(u[k-1]) k -= 1 i -= 1 else: if Backtrack[i][j][k] == 3: ans1 = ans1 + str(v[j-1]) ans2 = ans2 + str(w[i-1]) ans3 = ans3 + '-' j -= 1 i -= 1 else: if Backtrack[i][j][k] == 5: ans1 = ans1 + str(v[j-1]) ans2 = ans2 + '-' ans3 = ans3 + str(u[k-1]) j -= 1 k -= 1 else: if Backtrack[i][j][k] == 6: ans1 = ans1 + str(v[j-1]) ans2 = ans2 + str(w[i-1]) ans3 = ans3 + str(u[k-1]) j -= 1 k -= 1 i -= 1 fout.write(ans1[::-1]+'\n') fout.write(ans2[::-1]+'\n') fout.write(ans3[::-1]) fin = open('data.txt', 'r') fout=open('a.txt', 'w') v=fin.readline().replace('\n','') w=fin.readline().replace('\n','') u=fin.readline().replace('\n','') b=LCSBACKTRACK(v,w,u) OUTPUTAligm(b,len(v),len(w),len(u))
gpl-3.0
[ 318, 491, 3298, 7111, 19755, 8, 86, 12, 336, 12, 85, 304, 272, 2288, 221, 5396, 272, 333, 29, 552, 8, 86, 6393, 17, 272, 302, 29, 552, 8, 87, 6393, 17, 272, 634, 29, 552, 8, 85, 6393, 17, 272, 10257, 3885, 1524, 9046, 16, 367, 671, 315, 1425, 8, 76, 1874, 509, 612, 315, 1425, 8, 77, 1874, 509, 1315, 315, 1425, 8, 78, 1874, 272, 308, 1524, 9046, 16, 367, 671, 315, 1425, 8, 76, 1874, 509, 612, 315, 1425, 8, 77, 1874, 509, 1315, 315, 1425, 8, 78, 1874, 272, 367, 284, 315, 1425, 8, 78, 304, 267, 308, 59, 73, 1527, 16, 1527, 16, 10404, 446, 73, 267, 10257, 3885, 59, 73, 1527, 16, 1527, 16, 61, 275, 378, 272, 367, 284, 315, 1425, 8, 77, 304, 267, 308, 59, 16, 1527, 73, 1527, 16, 61, 275, 446, 73, 267, 10257, 3885, 59, 16, 1527, 73, 1527, 16, 61, 275, 413, 272, 367, 284, 315, 1425, 8, 76, 304, 267, 308, 59, 16, 1527, 16, 1527, 73, 10404, 446, 73, 267, 10257, 3885, 59, 16, 1527, 16, 1527, 73, 61, 275, 499, 272, 367, 1022, 315, 1425, 8, 17, 12, 822, 8, 85, 6393, 17, 304, 267, 367, 284, 315, 1425, 8, 17, 12, 552, 8, 87, 9, 435, 413, 304, 288, 367, 1335, 315, 1425, 8, 17, 12, 552, 8, 86, 9, 435, 413, 304, 355, 340, 8, 85, 59, 75, 13, 17, 19219, 86, 59, 74, 13, 17, 566, 460, 8, 86, 59, 74, 13, 17, 19219, 87, 59, 73, 13, 17, 4682, 490, 289, 29, 17, 355, 587, 26, 490, 289, 29, 16, 355, 308, 59, 73, 1527, 74, 1527, 75, 61, 275, 1390, 8, 83, 59, 73, 13, 17, 1527, 74, 1527, 75, 467, 308, 59, 73, 1527, 74, 13, 17, 1527, 75, 467, 308, 59, 73, 1527, 74, 1527, 75, 13, 17, 467, 83, 59, 73, 13, 17, 1527, 74, 13, 17, 1527, 75, 467, 83, 59, 73, 13, 17, 1527, 74, 1527, 75, 13, 17, 467, 639, 308, 59, 73, 1527, 74, 13, 17, 1527, 75, 13, 17, 467, 83, 59, 73, 13, 17, 1527, 74, 13, 17, 1527, 75, 13, 17, 61, 435, 289, 9, 355, 340, 308, 59, 73, 1527, 74, 1527, 75, 61, 508, 308, 59, 73, 13, 17, 1527, 74, 1527, 75, 2189, 490, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 275, 378, 355, 340, 308, 59, 73, 1527, 74, 1527, 75, 61, 508, 308, 59, 73, 1527, 74, 13, 17, 1527, 75, 2189, 490, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 275, 413, 355, 340, 308, 59, 73, 1527, 74, 1527, 75, 61, 508, 308, 59, 73, 1527, 74, 1527, 75, 13, 17, 2189, 490, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 275, 499, 355, 340, 308, 59, 73, 1527, 74, 1527, 75, 61, 508, 308, 59, 73, 13, 17, 1527, 74, 13, 17, 1527, 75, 2189, 490, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 275, 650, 355, 340, 308, 59, 73, 1527, 74, 1527, 75, 61, 508, 308, 59, 73, 13, 17, 1527, 74, 1527, 75, 13, 17, 2189, 490, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 275, 841, 355, 340, 308, 59, 73, 1527, 74, 1527, 75, 61, 508, 308, 59, 73, 1527, 74, 13, 17, 1527, 75, 13, 17, 2189, 490, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 275, 959, 355, 340, 308, 59, 73, 1527, 74, 1527, 75, 61, 508, 308, 59, 73, 13, 17, 1527, 74, 13, 17, 1527, 75, 13, 17, 61, 435, 289, 26, 490, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 275, 1227, 272, 17863, 14, 952, 8, 495, 8, 83, 59, 552, 8, 87, 30372, 552, 8, 86, 30372, 552, 8, 85, 3948, 19192, 78, 358, 272, 870, 8, 83, 9, 272, 870, 8, 4540, 3885, 9, 272, 372, 8, 4540, 3885, 9, 199, 199, 318, 18746, 6985, 13844, 8, 4540, 3885, 12, 1335, 12, 284, 12, 1022, 304, 272, 4987, 17, 275, 3087, 272, 4987, 18, 275, 3087, 272, 4987, 19, 275, 2125, 272, 1830, 1332, 73, 1111, 16, 9, 460, 8, 74, 1111, 16, 9, 460, 8, 75, 1111, 16, 2298, 267, 340, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 508, 378, 26, 288, 4987, 17, 275, 4987, 17, 435, 10791, 288, 4987, 18, 275, 4987, 18, 435, 620, 8, 87, 59, 73, 13, 17, 566, 288, 4987, 19, 275, 4987, 19, 435, 10791, 288, 284, 4862, 413, 267, 587, 26, 288, 340, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 508, 413, 26, 355, 4987, 17, 275, 4987, 17, 435, 620, 8, 86, 59, 74, 13, 17, 566, 355, 4987, 18, 275, 4987, 18, 435, 10791, 355, 4987, 19, 275, 4987, 19, 435, 10791, 355, 1335, 4862, 413, 288, 587, 26, 355, 340, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 508, 499, 26, 490, 4987, 17, 275, 4987, 17, 435, 10791, 490, 4987, 18, 275, 4987, 18, 435, 10791, 490, 4987, 19, 275, 4987, 19, 435, 620, 8, 85, 59, 75, 13, 17, 566, 490, 1022, 4862, 413, 355, 587, 26, 490, 340, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 508, 841, 26, 717, 4987, 17, 275, 4987, 17, 435, 10791, 717, 4987, 18, 275, 4987, 18, 435, 620, 8, 87, 59, 73, 13, 17, 566, 717, 4987, 19, 275, 4987, 19, 435, 620, 8, 85, 59, 75, 13, 17, 566, 717, 1022, 4862, 413, 717, 284, 4862, 413, 490, 587, 26, 717, 340, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 508, 650, 26, 1169, 4987, 17, 275, 4987, 17, 435, 620, 8, 86, 59, 74, 13, 17, 566, 1169, 4987, 18, 275, 4987, 18, 435, 620, 8, 87, 59, 73, 13, 17, 566, 1169, 4987, 19, 275, 4987, 19, 435, 10791, 1169, 1335, 4862, 413, 1169, 284, 4862, 413, 717, 587, 26, 1169, 340, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 508, 959, 26, 1816, 4987, 17, 275, 4987, 17, 435, 620, 8, 86, 59, 74, 13, 17, 566, 1816, 4987, 18, 275, 4987, 18, 435, 10791, 1816, 4987, 19 ]
[ 491, 3298, 7111, 19755, 8, 86, 12, 336, 12, 85, 304, 272, 2288, 221, 5396, 272, 333, 29, 552, 8, 86, 6393, 17, 272, 302, 29, 552, 8, 87, 6393, 17, 272, 634, 29, 552, 8, 85, 6393, 17, 272, 10257, 3885, 1524, 9046, 16, 367, 671, 315, 1425, 8, 76, 1874, 509, 612, 315, 1425, 8, 77, 1874, 509, 1315, 315, 1425, 8, 78, 1874, 272, 308, 1524, 9046, 16, 367, 671, 315, 1425, 8, 76, 1874, 509, 612, 315, 1425, 8, 77, 1874, 509, 1315, 315, 1425, 8, 78, 1874, 272, 367, 284, 315, 1425, 8, 78, 304, 267, 308, 59, 73, 1527, 16, 1527, 16, 10404, 446, 73, 267, 10257, 3885, 59, 73, 1527, 16, 1527, 16, 61, 275, 378, 272, 367, 284, 315, 1425, 8, 77, 304, 267, 308, 59, 16, 1527, 73, 1527, 16, 61, 275, 446, 73, 267, 10257, 3885, 59, 16, 1527, 73, 1527, 16, 61, 275, 413, 272, 367, 284, 315, 1425, 8, 76, 304, 267, 308, 59, 16, 1527, 16, 1527, 73, 10404, 446, 73, 267, 10257, 3885, 59, 16, 1527, 16, 1527, 73, 61, 275, 499, 272, 367, 1022, 315, 1425, 8, 17, 12, 822, 8, 85, 6393, 17, 304, 267, 367, 284, 315, 1425, 8, 17, 12, 552, 8, 87, 9, 435, 413, 304, 288, 367, 1335, 315, 1425, 8, 17, 12, 552, 8, 86, 9, 435, 413, 304, 355, 340, 8, 85, 59, 75, 13, 17, 19219, 86, 59, 74, 13, 17, 566, 460, 8, 86, 59, 74, 13, 17, 19219, 87, 59, 73, 13, 17, 4682, 490, 289, 29, 17, 355, 587, 26, 490, 289, 29, 16, 355, 308, 59, 73, 1527, 74, 1527, 75, 61, 275, 1390, 8, 83, 59, 73, 13, 17, 1527, 74, 1527, 75, 467, 308, 59, 73, 1527, 74, 13, 17, 1527, 75, 467, 308, 59, 73, 1527, 74, 1527, 75, 13, 17, 467, 83, 59, 73, 13, 17, 1527, 74, 13, 17, 1527, 75, 467, 83, 59, 73, 13, 17, 1527, 74, 1527, 75, 13, 17, 467, 639, 308, 59, 73, 1527, 74, 13, 17, 1527, 75, 13, 17, 467, 83, 59, 73, 13, 17, 1527, 74, 13, 17, 1527, 75, 13, 17, 61, 435, 289, 9, 355, 340, 308, 59, 73, 1527, 74, 1527, 75, 61, 508, 308, 59, 73, 13, 17, 1527, 74, 1527, 75, 2189, 490, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 275, 378, 355, 340, 308, 59, 73, 1527, 74, 1527, 75, 61, 508, 308, 59, 73, 1527, 74, 13, 17, 1527, 75, 2189, 490, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 275, 413, 355, 340, 308, 59, 73, 1527, 74, 1527, 75, 61, 508, 308, 59, 73, 1527, 74, 1527, 75, 13, 17, 2189, 490, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 275, 499, 355, 340, 308, 59, 73, 1527, 74, 1527, 75, 61, 508, 308, 59, 73, 13, 17, 1527, 74, 13, 17, 1527, 75, 2189, 490, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 275, 650, 355, 340, 308, 59, 73, 1527, 74, 1527, 75, 61, 508, 308, 59, 73, 13, 17, 1527, 74, 1527, 75, 13, 17, 2189, 490, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 275, 841, 355, 340, 308, 59, 73, 1527, 74, 1527, 75, 61, 508, 308, 59, 73, 1527, 74, 13, 17, 1527, 75, 13, 17, 2189, 490, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 275, 959, 355, 340, 308, 59, 73, 1527, 74, 1527, 75, 61, 508, 308, 59, 73, 13, 17, 1527, 74, 13, 17, 1527, 75, 13, 17, 61, 435, 289, 26, 490, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 275, 1227, 272, 17863, 14, 952, 8, 495, 8, 83, 59, 552, 8, 87, 30372, 552, 8, 86, 30372, 552, 8, 85, 3948, 19192, 78, 358, 272, 870, 8, 83, 9, 272, 870, 8, 4540, 3885, 9, 272, 372, 8, 4540, 3885, 9, 199, 199, 318, 18746, 6985, 13844, 8, 4540, 3885, 12, 1335, 12, 284, 12, 1022, 304, 272, 4987, 17, 275, 3087, 272, 4987, 18, 275, 3087, 272, 4987, 19, 275, 2125, 272, 1830, 1332, 73, 1111, 16, 9, 460, 8, 74, 1111, 16, 9, 460, 8, 75, 1111, 16, 2298, 267, 340, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 508, 378, 26, 288, 4987, 17, 275, 4987, 17, 435, 10791, 288, 4987, 18, 275, 4987, 18, 435, 620, 8, 87, 59, 73, 13, 17, 566, 288, 4987, 19, 275, 4987, 19, 435, 10791, 288, 284, 4862, 413, 267, 587, 26, 288, 340, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 508, 413, 26, 355, 4987, 17, 275, 4987, 17, 435, 620, 8, 86, 59, 74, 13, 17, 566, 355, 4987, 18, 275, 4987, 18, 435, 10791, 355, 4987, 19, 275, 4987, 19, 435, 10791, 355, 1335, 4862, 413, 288, 587, 26, 355, 340, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 508, 499, 26, 490, 4987, 17, 275, 4987, 17, 435, 10791, 490, 4987, 18, 275, 4987, 18, 435, 10791, 490, 4987, 19, 275, 4987, 19, 435, 620, 8, 85, 59, 75, 13, 17, 566, 490, 1022, 4862, 413, 355, 587, 26, 490, 340, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 508, 841, 26, 717, 4987, 17, 275, 4987, 17, 435, 10791, 717, 4987, 18, 275, 4987, 18, 435, 620, 8, 87, 59, 73, 13, 17, 566, 717, 4987, 19, 275, 4987, 19, 435, 620, 8, 85, 59, 75, 13, 17, 566, 717, 1022, 4862, 413, 717, 284, 4862, 413, 490, 587, 26, 717, 340, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 508, 650, 26, 1169, 4987, 17, 275, 4987, 17, 435, 620, 8, 86, 59, 74, 13, 17, 566, 1169, 4987, 18, 275, 4987, 18, 435, 620, 8, 87, 59, 73, 13, 17, 566, 1169, 4987, 19, 275, 4987, 19, 435, 10791, 1169, 1335, 4862, 413, 1169, 284, 4862, 413, 717, 587, 26, 1169, 340, 10257, 3885, 59, 73, 1527, 74, 1527, 75, 61, 508, 959, 26, 1816, 4987, 17, 275, 4987, 17, 435, 620, 8, 86, 59, 74, 13, 17, 566, 1816, 4987, 18, 275, 4987, 18, 435, 10791, 1816, 4987, 19, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
lcostantino/healing-os
healing/openstack/common/db/sqlalchemy/test_migrations.py
1
11081
# Copyright 2010-2011 OpenStack Foundation # Copyright 2012-2013 IBM Corp. # 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 functools import logging import os import subprocess import lockfile from oslotest import base as test_base from six import moves from six.moves.urllib import parse import sqlalchemy import sqlalchemy.exc from healing.openstack.common.db.sqlalchemy import utils from healing.openstack.common.gettextutils import _LE LOG = logging.getLogger(__name__) def _have_mysql(user, passwd, database): present = os.environ.get('TEST_MYSQL_PRESENT') if present is None: return utils.is_backend_avail(backend='mysql', user=user, passwd=passwd, database=database) return present.lower() in ('', 'true') def _have_postgresql(user, passwd, database): present = os.environ.get('TEST_POSTGRESQL_PRESENT') if present is None: return utils.is_backend_avail(backend='postgres', user=user, passwd=passwd, database=database) return present.lower() in ('', 'true') def _set_db_lock(lock_path=None, lock_prefix=None): def decorator(f): @functools.wraps(f) def wrapper(*args, **kwargs): try: path = lock_path or os.environ.get("HEALING_LOCK_PATH") lock = lockfile.FileLock(os.path.join(path, lock_prefix)) with lock: LOG.debug('Got lock "%s"' % f.__name__) return f(*args, **kwargs) finally: LOG.debug('Lock released "%s"' % f.__name__) return wrapper return decorator class BaseMigrationTestCase(test_base.BaseTestCase): """Base class fort testing of migration utils.""" def __init__(self, *args, **kwargs): super(BaseMigrationTestCase, self).__init__(*args, **kwargs) self.DEFAULT_CONFIG_FILE = os.path.join(os.path.dirname(__file__), 'test_migrations.conf') # Test machines can set the TEST_MIGRATIONS_CONF variable # to override the location of the config file for migration testing self.CONFIG_FILE_PATH = os.environ.get('TEST_MIGRATIONS_CONF', self.DEFAULT_CONFIG_FILE) self.test_databases = {} self.migration_api = None def setUp(self): super(BaseMigrationTestCase, self).setUp() # Load test databases from the config file. Only do this # once. No need to re-run this on each test... LOG.debug('config_path is %s' % self.CONFIG_FILE_PATH) if os.path.exists(self.CONFIG_FILE_PATH): cp = moves.configparser.RawConfigParser() try: cp.read(self.CONFIG_FILE_PATH) defaults = cp.defaults() for key, value in defaults.items(): self.test_databases[key] = value except moves.configparser.ParsingError as e: self.fail("Failed to read test_migrations.conf config " "file. Got error: %s" % e) else: self.fail("Failed to find test_migrations.conf config " "file.") self.engines = {} for key, value in self.test_databases.items(): self.engines[key] = sqlalchemy.create_engine(value) # We start each test case with a completely blank slate. self._reset_databases() def tearDown(self): # We destroy the test data store between each test case, # and recreate it, which ensures that we have no side-effects # from the tests self._reset_databases() super(BaseMigrationTestCase, self).tearDown() def execute_cmd(self, cmd=None): process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) output = process.communicate()[0] LOG.debug(output) self.assertEqual(0, process.returncode, "Failed to run: %s\n%s" % (cmd, output)) def _reset_pg(self, conn_pieces): (user, password, database, host) = utils.get_db_connection_info(conn_pieces) os.environ['PGPASSWORD'] = password os.environ['PGUSER'] = user # note(boris-42): We must create and drop database, we can't # drop database which we have connected to, so for such # operations there is a special database template1. sqlcmd = ("psql -w -U %(user)s -h %(host)s -c" " '%(sql)s' -d template1") sql = ("drop database if exists %s;") % database droptable = sqlcmd % {'user': user, 'host': host, 'sql': sql} self.execute_cmd(droptable) sql = ("create database %s;") % database createtable = sqlcmd % {'user': user, 'host': host, 'sql': sql} self.execute_cmd(createtable) os.unsetenv('PGPASSWORD') os.unsetenv('PGUSER') @_set_db_lock(lock_prefix='migration_tests-') def _reset_databases(self): for key, engine in self.engines.items(): conn_string = self.test_databases[key] conn_pieces = parse.urlparse(conn_string) engine.dispose() if conn_string.startswith('sqlite'): # We can just delete the SQLite database, which is # the easiest and cleanest solution db_path = conn_pieces.path.strip('/') if os.path.exists(db_path): os.unlink(db_path) # No need to recreate the SQLite DB. SQLite will # create it for us if it's not there... elif conn_string.startswith('mysql'): # We can execute the MySQL client to destroy and re-create # the MYSQL database, which is easier and less error-prone # than using SQLAlchemy to do this via MetaData...trust me. (user, password, database, host) = \ utils.get_db_connection_info(conn_pieces) sql = ("drop database if exists %(db)s; " "create database %(db)s;") % {'db': database} cmd = ("mysql -u \"%(user)s\" -p\"%(password)s\" -h %(host)s " "-e \"%(sql)s\"") % {'user': user, 'password': password, 'host': host, 'sql': sql} self.execute_cmd(cmd) elif conn_string.startswith('postgresql'): self._reset_pg(conn_pieces) class WalkVersionsMixin(object): def _walk_versions(self, engine=None, snake_walk=False, downgrade=True): # Determine latest version script from the repo, then # upgrade from 1 through to the latest, with no data # in the databases. This just checks that the schema itself # upgrades successfully. # Place the database under version control self.migration_api.version_control(engine, self.REPOSITORY, self.INIT_VERSION) self.assertEqual(self.INIT_VERSION, self.migration_api.db_version(engine, self.REPOSITORY)) LOG.debug('latest version is %s' % self.REPOSITORY.latest) versions = range(self.INIT_VERSION + 1, self.REPOSITORY.latest + 1) for version in versions: # upgrade -> downgrade -> upgrade self._migrate_up(engine, version, with_data=True) if snake_walk: downgraded = self._migrate_down( engine, version - 1, with_data=True) if downgraded: self._migrate_up(engine, version) if downgrade: # Now walk it back down to 0 from the latest, testing # the downgrade paths. for version in reversed(versions): # downgrade -> upgrade -> downgrade downgraded = self._migrate_down(engine, version - 1) if snake_walk and downgraded: self._migrate_up(engine, version) self._migrate_down(engine, version - 1) def _migrate_down(self, engine, version, with_data=False): try: self.migration_api.downgrade(engine, self.REPOSITORY, version) except NotImplementedError: # NOTE(sirp): some migrations, namely release-level # migrations, don't support a downgrade. return False self.assertEqual( version, self.migration_api.db_version(engine, self.REPOSITORY)) # NOTE(sirp): `version` is what we're downgrading to (i.e. the 'target' # version). So if we have any downgrade checks, they need to be run for # the previous (higher numbered) migration. if with_data: post_downgrade = getattr( self, "_post_downgrade_%03d" % (version + 1), None) if post_downgrade: post_downgrade(engine) return True def _migrate_up(self, engine, version, with_data=False): """migrate up to a new version of the db. We allow for data insertion and post checks at every migration version with special _pre_upgrade_### and _check_### functions in the main test. """ # NOTE(sdague): try block is here because it's impossible to debug # where a failed data migration happens otherwise try: if with_data: data = None pre_upgrade = getattr( self, "_pre_upgrade_%03d" % version, None) if pre_upgrade: data = pre_upgrade(engine) self.migration_api.upgrade(engine, self.REPOSITORY, version) self.assertEqual(version, self.migration_api.db_version(engine, self.REPOSITORY)) if with_data: check = getattr(self, "_check_%03d" % version, None) if check: check(engine, data) except Exception: LOG.error(_LE("Failed to migrate to version %s on engine %s") % (version, engine)) raise
apache-2.0
[ 3, 1898, 7129, 13, 8128, 14260, 2752, 199, 3, 1898, 6029, 13, 6965, 26202, 22304, 14, 199, 3, 2900, 5924, 5702, 14, 199, 3, 199, 3, 259, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 259, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 259, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 260, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 259, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 259, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 259, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 259, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 259, 1334, 314, 844, 14, 199, 199, 646, 9143, 199, 646, 2050, 199, 646, 747, 199, 646, 3873, 199, 199, 646, 4650, 493, 199, 504, 11258, 396, 492, 1300, 465, 511, 63, 1095, 199, 504, 3816, 492, 14569, 199, 504, 3816, 14, 4912, 14, 4078, 492, 2198, 199, 646, 8335, 199, 646, 8335, 14, 2804, 199, 199, 504, 946, 29515, 14, 8512, 14, 2330, 14, 697, 14, 14536, 492, 3778, 199, 504, 946, 29515, 14, 8512, 14, 2330, 14, 5152, 1208, 492, 485, 906, 199, 199, 4947, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 318, 485, 7804, 63, 8644, 8, 751, 12, 15081, 12, 3050, 304, 272, 3451, 275, 747, 14, 2314, 14, 362, 360, 2864, 63, 12339, 4657, 63, 19743, 358, 272, 340, 3451, 365, 488, 26, 267, 372, 3778, 14, 374, 63, 4620, 63, 18961, 8, 4620, 534, 8644, 297, 4228, 922, 29, 751, 12, 4228, 15081, 29, 12671, 12, 4228, 3050, 29, 4659, 9, 272, 372, 3451, 14, 2325, 342, 315, 13134, 283, 2052, 358, 421, 199, 318, 485, 7804, 63, 15437, 8, 751, 12, 15081, 12, 3050, 304, 272, 3451, 275, 747, 14, 2314, 14, 362, 360, 2864, 63, 4030, 39, 3830, 2940, 63, 19743, 358, 272, 340, 3451, 365, 488, 26, 267, 372, 3778, 14, 374, 63, 4620, 63, 18961, 8, 4620, 534, 10675, 297, 4228, 922, 29, 751, 12, 4228, 15081, 29, 12671, 12, 4228, 3050, 29, 4659, 9, 272, 372, 3451, 14, 2325, 342, 315, 13134, 283, 2052, 358, 421, 199, 318, 485, 409, 63, 697, 63, 831, 8, 831, 63, 515, 29, 403, 12, 4650, 63, 1861, 29, 403, 304, 272, 347, 7531, 8, 70, 304, 267, 768, 17869, 14, 13582, 8, 70, 9, 267, 347, 4975, 2031, 589, 12, 1011, 958, 304, 288, 862, 26, 355, 931, 275, 4650, 63, 515, 503, 747, 14, 2314, 14, 362, 480, 1645, 748, 1206, 63, 4406, 63, 3243, 531, 355, 4650, 275, 4650, 493, 14, 1173, 6432, 8, 736, 14, 515, 14, 904, 8, 515, 12, 4650, 63, 1861, 430, 355, 543, 4650, 26, 490, 5051, 14, 1757, 360, 13662, 4650, 2071, 83, 4507, 450, 289, 855, 354, 3368, 490, 372, 289, 2031, 589, 12, 1011, 958, 9, 288, 3753, 26, 355, 5051, 14, 1757, 360, 6432, 14286, 2071, 83, 4507, 450, 289, 855, 354, 3368, 267, 372, 4975, 272, 372, 7531, 421, 199, 533, 3523, 9816, 1746, 8, 396, 63, 1095, 14, 20760, 304, 272, 408, 1563, 1021, 289, 361, 5343, 402, 8367, 3778, 1041, 339, 347, 636, 826, 721, 277, 12, 627, 589, 12, 1011, 958, 304, 267, 1613, 8, 1563, 9816, 1746, 12, 291, 2843, 826, 9308, 589, 12, 1011, 958, 9, 398, 291, 14, 3472, 63, 5569, 63, 3817, 275, 747, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 6059, 283, 396, 63, 7685, 14, 2190, 358, 267, 327, 1379, 20601, 883, 663, 314, 7393, 63, 22487, 50, 12969, 63, 3103, 1750, 267, 327, 370, 4278, 314, 2909, 402, 314, 1101, 570, 367, 8367, 5343, 267, 291, 14, 5569, 63, 3817, 63, 3243, 275, 747, 14, 2314, 14, 362, 360, 2864, 63, 22487, 50, 12969, 63, 3103, 297, 6901, 291, 14, 3472, 63, 5569, 63, 3817, 9, 267, 291, 14, 396, 63, 17439, 275, 1052, 267, 291, 14, 8998, 63, 1246, 275, 488, 339, 347, 3613, 8, 277, 304, 267, 1613, 8, 1563, 9816, 1746, 12, 291, 680, 5996, 342, 398, 327, 7190, 511, 16219, 687, 314, 1101, 570, 14, 5972, 886, 642, 267, 327, 5403, 14, 3091, 1929, 370, 295, 13, 1065, 642, 641, 1924, 511, 1396, 267, 5051, 14, 1757, 360, 888, 63, 515, 365, 450, 83, 7, 450, 291, 14, 5569, 63, 3817, 63, 3243, 9, 267, 340, 747, 14, 515, 14, 2444, 8, 277, 14, 5569, 63, 3817, 63, 3243, 304, 288, 7667, 275, 14569, 14, 888, 2087, 14, 7963, 15218, 342, 288, 862, 26, 355, 7667, 14, 739, 8, 277, 14, 5569, 63, 3817, 63, 3243, 9, 355, 4243, 275, 7667, 14, 4322, 342, 355, 367, 790, 12, 574, 315, 4243, 14, 1744, 837, 490, 291, 14, 396, 63, 17439, 59, 498, 61, 275, 574, 288, 871, 14569, 14, 888, 2087, 14, 17412, 547, 465, 325, 26, 355, 291, 14, 1633, 480, 4276, 370, 1586, 511, 63, 7685, 14, 2190, 1101, 298, 2079, 298, 493, 14, 24734, 1125, 26, 450, 83, 2, 450, 325, 9, 267, 587, 26, 288, 291, 14, 1633, 480, 4276, 370, 2342, 511, 63, 7685, 14, 2190, 1101, 298, 1993, 298, 493, 2685, 398, 291, 14, 30378, 275, 1052, 267, 367, 790, 12, 574, 315, 291, 14, 396, 63, 17439, 14, 1744, 837, 288, 291, 14, 30378, 59, 498, 61, 275, 8335, 14, 981, 63, 3908, 8, 585, 9, 398, 327, 2136, 1343, 1924, 511, 1930, 543, 282, 14793, 4596, 308, 750, 14, 267, 291, 423, 3958, 63, 17439, 342, 339, 347, 6766, 8, 277, 304, 267, 327, 2136, 11972, 314, 511, 666, 3877, 3382, 1924, 511, 1930, 12, 267, 327, 436, 23959, 652, 12, 1314, 15620, 626, 781, 1172, 949, 5366, 13, 27626, 267, 327, 687, 314, 2295, 267, 291, 423, 3958, 63, 17439, 342, 267, 1613, 8, 1563, 9816, 1746, 12, 291, 680, 12336, 342, 339, 347, 5341, 63, 1760 ]
[ 1898, 7129, 13, 8128, 14260, 2752, 199, 3, 1898, 6029, 13, 6965, 26202, 22304, 14, 199, 3, 2900, 5924, 5702, 14, 199, 3, 199, 3, 259, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 259, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 259, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 260, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 259, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 259, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 259, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 259, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 259, 1334, 314, 844, 14, 199, 199, 646, 9143, 199, 646, 2050, 199, 646, 747, 199, 646, 3873, 199, 199, 646, 4650, 493, 199, 504, 11258, 396, 492, 1300, 465, 511, 63, 1095, 199, 504, 3816, 492, 14569, 199, 504, 3816, 14, 4912, 14, 4078, 492, 2198, 199, 646, 8335, 199, 646, 8335, 14, 2804, 199, 199, 504, 946, 29515, 14, 8512, 14, 2330, 14, 697, 14, 14536, 492, 3778, 199, 504, 946, 29515, 14, 8512, 14, 2330, 14, 5152, 1208, 492, 485, 906, 199, 199, 4947, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 318, 485, 7804, 63, 8644, 8, 751, 12, 15081, 12, 3050, 304, 272, 3451, 275, 747, 14, 2314, 14, 362, 360, 2864, 63, 12339, 4657, 63, 19743, 358, 272, 340, 3451, 365, 488, 26, 267, 372, 3778, 14, 374, 63, 4620, 63, 18961, 8, 4620, 534, 8644, 297, 4228, 922, 29, 751, 12, 4228, 15081, 29, 12671, 12, 4228, 3050, 29, 4659, 9, 272, 372, 3451, 14, 2325, 342, 315, 13134, 283, 2052, 358, 421, 199, 318, 485, 7804, 63, 15437, 8, 751, 12, 15081, 12, 3050, 304, 272, 3451, 275, 747, 14, 2314, 14, 362, 360, 2864, 63, 4030, 39, 3830, 2940, 63, 19743, 358, 272, 340, 3451, 365, 488, 26, 267, 372, 3778, 14, 374, 63, 4620, 63, 18961, 8, 4620, 534, 10675, 297, 4228, 922, 29, 751, 12, 4228, 15081, 29, 12671, 12, 4228, 3050, 29, 4659, 9, 272, 372, 3451, 14, 2325, 342, 315, 13134, 283, 2052, 358, 421, 199, 318, 485, 409, 63, 697, 63, 831, 8, 831, 63, 515, 29, 403, 12, 4650, 63, 1861, 29, 403, 304, 272, 347, 7531, 8, 70, 304, 267, 768, 17869, 14, 13582, 8, 70, 9, 267, 347, 4975, 2031, 589, 12, 1011, 958, 304, 288, 862, 26, 355, 931, 275, 4650, 63, 515, 503, 747, 14, 2314, 14, 362, 480, 1645, 748, 1206, 63, 4406, 63, 3243, 531, 355, 4650, 275, 4650, 493, 14, 1173, 6432, 8, 736, 14, 515, 14, 904, 8, 515, 12, 4650, 63, 1861, 430, 355, 543, 4650, 26, 490, 5051, 14, 1757, 360, 13662, 4650, 2071, 83, 4507, 450, 289, 855, 354, 3368, 490, 372, 289, 2031, 589, 12, 1011, 958, 9, 288, 3753, 26, 355, 5051, 14, 1757, 360, 6432, 14286, 2071, 83, 4507, 450, 289, 855, 354, 3368, 267, 372, 4975, 272, 372, 7531, 421, 199, 533, 3523, 9816, 1746, 8, 396, 63, 1095, 14, 20760, 304, 272, 408, 1563, 1021, 289, 361, 5343, 402, 8367, 3778, 1041, 339, 347, 636, 826, 721, 277, 12, 627, 589, 12, 1011, 958, 304, 267, 1613, 8, 1563, 9816, 1746, 12, 291, 2843, 826, 9308, 589, 12, 1011, 958, 9, 398, 291, 14, 3472, 63, 5569, 63, 3817, 275, 747, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 6059, 283, 396, 63, 7685, 14, 2190, 358, 267, 327, 1379, 20601, 883, 663, 314, 7393, 63, 22487, 50, 12969, 63, 3103, 1750, 267, 327, 370, 4278, 314, 2909, 402, 314, 1101, 570, 367, 8367, 5343, 267, 291, 14, 5569, 63, 3817, 63, 3243, 275, 747, 14, 2314, 14, 362, 360, 2864, 63, 22487, 50, 12969, 63, 3103, 297, 6901, 291, 14, 3472, 63, 5569, 63, 3817, 9, 267, 291, 14, 396, 63, 17439, 275, 1052, 267, 291, 14, 8998, 63, 1246, 275, 488, 339, 347, 3613, 8, 277, 304, 267, 1613, 8, 1563, 9816, 1746, 12, 291, 680, 5996, 342, 398, 327, 7190, 511, 16219, 687, 314, 1101, 570, 14, 5972, 886, 642, 267, 327, 5403, 14, 3091, 1929, 370, 295, 13, 1065, 642, 641, 1924, 511, 1396, 267, 5051, 14, 1757, 360, 888, 63, 515, 365, 450, 83, 7, 450, 291, 14, 5569, 63, 3817, 63, 3243, 9, 267, 340, 747, 14, 515, 14, 2444, 8, 277, 14, 5569, 63, 3817, 63, 3243, 304, 288, 7667, 275, 14569, 14, 888, 2087, 14, 7963, 15218, 342, 288, 862, 26, 355, 7667, 14, 739, 8, 277, 14, 5569, 63, 3817, 63, 3243, 9, 355, 4243, 275, 7667, 14, 4322, 342, 355, 367, 790, 12, 574, 315, 4243, 14, 1744, 837, 490, 291, 14, 396, 63, 17439, 59, 498, 61, 275, 574, 288, 871, 14569, 14, 888, 2087, 14, 17412, 547, 465, 325, 26, 355, 291, 14, 1633, 480, 4276, 370, 1586, 511, 63, 7685, 14, 2190, 1101, 298, 2079, 298, 493, 14, 24734, 1125, 26, 450, 83, 2, 450, 325, 9, 267, 587, 26, 288, 291, 14, 1633, 480, 4276, 370, 2342, 511, 63, 7685, 14, 2190, 1101, 298, 1993, 298, 493, 2685, 398, 291, 14, 30378, 275, 1052, 267, 367, 790, 12, 574, 315, 291, 14, 396, 63, 17439, 14, 1744, 837, 288, 291, 14, 30378, 59, 498, 61, 275, 8335, 14, 981, 63, 3908, 8, 585, 9, 398, 327, 2136, 1343, 1924, 511, 1930, 543, 282, 14793, 4596, 308, 750, 14, 267, 291, 423, 3958, 63, 17439, 342, 339, 347, 6766, 8, 277, 304, 267, 327, 2136, 11972, 314, 511, 666, 3877, 3382, 1924, 511, 1930, 12, 267, 327, 436, 23959, 652, 12, 1314, 15620, 626, 781, 1172, 949, 5366, 13, 27626, 267, 327, 687, 314, 2295, 267, 291, 423, 3958, 63, 17439, 342, 267, 1613, 8, 1563, 9816, 1746, 12, 291, 680, 12336, 342, 339, 347, 5341, 63, 1760, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
frouty/odoogoeen
addons/hr_holidays/report/holidays_summary_report.py
23
10494
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## import datetime import time from openerp.osv import fields, osv from openerp.report.interface import report_rml from openerp.report.interface import toxml from openerp import pooler import time from openerp.report import report_sxw from openerp.tools import ustr from openerp.tools.translate import _ from openerp.tools import to_xml def lengthmonth(year, month): if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))): return 29 return [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month] def strToDate(dt): if dt: dt_date=datetime.date(int(dt[0:4]),int(dt[5:7]),int(dt[8:10])) return dt_date else: return def emp_create_xml(self, cr, uid, dept, holiday_type, row_id, empid, name, som, eom): display={} if dept==0: count=0 p_id=pooler.get_pool(cr.dbname).get('hr.holidays').search(cr, uid, [('employee_id','in',[empid,False]), ('type', '=', 'remove')]) ids_date = pooler.get_pool(cr.dbname).get('hr.holidays').read(cr, uid, p_id, ['date_from','date_to','holiday_status_id','state']) for index in range(1,61): diff=index-1 current=som+datetime.timedelta(diff) for item in ids_date: if current >= strToDate(item['date_from']) and current <= strToDate(item['date_to']): if item['state'] in holiday_type: display[index]=item['holiday_status_id'][0] count=count +1 else: display[index]=' ' break else: display[index]=' ' else: for index in range(1,61): display[index]=' ' count='' data_xml=['<info id="%d" number="%d" val="%s" />' % (row_id,x,display[x]) for x in range(1,len(display)+1) ] # Computing the xml xml = ''' %s <employee row="%d" id="%d" name="%s" sum="%s"> </employee> ''' % (data_xml,row_id,dept, ustr(toxml(name)),count) return xml class report_custom(report_rml): def create_xml(self, cr, uid, ids, data, context): obj_dept = pooler.get_pool(cr.dbname).get('hr.department') obj_emp = pooler.get_pool(cr.dbname).get('hr.employee') depts=[] emp_id={} # done={} rpt_obj = pooler.get_pool(cr.dbname).get('hr.holidays') rml_obj=report_sxw.rml_parse(cr, uid, rpt_obj._name,context) cr.execute("SELECT name FROM res_company") res=cr.fetchone()[0] date_xml=[] date_today=time.strftime('%Y-%m-%d %H:%M:%S') date_xml +=['<res name="%s" today="%s" />' % (to_xml(res),date_today)] cr.execute("SELECT id, name, color_name FROM hr_holidays_status ORDER BY id") legend=cr.fetchall() today=datetime.datetime.today() first_date=data['form']['date_from'] som = strToDate(first_date) eom = som+datetime.timedelta(59) day_diff=eom-som name = '' if len(data['form'].get('emp', ())) == 1: name = obj_emp.read(cr, uid, data['form']['emp'][0], ['name'])['name'] if data['form']['holiday_type']!='both': type=data['form']['holiday_type'] if data['form']['holiday_type']=='Confirmed': holiday_type=('confirm') else: holiday_type=('validate') else: type="Confirmed and Approved" holiday_type=('confirm','validate') date_xml.append('<from>%s</from>\n'% (str(rml_obj.formatLang(som.strftime("%Y-%m-%d"),date=True)))) date_xml.append('<to>%s</to>\n' %(str(rml_obj.formatLang(eom.strftime("%Y-%m-%d"),date=True)))) date_xml.append('<type>%s</type>'%(type)) date_xml.append('<name>%s</name>'%(name)) # date_xml=[] for l in range(0,len(legend)): date_xml += ['<legend row="%d" id="%d" name="%s" color="%s" />' % (l+1,legend[l][0],_(legend[l][1]),legend[l][2])] date_xml += ['<date month="%s" year="%d" />' % (ustr(som.strftime('%B')), som.year),'<days>'] cell=1 if day_diff.days>=30: date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, _(som.replace(day=x).strftime('%a')),x-som.day+1) for x in range(som.day, lengthmonth(som.year, som.month)+1)] else: if day_diff.days>=(lengthmonth(som.year, som.month)-som.day): date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, _(som.replace(day=x).strftime('%a')),x-som.day+1) for x in range(som.day, lengthmonth(som.year, som.month)+1)] else: date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, _(som.replace(day=x).strftime('%a')),x-som.day+1) for x in range(som.day, eom.day+1)] cell=x-som.day+1 day_diff1=day_diff.days-cell+1 width_dict={} month_dict={} i=1 j=1 year=som.year month=som.month month_dict[j]=som.strftime('%B') width_dict[j]=cell while day_diff1>0: if month+i<=12: if day_diff1 > lengthmonth(year,i+month): # Not on 30 else you have problems when entering 01-01-2009 for example som1=datetime.date(year,month+i,1) date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, _(som1.replace(day=x).strftime('%a')),cell+x) for x in range(1, lengthmonth(year,i+month)+1)] i=i+1 j=j+1 month_dict[j]=som1.strftime('%B') cell=cell+x width_dict[j]=x else: som1=datetime.date(year,month+i,1) date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, _(som1.replace(day=x).strftime('%a')),cell+x) for x in range(1, eom.day+1)] i=i+1 j=j+1 month_dict[j]=som1.strftime('%B') cell=cell+x width_dict[j]=x day_diff1=day_diff1-x else: years=year+1 year=years month=0 i=1 if day_diff1>=30: som1=datetime.date(years,i,1) date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, _(som1.replace(day=x).strftime('%a')),cell+x) for x in range(1, lengthmonth(years,i)+1)] i=i+1 j=j+1 month_dict[j]=som1.strftime('%B') cell=cell+x width_dict[j]=x else: som1=datetime.date(years,i,1) i=i+1 j=j+1 month_dict[j]=som1.strftime('%B') date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, _(som1.replace(day=x).strftime('%a')),cell+x) for x in range(1, eom.day+1)] cell=cell+x width_dict[j]=x day_diff1=day_diff1-x date_xml.append('</days>') date_xml.append('<cols>3.5cm%s,0.4cm</cols>\n' % (',0.4cm' * (60))) date_xml = ''.join(date_xml) st='<cols_months>3.5cm' for m in range(1,len(width_dict)+1): st+=',' + str(0.4 *width_dict[m])+'cm' st+=',0.4cm</cols_months>\n' months_xml =['<months number="%d" name="%s"/>' % (x, _(month_dict[x])) for x in range(1,len(month_dict)+1) ] months_xml.append(st) emp_xml='' row_id=1 if data['model']=='hr.employee': for id in data['form']['emp']: items = obj_emp.read(cr, uid, id, ['id','name']) emp_xml += emp_create_xml(self, cr, uid, 0, holiday_type, row_id, items['id'], items['name'], som, eom) row_id = row_id +1 elif data['model']=='ir.ui.menu': for id in data['form']['depts']: dept = obj_dept.browse(cr, uid, id, context=context) emp_ids = obj_emp.search(cr, uid, [('department_id', '=', id)], context=context) if emp_ids==[]: continue dept_done=0 for item in obj_emp.read(cr, uid, emp_ids, ['id', 'name']): if dept_done==0: emp_xml += emp_create_xml(self, cr, uid, 1, holiday_type, row_id, dept.id, dept.name, som, eom) row_id = row_id +1 dept_done=1 emp_xml += emp_create_xml(self, cr, uid, 0, holiday_type, row_id, item['id'], item['name'], som, eom) row_id = row_id +1 header_xml = ''' <header> <date>%s</date> <company>%s</company> </header> ''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),to_xml(pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name)) # Computing the xml xml='''<?xml version="1.0" encoding="UTF-8" ?> <report> %s %s %s %s </report> ''' % (header_xml,months_xml,date_xml, ustr(emp_xml)) return xml report_custom('report.holidays.summary', 'hr.holidays', '', 'addons/hr_holidays/report/holidays_summary.xsl') # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
agpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 259, 7653, 12, 3232, 5800, 8259, 9274, 199, 3, 259, 1898, 334, 35, 9, 8353, 13, 6542, 11947, 12361, 8642, 1014, 921, 9864, 14, 1235, 10121, 199, 3, 199, 3, 259, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 259, 652, 1334, 314, 2895, 402, 314, 1664, 4265, 1696, 1684, 844, 465, 199, 3, 259, 3267, 701, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 199, 3, 259, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 4265, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 4265, 1696, 1684, 844, 199, 3, 259, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 4605, 199, 199, 646, 2197, 199, 646, 900, 199, 199, 504, 5166, 14, 4795, 492, 1504, 12, 9506, 199, 504, 5166, 14, 3070, 14, 3266, 492, 3622, 63, 16300, 199, 504, 5166, 14, 3070, 14, 3266, 492, 370, 1652, 199, 199, 504, 5166, 492, 1115, 79, 1435, 199, 646, 900, 199, 504, 5166, 14, 3070, 492, 3622, 63, 20851, 199, 504, 5166, 14, 2537, 492, 399, 495, 199, 504, 5166, 14, 2537, 14, 5275, 492, 485, 199, 504, 5166, 14, 2537, 492, 370, 63, 1652, 199, 199, 318, 2582, 4482, 8, 3403, 12, 5794, 304, 272, 340, 5794, 508, 499, 436, 3666, 3403, 450, 841, 508, 378, 9, 436, 3666, 3403, 450, 2948, 1137, 378, 9, 503, 334, 3403, 450, 8290, 508, 378, 15206, 267, 372, 7349, 272, 372, 359, 16, 12, 7105, 12, 7294, 12, 7105, 12, 4233, 12, 7105, 12, 4233, 12, 7105, 12, 7105, 12, 4233, 12, 7105, 12, 4233, 12, 7105, 1527, 4482, 61, 199, 199, 318, 620, 1378, 2506, 8, 3583, 304, 272, 340, 4487, 26, 267, 4487, 63, 602, 29, 2083, 14, 602, 8, 442, 8, 3583, 59, 16, 26, 20, 2522, 442, 8, 3583, 59, 21, 26, 23, 2522, 442, 8, 3583, 59, 24, 26, 709, 2459, 267, 372, 4487, 63, 602, 272, 587, 26, 267, 372, 421, 199, 318, 9052, 63, 981, 63, 1652, 8, 277, 12, 2467, 12, 1747, 12, 477, 541, 12, 26475, 2977, 63, 466, 12, 1962, 63, 344, 12, 9052, 344, 12, 536, 12, 308, 676, 12, 325, 676, 304, 272, 2929, 7622, 272, 340, 477, 541, 389, 16, 26, 267, 2338, 29, 16, 267, 299, 63, 344, 29, 555, 79, 1435, 14, 362, 63, 2293, 8, 1556, 14, 13238, 680, 362, 360, 6271, 14, 26131, 1959, 1733, 8, 1556, 12, 1747, 12, 4274, 10103, 63, 344, 1673, 262, 23993, 2109, 344, 12, 797, 2522, 661, 466, 297, 6291, 283, 2168, 2023, 267, 2762, 63, 602, 275, 1115, 79, 1435, 14, 362, 63, 2293, 8, 1556, 14, 13238, 680, 362, 360, 6271, 14, 26131, 1959, 739, 8, 1556, 12, 1747, 12, 299, 63, 344, 12, 788, 602, 63, 504, 1673, 602, 63, 475, 1673, 20154, 2977, 63, 1205, 63, 344, 1673, 929, 1105, 398, 367, 1478, 315, 1425, 8, 17, 12, 2976, 304, 288, 3915, 29, 1080, 13, 17, 288, 1453, 29, 83, 676, 11, 2083, 14, 7473, 8, 3028, 9, 953, 367, 1242, 315, 2762, 63, 602, 26, 355, 340, 1453, 2356, 620, 1378, 2506, 8, 1053, 459, 602, 63, 504, 1105, 436, 1453, 2695, 620, 1378, 2506, 8, 1053, 459, 602, 63, 475, 9090, 490, 340, 1242, 459, 929, 418, 315, 26475, 2977, 63, 466, 26, 717, 2929, 59, 1080, 10404, 1053, 459, 20154, 2977, 63, 1205, 63, 344, 3488, 16, 61, 717, 2338, 29, 835, 435, 17, 490, 587, 26, 717, 2929, 59, 1080, 61, 534, 283, 490, 2059, 355, 587, 26, 490, 2929, 59, 1080, 61, 534, 283, 272, 587, 26, 268, 367, 1478, 315, 1425, 8, 17, 12, 2976, 304, 1598, 2929, 59, 1080, 61, 534, 283, 1598, 2338, 19070, 2049, 272, 666, 63, 1652, 2968, 28, 815, 1305, 5961, 68, 2, 1329, 5961, 68, 2, 1139, 5961, 83, 2, 22294, 450, 334, 1143, 63, 344, 12, 88, 12, 2918, 59, 88, 566, 367, 671, 315, 1425, 8, 17, 12, 552, 8, 2918, 6393, 17, 9, 1622, 2286, 327, 27799, 314, 2748, 272, 2748, 275, 1449, 272, 450, 83, 272, 665, 10103, 1962, 5961, 68, 2, 1305, 5961, 68, 2, 536, 5961, 83, 2, 3089, 5961, 83, 1743, 272, 3068, 10103, 30, 272, 1449, 450, 334, 576, 63, 1652, 12, 1143, 63, 344, 12, 271, 541, 12, 399, 495, 8, 475, 1652, 8, 354, 1826, 835, 9, 339, 372, 2748, 199, 199, 533, 3622, 63, 4229, 8, 3070, 63, 16300, 304, 272, 347, 1218, 63, 1652, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 666, 12, 1067, 304, 267, 1559, 63, 271, 541, 275, 1115, 79, 1435, 14, 362, 63, 2293, 8, 1556, 14, 13238, 680, 362, 360, 6271, 14, 19623, 358, 267, 1559, 63, 2109, 275, 1115, 79, 1435, 14, 362, 63, 2293, 8, 1556, 14, 13238, 680, 362, 360, 6271, 14, 10103, 358, 267, 477, 8382, 9811, 267, 9052, 63, 344, 7622, 199, 3, 263, 4224, 7622, 267, 519, 541, 63, 1113, 275, 1115, 79, 1435, 14, 362, 63, 2293, 8, 1556, 14, 13238, 680, 362, 360, 6271, 14, 26131, 358, 267, 519, 757, 63, 1113, 29, 3070, 63, 20851, 14, 16300, 63, 1122, 8, 1556, 12, 1747, 12, 519, 541, 63, 1113, 423, 354, 12, 1100, 9, 267, 2467, 14, 2526, 480, 4859, 536, 4442, 522, 63, 4627, 531, 267, 522, 29, 1556, 14, 11591, 3430, 16, 61, 267, 1434, 63, 1652, 9811, 267, 1434, 63, 8136, 29, 521, 14, 6205, 3508, 57, 3295, 77, 3295, 68, 450, 40, 2689, 45, 2689, 51, 358, 267, 1434, 63, 1652, 847, 459, 28, 470, 536, 5961, 83, 2 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 259, 7653, 12, 3232, 5800, 8259, 9274, 199, 3, 259, 1898, 334, 35, 9, 8353, 13, 6542, 11947, 12361, 8642, 1014, 921, 9864, 14, 1235, 10121, 199, 3, 199, 3, 259, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 259, 652, 1334, 314, 2895, 402, 314, 1664, 4265, 1696, 1684, 844, 465, 199, 3, 259, 3267, 701, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 199, 3, 259, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 4265, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 4265, 1696, 1684, 844, 199, 3, 259, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 4605, 199, 199, 646, 2197, 199, 646, 900, 199, 199, 504, 5166, 14, 4795, 492, 1504, 12, 9506, 199, 504, 5166, 14, 3070, 14, 3266, 492, 3622, 63, 16300, 199, 504, 5166, 14, 3070, 14, 3266, 492, 370, 1652, 199, 199, 504, 5166, 492, 1115, 79, 1435, 199, 646, 900, 199, 504, 5166, 14, 3070, 492, 3622, 63, 20851, 199, 504, 5166, 14, 2537, 492, 399, 495, 199, 504, 5166, 14, 2537, 14, 5275, 492, 485, 199, 504, 5166, 14, 2537, 492, 370, 63, 1652, 199, 199, 318, 2582, 4482, 8, 3403, 12, 5794, 304, 272, 340, 5794, 508, 499, 436, 3666, 3403, 450, 841, 508, 378, 9, 436, 3666, 3403, 450, 2948, 1137, 378, 9, 503, 334, 3403, 450, 8290, 508, 378, 15206, 267, 372, 7349, 272, 372, 359, 16, 12, 7105, 12, 7294, 12, 7105, 12, 4233, 12, 7105, 12, 4233, 12, 7105, 12, 7105, 12, 4233, 12, 7105, 12, 4233, 12, 7105, 1527, 4482, 61, 199, 199, 318, 620, 1378, 2506, 8, 3583, 304, 272, 340, 4487, 26, 267, 4487, 63, 602, 29, 2083, 14, 602, 8, 442, 8, 3583, 59, 16, 26, 20, 2522, 442, 8, 3583, 59, 21, 26, 23, 2522, 442, 8, 3583, 59, 24, 26, 709, 2459, 267, 372, 4487, 63, 602, 272, 587, 26, 267, 372, 421, 199, 318, 9052, 63, 981, 63, 1652, 8, 277, 12, 2467, 12, 1747, 12, 477, 541, 12, 26475, 2977, 63, 466, 12, 1962, 63, 344, 12, 9052, 344, 12, 536, 12, 308, 676, 12, 325, 676, 304, 272, 2929, 7622, 272, 340, 477, 541, 389, 16, 26, 267, 2338, 29, 16, 267, 299, 63, 344, 29, 555, 79, 1435, 14, 362, 63, 2293, 8, 1556, 14, 13238, 680, 362, 360, 6271, 14, 26131, 1959, 1733, 8, 1556, 12, 1747, 12, 4274, 10103, 63, 344, 1673, 262, 23993, 2109, 344, 12, 797, 2522, 661, 466, 297, 6291, 283, 2168, 2023, 267, 2762, 63, 602, 275, 1115, 79, 1435, 14, 362, 63, 2293, 8, 1556, 14, 13238, 680, 362, 360, 6271, 14, 26131, 1959, 739, 8, 1556, 12, 1747, 12, 299, 63, 344, 12, 788, 602, 63, 504, 1673, 602, 63, 475, 1673, 20154, 2977, 63, 1205, 63, 344, 1673, 929, 1105, 398, 367, 1478, 315, 1425, 8, 17, 12, 2976, 304, 288, 3915, 29, 1080, 13, 17, 288, 1453, 29, 83, 676, 11, 2083, 14, 7473, 8, 3028, 9, 953, 367, 1242, 315, 2762, 63, 602, 26, 355, 340, 1453, 2356, 620, 1378, 2506, 8, 1053, 459, 602, 63, 504, 1105, 436, 1453, 2695, 620, 1378, 2506, 8, 1053, 459, 602, 63, 475, 9090, 490, 340, 1242, 459, 929, 418, 315, 26475, 2977, 63, 466, 26, 717, 2929, 59, 1080, 10404, 1053, 459, 20154, 2977, 63, 1205, 63, 344, 3488, 16, 61, 717, 2338, 29, 835, 435, 17, 490, 587, 26, 717, 2929, 59, 1080, 61, 534, 283, 490, 2059, 355, 587, 26, 490, 2929, 59, 1080, 61, 534, 283, 272, 587, 26, 268, 367, 1478, 315, 1425, 8, 17, 12, 2976, 304, 1598, 2929, 59, 1080, 61, 534, 283, 1598, 2338, 19070, 2049, 272, 666, 63, 1652, 2968, 28, 815, 1305, 5961, 68, 2, 1329, 5961, 68, 2, 1139, 5961, 83, 2, 22294, 450, 334, 1143, 63, 344, 12, 88, 12, 2918, 59, 88, 566, 367, 671, 315, 1425, 8, 17, 12, 552, 8, 2918, 6393, 17, 9, 1622, 2286, 327, 27799, 314, 2748, 272, 2748, 275, 1449, 272, 450, 83, 272, 665, 10103, 1962, 5961, 68, 2, 1305, 5961, 68, 2, 536, 5961, 83, 2, 3089, 5961, 83, 1743, 272, 3068, 10103, 30, 272, 1449, 450, 334, 576, 63, 1652, 12, 1143, 63, 344, 12, 271, 541, 12, 399, 495, 8, 475, 1652, 8, 354, 1826, 835, 9, 339, 372, 2748, 199, 199, 533, 3622, 63, 4229, 8, 3070, 63, 16300, 304, 272, 347, 1218, 63, 1652, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 666, 12, 1067, 304, 267, 1559, 63, 271, 541, 275, 1115, 79, 1435, 14, 362, 63, 2293, 8, 1556, 14, 13238, 680, 362, 360, 6271, 14, 19623, 358, 267, 1559, 63, 2109, 275, 1115, 79, 1435, 14, 362, 63, 2293, 8, 1556, 14, 13238, 680, 362, 360, 6271, 14, 10103, 358, 267, 477, 8382, 9811, 267, 9052, 63, 344, 7622, 199, 3, 263, 4224, 7622, 267, 519, 541, 63, 1113, 275, 1115, 79, 1435, 14, 362, 63, 2293, 8, 1556, 14, 13238, 680, 362, 360, 6271, 14, 26131, 358, 267, 519, 757, 63, 1113, 29, 3070, 63, 20851, 14, 16300, 63, 1122, 8, 1556, 12, 1747, 12, 519, 541, 63, 1113, 423, 354, 12, 1100, 9, 267, 2467, 14, 2526, 480, 4859, 536, 4442, 522, 63, 4627, 531, 267, 522, 29, 1556, 14, 11591, 3430, 16, 61, 267, 1434, 63, 1652, 9811, 267, 1434, 63, 8136, 29, 521, 14, 6205, 3508, 57, 3295, 77, 3295, 68, 450, 40, 2689, 45, 2689, 51, 358, 267, 1434, 63, 1652, 847, 459, 28, 470, 536, 5961, 83, 2, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 Sam Harwell # Copyright (c) 2014 Eric Vergnaud # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. The name of the author may not be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. class ATNDeserializationOptions(object): defaultOptions = None def __init__(self, copyFrom = None): self.readOnly = False self.verifyATN = True if copyFrom is None else copyFrom.verifyATN self.generateRuleBypassTransitions = False if copyFrom is None else copyFrom.generateRuleBypassTransitions def __setattr__(self, key, value): if key!="readOnly" and self.readOnly: raise Exception("The object is read only.") super(type(self), self).__setattr__(key,value) ATNDeserializationOptions.defaultOptions = ATNDeserializationOptions() ATNDeserializationOptions.defaultOptions.readOnly = True
bsd-3-clause
[ 3, 59, 1918, 298, 15400, 4190, 937, 199, 3, 1898, 334, 67, 9, 6171, 5773, 4646, 2235, 82, 199, 3, 1898, 334, 67, 9, 6171, 428, 455, 25378, 20501, 199, 3, 1898, 334, 67, 9, 6927, 662, 1567, 5444, 784, 32024, 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, 199, 3, 787, 7647, 26, 199, 3, 199, 3, 413, 14, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 3, 259, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 3, 499, 14, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 4248, 199, 3, 259, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 315, 314, 199, 3, 259, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 4084, 14, 199, 3, 650, 14, 710, 536, 402, 314, 4132, 1443, 440, 506, 1202, 370, 10692, 503, 10016, 7585, 199, 3, 259, 7131, 687, 642, 2032, 1928, 2488, 6791, 5313, 4983, 14, 199, 3, 199, 3, 5749, 4141, 2281, 7049, 6515, 2334, 17632, 1124, 1179, 2281, 891, 2401, 1821, 7168, 1549, 199, 3, 5292, 2990, 12, 6931, 12, 5400, 2845, 5471, 2296, 12, 2334, 5292, 2990, 199, 3, 1634, 3169, 2401, 3092, 2381, 437, 3115, 3104, 9315, 9706, 14, 199, 3, 1621, 4825, 6461, 7000, 2334, 17632, 6262, 7024, 2381, 1821, 8703, 12, 9168, 12, 199, 3, 9716, 12, 8820, 12, 9836, 12, 1549, 9110, 6736, 334, 6446, 12, 5400, 199, 3, 2845, 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, 1634, 199, 3, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 9726, 1634, 9712, 9784, 14, 199, 199, 533, 15059, 46, 872, 12161, 4558, 8, 785, 304, 339, 849, 4558, 275, 488, 339, 347, 636, 826, 721, 277, 12, 1331, 2532, 275, 488, 304, 267, 291, 14, 739, 5903, 275, 756, 267, 291, 14, 4712, 619, 46, 275, 715, 340, 1331, 2532, 365, 488, 587, 1331, 2532, 14, 4712, 619, 46, 267, 291, 14, 4208, 5065, 2175, 1529, 14612, 6150, 275, 756, 340, 1331, 2532, 365, 488, 587, 1331, 2532, 14, 4208, 5065, 2175, 1529, 14612, 6150, 339, 347, 636, 10202, 721, 277, 12, 790, 12, 574, 304, 267, 340, 790, 1, 628, 739, 5903, 2, 436, 291, 14, 739, 5903, 26, 288, 746, 2186, 480, 1918, 909, 365, 1586, 1454, 2685, 267, 1613, 8, 466, 8, 277, 395, 291, 2843, 10202, 721, 498, 12, 585, 9, 199, 199, 619, 46, 872, 12161, 4558, 14, 885, 4558, 275, 15059, 46, 872, 12161, 4558, 342, 199, 619, 46, 872, 12161, 4558, 14, 885, 4558, 14, 739, 5903, 275, 715, 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 ]
[ 59, 1918, 298, 15400, 4190, 937, 199, 3, 1898, 334, 67, 9, 6171, 5773, 4646, 2235, 82, 199, 3, 1898, 334, 67, 9, 6171, 428, 455, 25378, 20501, 199, 3, 1898, 334, 67, 9, 6927, 662, 1567, 5444, 784, 32024, 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, 199, 3, 787, 7647, 26, 199, 3, 199, 3, 413, 14, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 3, 259, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 3, 499, 14, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 4248, 199, 3, 259, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 315, 314, 199, 3, 259, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 4084, 14, 199, 3, 650, 14, 710, 536, 402, 314, 4132, 1443, 440, 506, 1202, 370, 10692, 503, 10016, 7585, 199, 3, 259, 7131, 687, 642, 2032, 1928, 2488, 6791, 5313, 4983, 14, 199, 3, 199, 3, 5749, 4141, 2281, 7049, 6515, 2334, 17632, 1124, 1179, 2281, 891, 2401, 1821, 7168, 1549, 199, 3, 5292, 2990, 12, 6931, 12, 5400, 2845, 5471, 2296, 12, 2334, 5292, 2990, 199, 3, 1634, 3169, 2401, 3092, 2381, 437, 3115, 3104, 9315, 9706, 14, 199, 3, 1621, 4825, 6461, 7000, 2334, 17632, 6262, 7024, 2381, 1821, 8703, 12, 9168, 12, 199, 3, 9716, 12, 8820, 12, 9836, 12, 1549, 9110, 6736, 334, 6446, 12, 5400, 199, 3, 2845, 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, 1634, 199, 3, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 9726, 1634, 9712, 9784, 14, 199, 199, 533, 15059, 46, 872, 12161, 4558, 8, 785, 304, 339, 849, 4558, 275, 488, 339, 347, 636, 826, 721, 277, 12, 1331, 2532, 275, 488, 304, 267, 291, 14, 739, 5903, 275, 756, 267, 291, 14, 4712, 619, 46, 275, 715, 340, 1331, 2532, 365, 488, 587, 1331, 2532, 14, 4712, 619, 46, 267, 291, 14, 4208, 5065, 2175, 1529, 14612, 6150, 275, 756, 340, 1331, 2532, 365, 488, 587, 1331, 2532, 14, 4208, 5065, 2175, 1529, 14612, 6150, 339, 347, 636, 10202, 721, 277, 12, 790, 12, 574, 304, 267, 340, 790, 1, 628, 739, 5903, 2, 436, 291, 14, 739, 5903, 26, 288, 746, 2186, 480, 1918, 909, 365, 1586, 1454, 2685, 267, 1613, 8, 466, 8, 277, 395, 291, 2843, 10202, 721, 498, 12, 585, 9, 199, 199, 619, 46, 872, 12161, 4558, 14, 885, 4558, 275, 15059, 46, 872, 12161, 4558, 342, 199, 619, 46, 872, 12161, 4558, 14, 885, 4558, 14, 739, 5903, 275, 715, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
mahabs/nitro
nssrc/com/citrix/netscaler/nitro/resource/config/vpn/vpnvserver_authenticationldappolicy_binding.py
1
14377
# # Copyright (c) 2008-2015 Citrix Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response from nssrc.com.citrix.netscaler.nitro.service.options import options from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_exception from nssrc.com.citrix.netscaler.nitro.util.nitro_util import nitro_util class vpnvserver_authenticationldappolicy_binding(base_resource) : """ Binding class showing the authenticationldappolicy that can be bound to vpnvserver. """ def __init__(self) : self._policy = "" self._priority = 0 self._acttype = 0 self._secondary = False self._groupextraction = False self._name = "" self._gotopriorityexpression = "" self._bindpoint = "" self.___count = 0 @property def priority(self) : """The priority, if any, of the VPN virtual server policy. """ try : return self._priority except Exception as e: raise e @priority.setter def priority(self, priority) : """The priority, if any, of the VPN virtual server policy. """ try : self._priority = priority except Exception as e: raise e @property def gotopriorityexpression(self) : """Expression or other value specifying the next policy to evaluate if the current policy evaluates to TRUE. Specify one of the following values: * NEXT - Evaluate the policy with the next higher priority number. * END - End policy evaluation. * USE_INVOCATION_RESULT - Applicable if this policy invokes another policy label. If the final goto in the invoked policy label has a value of END, the evaluation stops. If the final goto is anything other than END, the current policy label performs a NEXT. * A default syntax or classic expression that evaluates to a number. If you specify an expression, the number to which it evaluates determines the next policy to evaluate, as follows: * If the expression evaluates to a higher numbered priority, the policy with that priority is evaluated next. * If the expression evaluates to the priority of the current policy, the policy with the next higher numbered priority is evaluated next. * If the expression evaluates to a number that is larger than the largest numbered priority, policy evaluation ends. An UNDEF event is triggered if: * The expression is invalid. * The expression evaluates to a priority number that is numerically lower than the current policy's priority. * The expression evaluates to a priority number that is between the current policy's priority number (say, 30) and the highest priority number (say, 100), but does not match any configured priority number (for example, the expression evaluates to the number 85). This example assumes that the priority number increments by 10 for every successive policy, and therefore a priority number of 85 does not exist in the policy label. """ try : return self._gotopriorityexpression except Exception as e: raise e @gotopriorityexpression.setter def gotopriorityexpression(self, gotopriorityexpression) : """Expression or other value specifying the next policy to evaluate if the current policy evaluates to TRUE. Specify one of the following values: * NEXT - Evaluate the policy with the next higher priority number. * END - End policy evaluation. * USE_INVOCATION_RESULT - Applicable if this policy invokes another policy label. If the final goto in the invoked policy label has a value of END, the evaluation stops. If the final goto is anything other than END, the current policy label performs a NEXT. * A default syntax or classic expression that evaluates to a number. If you specify an expression, the number to which it evaluates determines the next policy to evaluate, as follows: * If the expression evaluates to a higher numbered priority, the policy with that priority is evaluated next. * If the expression evaluates to the priority of the current policy, the policy with the next higher numbered priority is evaluated next. * If the expression evaluates to a number that is larger than the largest numbered priority, policy evaluation ends. An UNDEF event is triggered if: * The expression is invalid. * The expression evaluates to a priority number that is numerically lower than the current policy's priority. * The expression evaluates to a priority number that is between the current policy's priority number (say, 30) and the highest priority number (say, 100), but does not match any configured priority number (for example, the expression evaluates to the number 85). This example assumes that the priority number increments by 10 for every successive policy, and therefore a priority number of 85 does not exist in the policy label. """ try : self._gotopriorityexpression = gotopriorityexpression except Exception as e: raise e @property def policy(self) : """The name of the policy, if any, bound to the VPN virtual server. """ try : return self._policy except Exception as e: raise e @policy.setter def policy(self, policy) : """The name of the policy, if any, bound to the VPN virtual server. """ try : self._policy = policy except Exception as e: raise e @property def groupextraction(self) : """Binds the authentication policy to a tertiary chain which will be used only for group extraction. The user will not authenticate against this server, and this will only be called if primary and/or secondary authentication has succeeded. """ try : return self._groupextraction except Exception as e: raise e @groupextraction.setter def groupextraction(self, groupextraction) : """Binds the authentication policy to a tertiary chain which will be used only for group extraction. The user will not authenticate against this server, and this will only be called if primary and/or secondary authentication has succeeded. """ try : self._groupextraction = groupextraction except Exception as e: raise e @property def name(self) : """Name of the virtual server.<br/>Minimum length = 1. """ try : return self._name except Exception as e: raise e @name.setter def name(self, name) : """Name of the virtual server.<br/>Minimum length = 1 """ try : self._name = name except Exception as e: raise e @property def secondary(self) : """Binds the authentication policy as the secondary policy to use in a two-factor configuration. A user must then authenticate not only via a primary authentication method but also via a secondary authentication method. User groups are aggregated across both. The user name must be exactly the same for both authentication methods, but they can require different passwords. """ try : return self._secondary except Exception as e: raise e @secondary.setter def secondary(self, secondary) : """Binds the authentication policy as the secondary policy to use in a two-factor configuration. A user must then authenticate not only via a primary authentication method but also via a secondary authentication method. User groups are aggregated across both. The user name must be exactly the same for both authentication methods, but they can require different passwords. """ try : self._secondary = secondary except Exception as e: raise e @property def bindpoint(self) : """Bind point to which to bind the policy. Applies only to rewrite and cache policies. If you do not set this parameter, the policy is bound to REQ_DEFAULT or RES_DEFAULT, depending on whether the policy rule is a response-time or a request-time expression. """ try : return self._bindpoint except Exception as e: raise e @bindpoint.setter def bindpoint(self, bindpoint) : """Bind point to which to bind the policy. Applies only to rewrite and cache policies. If you do not set this parameter, the policy is bound to REQ_DEFAULT or RES_DEFAULT, depending on whether the policy rule is a response-time or a request-time expression. """ try : self._bindpoint = bindpoint except Exception as e: raise e @property def acttype(self) : try : return self._acttype except Exception as e: raise e def _get_nitro_response(self, service, response) : """ converts nitro response into object and returns the object array in case of get request. """ try : result = service.payload_formatter.string_to_resource(vpnvserver_authenticationldappolicy_binding_response, response, self.__class__.__name__) if(result.errorcode != 0) : if (result.errorcode == 444) : service.clear_session(self) if result.severity : if (result.severity == "ERROR") : raise nitro_exception(result.errorcode, str(result.message), str(result.severity)) else : raise nitro_exception(result.errorcode, str(result.message), str(result.severity)) return result.vpnvserver_authenticationldappolicy_binding except Exception as e : raise e def _get_object_name(self) : """ Returns the value of object identifier argument """ try : if (self.name) : return str(self.name) return None except Exception as e : raise e @classmethod def add(cls, client, resource) : try : if resource and type(resource) is not list : updateresource = vpnvserver_authenticationldappolicy_binding() updateresource.name = resource.name updateresource.policy = resource.policy updateresource.secondary = resource.secondary updateresource.groupextraction = resource.groupextraction updateresource.gotopriorityexpression = resource.gotopriorityexpression updateresource.bindpoint = resource.bindpoint return updateresource.update_resource(client) else : if resource and len(resource) > 0 : updateresources = [vpnvserver_authenticationldappolicy_binding() for _ in range(len(resource))] for i in range(len(resource)) : updateresources[i].name = resource[i].name updateresources[i].policy = resource[i].policy updateresources[i].secondary = resource[i].secondary updateresources[i].groupextraction = resource[i].groupextraction updateresources[i].gotopriorityexpression = resource[i].gotopriorityexpression updateresources[i].bindpoint = resource[i].bindpoint return cls.update_bulk_request(client, updateresources) except Exception as e : raise e @classmethod def delete(cls, client, resource) : try : if resource and type(resource) is not list : deleteresource = vpnvserver_authenticationldappolicy_binding() deleteresource.name = resource.name deleteresource.policy = resource.policy deleteresource.secondary = resource.secondary deleteresource.groupextraction = resource.groupextraction deleteresource.bindpoint = resource.bindpoint return deleteresource.delete_resource(client) else : if resource and len(resource) > 0 : deleteresources = [vpnvserver_authenticationldappolicy_binding() for _ in range(len(resource))] for i in range(len(resource)) : deleteresources[i].name = resource[i].name deleteresources[i].policy = resource[i].policy deleteresources[i].secondary = resource[i].secondary deleteresources[i].groupextraction = resource[i].groupextraction deleteresources[i].bindpoint = resource[i].bindpoint return cls.delete_bulk_request(client, deleteresources) except Exception as e : raise e @classmethod def get(cls, service, name) : """ Use this API to fetch vpnvserver_authenticationldappolicy_binding resources. """ try : obj = vpnvserver_authenticationldappolicy_binding() obj.name = name response = obj.get_resources(service) return response except Exception as e: raise e @classmethod def get_filtered(cls, service, name, filter_) : """ Use this API to fetch filtered set of vpnvserver_authenticationldappolicy_binding resources. Filter string should be in JSON format.eg: "port:80,servicetype:HTTP". """ try : obj = vpnvserver_authenticationldappolicy_binding() obj.name = name option_ = options() option_.filter = filter_ response = obj.getfiltered(service, option_) return response except Exception as e: raise e @classmethod def count(cls, service, name) : """ Use this API to count vpnvserver_authenticationldappolicy_binding resources configued on NetScaler. """ try : obj = vpnvserver_authenticationldappolicy_binding() obj.name = name option_ = options() option_.count = True response = obj.get_resources(service, option_) if response : return response[0].__dict__['___count'] return 0 except Exception as e: raise e @classmethod def count_filtered(cls, service, name, filter_) : """ Use this API to count the filtered set of vpnvserver_authenticationldappolicy_binding resources. Filter string should be in JSON format.eg: "port:80,servicetype:HTTP". """ try : obj = vpnvserver_authenticationldappolicy_binding() obj.name = name option_ = options() option_.count = True option_.filter = filter_ response = obj.getfiltered(service, option_) if response : return response[0].__dict__['___count'] return 0 except Exception as e: raise e class Staaddresstype: IPV4 = "IPV4" IPV6 = "IPV6" class Bindpoint: REQUEST = "REQUEST" RESPONSE = "RESPONSE" ICA_REQUEST = "ICA_REQUEST" OTHERTCP_REQUEST = "OTHERTCP_REQUEST" class vpnvserver_authenticationldappolicy_binding_response(base_response) : def __init__(self, length=1) : self.vpnvserver_authenticationldappolicy_binding = [] self.errorcode = 0 self.message = "" self.severity = "" self.sessionid = "" self.vpnvserver_authenticationldappolicy_binding = [vpnvserver_authenticationldappolicy_binding() for _ in range(length)]
apache-2.0
[ 3, 199, 3, 1898, 334, 67, 9, 9079, 13, 7806, 445, 390, 1904, 15285, 12, 3277, 14, 199, 3, 199, 3, 257, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 531, 199, 3, 257, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 257, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 755, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 221, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 257, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 257, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 257, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 257, 4204, 1334, 314, 844, 14, 199, 3, 199, 199, 504, 302, 32231, 14, 957, 14, 14422, 1904, 14, 18860, 14, 18893, 14, 1927, 14, 1095, 14, 1095, 63, 1927, 492, 1300, 63, 1927, 199, 504, 302, 32231, 14, 957, 14, 14422, 1904, 14, 18860, 14, 18893, 14, 1927, 14, 1095, 14, 1095, 63, 1927, 492, 1300, 63, 1310, 199, 504, 302, 32231, 14, 957, 14, 14422, 1904, 14, 18860, 14, 18893, 14, 1364, 14, 1419, 492, 1511, 199, 504, 302, 32231, 14, 957, 14, 14422, 1904, 14, 18860, 14, 18893, 14, 1971, 14, 18893, 63, 1971, 492, 20107, 63, 1971, 199, 199, 504, 302, 32231, 14, 957, 14, 14422, 1904, 14, 18860, 14, 18893, 14, 1974, 14, 18893, 63, 1974, 492, 20107, 63, 1974, 199, 199, 533, 15978, 16120, 63, 11725, 9642, 3185, 63, 9140, 8, 1095, 63, 1927, 9, 520, 199, 198, 624, 22630, 316, 1021, 21207, 314, 6299, 9642, 3185, 626, 883, 506, 3914, 370, 15978, 16120, 14, 199, 198, 624, 199, 198, 318, 636, 826, 721, 277, 9, 520, 507, 198, 277, 423, 3185, 275, 3087, 507, 198, 277, 423, 6693, 275, 378, 507, 198, 277, 423, 2442, 466, 275, 378, 507, 198, 277, 423, 12371, 275, 756, 507, 198, 277, 423, 71, 7930, 321, 400, 6156, 275, 756, 507, 198, 277, 423, 354, 275, 3087, 507, 198, 277, 423, 7808, 21993, 3822, 5599, 275, 3087, 507, 198, 277, 423, 3409, 1403, 275, 3087, 507, 198, 277, 855, 63, 835, 275, 378, 421, 198, 32, 1829, 199, 198, 318, 7464, 8, 277, 9, 520, 507, 198, 624, 1918, 7464, 12, 340, 1263, 12, 402, 314, 29057, 5791, 1654, 4592, 14, 507, 198, 624, 507, 198, 893, 520, 686, 198, 1107, 291, 423, 6693, 507, 198, 2590, 2186, 465, 325, 26, 686, 198, 3730, 325, 421, 198, 32, 6693, 14, 8345, 199, 198, 318, 7464, 8, 277, 12, 7464, 9, 520, 507, 198, 624, 1918, 7464, 12, 340, 1263, 12, 402, 314, 29057, 5791, 1654, 4592, 14, 507, 198, 624, 507, 198, 893, 520, 686, 198, 277, 423, 6693, 275, 7464, 507, 198, 2590, 2186, 465, 325, 26, 686, 198, 3730, 325, 421, 198, 32, 1829, 199, 198, 318, 4788, 21993, 3822, 5599, 8, 277, 9, 520, 507, 198, 624, 9093, 503, 1163, 574, 9176, 314, 2163, 4592, 370, 9352, 340, 314, 1453, 4592, 22014, 370, 9074, 4187, 14, 221, 13327, 1373, 402, 314, 2569, 1338, 26, 507, 198, 10, 653, 2472, 446, 27450, 314, 4592, 543, 314, 2163, 10948, 7464, 1329, 14, 507, 198, 10, 7729, 446, 9599, 4592, 11735, 14, 507, 198, 10, 4815, 63, 568, 10662, 35, 2594, 63, 9517, 446, 4693, 606, 461, 340, 642, 4592, 29761, 4573, 4592, 1768, 14, 982, 314, 4242, 18878, 315, 314, 10302, 4592, 1768, 965, 282, 574, 402, 7729, 12, 314, 11735, 20922, 14, 982, 314, 4242, 18878, 365, 7003, 1163, 2419, 7729, 12, 314, 1453, 4592, 1768, 18628, 282, 653, 2472, 14, 507, 198, 10, 437, 849, 6302, 503, 31205, 3965, 626, 22014, 370, 282, 1329, 14, 507, 198, 3917, 1265, 4165, 376, 3965, 12, 314, 1329, 370, 1314, 652, 22014, 16756, 314, 2163, 4592, 370, 9352, 12, 465, 11924, 26, 507, 198, 10, 221, 982, 314, 3965, 22014, 370, 282, 10948, 1967, 18897, 7464, 12, 314, 4592, 543, 626, 7464, 365, 13006, 2163, 14, 507, 198, 10, 982, 314, 3965, 22014, 370, 314, 7464, 402, 314, 1453, 4592, 12, 314, 4592, 543, 314, 2163, 10948, 1967, 18897, 7464, 365, 13006, 2163, 14, 507, 198, 10, 982, 314, 3965, 22014, 370, 282, 1329, 626, 365, 12142, 2419, 314, 17451, 1967, 18897, 7464, 12, 4592, 11735, 11187, 14, 507, 198, 2493, 6778, 5638, 1566, 365, 15572, 340, 26, 507, 198, 10, 710, 3965, 365, 3866, 14, 507, 198, 10, 710, 3965, 22014, 370, 282, 7464, 1329, 626, 365, 8950, 1183, 5117, 2419, 314, 1453, 4592, 1159, 7464, 14, 507, 198, 10, 710, 3965, 22014, 370, 282, 7464, 1329, 626, 365, 3382, 314, 1453, 4592, 1159, 7464, 1329, 334, 19787, 12, 4233, 9, 436, 314, 15356, 7464, 1329, 334, 19787, 12, 2948, 395, 1325, 1630, 440, 1336, 1263, 7526, 7464, 1329, 334, 509, 2893, 12, 314, 3965, 22014, 370, 314, 1329, 16412, 680, 961, 2893, 15194, 626, 314, 7464, 1329, 10035, 1470, 701, 1616, 367, 4036, 27028, 3398, 4592, 12, 436, 16119, 282, 7464, 1329, 402, 16412, 1630, 440, 2187, 315, 314, 4592, 1768, 14, 507, 198, 624, 507, 198, 893, 520, 686, 198, 1107, 291, 423, 7808, 21993, 3822, 5599, 507, 198, 2590, 2186, 465, 325, 26, 686, 198, 3730, 325, 421, 198, 32, 7808, 21993, 3822, 5599, 14, 8345, 199, 198, 318, 4788, 21993, 3822, 5599, 8, 277, 12, 4788, 21993, 3822, 5599, 9, 520, 507, 198, 624, 9093, 503, 1163, 574, 9176, 314, 2163, 4592, 370, 9352, 340, 314, 1453, 4592, 22014, 370, 9074, 4187, 14, 221, 13327, 1373, 402, 314, 2569, 1338, 26, 507, 198, 10, 653, 2472, 446, 27450, 314, 4592, 543, 314, 2163, 10948, 7464, 1329, 14, 507, 198, 10, 7729, 446, 9599, 4592, 11735, 14, 507, 198, 10, 4815, 63, 568, 10662, 35, 2594, 63, 9517, 446, 4693, 606, 461, 340, 642, 4592, 29761, 4573, 4592, 1768, 14, 982, 314, 4242, 18878, 315, 314, 10302, 4592, 1768, 965, 282, 574, 402, 7729, 12, 314, 11735 ]
[ 199, 3, 1898, 334, 67, 9, 9079, 13, 7806, 445, 390, 1904, 15285, 12, 3277, 14, 199, 3, 199, 3, 257, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 531, 199, 3, 257, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 257, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 755, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 221, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 257, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 257, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 257, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 257, 4204, 1334, 314, 844, 14, 199, 3, 199, 199, 504, 302, 32231, 14, 957, 14, 14422, 1904, 14, 18860, 14, 18893, 14, 1927, 14, 1095, 14, 1095, 63, 1927, 492, 1300, 63, 1927, 199, 504, 302, 32231, 14, 957, 14, 14422, 1904, 14, 18860, 14, 18893, 14, 1927, 14, 1095, 14, 1095, 63, 1927, 492, 1300, 63, 1310, 199, 504, 302, 32231, 14, 957, 14, 14422, 1904, 14, 18860, 14, 18893, 14, 1364, 14, 1419, 492, 1511, 199, 504, 302, 32231, 14, 957, 14, 14422, 1904, 14, 18860, 14, 18893, 14, 1971, 14, 18893, 63, 1971, 492, 20107, 63, 1971, 199, 199, 504, 302, 32231, 14, 957, 14, 14422, 1904, 14, 18860, 14, 18893, 14, 1974, 14, 18893, 63, 1974, 492, 20107, 63, 1974, 199, 199, 533, 15978, 16120, 63, 11725, 9642, 3185, 63, 9140, 8, 1095, 63, 1927, 9, 520, 199, 198, 624, 22630, 316, 1021, 21207, 314, 6299, 9642, 3185, 626, 883, 506, 3914, 370, 15978, 16120, 14, 199, 198, 624, 199, 198, 318, 636, 826, 721, 277, 9, 520, 507, 198, 277, 423, 3185, 275, 3087, 507, 198, 277, 423, 6693, 275, 378, 507, 198, 277, 423, 2442, 466, 275, 378, 507, 198, 277, 423, 12371, 275, 756, 507, 198, 277, 423, 71, 7930, 321, 400, 6156, 275, 756, 507, 198, 277, 423, 354, 275, 3087, 507, 198, 277, 423, 7808, 21993, 3822, 5599, 275, 3087, 507, 198, 277, 423, 3409, 1403, 275, 3087, 507, 198, 277, 855, 63, 835, 275, 378, 421, 198, 32, 1829, 199, 198, 318, 7464, 8, 277, 9, 520, 507, 198, 624, 1918, 7464, 12, 340, 1263, 12, 402, 314, 29057, 5791, 1654, 4592, 14, 507, 198, 624, 507, 198, 893, 520, 686, 198, 1107, 291, 423, 6693, 507, 198, 2590, 2186, 465, 325, 26, 686, 198, 3730, 325, 421, 198, 32, 6693, 14, 8345, 199, 198, 318, 7464, 8, 277, 12, 7464, 9, 520, 507, 198, 624, 1918, 7464, 12, 340, 1263, 12, 402, 314, 29057, 5791, 1654, 4592, 14, 507, 198, 624, 507, 198, 893, 520, 686, 198, 277, 423, 6693, 275, 7464, 507, 198, 2590, 2186, 465, 325, 26, 686, 198, 3730, 325, 421, 198, 32, 1829, 199, 198, 318, 4788, 21993, 3822, 5599, 8, 277, 9, 520, 507, 198, 624, 9093, 503, 1163, 574, 9176, 314, 2163, 4592, 370, 9352, 340, 314, 1453, 4592, 22014, 370, 9074, 4187, 14, 221, 13327, 1373, 402, 314, 2569, 1338, 26, 507, 198, 10, 653, 2472, 446, 27450, 314, 4592, 543, 314, 2163, 10948, 7464, 1329, 14, 507, 198, 10, 7729, 446, 9599, 4592, 11735, 14, 507, 198, 10, 4815, 63, 568, 10662, 35, 2594, 63, 9517, 446, 4693, 606, 461, 340, 642, 4592, 29761, 4573, 4592, 1768, 14, 982, 314, 4242, 18878, 315, 314, 10302, 4592, 1768, 965, 282, 574, 402, 7729, 12, 314, 11735, 20922, 14, 982, 314, 4242, 18878, 365, 7003, 1163, 2419, 7729, 12, 314, 1453, 4592, 1768, 18628, 282, 653, 2472, 14, 507, 198, 10, 437, 849, 6302, 503, 31205, 3965, 626, 22014, 370, 282, 1329, 14, 507, 198, 3917, 1265, 4165, 376, 3965, 12, 314, 1329, 370, 1314, 652, 22014, 16756, 314, 2163, 4592, 370, 9352, 12, 465, 11924, 26, 507, 198, 10, 221, 982, 314, 3965, 22014, 370, 282, 10948, 1967, 18897, 7464, 12, 314, 4592, 543, 626, 7464, 365, 13006, 2163, 14, 507, 198, 10, 982, 314, 3965, 22014, 370, 314, 7464, 402, 314, 1453, 4592, 12, 314, 4592, 543, 314, 2163, 10948, 1967, 18897, 7464, 365, 13006, 2163, 14, 507, 198, 10, 982, 314, 3965, 22014, 370, 282, 1329, 626, 365, 12142, 2419, 314, 17451, 1967, 18897, 7464, 12, 4592, 11735, 11187, 14, 507, 198, 2493, 6778, 5638, 1566, 365, 15572, 340, 26, 507, 198, 10, 710, 3965, 365, 3866, 14, 507, 198, 10, 710, 3965, 22014, 370, 282, 7464, 1329, 626, 365, 8950, 1183, 5117, 2419, 314, 1453, 4592, 1159, 7464, 14, 507, 198, 10, 710, 3965, 22014, 370, 282, 7464, 1329, 626, 365, 3382, 314, 1453, 4592, 1159, 7464, 1329, 334, 19787, 12, 4233, 9, 436, 314, 15356, 7464, 1329, 334, 19787, 12, 2948, 395, 1325, 1630, 440, 1336, 1263, 7526, 7464, 1329, 334, 509, 2893, 12, 314, 3965, 22014, 370, 314, 1329, 16412, 680, 961, 2893, 15194, 626, 314, 7464, 1329, 10035, 1470, 701, 1616, 367, 4036, 27028, 3398, 4592, 12, 436, 16119, 282, 7464, 1329, 402, 16412, 1630, 440, 2187, 315, 314, 4592, 1768, 14, 507, 198, 624, 507, 198, 893, 520, 686, 198, 1107, 291, 423, 7808, 21993, 3822, 5599, 507, 198, 2590, 2186, 465, 325, 26, 686, 198, 3730, 325, 421, 198, 32, 7808, 21993, 3822, 5599, 14, 8345, 199, 198, 318, 4788, 21993, 3822, 5599, 8, 277, 12, 4788, 21993, 3822, 5599, 9, 520, 507, 198, 624, 9093, 503, 1163, 574, 9176, 314, 2163, 4592, 370, 9352, 340, 314, 1453, 4592, 22014, 370, 9074, 4187, 14, 221, 13327, 1373, 402, 314, 2569, 1338, 26, 507, 198, 10, 653, 2472, 446, 27450, 314, 4592, 543, 314, 2163, 10948, 7464, 1329, 14, 507, 198, 10, 7729, 446, 9599, 4592, 11735, 14, 507, 198, 10, 4815, 63, 568, 10662, 35, 2594, 63, 9517, 446, 4693, 606, 461, 340, 642, 4592, 29761, 4573, 4592, 1768, 14, 982, 314, 4242, 18878, 315, 314, 10302, 4592, 1768, 965, 282, 574, 402, 7729, 12, 314, 11735, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
100Shapes/wagtail
wagtail/wagtailsearch/management/commands/update_index.py
2
2445
from django.core.management.base import BaseCommand from django.db import models from wagtail.wagtailsearch import Indexed, get_search_backend class Command(BaseCommand): def handle(self, **options): # Print info self.stdout.write("Getting object list") # Get list of indexed models indexed_models = [model for model in models.get_models() if issubclass(model, Indexed)] # Object set object_set = {} # Add all objects to object set and detect any duplicates # Duplicates are caused when both a model and a derived model are indexed # Eg, if BlogPost inherits from Page and both of these models are indexed # If we were to add all objects from both models into the index, all the BlogPosts will have two entries for model in indexed_models: # Get toplevel content type toplevel_content_type = model.indexed_get_toplevel_content_type() # Loop through objects for obj in model.get_indexed_objects(): # Get key for this object key = toplevel_content_type + ':' + str(obj.pk) # Check if this key already exists if key in object_set: # Conflict, work out who should get this space # The object with the longest content type string gets the space # Eg, "wagtailcore.Page-myapp.BlogPost" kicks out "wagtailcore.Page" if len(obj.indexed_get_content_type()) > len(object_set[key].indexed_get_content_type()): # Take the spot object_set[key] = obj else: # Space free, take it object_set[key] = obj # Search backend if 'backend' in options: s = options['backend'] else: s = get_search_backend() # Reset the index self.stdout.write("Reseting index") s.reset_index() # Add types self.stdout.write("Adding types") for model in indexed_models: s.add_type(model) # Add objects to index self.stdout.write("Adding objects") for result in s.add_bulk(object_set.values()): self.stdout.write(result[0] + ' ' + str(result[1])) # Refresh index self.stdout.write("Refreshing index") s.refresh_index()
bsd-3-clause
[ 504, 1639, 14, 1018, 14, 8110, 14, 1095, 492, 22239, 199, 504, 1639, 14, 697, 492, 1709, 199, 199, 504, 7328, 14, 17296, 1733, 492, 26437, 12, 664, 63, 1733, 63, 4620, 421, 199, 533, 5817, 8, 25150, 304, 272, 347, 2429, 8, 277, 12, 1011, 1419, 304, 267, 327, 9101, 2256, 267, 291, 14, 2703, 14, 952, 480, 28277, 909, 769, 531, 398, 327, 2372, 769, 402, 15235, 1709, 267, 15235, 63, 992, 275, 359, 1238, 367, 1402, 315, 1709, 14, 362, 63, 992, 342, 340, 11602, 8, 1238, 12, 26437, 1874, 398, 327, 6935, 663, 267, 909, 63, 409, 275, 1052, 398, 327, 2654, 1006, 2251, 370, 909, 663, 436, 9696, 1263, 15755, 267, 327, 577, 10771, 787, 18104, 1380, 3865, 282, 1402, 436, 282, 7131, 1402, 787, 15235, 267, 327, 662, 71, 12, 340, 29775, 6564, 21592, 687, 10331, 436, 3865, 402, 3520, 1709, 787, 15235, 267, 327, 982, 781, 4898, 370, 1050, 1006, 2251, 687, 3865, 1709, 1901, 314, 1478, 12, 1006, 314, 29775, 6564, 83, 911, 1172, 2877, 4811, 267, 367, 1402, 315, 15235, 63, 992, 26, 288, 327, 2372, 13836, 1564, 730, 288, 13836, 63, 1317, 63, 466, 275, 1402, 14, 16821, 63, 362, 63, 13517, 63, 1317, 63, 466, 342, 953, 327, 18175, 4012, 2251, 288, 367, 1559, 315, 1402, 14, 362, 63, 16821, 63, 1462, 837, 355, 327, 2372, 790, 367, 642, 909, 355, 790, 275, 13836, 63, 1317, 63, 466, 435, 10871, 435, 620, 8, 1113, 14, 2051, 9, 2234, 327, 2670, 340, 642, 790, 2575, 3495, 355, 340, 790, 315, 909, 63, 409, 26, 490, 327, 32539, 6960, 12, 1736, 734, 3963, 1077, 664, 642, 4601, 490, 327, 710, 909, 543, 314, 21303, 1564, 730, 1059, 7545, 314, 4601, 490, 327, 662, 71, 12, 298, 31439, 14, 3276, 13, 1662, 571, 14, 26081, 6564, 2, 29898, 83, 734, 298, 31439, 14, 3276, 2, 490, 340, 822, 8, 1113, 14, 16821, 63, 362, 63, 1317, 63, 466, 1012, 690, 822, 8, 785, 63, 409, 59, 498, 1055, 16821, 63, 362, 63, 1317, 63, 466, 5109, 717, 327, 18146, 314, 23226, 717, 909, 63, 409, 59, 498, 61, 275, 1559, 355, 587, 26, 490, 327, 19326, 2867, 12, 5452, 652, 490, 909, 63, 409, 59, 498, 61, 275, 1559, 398, 327, 8730, 4865, 267, 340, 283, 4620, 7, 315, 1511, 26, 288, 308, 275, 1511, 459, 4620, 418, 267, 587, 26, 288, 308, 275, 664, 63, 1733, 63, 4620, 342, 398, 327, 15510, 314, 1478, 267, 291, 14, 2703, 14, 952, 480, 9637, 316, 1478, 531, 267, 308, 14, 3958, 63, 1080, 342, 398, 327, 2654, 2943, 267, 291, 14, 2703, 14, 952, 480, 20897, 2943, 531, 267, 367, 1402, 315, 15235, 63, 992, 26, 288, 308, 14, 525, 63, 466, 8, 1238, 9, 398, 327, 2654, 2251, 370, 1478, 267, 291, 14, 2703, 14, 952, 480, 20897, 2251, 531, 267, 367, 754, 315, 308, 14, 525, 63, 9377, 8, 785, 63, 409, 14, 1459, 5109, 288, 291, 14, 2703, 14, 952, 8, 1099, 59, 16, 61, 435, 283, 283, 435, 620, 8, 1099, 59, 17, 2459, 398, 327, 30345, 1478, 267, 291, 14, 2703, 14, 952, 480, 18730, 316, 1478, 531, 267, 308, 14, 6635, 63, 1080, 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 ]
[ 1639, 14, 1018, 14, 8110, 14, 1095, 492, 22239, 199, 504, 1639, 14, 697, 492, 1709, 199, 199, 504, 7328, 14, 17296, 1733, 492, 26437, 12, 664, 63, 1733, 63, 4620, 421, 199, 533, 5817, 8, 25150, 304, 272, 347, 2429, 8, 277, 12, 1011, 1419, 304, 267, 327, 9101, 2256, 267, 291, 14, 2703, 14, 952, 480, 28277, 909, 769, 531, 398, 327, 2372, 769, 402, 15235, 1709, 267, 15235, 63, 992, 275, 359, 1238, 367, 1402, 315, 1709, 14, 362, 63, 992, 342, 340, 11602, 8, 1238, 12, 26437, 1874, 398, 327, 6935, 663, 267, 909, 63, 409, 275, 1052, 398, 327, 2654, 1006, 2251, 370, 909, 663, 436, 9696, 1263, 15755, 267, 327, 577, 10771, 787, 18104, 1380, 3865, 282, 1402, 436, 282, 7131, 1402, 787, 15235, 267, 327, 662, 71, 12, 340, 29775, 6564, 21592, 687, 10331, 436, 3865, 402, 3520, 1709, 787, 15235, 267, 327, 982, 781, 4898, 370, 1050, 1006, 2251, 687, 3865, 1709, 1901, 314, 1478, 12, 1006, 314, 29775, 6564, 83, 911, 1172, 2877, 4811, 267, 367, 1402, 315, 15235, 63, 992, 26, 288, 327, 2372, 13836, 1564, 730, 288, 13836, 63, 1317, 63, 466, 275, 1402, 14, 16821, 63, 362, 63, 13517, 63, 1317, 63, 466, 342, 953, 327, 18175, 4012, 2251, 288, 367, 1559, 315, 1402, 14, 362, 63, 16821, 63, 1462, 837, 355, 327, 2372, 790, 367, 642, 909, 355, 790, 275, 13836, 63, 1317, 63, 466, 435, 10871, 435, 620, 8, 1113, 14, 2051, 9, 2234, 327, 2670, 340, 642, 790, 2575, 3495, 355, 340, 790, 315, 909, 63, 409, 26, 490, 327, 32539, 6960, 12, 1736, 734, 3963, 1077, 664, 642, 4601, 490, 327, 710, 909, 543, 314, 21303, 1564, 730, 1059, 7545, 314, 4601, 490, 327, 662, 71, 12, 298, 31439, 14, 3276, 13, 1662, 571, 14, 26081, 6564, 2, 29898, 83, 734, 298, 31439, 14, 3276, 2, 490, 340, 822, 8, 1113, 14, 16821, 63, 362, 63, 1317, 63, 466, 1012, 690, 822, 8, 785, 63, 409, 59, 498, 1055, 16821, 63, 362, 63, 1317, 63, 466, 5109, 717, 327, 18146, 314, 23226, 717, 909, 63, 409, 59, 498, 61, 275, 1559, 355, 587, 26, 490, 327, 19326, 2867, 12, 5452, 652, 490, 909, 63, 409, 59, 498, 61, 275, 1559, 398, 327, 8730, 4865, 267, 340, 283, 4620, 7, 315, 1511, 26, 288, 308, 275, 1511, 459, 4620, 418, 267, 587, 26, 288, 308, 275, 664, 63, 1733, 63, 4620, 342, 398, 327, 15510, 314, 1478, 267, 291, 14, 2703, 14, 952, 480, 9637, 316, 1478, 531, 267, 308, 14, 3958, 63, 1080, 342, 398, 327, 2654, 2943, 267, 291, 14, 2703, 14, 952, 480, 20897, 2943, 531, 267, 367, 1402, 315, 15235, 63, 992, 26, 288, 308, 14, 525, 63, 466, 8, 1238, 9, 398, 327, 2654, 2251, 370, 1478, 267, 291, 14, 2703, 14, 952, 480, 20897, 2251, 531, 267, 367, 754, 315, 308, 14, 525, 63, 9377, 8, 785, 63, 409, 14, 1459, 5109, 288, 291, 14, 2703, 14, 952, 8, 1099, 59, 16, 61, 435, 283, 283, 435, 620, 8, 1099, 59, 17, 2459, 398, 327, 30345, 1478, 267, 291, 14, 2703, 14, 952, 480, 18730, 316, 1478, 531, 267, 308, 14, 6635, 63, 1080, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
purduesigbots/pros-cli
pros/common/ui/interactive/components/container.py
1
1157
from typing import * from pros.common.ui.interactive.parameters import BooleanParameter from .component import Component class Container(Component): """ A Container has multiple Components, possibly a title, and possibly a description """ def __init__(self, *elements: Component, title: Optional[AnyStr] = None, description: Optional[AnyStr] = None, collapsed: Union[BooleanParameter, bool] = False): self.title = title self.description = description self.elements = elements self.collapsed = BooleanParameter(collapsed) if isinstance(collapsed, bool) else collapsed def __getstate__(self): extra_state = { 'uuid': self.collapsed.uuid, 'collapsed': self.collapsed.value } if self.title is not None: extra_state['title'] = self.title if self.description is not None: extra_state['description'] = self.description return dict( **super(Container, self).__getstate__(), **extra_state, elements=[e.__getstate__() for e in self.elements] )
mpl-2.0
[ 504, 14090, 492, 627, 199, 199, 504, 557, 83, 14, 2330, 14, 1907, 14, 13543, 14, 3214, 492, 9411, 4720, 199, 504, 1275, 3173, 492, 12727, 421, 199, 533, 15395, 8, 7004, 304, 272, 408, 272, 437, 15395, 965, 3663, 17823, 12, 12570, 282, 2538, 12, 436, 12570, 282, 1369, 272, 408, 339, 347, 636, 826, 721, 277, 12, 627, 5527, 26, 12727, 12, 326, 2538, 26, 4879, 59, 9874, 2848, 61, 275, 488, 12, 1369, 26, 4879, 59, 9874, 2848, 61, 275, 488, 12, 326, 31219, 26, 15961, 59, 4082, 4720, 12, 2155, 61, 275, 756, 304, 267, 291, 14, 1213, 275, 2538, 267, 291, 14, 1802, 275, 1369, 267, 291, 14, 5527, 275, 4008, 267, 291, 14, 761, 9982, 275, 9411, 4720, 8, 761, 9982, 9, 340, 1228, 8, 761, 9982, 12, 2155, 9, 587, 31219, 339, 347, 636, 16011, 721, 277, 304, 267, 2402, 63, 929, 275, 469, 288, 283, 2580, 356, 291, 14, 761, 9982, 14, 2580, 12, 288, 283, 761, 9982, 356, 291, 14, 761, 9982, 14, 585, 267, 789, 267, 340, 291, 14, 1213, 365, 440, 488, 26, 288, 2402, 63, 929, 459, 1213, 418, 275, 291, 14, 1213, 267, 340, 291, 14, 1802, 365, 440, 488, 26, 288, 2402, 63, 929, 459, 1802, 418, 275, 291, 14, 1802, 267, 372, 1211, 8, 288, 1011, 4792, 8, 4076, 12, 291, 2843, 16011, 29709, 288, 1011, 2911, 63, 929, 12, 288, 4008, 1524, 69, 855, 16011, 4533, 367, 325, 315, 291, 14, 5527, 61, 267, 776, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 14090, 492, 627, 199, 199, 504, 557, 83, 14, 2330, 14, 1907, 14, 13543, 14, 3214, 492, 9411, 4720, 199, 504, 1275, 3173, 492, 12727, 421, 199, 533, 15395, 8, 7004, 304, 272, 408, 272, 437, 15395, 965, 3663, 17823, 12, 12570, 282, 2538, 12, 436, 12570, 282, 1369, 272, 408, 339, 347, 636, 826, 721, 277, 12, 627, 5527, 26, 12727, 12, 326, 2538, 26, 4879, 59, 9874, 2848, 61, 275, 488, 12, 1369, 26, 4879, 59, 9874, 2848, 61, 275, 488, 12, 326, 31219, 26, 15961, 59, 4082, 4720, 12, 2155, 61, 275, 756, 304, 267, 291, 14, 1213, 275, 2538, 267, 291, 14, 1802, 275, 1369, 267, 291, 14, 5527, 275, 4008, 267, 291, 14, 761, 9982, 275, 9411, 4720, 8, 761, 9982, 9, 340, 1228, 8, 761, 9982, 12, 2155, 9, 587, 31219, 339, 347, 636, 16011, 721, 277, 304, 267, 2402, 63, 929, 275, 469, 288, 283, 2580, 356, 291, 14, 761, 9982, 14, 2580, 12, 288, 283, 761, 9982, 356, 291, 14, 761, 9982, 14, 585, 267, 789, 267, 340, 291, 14, 1213, 365, 440, 488, 26, 288, 2402, 63, 929, 459, 1213, 418, 275, 291, 14, 1213, 267, 340, 291, 14, 1802, 365, 440, 488, 26, 288, 2402, 63, 929, 459, 1802, 418, 275, 291, 14, 1802, 267, 372, 1211, 8, 288, 1011, 4792, 8, 4076, 12, 291, 2843, 16011, 29709, 288, 1011, 2911, 63, 929, 12, 288, 4008, 1524, 69, 855, 16011, 4533, 367, 325, 315, 291, 14, 5527, 61, 267, 776, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
Stanford-Online/edx-platform
common/djangoapps/course_modes/helpers.py
23
3214
""" Helper methods for CourseModes. """ from django.utils.translation import ugettext_lazy as _ from course_modes.models import CourseMode from student.helpers import VERIFY_STATUS_APPROVED, VERIFY_STATUS_NEED_TO_VERIFY, VERIFY_STATUS_SUBMITTED DISPLAY_VERIFIED = "verified" DISPLAY_HONOR = "honor" DISPLAY_AUDIT = "audit" DISPLAY_PROFESSIONAL = "professional" def enrollment_mode_display(mode, verification_status, course_id): """ Select appropriate display strings and CSS classes. Uses mode and verification status to select appropriate display strings and CSS classes for certificate display. Args: mode (str): enrollment mode. verification_status (str) : verification status of student Returns: dictionary: """ show_image = False image_alt = '' enrollment_title = '' enrollment_value = '' display_mode = _enrollment_mode_display(mode, verification_status, course_id) if display_mode == DISPLAY_VERIFIED: if verification_status in [VERIFY_STATUS_NEED_TO_VERIFY, VERIFY_STATUS_SUBMITTED]: enrollment_title = _("Your verification is pending") enrollment_value = _("Verified: Pending Verification") show_image = True image_alt = _("ID verification pending") elif verification_status == VERIFY_STATUS_APPROVED: enrollment_title = _("You're enrolled as a verified student") enrollment_value = _("Verified") show_image = True image_alt = _("ID Verified Ribbon/Badge") elif display_mode == DISPLAY_HONOR: enrollment_title = _("You're enrolled as an honor code student") enrollment_value = _("Honor Code") elif display_mode == DISPLAY_PROFESSIONAL: enrollment_title = _("You're enrolled as a professional education student") enrollment_value = _("Professional Ed") return { 'enrollment_title': unicode(enrollment_title), 'enrollment_value': unicode(enrollment_value), 'show_image': show_image, 'image_alt': unicode(image_alt), 'display_mode': _enrollment_mode_display(mode, verification_status, course_id) } def _enrollment_mode_display(enrollment_mode, verification_status, course_id): """Checking enrollment mode and status and returns the display mode Args: enrollment_mode (str): enrollment mode. verification_status (str) : verification status of student Returns: display_mode (str) : display mode for certs """ course_mode_slugs = [mode.slug for mode in CourseMode.modes_for_course(course_id)] if enrollment_mode == CourseMode.VERIFIED: if verification_status in [VERIFY_STATUS_NEED_TO_VERIFY, VERIFY_STATUS_SUBMITTED, VERIFY_STATUS_APPROVED]: display_mode = DISPLAY_VERIFIED elif DISPLAY_HONOR in course_mode_slugs: display_mode = DISPLAY_HONOR else: display_mode = DISPLAY_AUDIT elif enrollment_mode in [CourseMode.PROFESSIONAL, CourseMode.NO_ID_PROFESSIONAL_MODE]: display_mode = DISPLAY_PROFESSIONAL else: display_mode = enrollment_mode return display_mode
agpl-3.0
[ 624, 11642, 3102, 367, 5531, 19578, 14, 408, 199, 504, 1639, 14, 1208, 14, 6893, 492, 10366, 63, 6395, 465, 485, 199, 199, 504, 2518, 63, 10433, 14, 992, 492, 27312, 199, 504, 6474, 14, 7546, 492, 12348, 13367, 63, 6305, 63, 1282, 2514, 14112, 12, 12348, 13367, 63, 6305, 63, 28888, 63, 2566, 63, 22443, 12, 12348, 13367, 63, 6305, 63, 6348, 13965, 52, 1149, 199, 199, 20993, 63, 2111, 31223, 275, 298, 12949, 2, 199, 20993, 63, 40, 615, 726, 275, 298, 19923, 2, 199, 20993, 63, 33, 3383, 649, 275, 298, 14274, 2, 199, 20993, 63, 2514, 38, 9577, 748, 275, 298, 14979, 28661, 2, 421, 199, 318, 14869, 63, 632, 63, 2918, 8, 632, 12, 14786, 63, 1205, 12, 2518, 63, 344, 304, 272, 408, 9496, 5827, 2929, 3326, 436, 15750, 3992, 14, 398, 14911, 818, 436, 14786, 2004, 370, 3504, 5827, 2929, 3326, 436, 15750, 3992, 267, 367, 5897, 2929, 14, 398, 3033, 26, 288, 818, 334, 495, 304, 14869, 818, 14, 288, 14786, 63, 1205, 334, 495, 9, 520, 14786, 2004, 402, 6474, 398, 1803, 26, 288, 2600, 26, 272, 408, 272, 2498, 63, 1569, 275, 756, 272, 1834, 63, 4478, 275, 2125, 272, 14869, 63, 1213, 275, 2125, 272, 14869, 63, 585, 275, 2125, 272, 2929, 63, 632, 275, 485, 12214, 63, 632, 63, 2918, 8, 632, 12, 14786, 63, 1205, 12, 2518, 63, 344, 9, 339, 340, 2929, 63, 632, 508, 7587, 11625, 63, 2111, 31223, 26, 267, 340, 14786, 63, 1205, 315, 359, 22443, 63, 6305, 63, 28888, 63, 2566, 63, 22443, 12, 12348, 13367, 63, 6305, 63, 6348, 13965, 52, 1149, 2189, 288, 14869, 63, 1213, 275, 3824, 14398, 14786, 365, 9413, 531, 288, 14869, 63, 585, 275, 3824, 3673, 4541, 26, 29216, 5444, 7313, 531, 288, 2498, 63, 1569, 275, 715, 288, 1834, 63, 4478, 275, 3824, 998, 14786, 9413, 531, 267, 916, 14786, 63, 1205, 508, 12348, 13367, 63, 6305, 63, 1282, 2514, 14112, 26, 288, 14869, 63, 1213, 275, 3824, 5556, 3984, 26802, 465, 282, 16317, 6474, 531, 288, 14869, 63, 585, 275, 3824, 3673, 4541, 531, 288, 2498, 63, 1569, 275, 715, 288, 1834, 63, 4478, 275, 3824, 998, 5444, 4541, 820, 1892, 13520, 15, 5725, 303, 531, 272, 916, 2929, 63, 632, 508, 7587, 11625, 63, 40, 615, 726, 26, 267, 14869, 63, 1213, 275, 3824, 5556, 3984, 26802, 465, 376, 394, 15034, 1233, 6474, 531, 267, 14869, 63, 585, 275, 3824, 40, 15034, 5495, 531, 272, 916, 2929, 63, 632, 508, 7587, 11625, 63, 2514, 38, 9577, 748, 26, 267, 14869, 63, 1213, 275, 3824, 5556, 3984, 26802, 465, 282, 22398, 28661, 3988, 30500, 6474, 531, 267, 14869, 63, 585, 275, 3824, 919, 70, 28661, 17379, 531, 339, 372, 469, 267, 283, 12214, 63, 1213, 356, 2649, 8, 12214, 63, 1213, 395, 267, 283, 12214, 63, 585, 356, 2649, 8, 12214, 63, 585, 395, 267, 283, 2384, 63, 1569, 356, 2498, 63, 1569, 12, 267, 283, 1569, 63, 4478, 356, 2649, 8, 1569, 63, 4478, 395, 267, 283, 2918, 63, 632, 356, 485, 12214, 63, 632, 63, 2918, 8, 632, 12, 14786, 63, 1205, 12, 2518, 63, 344, 9, 272, 789, 421, 199, 318, 485, 12214, 63, 632, 63, 2918, 8, 12214, 63, 632, 12, 14786, 63, 1205, 12, 2518, 63, 344, 304, 272, 408, 14740, 14869, 818, 436, 2004, 436, 2529, 314, 2929, 818, 1362, 3033, 26, 267, 14869, 63, 632, 334, 495, 304, 14869, 818, 14, 267, 14786, 63, 1205, 334, 495, 9, 520, 14786, 2004, 402, 6474, 339, 1803, 26, 267, 2929, 63, 632, 334, 495, 9, 520, 2929, 818, 367, 25949, 272, 408, 272, 2518, 63, 632, 63, 2482, 85, 458, 275, 359, 632, 14, 5464, 367, 818, 315, 27312, 14, 10433, 63, 509, 63, 1972, 8, 1972, 63, 344, 1874, 339, 340, 14869, 63, 632, 508, 27312, 14, 2111, 31223, 26, 267, 340, 14786, 63, 1205, 315, 359, 22443, 63, 6305, 63, 28888, 63, 2566, 63, 22443, 12, 12348, 13367, 63, 6305, 63, 6348, 13965, 52, 1149, 12, 12348, 13367, 63, 6305, 63, 1282, 2514, 14112, 2189, 288, 2929, 63, 632, 275, 7587, 11625, 63, 2111, 31223, 267, 916, 7587, 11625, 63, 40, 615, 726, 315, 2518, 63, 632, 63, 2482, 85, 458, 26, 288, 2929, 63, 632, 275, 7587, 11625, 63, 40, 615, 726, 267, 587, 26, 288, 2929, 63, 632, 275, 7587, 11625, 63, 33, 3383, 649, 272, 916, 14869, 63, 632, 315, 359, 6979, 1385, 14, 2514, 38, 9577, 748, 12, 27312, 14, 2826, 63, 998, 63, 2514, 38, 9577, 748, 63, 6963, 2189, 267, 2929, 63, 632, 275, 7587, 11625, 63, 2514, 38, 9577, 748, 272, 587, 26, 267, 2929, 63, 632, 275, 14869, 63, 632, 339, 372, 2929, 63, 632, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 11642, 3102, 367, 5531, 19578, 14, 408, 199, 504, 1639, 14, 1208, 14, 6893, 492, 10366, 63, 6395, 465, 485, 199, 199, 504, 2518, 63, 10433, 14, 992, 492, 27312, 199, 504, 6474, 14, 7546, 492, 12348, 13367, 63, 6305, 63, 1282, 2514, 14112, 12, 12348, 13367, 63, 6305, 63, 28888, 63, 2566, 63, 22443, 12, 12348, 13367, 63, 6305, 63, 6348, 13965, 52, 1149, 199, 199, 20993, 63, 2111, 31223, 275, 298, 12949, 2, 199, 20993, 63, 40, 615, 726, 275, 298, 19923, 2, 199, 20993, 63, 33, 3383, 649, 275, 298, 14274, 2, 199, 20993, 63, 2514, 38, 9577, 748, 275, 298, 14979, 28661, 2, 421, 199, 318, 14869, 63, 632, 63, 2918, 8, 632, 12, 14786, 63, 1205, 12, 2518, 63, 344, 304, 272, 408, 9496, 5827, 2929, 3326, 436, 15750, 3992, 14, 398, 14911, 818, 436, 14786, 2004, 370, 3504, 5827, 2929, 3326, 436, 15750, 3992, 267, 367, 5897, 2929, 14, 398, 3033, 26, 288, 818, 334, 495, 304, 14869, 818, 14, 288, 14786, 63, 1205, 334, 495, 9, 520, 14786, 2004, 402, 6474, 398, 1803, 26, 288, 2600, 26, 272, 408, 272, 2498, 63, 1569, 275, 756, 272, 1834, 63, 4478, 275, 2125, 272, 14869, 63, 1213, 275, 2125, 272, 14869, 63, 585, 275, 2125, 272, 2929, 63, 632, 275, 485, 12214, 63, 632, 63, 2918, 8, 632, 12, 14786, 63, 1205, 12, 2518, 63, 344, 9, 339, 340, 2929, 63, 632, 508, 7587, 11625, 63, 2111, 31223, 26, 267, 340, 14786, 63, 1205, 315, 359, 22443, 63, 6305, 63, 28888, 63, 2566, 63, 22443, 12, 12348, 13367, 63, 6305, 63, 6348, 13965, 52, 1149, 2189, 288, 14869, 63, 1213, 275, 3824, 14398, 14786, 365, 9413, 531, 288, 14869, 63, 585, 275, 3824, 3673, 4541, 26, 29216, 5444, 7313, 531, 288, 2498, 63, 1569, 275, 715, 288, 1834, 63, 4478, 275, 3824, 998, 14786, 9413, 531, 267, 916, 14786, 63, 1205, 508, 12348, 13367, 63, 6305, 63, 1282, 2514, 14112, 26, 288, 14869, 63, 1213, 275, 3824, 5556, 3984, 26802, 465, 282, 16317, 6474, 531, 288, 14869, 63, 585, 275, 3824, 3673, 4541, 531, 288, 2498, 63, 1569, 275, 715, 288, 1834, 63, 4478, 275, 3824, 998, 5444, 4541, 820, 1892, 13520, 15, 5725, 303, 531, 272, 916, 2929, 63, 632, 508, 7587, 11625, 63, 40, 615, 726, 26, 267, 14869, 63, 1213, 275, 3824, 5556, 3984, 26802, 465, 376, 394, 15034, 1233, 6474, 531, 267, 14869, 63, 585, 275, 3824, 40, 15034, 5495, 531, 272, 916, 2929, 63, 632, 508, 7587, 11625, 63, 2514, 38, 9577, 748, 26, 267, 14869, 63, 1213, 275, 3824, 5556, 3984, 26802, 465, 282, 22398, 28661, 3988, 30500, 6474, 531, 267, 14869, 63, 585, 275, 3824, 919, 70, 28661, 17379, 531, 339, 372, 469, 267, 283, 12214, 63, 1213, 356, 2649, 8, 12214, 63, 1213, 395, 267, 283, 12214, 63, 585, 356, 2649, 8, 12214, 63, 585, 395, 267, 283, 2384, 63, 1569, 356, 2498, 63, 1569, 12, 267, 283, 1569, 63, 4478, 356, 2649, 8, 1569, 63, 4478, 395, 267, 283, 2918, 63, 632, 356, 485, 12214, 63, 632, 63, 2918, 8, 632, 12, 14786, 63, 1205, 12, 2518, 63, 344, 9, 272, 789, 421, 199, 318, 485, 12214, 63, 632, 63, 2918, 8, 12214, 63, 632, 12, 14786, 63, 1205, 12, 2518, 63, 344, 304, 272, 408, 14740, 14869, 818, 436, 2004, 436, 2529, 314, 2929, 818, 1362, 3033, 26, 267, 14869, 63, 632, 334, 495, 304, 14869, 818, 14, 267, 14786, 63, 1205, 334, 495, 9, 520, 14786, 2004, 402, 6474, 339, 1803, 26, 267, 2929, 63, 632, 334, 495, 9, 520, 2929, 818, 367, 25949, 272, 408, 272, 2518, 63, 632, 63, 2482, 85, 458, 275, 359, 632, 14, 5464, 367, 818, 315, 27312, 14, 10433, 63, 509, 63, 1972, 8, 1972, 63, 344, 1874, 339, 340, 14869, 63, 632, 508, 27312, 14, 2111, 31223, 26, 267, 340, 14786, 63, 1205, 315, 359, 22443, 63, 6305, 63, 28888, 63, 2566, 63, 22443, 12, 12348, 13367, 63, 6305, 63, 6348, 13965, 52, 1149, 12, 12348, 13367, 63, 6305, 63, 1282, 2514, 14112, 2189, 288, 2929, 63, 632, 275, 7587, 11625, 63, 2111, 31223, 267, 916, 7587, 11625, 63, 40, 615, 726, 315, 2518, 63, 632, 63, 2482, 85, 458, 26, 288, 2929, 63, 632, 275, 7587, 11625, 63, 40, 615, 726, 267, 587, 26, 288, 2929, 63, 632, 275, 7587, 11625, 63, 33, 3383, 649, 272, 916, 14869, 63, 632, 315, 359, 6979, 1385, 14, 2514, 38, 9577, 748, 12, 27312, 14, 2826, 63, 998, 63, 2514, 38, 9577, 748, 63, 6963, 2189, 267, 2929, 63, 632, 275, 7587, 11625, 63, 2514, 38, 9577, 748, 272, 587, 26, 267, 2929, 63, 632, 275, 14869, 63, 632, 339, 372, 2929, 63, 632, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 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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 ]
Changaco/oh-mainline
vendor/packages/html5lib/html5lib/tests/test_tokenizer.py
72
6826
import sys import os import unittest import cStringIO import warnings import re try: import json except ImportError: import simplejson as json from support import html5lib_test_files from html5lib.tokenizer import HTMLTokenizer from html5lib import constants class TokenizerTestParser(object): def __init__(self, initialState, lastStartTag=None): self.tokenizer = HTMLTokenizer self._state = initialState self._lastStartTag = lastStartTag def parse(self, stream, encoding=None, innerHTML=False): tokenizer = self.tokenizer(stream, encoding) self.outputTokens = [] tokenizer.state = getattr(tokenizer, self._state) if self._lastStartTag is not None: tokenizer.currentToken = {"type": "startTag", "name":self._lastStartTag} types = dict((v,k) for k,v in constants.tokenTypes.iteritems()) for token in tokenizer: getattr(self, 'process%s' % types[token["type"]])(token) return self.outputTokens def processDoctype(self, token): self.outputTokens.append([u"DOCTYPE", token["name"], token["publicId"], token["systemId"], token["correct"]]) def processStartTag(self, token): self.outputTokens.append([u"StartTag", token["name"], dict(token["data"][::-1]), token["selfClosing"]]) def processEmptyTag(self, token): if token["name"] not in constants.voidElements: self.outputTokens.append(u"ParseError") self.outputTokens.append([u"StartTag", token["name"], dict(token["data"][::-1])]) def processEndTag(self, token): self.outputTokens.append([u"EndTag", token["name"], token["selfClosing"]]) def processComment(self, token): self.outputTokens.append([u"Comment", token["data"]]) def processSpaceCharacters(self, token): self.outputTokens.append([u"Character", token["data"]]) self.processSpaceCharacters = self.processCharacters def processCharacters(self, token): self.outputTokens.append([u"Character", token["data"]]) def processEOF(self, token): pass def processParseError(self, token): self.outputTokens.append([u"ParseError", token["data"]]) def concatenateCharacterTokens(tokens): outputTokens = [] for token in tokens: if not "ParseError" in token and token[0] == "Character": if (outputTokens and not "ParseError" in outputTokens[-1] and outputTokens[-1][0] == "Character"): outputTokens[-1][1] += token[1] else: outputTokens.append(token) else: outputTokens.append(token) return outputTokens def normalizeTokens(tokens): # TODO: convert tests to reflect arrays for i, token in enumerate(tokens): if token[0] == u'ParseError': tokens[i] = token[0] return tokens def tokensMatch(expectedTokens, receivedTokens, ignoreErrorOrder, ignoreErrors=False): """Test whether the test has passed or failed If the ignoreErrorOrder flag is set to true we don't test the relative positions of parse errors and non parse errors """ checkSelfClosing= False for token in expectedTokens: if (token[0] == "StartTag" and len(token) == 4 or token[0] == "EndTag" and len(token) == 3): checkSelfClosing = True break if not checkSelfClosing: for token in receivedTokens: if token[0] == "StartTag" or token[0] == "EndTag": token.pop() if not ignoreErrorOrder and not ignoreErrors: return expectedTokens == receivedTokens else: #Sort the tokens into two groups; non-parse errors and parse errors tokens = {"expected":[[],[]], "received":[[],[]]} for tokenType, tokenList in zip(tokens.keys(), (expectedTokens, receivedTokens)): for token in tokenList: if token != "ParseError": tokens[tokenType][0].append(token) else: if not ignoreErrors: tokens[tokenType][1].append(token) return tokens["expected"] == tokens["received"] def unescape_test(test): def decode(inp): return inp.decode("unicode-escape") test["input"] = decode(test["input"]) for token in test["output"]: if token == "ParseError": continue else: token[1] = decode(token[1]) if len(token) > 2: for key, value in token[2]: del token[2][key] token[2][decode(key)] = decode(value) return test def runTokenizerTest(test): #XXX - move this out into the setup function #concatenate all consecutive character tokens into a single token if 'doubleEscaped' in test: test = unescape_test(test) expected = concatenateCharacterTokens(test['output']) if 'lastStartTag' not in test: test['lastStartTag'] = None outBuffer = cStringIO.StringIO() stdout = sys.stdout sys.stdout = outBuffer parser = TokenizerTestParser(test['initialState'], test['lastStartTag']) tokens = parser.parse(test['input']) tokens = concatenateCharacterTokens(tokens) received = normalizeTokens(tokens) errorMsg = u"\n".join(["\n\nInitial state:", test['initialState'] , "\nInput:", unicode(test['input']), "\nExpected:", unicode(expected), "\nreceived:", unicode(tokens)]) errorMsg = errorMsg.encode("utf-8") ignoreErrorOrder = test.get('ignoreErrorOrder', False) assert tokensMatch(expected, received, ignoreErrorOrder), errorMsg def _doCapitalize(match): return match.group(1).upper() _capitalizeRe = re.compile(r"\W+(\w)").sub def capitalize(s): s = s.lower() s = _capitalizeRe(_doCapitalize, s) return s def test_tokenizer(): for filename in html5lib_test_files('tokenizer', '*.test'): tests = json.load(file(filename)) testName = os.path.basename(filename).replace(".test","") if 'tests' in tests: for index,test in enumerate(tests['tests']): #Skip tests with a self closing flag skip = False if 'initialStates' not in test: test["initialStates"] = ["Data state"] for initialState in test["initialStates"]: test["initialState"] = capitalize(initialState) yield runTokenizerTest, test
agpl-3.0
[ 646, 984, 199, 646, 747, 199, 646, 2882, 199, 646, 15073, 199, 646, 3598, 199, 646, 295, 199, 199, 893, 26, 272, 492, 2022, 199, 2590, 3545, 26, 272, 492, 13804, 465, 2022, 199, 199, 504, 2291, 492, 3517, 21, 773, 63, 396, 63, 1725, 199, 504, 3517, 21, 773, 14, 13771, 492, 4163, 21782, 199, 504, 3517, 21, 773, 492, 5262, 199, 199, 533, 8767, 1793, 774, 2842, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 2536, 2223, 12, 2061, 17697, 29, 403, 304, 267, 291, 14, 13771, 275, 4163, 21782, 267, 291, 423, 929, 275, 2536, 2223, 267, 291, 423, 2019, 17697, 275, 2061, 17697, 339, 347, 2198, 8, 277, 12, 2547, 12, 2644, 29, 403, 12, 6506, 4943, 29, 797, 304, 267, 14803, 275, 291, 14, 13771, 8, 1745, 12, 2644, 9, 267, 291, 14, 1199, 16419, 275, 942, 398, 14803, 14, 929, 275, 2519, 8, 13771, 12, 291, 423, 929, 9, 267, 340, 291, 423, 2019, 17697, 365, 440, 488, 26, 288, 14803, 14, 11631, 275, 2420, 466, 582, 298, 16252, 401, 221, 4228, 298, 354, 582, 277, 423, 2019, 17697, 93, 398, 2943, 275, 1211, 1332, 86, 12, 75, 9, 367, 1022, 12, 86, 315, 5262, 14, 1418, 4100, 14, 4611, 1012, 267, 367, 1526, 315, 14803, 26, 288, 2519, 8, 277, 12, 283, 1412, 5, 83, 7, 450, 2943, 59, 1418, 905, 466, 937, 566, 8, 1418, 9, 398, 372, 291, 14, 1199, 16419, 339, 347, 2112, 21629, 8, 277, 12, 1526, 304, 267, 291, 14, 1199, 16419, 14, 740, 779, 85, 2, 16556, 401, 1526, 905, 354, 2255, 1526, 905, 25311, 2255, 3303, 1526, 905, 20150, 2255, 1526, 905, 4525, 937, 566, 339, 347, 2112, 17697, 8, 277, 12, 1526, 304, 267, 291, 14, 1199, 16419, 14, 740, 779, 85, 2, 17697, 401, 1526, 905, 354, 2255, 221, 3303, 1211, 8, 1418, 905, 576, 9210, 21123, 17, 2522, 1526, 905, 26770, 937, 566, 339, 347, 2112, 4699, 1931, 8, 277, 12, 1526, 304, 267, 340, 1526, 905, 354, 937, 440, 315, 5262, 14, 1647, 6255, 26, 288, 291, 14, 1199, 16419, 14, 740, 8, 85, 2, 9123, 531, 267, 291, 14, 1199, 16419, 14, 740, 779, 85, 2, 17697, 401, 1526, 905, 354, 2255, 1211, 8, 1418, 905, 576, 9210, 21123, 17, 24310, 339, 347, 2112, 16906, 8, 277, 12, 1526, 304, 267, 291, 14, 1199, 16419, 14, 740, 779, 85, 2, 16906, 401, 1526, 905, 354, 2255, 221, 3303, 1526, 905, 26770, 937, 566, 339, 347, 2112, 7488, 8, 277, 12, 1526, 304, 267, 291, 14, 1199, 16419, 14, 740, 779, 85, 2, 7488, 401, 1526, 905, 576, 937, 566, 339, 347, 2112, 28501, 8, 277, 12, 1526, 304, 267, 291, 14, 1199, 16419, 14, 740, 779, 85, 2, 14852, 401, 1526, 905, 576, 937, 566, 267, 291, 14, 1412, 28501, 275, 291, 14, 1412, 9272, 339, 347, 2112, 9272, 8, 277, 12, 1526, 304, 267, 291, 14, 1199, 16419, 14, 740, 779, 85, 2, 14852, 401, 1526, 905, 576, 937, 566, 339, 347, 2112, 13178, 8, 277, 12, 1526, 304, 267, 986, 339, 347, 2112, 9123, 8, 277, 12, 1526, 304, 267, 291, 14, 1199, 16419, 14, 740, 779, 85, 2, 9123, 401, 1526, 905, 576, 937, 566, 199, 199, 318, 24788, 14852, 16419, 8, 4504, 304, 272, 1072, 16419, 275, 942, 272, 367, 1526, 315, 4645, 26, 267, 340, 440, 298, 9123, 2, 315, 1526, 436, 1526, 59, 16, 61, 508, 298, 14852, 582, 288, 340, 334, 1199, 16419, 436, 440, 298, 9123, 2, 315, 1072, 16419, 1988, 17, 61, 436, 355, 1072, 16419, 1988, 17, 1527, 16, 61, 508, 298, 14852, 2349, 355, 1072, 16419, 1988, 17, 1527, 17, 61, 847, 1526, 59, 17, 61, 288, 587, 26, 355, 1072, 16419, 14, 740, 8, 1418, 9, 267, 587, 26, 288, 1072, 16419, 14, 740, 8, 1418, 9, 272, 372, 1072, 16419, 199, 199, 318, 7666, 16419, 8, 4504, 304, 272, 327, 3254, 26, 3957, 2295, 370, 16806, 6572, 272, 367, 284, 12, 1526, 315, 3874, 8, 4504, 304, 267, 340, 1526, 59, 16, 61, 508, 399, 7, 9123, 356, 288, 4645, 59, 73, 61, 275, 1526, 59, 16, 61, 272, 372, 4645, 199, 199, 318, 4645, 4486, 8, 2062, 16419, 12, 3086, 16419, 12, 3686, 547, 4738, 12, 355, 3686, 9298, 29, 797, 304, 272, 408, 774, 3775, 314, 511, 965, 3032, 503, 3405, 339, 982, 314, 3686, 547, 4738, 3305, 365, 663, 370, 2549, 781, 2793, 1133, 511, 314, 3847, 272, 12266, 402, 2198, 2552, 436, 2222, 2198, 2552, 272, 408, 272, 1104, 12887, 18433, 29, 756, 272, 367, 1526, 315, 1420, 16419, 26, 267, 340, 334, 1418, 59, 16, 61, 508, 298, 17697, 2, 436, 822, 8, 1418, 9, 508, 841, 288, 503, 1526, 59, 16, 61, 508, 298, 16906, 2, 436, 822, 8, 1418, 9, 508, 650, 304, 288, 1104, 12887, 18433, 275, 715, 288, 2059, 339, 340, 440, 1104, 12887, 18433, 26, 267, 367, 1526, 315, 3086, 16419, 26, 288, 340, 1526, 59, 16, 61, 508, 298, 17697, 2, 503, 1526, 59, 16, 61, 508, 298, 16906, 582, 355, 1526, 14, 1935, 342, 339, 340, 440, 3686, 547, 4738, 436, 440, 3686, 9298, 26, 267, 372, 1420, 16419, 508, 3086, 16419, 272, 587, 26, 267, 327, 14376, 314, 4645, 1901, 2877, 4652, 27, 2222, 13, 1122, 2552, 436, 2198, 2552, 267, 4645, 275, 2420, 2062, 582, 9046, 6922, 2365, 298, 9226, 582, 9046, 6922, 2677, 93, 267, 367, 1526, 804, 12, 1526, 1296, 315, 3482, 8, 4504, 14, 1612, 1062, 1460, 334, 2062, 16419, 12, 3086, 16419, 2298, 288, 367, 1526, 315, 1526, 1296, 26, 355, 340, 1526, 1137, 298, 9123, 582, 490, 4645, 59, 1418, 804, 1527, 16, 1055, 740, 8, 1418, 9, 355, 587, 26, 490, 340, 440, 3686, 9298, 26, 717, 4645, 59, 1418, 804, 1527, 17, 1055, 740, 8, 1418, 9, 267, 372, 4645, 905, 2062, 937, 508, 4645, 905, 9226, 937, 199, 199, 318, 22221, 63, 396, 8, 396, 304, 272, 347, 4849, 8, 11416, 304, 267, 372, 10702, 14, 2708, 480, 2975, 13, 3765, 531, 339, 511, 905, 1210, 937, 275, 4849, 8, 396, 905, 1210, 3135, 272, 367, 1526, 315 ]
[ 984, 199, 646, 747, 199, 646, 2882, 199, 646, 15073, 199, 646, 3598, 199, 646, 295, 199, 199, 893, 26, 272, 492, 2022, 199, 2590, 3545, 26, 272, 492, 13804, 465, 2022, 199, 199, 504, 2291, 492, 3517, 21, 773, 63, 396, 63, 1725, 199, 504, 3517, 21, 773, 14, 13771, 492, 4163, 21782, 199, 504, 3517, 21, 773, 492, 5262, 199, 199, 533, 8767, 1793, 774, 2842, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 2536, 2223, 12, 2061, 17697, 29, 403, 304, 267, 291, 14, 13771, 275, 4163, 21782, 267, 291, 423, 929, 275, 2536, 2223, 267, 291, 423, 2019, 17697, 275, 2061, 17697, 339, 347, 2198, 8, 277, 12, 2547, 12, 2644, 29, 403, 12, 6506, 4943, 29, 797, 304, 267, 14803, 275, 291, 14, 13771, 8, 1745, 12, 2644, 9, 267, 291, 14, 1199, 16419, 275, 942, 398, 14803, 14, 929, 275, 2519, 8, 13771, 12, 291, 423, 929, 9, 267, 340, 291, 423, 2019, 17697, 365, 440, 488, 26, 288, 14803, 14, 11631, 275, 2420, 466, 582, 298, 16252, 401, 221, 4228, 298, 354, 582, 277, 423, 2019, 17697, 93, 398, 2943, 275, 1211, 1332, 86, 12, 75, 9, 367, 1022, 12, 86, 315, 5262, 14, 1418, 4100, 14, 4611, 1012, 267, 367, 1526, 315, 14803, 26, 288, 2519, 8, 277, 12, 283, 1412, 5, 83, 7, 450, 2943, 59, 1418, 905, 466, 937, 566, 8, 1418, 9, 398, 372, 291, 14, 1199, 16419, 339, 347, 2112, 21629, 8, 277, 12, 1526, 304, 267, 291, 14, 1199, 16419, 14, 740, 779, 85, 2, 16556, 401, 1526, 905, 354, 2255, 1526, 905, 25311, 2255, 3303, 1526, 905, 20150, 2255, 1526, 905, 4525, 937, 566, 339, 347, 2112, 17697, 8, 277, 12, 1526, 304, 267, 291, 14, 1199, 16419, 14, 740, 779, 85, 2, 17697, 401, 1526, 905, 354, 2255, 221, 3303, 1211, 8, 1418, 905, 576, 9210, 21123, 17, 2522, 1526, 905, 26770, 937, 566, 339, 347, 2112, 4699, 1931, 8, 277, 12, 1526, 304, 267, 340, 1526, 905, 354, 937, 440, 315, 5262, 14, 1647, 6255, 26, 288, 291, 14, 1199, 16419, 14, 740, 8, 85, 2, 9123, 531, 267, 291, 14, 1199, 16419, 14, 740, 779, 85, 2, 17697, 401, 1526, 905, 354, 2255, 1211, 8, 1418, 905, 576, 9210, 21123, 17, 24310, 339, 347, 2112, 16906, 8, 277, 12, 1526, 304, 267, 291, 14, 1199, 16419, 14, 740, 779, 85, 2, 16906, 401, 1526, 905, 354, 2255, 221, 3303, 1526, 905, 26770, 937, 566, 339, 347, 2112, 7488, 8, 277, 12, 1526, 304, 267, 291, 14, 1199, 16419, 14, 740, 779, 85, 2, 7488, 401, 1526, 905, 576, 937, 566, 339, 347, 2112, 28501, 8, 277, 12, 1526, 304, 267, 291, 14, 1199, 16419, 14, 740, 779, 85, 2, 14852, 401, 1526, 905, 576, 937, 566, 267, 291, 14, 1412, 28501, 275, 291, 14, 1412, 9272, 339, 347, 2112, 9272, 8, 277, 12, 1526, 304, 267, 291, 14, 1199, 16419, 14, 740, 779, 85, 2, 14852, 401, 1526, 905, 576, 937, 566, 339, 347, 2112, 13178, 8, 277, 12, 1526, 304, 267, 986, 339, 347, 2112, 9123, 8, 277, 12, 1526, 304, 267, 291, 14, 1199, 16419, 14, 740, 779, 85, 2, 9123, 401, 1526, 905, 576, 937, 566, 199, 199, 318, 24788, 14852, 16419, 8, 4504, 304, 272, 1072, 16419, 275, 942, 272, 367, 1526, 315, 4645, 26, 267, 340, 440, 298, 9123, 2, 315, 1526, 436, 1526, 59, 16, 61, 508, 298, 14852, 582, 288, 340, 334, 1199, 16419, 436, 440, 298, 9123, 2, 315, 1072, 16419, 1988, 17, 61, 436, 355, 1072, 16419, 1988, 17, 1527, 16, 61, 508, 298, 14852, 2349, 355, 1072, 16419, 1988, 17, 1527, 17, 61, 847, 1526, 59, 17, 61, 288, 587, 26, 355, 1072, 16419, 14, 740, 8, 1418, 9, 267, 587, 26, 288, 1072, 16419, 14, 740, 8, 1418, 9, 272, 372, 1072, 16419, 199, 199, 318, 7666, 16419, 8, 4504, 304, 272, 327, 3254, 26, 3957, 2295, 370, 16806, 6572, 272, 367, 284, 12, 1526, 315, 3874, 8, 4504, 304, 267, 340, 1526, 59, 16, 61, 508, 399, 7, 9123, 356, 288, 4645, 59, 73, 61, 275, 1526, 59, 16, 61, 272, 372, 4645, 199, 199, 318, 4645, 4486, 8, 2062, 16419, 12, 3086, 16419, 12, 3686, 547, 4738, 12, 355, 3686, 9298, 29, 797, 304, 272, 408, 774, 3775, 314, 511, 965, 3032, 503, 3405, 339, 982, 314, 3686, 547, 4738, 3305, 365, 663, 370, 2549, 781, 2793, 1133, 511, 314, 3847, 272, 12266, 402, 2198, 2552, 436, 2222, 2198, 2552, 272, 408, 272, 1104, 12887, 18433, 29, 756, 272, 367, 1526, 315, 1420, 16419, 26, 267, 340, 334, 1418, 59, 16, 61, 508, 298, 17697, 2, 436, 822, 8, 1418, 9, 508, 841, 288, 503, 1526, 59, 16, 61, 508, 298, 16906, 2, 436, 822, 8, 1418, 9, 508, 650, 304, 288, 1104, 12887, 18433, 275, 715, 288, 2059, 339, 340, 440, 1104, 12887, 18433, 26, 267, 367, 1526, 315, 3086, 16419, 26, 288, 340, 1526, 59, 16, 61, 508, 298, 17697, 2, 503, 1526, 59, 16, 61, 508, 298, 16906, 582, 355, 1526, 14, 1935, 342, 339, 340, 440, 3686, 547, 4738, 436, 440, 3686, 9298, 26, 267, 372, 1420, 16419, 508, 3086, 16419, 272, 587, 26, 267, 327, 14376, 314, 4645, 1901, 2877, 4652, 27, 2222, 13, 1122, 2552, 436, 2198, 2552, 267, 4645, 275, 2420, 2062, 582, 9046, 6922, 2365, 298, 9226, 582, 9046, 6922, 2677, 93, 267, 367, 1526, 804, 12, 1526, 1296, 315, 3482, 8, 4504, 14, 1612, 1062, 1460, 334, 2062, 16419, 12, 3086, 16419, 2298, 288, 367, 1526, 315, 1526, 1296, 26, 355, 340, 1526, 1137, 298, 9123, 582, 490, 4645, 59, 1418, 804, 1527, 16, 1055, 740, 8, 1418, 9, 355, 587, 26, 490, 340, 440, 3686, 9298, 26, 717, 4645, 59, 1418, 804, 1527, 17, 1055, 740, 8, 1418, 9, 267, 372, 4645, 905, 2062, 937, 508, 4645, 905, 9226, 937, 199, 199, 318, 22221, 63, 396, 8, 396, 304, 272, 347, 4849, 8, 11416, 304, 267, 372, 10702, 14, 2708, 480, 2975, 13, 3765, 531, 339, 511, 905, 1210, 937, 275, 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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
NeovaHealth/odoo
addons/website_forum_doc/__openerp__.py
322
1508
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2014-Today OpenERP SA (<http://www.openerp.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## { 'name': 'Documentation', 'category': 'Website', 'summary': 'Forum, Documentation', 'version': '1.0', 'description': """ Documentation based on question and pertinent answers of Forum """, 'author': 'OpenERP SA', 'depends': [ 'website_forum' ], 'data': [ 'data/doc_data.xml', 'security/ir.model.access.csv', 'views/doc.xml', 'views/website_doc.xml', ], 'demo': [ 'data/doc_demo.xml', ], 'installable': True, }
agpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 259, 7653, 12, 3232, 5800, 8259, 9274, 199, 3, 259, 1898, 334, 35, 9, 6927, 13, 31982, 7653, 13950, 8642, 1014, 921, 1544, 14, 11267, 14, 957, 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, 91, 272, 283, 354, 356, 283, 17763, 297, 272, 283, 3710, 356, 283, 26354, 297, 272, 283, 4705, 356, 283, 1858, 453, 12, 15249, 297, 272, 283, 1023, 356, 283, 17, 14, 16, 297, 272, 283, 1802, 356, 408, 199, 17763, 4079, 641, 7894, 436, 1126, 1346, 484, 17133, 402, 2104, 453, 267, 10327, 272, 283, 2502, 356, 283, 25347, 13950, 297, 272, 283, 8912, 356, 359, 267, 283, 7360, 63, 10044, 7, 272, 2156, 272, 283, 576, 356, 359, 267, 283, 576, 15, 1301, 63, 576, 14, 1652, 297, 267, 283, 4416, 15, 723, 14, 1238, 14, 2732, 14, 4737, 297, 267, 283, 4196, 15, 1301, 14, 1652, 297, 267, 283, 4196, 15, 7360, 63, 1301, 14, 1652, 297, 272, 2156, 272, 283, 8768, 356, 359, 267, 283, 576, 15, 1301, 63, 8768, 14, 1652, 297, 272, 2156, 272, 283, 21762, 356, 715, 12, 199, 93, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 259, 7653, 12, 3232, 5800, 8259, 9274, 199, 3, 259, 1898, 334, 35, 9, 6927, 13, 31982, 7653, 13950, 8642, 1014, 921, 1544, 14, 11267, 14, 957, 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, 91, 272, 283, 354, 356, 283, 17763, 297, 272, 283, 3710, 356, 283, 26354, 297, 272, 283, 4705, 356, 283, 1858, 453, 12, 15249, 297, 272, 283, 1023, 356, 283, 17, 14, 16, 297, 272, 283, 1802, 356, 408, 199, 17763, 4079, 641, 7894, 436, 1126, 1346, 484, 17133, 402, 2104, 453, 267, 10327, 272, 283, 2502, 356, 283, 25347, 13950, 297, 272, 283, 8912, 356, 359, 267, 283, 7360, 63, 10044, 7, 272, 2156, 272, 283, 576, 356, 359, 267, 283, 576, 15, 1301, 63, 576, 14, 1652, 297, 267, 283, 4416, 15, 723, 14, 1238, 14, 2732, 14, 4737, 297, 267, 283, 4196, 15, 1301, 14, 1652, 297, 267, 283, 4196, 15, 7360, 63, 1301, 14, 1652, 297, 272, 2156, 272, 283, 8768, 356, 359, 267, 283, 576, 15, 1301, 63, 8768, 14, 1652, 297, 272, 2156, 272, 283, 21762, 356, 715, 12, 199, 93, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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 ]
jamielennox/keystone
keystone/contrib/federation/schema.py
14
2401
# 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 keystone.common import validation from keystone.common.validation import parameter_types basic_property_id = { 'type': 'object', 'properties': { 'id': { 'type': 'string' } }, 'required': ['id'], 'additionalProperties': False } saml_create = { 'type': 'object', 'properties': { 'identity': { 'type': 'object', 'properties': { 'token': basic_property_id, 'methods': { 'type': 'array' } }, 'required': ['token'], 'additionalProperties': False }, 'scope': { 'type': 'object', 'properties': { 'service_provider': basic_property_id }, 'required': ['service_provider'], 'additionalProperties': False }, }, 'required': ['identity', 'scope'], 'additionalProperties': False } _service_provider_properties = { # NOTE(rodrigods): The database accepts URLs with 256 as max length, # but parameter_types.url uses 225 as max length. 'auth_url': parameter_types.url, 'sp_url': parameter_types.url, 'description': validation.nullable(parameter_types.description), 'enabled': parameter_types.boolean, 'relay_state_prefix': validation.nullable(parameter_types.description) } service_provider_create = { 'type': 'object', 'properties': _service_provider_properties, # NOTE(rodrigods): 'id' is not required since it is passed in the URL 'required': ['auth_url', 'sp_url'], 'additionalProperties': False } service_provider_update = { 'type': 'object', 'properties': _service_provider_properties, # Make sure at least one property is being updated 'minProperties': 1, 'additionalProperties': False }
apache-2.0
[ 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, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 1334, 314, 844, 14, 199, 199, 504, 19395, 14, 2330, 492, 6411, 199, 504, 19395, 14, 2330, 14, 6136, 492, 2725, 63, 1313, 421, 199, 4316, 63, 1829, 63, 344, 275, 469, 272, 283, 466, 356, 283, 785, 297, 272, 283, 3282, 356, 469, 267, 283, 344, 356, 469, 288, 283, 466, 356, 283, 875, 7, 267, 789, 272, 1660, 272, 283, 2427, 356, 788, 344, 995, 272, 283, 8460, 8516, 356, 756, 199, 93, 199, 199, 29338, 63, 981, 275, 469, 272, 283, 466, 356, 283, 785, 297, 272, 283, 3282, 356, 469, 267, 283, 5582, 356, 469, 288, 283, 466, 356, 283, 785, 297, 288, 283, 3282, 356, 469, 355, 283, 1418, 356, 5678, 63, 1829, 63, 344, 12, 355, 283, 2474, 356, 469, 490, 283, 466, 356, 283, 1144, 7, 355, 789, 288, 1660, 288, 283, 2427, 356, 788, 1418, 995, 288, 283, 8460, 8516, 356, 756, 267, 1660, 267, 283, 2645, 356, 469, 288, 283, 466, 356, 283, 785, 297, 288, 283, 3282, 356, 469, 355, 283, 1364, 63, 3780, 356, 5678, 63, 1829, 63, 344, 288, 1660, 288, 283, 2427, 356, 788, 1364, 63, 3780, 995, 288, 283, 8460, 8516, 356, 756, 267, 1660, 272, 1660, 272, 283, 2427, 356, 788, 5582, 297, 283, 2645, 995, 272, 283, 8460, 8516, 356, 756, 199, 93, 199, 199, 63, 1364, 63, 3780, 63, 3282, 275, 469, 272, 327, 6944, 8, 293, 17824, 71, 364, 83, 304, 710, 3050, 11479, 10867, 543, 7633, 465, 1390, 2582, 12, 272, 327, 1325, 2725, 63, 1313, 14, 633, 4440, 28842, 465, 1390, 2582, 14, 272, 283, 1178, 63, 633, 356, 2725, 63, 1313, 14, 633, 12, 272, 283, 681, 63, 633, 356, 2725, 63, 1313, 14, 633, 12, 272, 283, 1802, 356, 6411, 14, 16375, 8, 5329, 63, 1313, 14, 1802, 395, 272, 283, 3827, 356, 2725, 63, 1313, 14, 4871, 12, 272, 283, 21855, 63, 929, 63, 1861, 356, 6411, 14, 16375, 8, 5329, 63, 1313, 14, 1802, 9, 199, 93, 199, 199, 1364, 63, 3780, 63, 981, 275, 469, 272, 283, 466, 356, 283, 785, 297, 272, 283, 3282, 356, 485, 1364, 63, 3780, 63, 3282, 12, 272, 327, 6944, 8, 293, 17824, 71, 364, 83, 304, 283, 344, 7, 365, 440, 1415, 3967, 652, 365, 3032, 315, 314, 2851, 272, 283, 2427, 356, 788, 1178, 63, 633, 297, 283, 681, 63, 633, 995, 272, 283, 8460, 8516, 356, 756, 199, 93, 199, 199, 1364, 63, 3780, 63, 873, 275, 469, 272, 283, 466, 356, 283, 785, 297, 272, 283, 3282, 356, 485, 1364, 63, 3780, 63, 3282, 12, 272, 327, 4155, 3238, 737, 5210, 1373, 3324, 365, 3769, 4588, 272, 283, 827, 8516, 356, 413, 12, 272, 283, 8460, 8516, 356, 756, 199, 93, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 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, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 1334, 314, 844, 14, 199, 199, 504, 19395, 14, 2330, 492, 6411, 199, 504, 19395, 14, 2330, 14, 6136, 492, 2725, 63, 1313, 421, 199, 4316, 63, 1829, 63, 344, 275, 469, 272, 283, 466, 356, 283, 785, 297, 272, 283, 3282, 356, 469, 267, 283, 344, 356, 469, 288, 283, 466, 356, 283, 875, 7, 267, 789, 272, 1660, 272, 283, 2427, 356, 788, 344, 995, 272, 283, 8460, 8516, 356, 756, 199, 93, 199, 199, 29338, 63, 981, 275, 469, 272, 283, 466, 356, 283, 785, 297, 272, 283, 3282, 356, 469, 267, 283, 5582, 356, 469, 288, 283, 466, 356, 283, 785, 297, 288, 283, 3282, 356, 469, 355, 283, 1418, 356, 5678, 63, 1829, 63, 344, 12, 355, 283, 2474, 356, 469, 490, 283, 466, 356, 283, 1144, 7, 355, 789, 288, 1660, 288, 283, 2427, 356, 788, 1418, 995, 288, 283, 8460, 8516, 356, 756, 267, 1660, 267, 283, 2645, 356, 469, 288, 283, 466, 356, 283, 785, 297, 288, 283, 3282, 356, 469, 355, 283, 1364, 63, 3780, 356, 5678, 63, 1829, 63, 344, 288, 1660, 288, 283, 2427, 356, 788, 1364, 63, 3780, 995, 288, 283, 8460, 8516, 356, 756, 267, 1660, 272, 1660, 272, 283, 2427, 356, 788, 5582, 297, 283, 2645, 995, 272, 283, 8460, 8516, 356, 756, 199, 93, 199, 199, 63, 1364, 63, 3780, 63, 3282, 275, 469, 272, 327, 6944, 8, 293, 17824, 71, 364, 83, 304, 710, 3050, 11479, 10867, 543, 7633, 465, 1390, 2582, 12, 272, 327, 1325, 2725, 63, 1313, 14, 633, 4440, 28842, 465, 1390, 2582, 14, 272, 283, 1178, 63, 633, 356, 2725, 63, 1313, 14, 633, 12, 272, 283, 681, 63, 633, 356, 2725, 63, 1313, 14, 633, 12, 272, 283, 1802, 356, 6411, 14, 16375, 8, 5329, 63, 1313, 14, 1802, 395, 272, 283, 3827, 356, 2725, 63, 1313, 14, 4871, 12, 272, 283, 21855, 63, 929, 63, 1861, 356, 6411, 14, 16375, 8, 5329, 63, 1313, 14, 1802, 9, 199, 93, 199, 199, 1364, 63, 3780, 63, 981, 275, 469, 272, 283, 466, 356, 283, 785, 297, 272, 283, 3282, 356, 485, 1364, 63, 3780, 63, 3282, 12, 272, 327, 6944, 8, 293, 17824, 71, 364, 83, 304, 283, 344, 7, 365, 440, 1415, 3967, 652, 365, 3032, 315, 314, 2851, 272, 283, 2427, 356, 788, 1178, 63, 633, 297, 283, 681, 63, 633, 995, 272, 283, 8460, 8516, 356, 756, 199, 93, 199, 199, 1364, 63, 3780, 63, 873, 275, 469, 272, 283, 466, 356, 283, 785, 297, 272, 283, 3282, 356, 485, 1364, 63, 3780, 63, 3282, 12, 272, 327, 4155, 3238, 737, 5210, 1373, 3324, 365, 3769, 4588, 272, 283, 827, 8516, 356, 413, 12, 272, 283, 8460, 8516, 356, 756, 199, 93, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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 ]
apache/airflow
tests/providers/google/cloud/operators/test_mlengine_system.py
10
1883
# # 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 urllib.parse import urlparse import pytest from airflow.providers.google.cloud.example_dags.example_mlengine import ( JOB_DIR, PREDICTION_OUTPUT, SAVED_MODEL_PATH, SUMMARY_STAGING, SUMMARY_TMP, ) from tests.providers.google.cloud.utils.gcp_authenticator import GCP_AI_KEY from tests.test_utils.gcp_system_helpers import CLOUD_DAG_FOLDER, GoogleSystemTest, provide_gcp_context BUCKETS = { urlparse(bucket_url).netloc for bucket_url in {SAVED_MODEL_PATH, JOB_DIR, PREDICTION_OUTPUT, SUMMARY_TMP, SUMMARY_STAGING} } @pytest.mark.credential_file(GCP_AI_KEY) class MlEngineExampleDagTest(GoogleSystemTest): @provide_gcp_context(GCP_AI_KEY) def setUp(self): super().setUp() for bucket in BUCKETS: self.create_gcs_bucket(bucket) @provide_gcp_context(GCP_AI_KEY) def tearDown(self): for bucket in BUCKETS: self.delete_gcs_bucket(bucket) super().tearDown() @provide_gcp_context(GCP_AI_KEY) def test_run_example_dag(self): self.run_dag('example_gcp_mlengine', CLOUD_DAG_FOLDER)
apache-2.0
[ 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, 504, 4011, 14, 1122, 492, 7097, 199, 199, 646, 4613, 199, 199, 504, 16321, 14, 9710, 14, 3098, 14, 4091, 14, 2694, 63, 32137, 14, 2694, 63, 77, 552, 2598, 492, 334, 272, 1603, 5488, 63, 3022, 12, 272, 510, 7387, 6196, 1075, 63, 8414, 12, 272, 428, 6087, 1149, 63, 11429, 63, 3243, 12, 272, 24558, 24794, 63, 840, 1254, 1206, 12, 272, 24558, 24794, 63, 17983, 12, 199, 9, 199, 504, 2295, 14, 9710, 14, 3098, 14, 4091, 14, 1208, 14, 20622, 63, 1178, 21345, 492, 30902, 63, 7730, 63, 3078, 199, 504, 2295, 14, 396, 63, 1208, 14, 20622, 63, 2253, 63, 7546, 492, 445, 1484, 3383, 63, 28211, 63, 19041, 12, 4475, 3989, 774, 12, 5647, 63, 20622, 63, 1100, 199, 199, 20156, 51, 275, 469, 272, 7097, 8, 4623, 63, 633, 680, 12652, 272, 367, 5315, 63, 633, 315, 469, 4251, 14112, 63, 11429, 63, 3243, 12, 1603, 5488, 63, 3022, 12, 510, 7387, 6196, 1075, 63, 8414, 12, 24558, 24794, 63, 17983, 12, 24558, 24794, 63, 840, 1254, 1206, 93, 199, 93, 421, 199, 32, 4462, 14, 1657, 14, 15591, 63, 493, 8, 39, 2890, 63, 7730, 63, 3078, 9, 199, 533, 603, 76, 8524, 9846, 27234, 774, 8, 13266, 3989, 774, 304, 272, 768, 20824, 63, 20622, 63, 1100, 8, 39, 2890, 63, 7730, 63, 3078, 9, 272, 347, 3613, 8, 277, 304, 267, 1613, 1252, 5996, 342, 267, 367, 5315, 315, 16331, 15244, 51, 26, 288, 291, 14, 981, 63, 21757, 63, 4623, 8, 4623, 9, 339, 768, 20824, 63, 20622, 63, 1100, 8, 39, 2890, 63, 7730, 63, 3078, 9, 272, 347, 6766, 8, 277, 304, 267, 367, 5315, 315, 16331, 15244, 51, 26, 288, 291, 14, 1807, 63, 21757, 63, 4623, 8, 4623, 9, 267, 1613, 1252, 12336, 342, 339, 768, 20824, 63, 20622, 63, 1100, 8, 39, 2890, 63, 7730, 63, 3078, 9, 272, 347, 511, 63, 1065, 63, 2694, 63, 7406, 8, 277, 304, 267, 291, 14, 1065, 63, 7406, 360, 2694, 63, 20622, 63, 77, 552, 2598, 297, 445, 1484, 3383, 63, 28211, 63, 19041, 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 ]
[ 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, 504, 4011, 14, 1122, 492, 7097, 199, 199, 646, 4613, 199, 199, 504, 16321, 14, 9710, 14, 3098, 14, 4091, 14, 2694, 63, 32137, 14, 2694, 63, 77, 552, 2598, 492, 334, 272, 1603, 5488, 63, 3022, 12, 272, 510, 7387, 6196, 1075, 63, 8414, 12, 272, 428, 6087, 1149, 63, 11429, 63, 3243, 12, 272, 24558, 24794, 63, 840, 1254, 1206, 12, 272, 24558, 24794, 63, 17983, 12, 199, 9, 199, 504, 2295, 14, 9710, 14, 3098, 14, 4091, 14, 1208, 14, 20622, 63, 1178, 21345, 492, 30902, 63, 7730, 63, 3078, 199, 504, 2295, 14, 396, 63, 1208, 14, 20622, 63, 2253, 63, 7546, 492, 445, 1484, 3383, 63, 28211, 63, 19041, 12, 4475, 3989, 774, 12, 5647, 63, 20622, 63, 1100, 199, 199, 20156, 51, 275, 469, 272, 7097, 8, 4623, 63, 633, 680, 12652, 272, 367, 5315, 63, 633, 315, 469, 4251, 14112, 63, 11429, 63, 3243, 12, 1603, 5488, 63, 3022, 12, 510, 7387, 6196, 1075, 63, 8414, 12, 24558, 24794, 63, 17983, 12, 24558, 24794, 63, 840, 1254, 1206, 93, 199, 93, 421, 199, 32, 4462, 14, 1657, 14, 15591, 63, 493, 8, 39, 2890, 63, 7730, 63, 3078, 9, 199, 533, 603, 76, 8524, 9846, 27234, 774, 8, 13266, 3989, 774, 304, 272, 768, 20824, 63, 20622, 63, 1100, 8, 39, 2890, 63, 7730, 63, 3078, 9, 272, 347, 3613, 8, 277, 304, 267, 1613, 1252, 5996, 342, 267, 367, 5315, 315, 16331, 15244, 51, 26, 288, 291, 14, 981, 63, 21757, 63, 4623, 8, 4623, 9, 339, 768, 20824, 63, 20622, 63, 1100, 8, 39, 2890, 63, 7730, 63, 3078, 9, 272, 347, 6766, 8, 277, 304, 267, 367, 5315, 315, 16331, 15244, 51, 26, 288, 291, 14, 1807, 63, 21757, 63, 4623, 8, 4623, 9, 267, 1613, 1252, 12336, 342, 339, 768, 20824, 63, 20622, 63, 1100, 8, 39, 2890, 63, 7730, 63, 3078, 9, 272, 347, 511, 63, 1065, 63, 2694, 63, 7406, 8, 277, 304, 267, 291, 14, 1065, 63, 7406, 360, 2694, 63, 20622, 63, 77, 552, 2598, 297, 445, 1484, 3383, 63, 28211, 63, 19041, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
yanheven/horizon
horizon/tabs/base.py
36
17272
# Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import sys import six from django.template.loader import render_to_string from django.template import TemplateSyntaxError # noqa from django.utils.datastructures import SortedDict from horizon import exceptions from horizon.utils import html SEPARATOR = "__" CSS_TAB_GROUP_CLASSES = ["nav", "nav-tabs", "ajax-tabs"] CSS_ACTIVE_TAB_CLASSES = ["active"] CSS_DISABLED_TAB_CLASSES = ["disabled"] class TabGroup(html.HTMLElement): """A container class which knows how to manage and render :class:`~horizon.tabs.Tab` objects. .. attribute:: slug The URL slug and pseudo-unique identifier for this tab group. .. attribute:: template_name The name of the template which will be used to render this tab group. Default: ``"horizon/common/_tab_group.html"`` .. attribute:: sticky Boolean to control whether the active tab state should be stored across requests for a given user. (State storage is all done client-side.) .. attribute:: show_single_tab Boolean to control whether the tab bar is shown when the tab group has only one tab. Default: ``False`` .. attribute:: param_name The name of the GET request parameter which will be used when requesting specific tab data. Default: ``tab``. .. attribute:: classes A list of CSS classes which should be displayed on this tab group. .. attribute:: attrs A dictionary of HTML attributes which should be rendered into the markup for this tab group. .. attribute:: selected Read-only property which is set to the instance of the currently-selected tab if there is one, otherwise ``None``. .. attribute:: active Read-only property which is set to the value of the current active tab. This may not be the same as the value of ``selected`` if no specific tab was requested via the ``GET`` parameter. """ slug = None template_name = "horizon/common/_tab_group.html" param_name = 'tab' sticky = False show_single_tab = False _selected = None _active = None @property def selected(self): return self._selected @property def active(self): return self._active def __init__(self, request, **kwargs): super(TabGroup, self).__init__() if not hasattr(self, "tabs"): raise NotImplementedError('%s must declare a "tabs" attribute.' % self.__class__) if not self.slug: raise NotImplementedError('%s must declare a "slug" attribute.' % self.__class__) self.request = request self.kwargs = kwargs self._data = None tab_instances = [] for tab in self.tabs: tab_instances.append((tab.slug, tab(self, request))) self._tabs = SortedDict(tab_instances) if self.sticky: self.attrs['data-sticky-tabs'] = 'sticky' if not self._set_active_tab(): self.tabs_not_available() def __repr__(self): return "<%s: %s>" % (self.__class__.__name__, self.slug) def load_tab_data(self): """Preload all data that for the tabs that will be displayed.""" for tab in self._tabs.values(): if tab.load and not tab.data_loaded: try: tab._data = tab.get_context_data(self.request) except Exception: tab._data = False exceptions.handle(self.request) def get_id(self): """Returns the id for this tab group. Defaults to the value of the tab group's :attr:`horizon.tabs.Tab.slug`. """ return self.slug def get_default_classes(self): """Returns a list of the default classes for the tab group. Defaults to ``["nav", "nav-tabs", "ajax-tabs"]``. """ default_classes = super(TabGroup, self).get_default_classes() default_classes.extend(CSS_TAB_GROUP_CLASSES) return default_classes def tabs_not_available(self): """In the event that no tabs are either allowed or enabled, this method is the fallback handler. By default it's a no-op, but it exists to make redirecting or raising exceptions possible for subclasses. """ pass def _set_active_tab(self): marked_active = None # See if we have a selected tab via the GET parameter. tab = self.get_selected_tab() if tab: tab._active = True self._active = tab marked_active = tab # Iterate through to mark them all accordingly. for tab in self._tabs.values(): if tab._allowed and tab._enabled and not marked_active: tab._active = True self._active = tab marked_active = True elif tab == marked_active: continue else: tab._active = False return marked_active def render(self): """Renders the HTML output for this tab group.""" return render_to_string(self.template_name, {"tab_group": self}) def get_tabs(self): """Returns a list of the allowed tabs for this tab group.""" return filter(lambda tab: tab._allowed, self._tabs.values()) def get_tab(self, tab_name, allow_disabled=False): """Returns a specific tab from this tab group. If the tab is not allowed or not enabled this method returns ``None``. If the tab is disabled but you wish to return it anyway, you can pass ``True`` to the allow_disabled argument. """ tab = self._tabs.get(tab_name, None) if tab and tab._allowed and (tab._enabled or allow_disabled): return tab return None def get_loaded_tabs(self): return filter(lambda t: self.get_tab(t.slug), self._tabs.values()) def get_selected_tab(self): """Returns the tab specific by the GET request parameter. In the event that there is no GET request parameter, the value of the query parameter is invalid, or the tab is not allowed/enabled, the return value of this function is None. """ selected = self.request.GET.get(self.param_name, None) if selected: try: tab_group, tab_name = selected.split(SEPARATOR) except ValueError: return None if tab_group == self.get_id(): self._selected = self.get_tab(tab_name) return self._selected class Tab(html.HTMLElement): """A reusable interface for constructing a tab within a :class:`~horizon.tabs.TabGroup`. .. attribute:: name The display name for the tab which will be rendered as the text for the tab element in the HTML. Required. .. attribute:: slug The URL slug and id attribute for the tab. This should be unique for a given tab group. Required. .. attribute:: preload Determines whether the contents of the tab should be rendered into the page's HTML when the tab group is rendered, or whether it should be loaded dynamically when the tab is selected. Default: ``True``. .. attribute:: classes A list of CSS classes which should be displayed on this tab. .. attribute:: attrs A dictionary of HTML attributes which should be rendered into the markup for this tab. .. attribute:: load Read-only access to determine whether or not this tab's data should be loaded immediately. .. attribute:: permissions A list of permission names which this tab requires in order to be displayed. Defaults to an empty list (``[]``). """ name = None slug = None preload = True _active = None permissions = [] def __init__(self, tab_group, request=None): super(Tab, self).__init__() # Priority: constructor, class-defined, fallback if not self.name: raise ValueError("%s must have a name." % self.__class__.__name__) self.name = unicode(self.name) # Force unicode. if not self.slug: raise ValueError("%s must have a slug." % self.__class__.__name__) self.tab_group = tab_group self.request = request if request: self._allowed = self.allowed(request) and ( self._has_permissions(request)) self._enabled = self.enabled(request) def __repr__(self): return "<%s: %s>" % (self.__class__.__name__, self.slug) def _has_permissions(self, request): return request.user.has_perms(self.permissions) def is_active(self): """Method to access whether or not this tab is the active tab.""" if self._active is None: self.tab_group._set_active_tab() return self._active @property def load(self): load_preloaded = self.preload or self.is_active() return load_preloaded and self._allowed and self._enabled @property def data(self): if getattr(self, "_data", None) is None: self._data = self.get_context_data(self.request) return self._data @property def data_loaded(self): return getattr(self, "_data", None) is not None def render(self): """Renders the tab to HTML using the :meth:`~horizon.tabs.Tab.get_context_data` method and the :meth:`~horizon.tabs.Tab.get_template_name` method. If :attr:`~horizon.tabs.Tab.preload` is ``False`` and ``force_load`` is not ``True``, or either :meth:`~horizon.tabs.Tab.allowed` or :meth:`~horizon.tabs.Tab.enabled` returns ``False`` this method will return an empty string. """ if not self.load: return '' try: context = self.data except exceptions.Http302: raise except Exception: exc_type, exc_value, exc_traceback = sys.exc_info() raise six.reraise(TemplateSyntaxError, exc_value, exc_traceback) return render_to_string(self.get_template_name(self.request), context) def get_id(self): """Returns the id for this tab. Defaults to ``"{{ tab_group.slug }}__{{ tab.slug }}"``. """ return SEPARATOR.join([self.tab_group.slug, self.slug]) def get_query_string(self): return "=".join((self.tab_group.param_name, self.get_id())) def get_default_classes(self): """Returns a list of the default classes for the tab. Defaults to and empty list (``[]``), however additional classes may be added depending on the state of the tab as follows: If the tab is the active tab for the tab group, in which the class ``"active"`` will be added. If the tab is not enabled, the classes the class ``"disabled"`` will be added. """ default_classes = super(Tab, self).get_default_classes() if self.is_active(): default_classes.extend(CSS_ACTIVE_TAB_CLASSES) if not self._enabled: default_classes.extend(CSS_DISABLED_TAB_CLASSES) return default_classes def get_template_name(self, request): """Returns the name of the template to be used for rendering this tab. By default it returns the value of the ``template_name`` attribute on the ``Tab`` class. """ if not hasattr(self, "template_name"): raise AttributeError("%s must have a template_name attribute or " "override the get_template_name method." % self.__class__.__name__) return self.template_name def get_context_data(self, request, **kwargs): """This method should return a dictionary of context data used to render the tab. Required. """ return kwargs def enabled(self, request): """Determines whether or not the tab should be accessible (e.g. be rendered into the HTML on load and respond to a click event). If a tab returns ``False`` from ``enabled`` it will ignore the value of ``preload`` and only render the HTML of the tab after being clicked. The default behavior is to return ``True`` for all cases. """ return True def allowed(self, request): """Determines whether or not the tab is displayed. Tab instances can override this method to specify conditions under which this tab should not be shown at all by returning ``False``. The default behavior is to return ``True`` for all cases. """ return True def post(self, request, *args, **kwargs): """Handles POST data sent to a tab. Tab instances can override this method to have tab-specific POST logic without polluting the TabView code. The default behavior is to ignore POST data. """ pass class TableTab(Tab): """A :class:`~horizon.tabs.Tab` class which knows how to deal with :class:`~horizon.tables.DataTable` classes rendered inside of it. This distinct class is required due to the complexity involved in handling both dynamic tab loading, dynamic table updating and table actions all within one view. .. attribute:: table_classes An iterable containing the :class:`~horizon.tables.DataTable` classes which this tab will contain. Equivalent to the :attr:`~horizon.tables.MultiTableView.table_classes` attribute on :class:`~horizon.tables.MultiTableView`. For each table class you need to define a corresponding ``get_{{ table_name }}_data`` method as with :class:`~horizon.tables.MultiTableView`. """ table_classes = None def __init__(self, tab_group, request): super(TableTab, self).__init__(tab_group, request) if not self.table_classes: class_name = self.__class__.__name__ raise NotImplementedError("You must define a table_class " "attribute on %s" % class_name) # Instantiate our table classes but don't assign data yet table_instances = [(table._meta.name, table(request, **tab_group.kwargs)) for table in self.table_classes] self._tables = SortedDict(table_instances) self._table_data_loaded = False def load_table_data(self): """Calls the ``get_{{ table_name }}_data`` methods for each table class and sets the data on the tables. """ # We only want the data to be loaded once, so we track if we have... if not self._table_data_loaded: for table_name, table in self._tables.items(): # Fetch the data function. func_name = "get_%s_data" % table_name data_func = getattr(self, func_name, None) if data_func is None: cls_name = self.__class__.__name__ raise NotImplementedError("You must define a %s method " "on %s." % (func_name, cls_name)) # Load the data. table.data = data_func() table._meta.has_prev_data = self.has_prev_data(table) table._meta.has_more_data = self.has_more_data(table) # Mark our data as loaded so we don't run the loaders again. self._table_data_loaded = True def get_context_data(self, request, **kwargs): """Adds a ``{{ table_name }}_table`` item to the context for each table in the :attr:`~horizon.tabs.TableTab.table_classes` attribute. If only one table class is provided, a shortcut ``table`` context variable is also added containing the single table. """ context = super(TableTab, self).get_context_data(request, **kwargs) # If the data hasn't been manually loaded before now, # make certain it's loaded before setting the context. self.load_table_data() for table_name, table in self._tables.items(): # If there's only one table class, add a shortcut name as well. if len(self.table_classes) == 1: context["table"] = table context["%s_table" % table_name] = table return context def has_prev_data(self, table): return False def has_more_data(self, table): return False
apache-2.0
[ 3, 1898, 6029, 653, 2871, 7586, 12, 3277, 14, 199, 3, 199, 3, 259, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 259, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 259, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 260, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 259, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 259, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 259, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 259, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 259, 1334, 314, 844, 14, 199, 199, 646, 984, 199, 199, 646, 3816, 199, 199, 504, 1639, 14, 1160, 14, 3422, 492, 3795, 63, 475, 63, 875, 199, 504, 1639, 14, 1160, 492, 17762, 221, 327, 8151, 199, 504, 1639, 14, 1208, 14, 23004, 492, 27432, 2141, 199, 199, 504, 21726, 492, 4967, 199, 504, 21726, 14, 1208, 492, 3517, 199, 199, 15828, 275, 4396, 2, 199, 14391, 63, 10129, 63, 7823, 63, 13748, 275, 2097, 10927, 401, 298, 10927, 13, 8741, 401, 298, 12774, 13, 8741, 937, 199, 14391, 63, 10401, 63, 10129, 63, 13748, 275, 2097, 2682, 937, 199, 14391, 63, 16205, 63, 10129, 63, 13748, 275, 2097, 7011, 937, 421, 199, 533, 23159, 2448, 8, 1360, 14, 31428, 968, 304, 272, 408, 33, 3970, 1021, 1314, 19428, 4212, 370, 9635, 436, 3795, 272, 520, 533, 6054, 16561, 14, 8741, 14, 7690, 64, 2251, 14, 339, 2508, 2225, 447, 8889, 398, 710, 2851, 8889, 436, 15984, 13, 3235, 5148, 367, 642, 5174, 1572, 14, 339, 2508, 2225, 447, 1978, 63, 354, 398, 710, 536, 402, 314, 1978, 1314, 911, 506, 1202, 370, 3795, 642, 5174, 1572, 14, 267, 3758, 26, 25916, 16561, 15, 2330, 15607, 2902, 63, 923, 14, 1360, 31002, 339, 2508, 2225, 447, 17870, 398, 9411, 370, 3304, 3775, 314, 4702, 5174, 1174, 1077, 506, 5489, 267, 9371, 4145, 367, 282, 1627, 922, 14, 334, 2223, 4887, 365, 1006, 4224, 267, 1890, 13, 2441, 4959, 339, 2508, 2225, 447, 2498, 63, 4780, 63, 2902, 398, 9411, 370, 3304, 3775, 314, 5174, 4681, 365, 9164, 1380, 314, 5174, 1572, 267, 965, 1454, 1373, 5174, 14, 3758, 26, 1124, 797, 1040, 339, 2508, 2225, 447, 1215, 63, 354, 398, 710, 536, 402, 314, 9576, 1056, 2725, 1314, 911, 506, 1202, 1380, 267, 23502, 2488, 5174, 666, 14, 3758, 26, 1124, 2902, 4345, 339, 2508, 2225, 447, 3992, 398, 437, 769, 402, 15750, 3992, 1314, 1077, 506, 9080, 641, 642, 5174, 1572, 14, 339, 2508, 2225, 447, 3290, 398, 437, 2600, 402, 4163, 3004, 1314, 1077, 506, 8018, 1901, 314, 267, 9189, 367, 642, 5174, 1572, 14, 339, 2508, 2225, 447, 4895, 398, 5574, 13, 2118, 3324, 1314, 365, 663, 370, 314, 1256, 402, 314, 267, 5544, 13, 5511, 5174, 340, 2337, 365, 1373, 12, 4257, 1124, 403, 4345, 339, 2508, 2225, 447, 4702, 398, 5574, 13, 2118, 3324, 1314, 365, 663, 370, 314, 574, 402, 314, 1453, 4702, 5174, 14, 267, 961, 1443, 440, 506, 314, 2011, 465, 314, 574, 402, 1124, 5511, 1040, 340, 949, 267, 2488, 5174, 1990, 5839, 4799, 314, 1124, 2970, 1040, 2725, 14, 272, 408, 272, 8889, 275, 488, 272, 1978, 63, 354, 275, 298, 16561, 15, 2330, 15607, 2902, 63, 923, 14, 1360, 2, 272, 1215, 63, 354, 275, 283, 2902, 7, 272, 17870, 275, 756, 272, 2498, 63, 4780, 63, 2902, 275, 756, 272, 485, 5511, 275, 488, 272, 485, 2682, 275, 488, 339, 768, 1829, 272, 347, 4895, 8, 277, 304, 267, 372, 291, 423, 5511, 339, 768, 1829, 272, 347, 4702, 8, 277, 304, 267, 372, 291, 423, 2682, 339, 347, 636, 826, 721, 277, 12, 1056, 12, 1011, 958, 304, 267, 1613, 8, 7690, 2448, 12, 291, 2843, 826, 4533, 267, 340, 440, 2688, 8, 277, 12, 298, 8741, 2349, 288, 746, 4279, 3508, 83, 1471, 20771, 282, 298, 8741, 2, 2225, 3530, 4228, 450, 291, 855, 533, 3368, 267, 340, 440, 291, 14, 5464, 26, 288, 746, 4279, 3508, 83, 1471, 20771, 282, 298, 5464, 2, 2225, 3530, 4228, 450, 291, 855, 533, 3368, 267, 291, 14, 1069, 275, 1056, 267, 291, 14, 958, 275, 2074, 267, 291, 423, 576, 275, 488, 267, 5174, 63, 5990, 275, 942, 267, 367, 5174, 315, 291, 14, 8741, 26, 288, 5174, 63, 5990, 14, 740, 1332, 2902, 14, 5464, 12, 5174, 8, 277, 12, 1056, 1724, 267, 291, 423, 8741, 275, 27432, 2141, 8, 2902, 63, 5990, 9, 267, 340, 291, 14, 27364, 26, 288, 291, 14, 3288, 459, 576, 13, 27364, 13, 8741, 418, 275, 283, 27364, 7, 267, 340, 440, 291, 423, 409, 63, 2682, 63, 2902, 837, 288, 291, 14, 8741, 63, 1397, 63, 4561, 342, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 23054, 83, 26, 450, 83, 4335, 450, 334, 277, 855, 533, 4914, 354, 3108, 291, 14, 5464, 9, 339, 347, 2248, 63, 2902, 63, 576, 8, 277, 304, 267, 408, 2398, 912, 1006, 666, 626, 367, 314, 12187, 626, 911, 506, 9080, 1041, 267, 367, 5174, 315, 291, 423, 8741, 14, 1459, 837, 288, 340, 5174, 14, 912, 436, 440, 5174, 14, 576, 63, 4591, 26, 355, 862, 26, 490, 5174, 423, 576, 275, 5174, 14, 362, 63, 1100, 63, 576, 8, 277, 14, 1069, 9, 355, 871, 2186, 26, 490, 5174, 423, 576, 275, 756, 490, 4967, 14, 2479, 8, 277, 14, 1069, 9, 339, 347, 664, 63, 344, 8, 277, 304, 267, 408, 3407, 314, 1305, 367, 642, 5174, 1572, 14, 7827, 370, 314, 574, 402, 314, 5174, 267, 1572, 1159, 520, 962, 1705, 16561, 14, 8741, 14, 7690, 14, 5464, 2313, 267, 408, 267, 372, 291, 14, 5464, 339, 347, 664, 63, 885, 63, 2888, 8, 277, 304, 267, 408, 3407, 282, 769, 402, 314, 849, 3992, 367, 314, 5174, 1572, 14, 7827, 370, 267, 1124, 905, 10927, 401, 298 ]
[ 1898, 6029, 653, 2871, 7586, 12, 3277, 14, 199, 3, 199, 3, 259, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 259, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 259, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 260, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 259, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 259, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 259, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 259, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 259, 1334, 314, 844, 14, 199, 199, 646, 984, 199, 199, 646, 3816, 199, 199, 504, 1639, 14, 1160, 14, 3422, 492, 3795, 63, 475, 63, 875, 199, 504, 1639, 14, 1160, 492, 17762, 221, 327, 8151, 199, 504, 1639, 14, 1208, 14, 23004, 492, 27432, 2141, 199, 199, 504, 21726, 492, 4967, 199, 504, 21726, 14, 1208, 492, 3517, 199, 199, 15828, 275, 4396, 2, 199, 14391, 63, 10129, 63, 7823, 63, 13748, 275, 2097, 10927, 401, 298, 10927, 13, 8741, 401, 298, 12774, 13, 8741, 937, 199, 14391, 63, 10401, 63, 10129, 63, 13748, 275, 2097, 2682, 937, 199, 14391, 63, 16205, 63, 10129, 63, 13748, 275, 2097, 7011, 937, 421, 199, 533, 23159, 2448, 8, 1360, 14, 31428, 968, 304, 272, 408, 33, 3970, 1021, 1314, 19428, 4212, 370, 9635, 436, 3795, 272, 520, 533, 6054, 16561, 14, 8741, 14, 7690, 64, 2251, 14, 339, 2508, 2225, 447, 8889, 398, 710, 2851, 8889, 436, 15984, 13, 3235, 5148, 367, 642, 5174, 1572, 14, 339, 2508, 2225, 447, 1978, 63, 354, 398, 710, 536, 402, 314, 1978, 1314, 911, 506, 1202, 370, 3795, 642, 5174, 1572, 14, 267, 3758, 26, 25916, 16561, 15, 2330, 15607, 2902, 63, 923, 14, 1360, 31002, 339, 2508, 2225, 447, 17870, 398, 9411, 370, 3304, 3775, 314, 4702, 5174, 1174, 1077, 506, 5489, 267, 9371, 4145, 367, 282, 1627, 922, 14, 334, 2223, 4887, 365, 1006, 4224, 267, 1890, 13, 2441, 4959, 339, 2508, 2225, 447, 2498, 63, 4780, 63, 2902, 398, 9411, 370, 3304, 3775, 314, 5174, 4681, 365, 9164, 1380, 314, 5174, 1572, 267, 965, 1454, 1373, 5174, 14, 3758, 26, 1124, 797, 1040, 339, 2508, 2225, 447, 1215, 63, 354, 398, 710, 536, 402, 314, 9576, 1056, 2725, 1314, 911, 506, 1202, 1380, 267, 23502, 2488, 5174, 666, 14, 3758, 26, 1124, 2902, 4345, 339, 2508, 2225, 447, 3992, 398, 437, 769, 402, 15750, 3992, 1314, 1077, 506, 9080, 641, 642, 5174, 1572, 14, 339, 2508, 2225, 447, 3290, 398, 437, 2600, 402, 4163, 3004, 1314, 1077, 506, 8018, 1901, 314, 267, 9189, 367, 642, 5174, 1572, 14, 339, 2508, 2225, 447, 4895, 398, 5574, 13, 2118, 3324, 1314, 365, 663, 370, 314, 1256, 402, 314, 267, 5544, 13, 5511, 5174, 340, 2337, 365, 1373, 12, 4257, 1124, 403, 4345, 339, 2508, 2225, 447, 4702, 398, 5574, 13, 2118, 3324, 1314, 365, 663, 370, 314, 574, 402, 314, 1453, 4702, 5174, 14, 267, 961, 1443, 440, 506, 314, 2011, 465, 314, 574, 402, 1124, 5511, 1040, 340, 949, 267, 2488, 5174, 1990, 5839, 4799, 314, 1124, 2970, 1040, 2725, 14, 272, 408, 272, 8889, 275, 488, 272, 1978, 63, 354, 275, 298, 16561, 15, 2330, 15607, 2902, 63, 923, 14, 1360, 2, 272, 1215, 63, 354, 275, 283, 2902, 7, 272, 17870, 275, 756, 272, 2498, 63, 4780, 63, 2902, 275, 756, 272, 485, 5511, 275, 488, 272, 485, 2682, 275, 488, 339, 768, 1829, 272, 347, 4895, 8, 277, 304, 267, 372, 291, 423, 5511, 339, 768, 1829, 272, 347, 4702, 8, 277, 304, 267, 372, 291, 423, 2682, 339, 347, 636, 826, 721, 277, 12, 1056, 12, 1011, 958, 304, 267, 1613, 8, 7690, 2448, 12, 291, 2843, 826, 4533, 267, 340, 440, 2688, 8, 277, 12, 298, 8741, 2349, 288, 746, 4279, 3508, 83, 1471, 20771, 282, 298, 8741, 2, 2225, 3530, 4228, 450, 291, 855, 533, 3368, 267, 340, 440, 291, 14, 5464, 26, 288, 746, 4279, 3508, 83, 1471, 20771, 282, 298, 5464, 2, 2225, 3530, 4228, 450, 291, 855, 533, 3368, 267, 291, 14, 1069, 275, 1056, 267, 291, 14, 958, 275, 2074, 267, 291, 423, 576, 275, 488, 267, 5174, 63, 5990, 275, 942, 267, 367, 5174, 315, 291, 14, 8741, 26, 288, 5174, 63, 5990, 14, 740, 1332, 2902, 14, 5464, 12, 5174, 8, 277, 12, 1056, 1724, 267, 291, 423, 8741, 275, 27432, 2141, 8, 2902, 63, 5990, 9, 267, 340, 291, 14, 27364, 26, 288, 291, 14, 3288, 459, 576, 13, 27364, 13, 8741, 418, 275, 283, 27364, 7, 267, 340, 440, 291, 423, 409, 63, 2682, 63, 2902, 837, 288, 291, 14, 8741, 63, 1397, 63, 4561, 342, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 23054, 83, 26, 450, 83, 4335, 450, 334, 277, 855, 533, 4914, 354, 3108, 291, 14, 5464, 9, 339, 347, 2248, 63, 2902, 63, 576, 8, 277, 304, 267, 408, 2398, 912, 1006, 666, 626, 367, 314, 12187, 626, 911, 506, 9080, 1041, 267, 367, 5174, 315, 291, 423, 8741, 14, 1459, 837, 288, 340, 5174, 14, 912, 436, 440, 5174, 14, 576, 63, 4591, 26, 355, 862, 26, 490, 5174, 423, 576, 275, 5174, 14, 362, 63, 1100, 63, 576, 8, 277, 14, 1069, 9, 355, 871, 2186, 26, 490, 5174, 423, 576, 275, 756, 490, 4967, 14, 2479, 8, 277, 14, 1069, 9, 339, 347, 664, 63, 344, 8, 277, 304, 267, 408, 3407, 314, 1305, 367, 642, 5174, 1572, 14, 7827, 370, 314, 574, 402, 314, 5174, 267, 1572, 1159, 520, 962, 1705, 16561, 14, 8741, 14, 7690, 14, 5464, 2313, 267, 408, 267, 372, 291, 14, 5464, 339, 347, 664, 63, 885, 63, 2888, 8, 277, 304, 267, 408, 3407, 282, 769, 402, 314, 849, 3992, 367, 314, 5174, 1572, 14, 7827, 370, 267, 1124,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 1, 1, 1, 1, 1, 1, 1 ]
TedaLIEz/sentry
src/sentry/migrations/0046_auto__add_teammember__add_unique_teammember_team_user__add_team__add_p.py
36
22165
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'TeamMember' db.create_table('sentry_teammember', ( ('id', self.gf('sentry.db.models.fields.bounded.BoundedBigAutoField')(primary_key=True)), ('team', self.gf('sentry.db.models.fields.FlexibleForeignKey')(to=orm['sentry.Team'])), ('user', self.gf('sentry.db.models.fields.FlexibleForeignKey')(related_name='sentry_teammember_set', to=orm['sentry.User'])), ('is_active', self.gf('django.db.models.fields.BooleanField')(default=True)), ('type', self.gf('django.db.models.fields.IntegerField')(default=0)), ('date_added', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), )) db.send_create_signal('sentry', ['TeamMember']) # Adding unique constraint on 'TeamMember', fields ['team', 'user'] db.create_unique('sentry_teammember', ['team_id', 'user_id']) # Adding model 'Team' db.create_table('sentry_team', ( ('id', self.gf('sentry.db.models.fields.bounded.BoundedBigAutoField')(primary_key=True)), ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=50, db_index=True)), ('name', self.gf('django.db.models.fields.CharField')(max_length=64)), ('owner', self.gf('sentry.db.models.fields.FlexibleForeignKey')(to=orm['sentry.User'])), )) db.send_create_signal('sentry', ['Team']) # Adding model 'ProjectKey' db.create_table('sentry_projectkey', ( ('id', self.gf('sentry.db.models.fields.bounded.BoundedBigAutoField')(primary_key=True)), ('project', self.gf('sentry.db.models.fields.FlexibleForeignKey')(to=orm['sentry.Project'])), ('public_key', self.gf('django.db.models.fields.CharField')(max_length=32, unique=True, null=True)), ('secret_key', self.gf('django.db.models.fields.CharField')(max_length=32, unique=True, null=True)), ('user', self.gf('sentry.db.models.fields.FlexibleForeignKey')(to=orm['sentry.User'], null=True)), )) db.send_create_signal('sentry', ['ProjectKey']) # Adding field 'Project.slug' db.add_column('sentry_project', 'slug', self.gf('django.db.models.fields.SlugField')(max_length=50, unique=True, null=True, db_index=True), keep_default=False) # Adding field 'Project.team' db.add_column('sentry_project', 'team', self.gf('sentry.db.models.fields.FlexibleForeignKey')(to=orm['sentry.Team'], null=True), keep_default=False) def backwards(self, orm): # Removing unique constraint on 'TeamMember', fields ['team', 'user'] db.delete_unique('sentry_teammember', ['team_id', 'user_id']) # Deleting model 'TeamMember' db.delete_table('sentry_teammember') # Deleting model 'Team' db.delete_table('sentry_team') # Deleting model 'ProjectKey' db.delete_table('sentry_projectkey') # Deleting field 'Project.slug' db.delete_column('sentry_project', 'slug') # Deleting field 'Project.team' db.delete_column('sentry_project', 'team_id') models = { 'sentry.user': { 'Meta': {'object_name': 'User', 'db_table': "'auth_user'"}, 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'id': ('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'}), 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) }, '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': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) }, 'sentry.event': { 'Meta': {'unique_together': "(('project', 'event_id'),)", 'object_name': 'Event', 'db_table': "'sentry_message'"}, 'checksum': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}), 'culprit': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'db_column': "'view'", 'blank': 'True'}), 'data': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'datetime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), 'event_id': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'db_column': "'message_id'"}), 'group': ('sentry.db.models.fields.FlexibleForeignKey', [], {'blank': 'True', 'related_name': "'event_set'", 'null': 'True', 'to': "orm['sentry.Group']"}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'level': ('django.db.models.fields.PositiveIntegerField', [], {'default': '40', 'db_index': 'True', 'blank': 'True'}), 'logger': ('django.db.models.fields.CharField', [], {'default': "'root'", 'max_length': '64', 'db_index': 'True', 'blank': 'True'}), 'message': ('django.db.models.fields.TextField', [], {}), 'project': ('sentry.db.models.fields.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}), 'server_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'db_index': 'True'}), 'site': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'db_index': 'True'}), 'time_spent': ('django.db.models.fields.FloatField', [], {'null': 'True'}) }, 'sentry.filtervalue': { 'Meta': {'unique_together': "(('project', 'key', 'value'),)", 'object_name': 'FilterValue'}, 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'max_length': '32'}), 'project': ('sentry.db.models.fields.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}), 'value': ('django.db.models.fields.CharField', [], {'max_length': '200'}) }, 'sentry.group': { 'Meta': {'unique_together': "(('project', 'logger', 'culprit', 'checksum'),)", 'object_name': 'Group', 'db_table': "'sentry_groupedmessage'"}, 'checksum': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}), 'culprit': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'db_column': "'view'", 'blank': 'True'}), 'data': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'first_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), 'level': ('django.db.models.fields.PositiveIntegerField', [], {'default': '40', 'db_index': 'True', 'blank': 'True'}), 'logger': ('django.db.models.fields.CharField', [], {'default': "'root'", 'max_length': '64', 'db_index': 'True', 'blank': 'True'}), 'message': ('django.db.models.fields.TextField', [], {}), 'project': ('sentry.db.models.fields.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}), 'score': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'status': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True'}), 'time_spent_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'time_spent_total': ('django.db.models.fields.FloatField', [], {'default': '0'}), 'times_seen': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1', 'db_index': 'True'}), 'views': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sentry.View']", 'symmetrical': 'False', 'blank': 'True'}) }, 'sentry.groupbookmark': { 'Meta': {'unique_together': "(('project', 'user', 'group'),)", 'object_name': 'GroupBookmark'}, 'group': ('sentry.db.models.fields.FlexibleForeignKey', [], {'related_name': "'bookmark_set'", 'to': "orm['sentry.Group']"}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'project': ('sentry.db.models.fields.FlexibleForeignKey', [], {'related_name': "'bookmark_set'", 'to': "orm['sentry.Project']"}), 'user': ('sentry.db.models.fields.FlexibleForeignKey', [], {'related_name': "'sentry_bookmark_set'", 'to': "orm['sentry.User']"}) }, 'sentry.groupmeta': { 'Meta': {'unique_together': "(('group', 'key'),)", 'object_name': 'GroupMeta'}, 'group': ('sentry.db.models.fields.FlexibleForeignKey', [], {'to': "orm['sentry.Group']"}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'max_length': '64'}), 'value': ('django.db.models.fields.TextField', [], {}) }, 'sentry.messagecountbyminute': { 'Meta': {'unique_together': "(('project', 'group', 'date'),)", 'object_name': 'MessageCountByMinute'}, 'date': ('django.db.models.fields.DateTimeField', [], {}), 'group': ('sentry.db.models.fields.FlexibleForeignKey', [], {'to': "orm['sentry.Group']"}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'project': ('sentry.db.models.fields.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}), 'time_spent_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'time_spent_total': ('django.db.models.fields.FloatField', [], {'default': '0'}), 'times_seen': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}) }, 'sentry.messagefiltervalue': { 'Meta': {'unique_together': "(('project', 'key', 'value', 'group'),)", 'object_name': 'MessageFilterValue'}, 'first_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True', 'db_index': 'True'}), 'group': ('sentry.db.models.fields.FlexibleForeignKey', [], {'to': "orm['sentry.Group']"}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'max_length': '32'}), 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True', 'db_index': 'True'}), 'project': ('sentry.db.models.fields.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}), 'times_seen': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), 'value': ('django.db.models.fields.CharField', [], {'max_length': '200'}) }, 'sentry.messageindex': { 'Meta': {'unique_together': "(('column', 'value', 'object_id'),)", 'object_name': 'MessageIndex'}, 'column': ('django.db.models.fields.CharField', [], {'max_length': '32'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), 'value': ('django.db.models.fields.CharField', [], {'max_length': '128'}) }, 'sentry.option': { 'Meta': {'object_name': 'Option'}, 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'}), 'value': ('picklefield.fields.PickledObjectField', [], {}) }, 'sentry.pendingprojectmember': { 'Meta': {'unique_together': "(('project', 'email'),)", 'object_name': 'PendingProjectMember'}, 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'project': ('sentry.db.models.fields.FlexibleForeignKey', [], {'related_name': "'pending_member_set'", 'to': "orm['sentry.Project']"}), 'type': ('django.db.models.fields.IntegerField', [], {'default': '0'}) }, 'sentry.project': { 'Meta': {'object_name': 'Project'}, 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}), 'owner': ('sentry.db.models.fields.FlexibleForeignKey', [], {'related_name': "'sentry_owned_project_set'", 'null': 'True', 'to': "orm['sentry.User']"}), 'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'db_index': 'True'}), 'status': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True'}), 'team': ('sentry.db.models.fields.FlexibleForeignKey', [], {'to': "orm['sentry.Team']", 'null': 'True'}) }, 'sentry.projectcountbyminute': { 'Meta': {'unique_together': "(('project', 'date'),)", 'object_name': 'ProjectCountByMinute'}, 'date': ('django.db.models.fields.DateTimeField', [], {}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'project': ('sentry.db.models.fields.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}), 'time_spent_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'time_spent_total': ('django.db.models.fields.FloatField', [], {'default': '0'}), 'times_seen': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}) }, 'sentry.projectdomain': { 'Meta': {'unique_together': "(('project', 'domain'),)", 'object_name': 'ProjectDomain'}, 'domain': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'project': ('sentry.db.models.fields.FlexibleForeignKey', [], {'related_name': "'domain_set'", 'to': "orm['sentry.Project']"}) }, 'sentry.projectkey': { 'Meta': {'object_name': 'ProjectKey'}, 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'project': ('sentry.db.models.fields.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}), 'public_key': ('django.db.models.fields.CharField', [], {'max_length': '32', 'unique': 'True', 'null': 'True'}), 'secret_key': ('django.db.models.fields.CharField', [], {'max_length': '32', 'unique': 'True', 'null': 'True'}), 'user': ('sentry.db.models.fields.FlexibleForeignKey', [], {'to': "orm['sentry.User']", 'null': 'True'}) }, 'sentry.projectmember': { 'Meta': {'unique_together': "(('project', 'user'),)", 'object_name': 'ProjectMember'}, 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'project': ('sentry.db.models.fields.FlexibleForeignKey', [], {'related_name': "'member_set'", 'to': "orm['sentry.Project']"}), 'public_key': ('django.db.models.fields.CharField', [], {'max_length': '32', 'unique': 'True', 'null': 'True'}), 'secret_key': ('django.db.models.fields.CharField', [], {'max_length': '32', 'unique': 'True', 'null': 'True'}), 'type': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'user': ('sentry.db.models.fields.FlexibleForeignKey', [], {'related_name': "'sentry_project_set'", 'to': "orm['sentry.User']"}) }, 'sentry.projectoption': { 'Meta': {'unique_together': "(('project', 'key'),)", 'object_name': 'ProjectOption', 'db_table': "'sentry_projectoptions'"}, 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'max_length': '64'}), 'project': ('sentry.db.models.fields.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}), 'value': ('picklefield.fields.PickledObjectField', [], {}) }, 'sentry.searchdocument': { 'Meta': {'unique_together': "(('project', 'group'),)", 'object_name': 'SearchDocument'}, 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'date_changed': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'group': ('sentry.db.models.fields.FlexibleForeignKey', [], {'to': "orm['sentry.Group']"}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'project': ('sentry.db.models.fields.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}), 'status': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), 'total_events': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}) }, 'sentry.searchtoken': { 'Meta': {'unique_together': "(('document', 'field', 'token'),)", 'object_name': 'SearchToken'}, 'document': ('sentry.db.models.fields.FlexibleForeignKey', [], {'related_name': "'token_set'", 'to': "orm['sentry.SearchDocument']"}), 'field': ('django.db.models.fields.CharField', [], {'default': "'text'", 'max_length': '64'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'times_seen': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}), 'token': ('django.db.models.fields.CharField', [], {'max_length': '128'}) }, 'sentry.team': { 'Meta': {'object_name': 'Team'}, 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), 'owner': ('sentry.db.models.fields.FlexibleForeignKey', [], {'to': "orm['sentry.User']"}), 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}) }, 'sentry.teammember': { 'Meta': {'unique_together': "(('team', 'user'),)", 'object_name': 'TeamMember'}, 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'team': ('sentry.db.models.fields.FlexibleForeignKey', [], {'to': "orm['sentry.Team']"}), 'type': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'user': ('sentry.db.models.fields.FlexibleForeignKey', [], {'related_name': "'sentry_teammember_set'", 'to': "orm['sentry.User']"}) }, 'sentry.view': { 'Meta': {'object_name': 'View'}, 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}), 'path': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), 'verbose_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True'}), 'verbose_name_plural': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True'}) } } complete_apps = ['sentry']
bsd-3-clause
[ 3, 2644, 26, 2774, 13, 24, 199, 646, 2197, 199, 504, 12919, 14, 697, 492, 1592, 199, 504, 12919, 14, 86, 18, 492, 24765, 199, 504, 1639, 14, 697, 492, 1709, 199, 199, 533, 12090, 8, 24822, 304, 339, 347, 17465, 8, 277, 12, 9813, 304, 398, 327, 12934, 1402, 283, 13126, 7021, 7, 267, 1592, 14, 981, 63, 1224, 360, 3870, 63, 5969, 1114, 297, 334, 288, 661, 344, 297, 291, 14, 7102, 360, 3870, 14, 697, 14, 992, 14, 955, 14, 7547, 14, 12614, 7533, 3327, 63, 498, 29, 549, 1826, 288, 661, 5969, 297, 291, 14, 7102, 360, 3870, 14, 697, 14, 992, 14, 955, 14, 9550, 7533, 475, 29, 1025, 459, 3870, 14, 13126, 16607, 288, 661, 751, 297, 291, 14, 7102, 360, 3870, 14, 697, 14, 992, 14, 955, 14, 9550, 7533, 2407, 63, 354, 534, 3870, 63, 5969, 1114, 63, 409, 297, 370, 29, 1025, 459, 3870, 14, 1899, 16607, 288, 661, 374, 63, 2682, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 5036, 7533, 885, 29, 549, 1826, 288, 661, 466, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 3901, 7533, 885, 29, 16, 1826, 288, 661, 602, 63, 3270, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 7533, 885, 29, 2083, 14, 2083, 14, 2131, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 3870, 297, 788, 13126, 7021, 1105, 398, 327, 12934, 3747, 5828, 641, 283, 13126, 7021, 297, 1504, 788, 5969, 297, 283, 751, 418, 267, 1592, 14, 981, 63, 3235, 360, 3870, 63, 5969, 1114, 297, 788, 5969, 63, 344, 297, 283, 751, 63, 344, 1105, 398, 327, 12934, 1402, 283, 13126, 7, 267, 1592, 14, 981, 63, 1224, 360, 3870, 63, 5969, 297, 334, 288, 661, 344, 297, 291, 14, 7102, 360, 3870, 14, 697, 14, 992, 14, 955, 14, 7547, 14, 12614, 7533, 3327, 63, 498, 29, 549, 1826, 288, 661, 5464, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 17315, 7533, 3235, 29, 549, 12, 1390, 63, 1267, 29, 1400, 12, 1592, 63, 1080, 29, 549, 1826, 288, 661, 354, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 772, 1826, 288, 661, 4597, 297, 291, 14, 7102, 360, 3870, 14, 697, 14, 992, 14, 955, 14, 9550, 7533, 475, 29, 1025, 459, 3870, 14, 1899, 16607, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 3870, 297, 788, 13126, 1105, 398, 327, 12934, 1402, 283, 4761, 1197, 7, 267, 1592, 14, 981, 63, 1224, 360, 3870, 63, 1715, 498, 297, 334, 288, 661, 344, 297, 291, 14, 7102, 360, 3870, 14, 697, 14, 992, 14, 955, 14, 7547, 14, 12614, 7533, 3327, 63, 498, 29, 549, 1826, 288, 661, 1715, 297, 291, 14, 7102, 360, 3870, 14, 697, 14, 992, 14, 955, 14, 9550, 7533, 475, 29, 1025, 459, 3870, 14, 4761, 16607, 288, 661, 3455, 63, 498, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 708, 12, 3747, 29, 549, 12, 2973, 29, 549, 1826, 288, 661, 4731, 63, 498, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 708, 12, 3747, 29, 549, 12, 2973, 29, 549, 1826, 288, 661, 751, 297, 291, 14, 7102, 360, 3870, 14, 697, 14, 992, 14, 955, 14, 9550, 7533, 475, 29, 1025, 459, 3870, 14, 1899, 995, 2973, 29, 549, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 3870, 297, 788, 4761, 1197, 1105, 398, 327, 12934, 901, 283, 4761, 14, 5464, 7, 267, 1592, 14, 525, 63, 2301, 360, 3870, 63, 1715, 297, 283, 5464, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 17315, 7533, 988, 63, 1267, 29, 1400, 12, 3747, 29, 549, 12, 2973, 29, 549, 12, 1592, 63, 1080, 29, 549, 395, 4215, 63, 885, 29, 797, 9, 398, 327, 12934, 901, 283, 4761, 14, 5969, 7, 267, 1592, 14, 525, 63, 2301, 360, 3870, 63, 1715, 297, 283, 5969, 297, 291, 14, 7102, 360, 3870, 14, 697, 14, 992, 14, 955, 14, 9550, 7533, 475, 29, 1025, 459, 3870, 14, 13126, 995, 2973, 29, 549, 395, 4215, 63, 885, 29, 797, 9, 2378, 347, 8552, 8, 277, 12, 9813, 304, 398, 327, 29343, 3747, 5828, 641, 283, 13126, 7021, 297, 1504, 788, 5969, 297, 283, 751, 418, 267, 1592, 14, 1807, 63, 3235, 360, 3870, 63, 5969, 1114, 297, 788, 5969, 63, 344, 297, 283, 751, 63, 344, 1105, 398, 327, 15920, 1402, 283, 13126, 7021, 7, 267, 1592, 14, 1807, 63, 1224, 360, 3870, 63, 5969, 1114, 358, 398, 327, 15920, 1402, 283, 13126, 7, 267, 1592, 14, 1807, 63, 1224, 360, 3870, 63, 5969, 358, 398, 327, 15920, 1402, 283, 4761, 1197, 7, 267, 1592, 14, 1807, 63, 1224, 360, 3870, 63, 1715, 498, 358, 398, 327, 15920, 901, 283, 4761, 14, 5464, 7, 267, 1592, 14, 1807, 63, 2301, 360, 3870, 63, 1715, 297, 283, 5464, 358, 398, 327, 15920, 901, 283, 4761, 14, 5969, 7, 267, 1592, 14, 1807, 63, 2301, 360, 3870, 63, 1715, 297, 283, 5969, 63, 344, 358, 2378, 1709, 275, 469, 267, 283, 3870, 14, 751, 356, 469, 288, 283, 3396, 356, 791, 785, 63, 354, 356, 283, 1899, 297, 283, 697, 63, 1224, 356, 3546, 1178, 63, 751, 15208, 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, 344, 356, 661, 1176, 14, 697, 14, 992, 14 ]
[ 2644, 26, 2774, 13, 24, 199, 646, 2197, 199, 504, 12919, 14, 697, 492, 1592, 199, 504, 12919, 14, 86, 18, 492, 24765, 199, 504, 1639, 14, 697, 492, 1709, 199, 199, 533, 12090, 8, 24822, 304, 339, 347, 17465, 8, 277, 12, 9813, 304, 398, 327, 12934, 1402, 283, 13126, 7021, 7, 267, 1592, 14, 981, 63, 1224, 360, 3870, 63, 5969, 1114, 297, 334, 288, 661, 344, 297, 291, 14, 7102, 360, 3870, 14, 697, 14, 992, 14, 955, 14, 7547, 14, 12614, 7533, 3327, 63, 498, 29, 549, 1826, 288, 661, 5969, 297, 291, 14, 7102, 360, 3870, 14, 697, 14, 992, 14, 955, 14, 9550, 7533, 475, 29, 1025, 459, 3870, 14, 13126, 16607, 288, 661, 751, 297, 291, 14, 7102, 360, 3870, 14, 697, 14, 992, 14, 955, 14, 9550, 7533, 2407, 63, 354, 534, 3870, 63, 5969, 1114, 63, 409, 297, 370, 29, 1025, 459, 3870, 14, 1899, 16607, 288, 661, 374, 63, 2682, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 5036, 7533, 885, 29, 549, 1826, 288, 661, 466, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 3901, 7533, 885, 29, 16, 1826, 288, 661, 602, 63, 3270, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 7533, 885, 29, 2083, 14, 2083, 14, 2131, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 3870, 297, 788, 13126, 7021, 1105, 398, 327, 12934, 3747, 5828, 641, 283, 13126, 7021, 297, 1504, 788, 5969, 297, 283, 751, 418, 267, 1592, 14, 981, 63, 3235, 360, 3870, 63, 5969, 1114, 297, 788, 5969, 63, 344, 297, 283, 751, 63, 344, 1105, 398, 327, 12934, 1402, 283, 13126, 7, 267, 1592, 14, 981, 63, 1224, 360, 3870, 63, 5969, 297, 334, 288, 661, 344, 297, 291, 14, 7102, 360, 3870, 14, 697, 14, 992, 14, 955, 14, 7547, 14, 12614, 7533, 3327, 63, 498, 29, 549, 1826, 288, 661, 5464, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 17315, 7533, 3235, 29, 549, 12, 1390, 63, 1267, 29, 1400, 12, 1592, 63, 1080, 29, 549, 1826, 288, 661, 354, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 772, 1826, 288, 661, 4597, 297, 291, 14, 7102, 360, 3870, 14, 697, 14, 992, 14, 955, 14, 9550, 7533, 475, 29, 1025, 459, 3870, 14, 1899, 16607, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 3870, 297, 788, 13126, 1105, 398, 327, 12934, 1402, 283, 4761, 1197, 7, 267, 1592, 14, 981, 63, 1224, 360, 3870, 63, 1715, 498, 297, 334, 288, 661, 344, 297, 291, 14, 7102, 360, 3870, 14, 697, 14, 992, 14, 955, 14, 7547, 14, 12614, 7533, 3327, 63, 498, 29, 549, 1826, 288, 661, 1715, 297, 291, 14, 7102, 360, 3870, 14, 697, 14, 992, 14, 955, 14, 9550, 7533, 475, 29, 1025, 459, 3870, 14, 4761, 16607, 288, 661, 3455, 63, 498, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 708, 12, 3747, 29, 549, 12, 2973, 29, 549, 1826, 288, 661, 4731, 63, 498, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 708, 12, 3747, 29, 549, 12, 2973, 29, 549, 1826, 288, 661, 751, 297, 291, 14, 7102, 360, 3870, 14, 697, 14, 992, 14, 955, 14, 9550, 7533, 475, 29, 1025, 459, 3870, 14, 1899, 995, 2973, 29, 549, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 3870, 297, 788, 4761, 1197, 1105, 398, 327, 12934, 901, 283, 4761, 14, 5464, 7, 267, 1592, 14, 525, 63, 2301, 360, 3870, 63, 1715, 297, 283, 5464, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 17315, 7533, 988, 63, 1267, 29, 1400, 12, 3747, 29, 549, 12, 2973, 29, 549, 12, 1592, 63, 1080, 29, 549, 395, 4215, 63, 885, 29, 797, 9, 398, 327, 12934, 901, 283, 4761, 14, 5969, 7, 267, 1592, 14, 525, 63, 2301, 360, 3870, 63, 1715, 297, 283, 5969, 297, 291, 14, 7102, 360, 3870, 14, 697, 14, 992, 14, 955, 14, 9550, 7533, 475, 29, 1025, 459, 3870, 14, 13126, 995, 2973, 29, 549, 395, 4215, 63, 885, 29, 797, 9, 2378, 347, 8552, 8, 277, 12, 9813, 304, 398, 327, 29343, 3747, 5828, 641, 283, 13126, 7021, 297, 1504, 788, 5969, 297, 283, 751, 418, 267, 1592, 14, 1807, 63, 3235, 360, 3870, 63, 5969, 1114, 297, 788, 5969, 63, 344, 297, 283, 751, 63, 344, 1105, 398, 327, 15920, 1402, 283, 13126, 7021, 7, 267, 1592, 14, 1807, 63, 1224, 360, 3870, 63, 5969, 1114, 358, 398, 327, 15920, 1402, 283, 13126, 7, 267, 1592, 14, 1807, 63, 1224, 360, 3870, 63, 5969, 358, 398, 327, 15920, 1402, 283, 4761, 1197, 7, 267, 1592, 14, 1807, 63, 1224, 360, 3870, 63, 1715, 498, 358, 398, 327, 15920, 901, 283, 4761, 14, 5464, 7, 267, 1592, 14, 1807, 63, 2301, 360, 3870, 63, 1715, 297, 283, 5464, 358, 398, 327, 15920, 901, 283, 4761, 14, 5969, 7, 267, 1592, 14, 1807, 63, 2301, 360, 3870, 63, 1715, 297, 283, 5969, 63, 344, 358, 2378, 1709, 275, 469, 267, 283, 3870, 14, 751, 356, 469, 288, 283, 3396, 356, 791, 785, 63, 354, 356, 283, 1899, 297, 283, 697, 63, 1224, 356, 3546, 1178, 63, 751, 15208, 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, 344, 356, 661, 1176, 14, 697, 14, 992, 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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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 ]
apache-spark-on-k8s/spark
examples/src/main/python/ml/bisecting_k_means_example.py
69
1777
# # 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 __future__ import print_function # $example on$ from pyspark.ml.clustering import BisectingKMeans # $example off$ from pyspark.sql import SparkSession """ An example demonstrating bisecting k-means clustering. Run with: bin/spark-submit examples/src/main/python/ml/bisecting_k_means_example.py """ if __name__ == "__main__": spark = SparkSession\ .builder\ .appName("BisectingKMeansExample")\ .getOrCreate() # $example on$ # Loads data. dataset = spark.read.format("libsvm").load("data/mllib/sample_kmeans_data.txt") # Trains a bisecting k-means model. bkm = BisectingKMeans().setK(2).setSeed(1) model = bkm.fit(dataset) # Evaluate clustering. cost = model.computeCost(dataset) print("Within Set Sum of Squared Errors = " + str(cost)) # Shows the result. print("Cluster Centers: ") centers = model.clusterCenters() for center in centers: print(center) # $example off$ spark.stop()
apache-2.0
[ 3, 199, 3, 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 503, 1655, 199, 3, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 1854, 543, 199, 3, 642, 1736, 367, 4722, 2556, 12602, 4248, 12715, 14, 199, 3, 710, 14857, 12378, 642, 570, 370, 2047, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 199, 3, 334, 1589, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 199, 3, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 259, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 199, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 3, 2672, 2694, 641, 4, 199, 504, 15847, 14, 757, 14, 25802, 492, 699, 13133, 316, 43, 21190, 199, 3, 2672, 2694, 2331, 4, 199, 504, 15847, 14, 3009, 492, 13932, 4434, 199, 199, 624, 199, 2493, 2893, 23789, 495, 1958, 19063, 316, 1022, 13, 11579, 19454, 14, 199, 2540, 543, 26, 523, 2517, 15, 9852, 13, 7275, 7251, 15, 2164, 15, 973, 15, 1548, 15, 757, 15, 23247, 316, 63, 75, 63, 11579, 63, 2694, 14, 647, 199, 624, 199, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 272, 15442, 275, 13932, 4434, 60, 267, 1275, 5649, 60, 267, 1275, 571, 985, 480, 34, 13133, 316, 43, 21190, 9846, 27681, 267, 1275, 30457, 2499, 342, 339, 327, 2672, 2694, 641, 4, 272, 327, 30367, 666, 14, 272, 4789, 275, 15442, 14, 739, 14, 908, 480, 8450, 2611, 3471, 912, 480, 576, 15, 25598, 15, 3271, 63, 75, 11579, 63, 576, 14, 2424, 531, 339, 327, 12643, 3617, 282, 19063, 316, 1022, 13, 11579, 1402, 14, 272, 330, 14595, 275, 699, 13133, 316, 43, 21190, 1252, 409, 43, 8, 18, 680, 409, 19554, 8, 17, 9, 272, 1402, 275, 330, 14595, 14, 3269, 8, 5214, 9, 339, 327, 27450, 19454, 14, 272, 7918, 275, 1402, 14, 3357, 15568, 8, 5214, 9, 272, 870, 480, 3007, 262, 2494, 12094, 402, 428, 30458, 20456, 275, 298, 435, 620, 8, 6336, 430, 339, 327, 12968, 83, 314, 754, 14, 272, 870, 480, 9581, 32267, 878, 26, 6099, 272, 19190, 275, 1402, 14, 4201, 18345, 878, 342, 272, 367, 8126, 315, 19190, 26, 267, 870, 8, 4218, 9, 272, 327, 2672, 2694, 2331, 4, 339, 15442, 14, 2379, 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 ]
[ 199, 3, 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 503, 1655, 199, 3, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 1854, 543, 199, 3, 642, 1736, 367, 4722, 2556, 12602, 4248, 12715, 14, 199, 3, 710, 14857, 12378, 642, 570, 370, 2047, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 199, 3, 334, 1589, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 199, 3, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 259, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 199, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 3, 2672, 2694, 641, 4, 199, 504, 15847, 14, 757, 14, 25802, 492, 699, 13133, 316, 43, 21190, 199, 3, 2672, 2694, 2331, 4, 199, 504, 15847, 14, 3009, 492, 13932, 4434, 199, 199, 624, 199, 2493, 2893, 23789, 495, 1958, 19063, 316, 1022, 13, 11579, 19454, 14, 199, 2540, 543, 26, 523, 2517, 15, 9852, 13, 7275, 7251, 15, 2164, 15, 973, 15, 1548, 15, 757, 15, 23247, 316, 63, 75, 63, 11579, 63, 2694, 14, 647, 199, 624, 199, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 272, 15442, 275, 13932, 4434, 60, 267, 1275, 5649, 60, 267, 1275, 571, 985, 480, 34, 13133, 316, 43, 21190, 9846, 27681, 267, 1275, 30457, 2499, 342, 339, 327, 2672, 2694, 641, 4, 272, 327, 30367, 666, 14, 272, 4789, 275, 15442, 14, 739, 14, 908, 480, 8450, 2611, 3471, 912, 480, 576, 15, 25598, 15, 3271, 63, 75, 11579, 63, 576, 14, 2424, 531, 339, 327, 12643, 3617, 282, 19063, 316, 1022, 13, 11579, 1402, 14, 272, 330, 14595, 275, 699, 13133, 316, 43, 21190, 1252, 409, 43, 8, 18, 680, 409, 19554, 8, 17, 9, 272, 1402, 275, 330, 14595, 14, 3269, 8, 5214, 9, 339, 327, 27450, 19454, 14, 272, 7918, 275, 1402, 14, 3357, 15568, 8, 5214, 9, 272, 870, 480, 3007, 262, 2494, 12094, 402, 428, 30458, 20456, 275, 298, 435, 620, 8, 6336, 430, 339, 327, 12968, 83, 314, 754, 14, 272, 870, 480, 9581, 32267, 878, 26, 6099, 272, 19190, 275, 1402, 14, 4201, 18345, 878, 342, 272, 367, 8126, 315, 19190, 26, 267, 870, 8, 4218, 9, 272, 327, 2672, 2694, 2331, 4, 339, 15442, 14, 2379, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
mmoya/ansible
lib/ansible/utils/display_functions.py
147
2184
# (c) 2014, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. import textwrap from ansible import constants as C from ansible import errors from ansible.callbacks import display __all__ = ['deprecated', 'warning', 'system_warning'] # list of all deprecation messages to prevent duplicate display deprecations = {} warns = {} def deprecated(msg, version, removed=False): ''' used to print out a deprecation message.''' if not removed and not C.DEPRECATION_WARNINGS: return if not removed: if version: new_msg = "\n[DEPRECATION WARNING]: %s. This feature will be removed in version %s." % (msg, version) else: new_msg = "\n[DEPRECATION WARNING]: %s. This feature will be removed in a future release." % (msg) new_msg = new_msg + " Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.\n\n" else: raise errors.AnsibleError("[DEPRECATED]: %s. Please update your playbooks." % msg) wrapped = textwrap.wrap(new_msg, 79) new_msg = "\n".join(wrapped) + "\n" if new_msg not in deprecations: display(new_msg, color='purple', stderr=True) deprecations[new_msg] = 1 def warning(msg): new_msg = "\n[WARNING]: %s" % msg wrapped = textwrap.wrap(new_msg, 79) new_msg = "\n".join(wrapped) + "\n" if new_msg not in warns: display(new_msg, color='bright purple', stderr=True) warns[new_msg] = 1 def system_warning(msg): if C.SYSTEM_WARNINGS: warning(msg)
gpl-3.0
[ 3, 334, 67, 9, 6927, 12, 16922, 22453, 665, 22333, 14, 24247, 32, 6799, 14, 957, 30, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 2622, 199, 3, 199, 3, 2622, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 2622, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 2622, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 646, 13390, 199, 199, 504, 3242, 492, 5262, 465, 445, 199, 504, 3242, 492, 2552, 199, 504, 3242, 14, 11948, 492, 2929, 199, 199, 363, 452, 363, 275, 788, 6667, 297, 283, 3764, 297, 283, 2253, 63, 3764, 418, 199, 199, 3, 769, 402, 1006, 17831, 3788, 370, 7981, 9250, 2929, 199, 15383, 83, 275, 1052, 199, 19811, 275, 1052, 199, 199, 318, 5906, 8, 1328, 12, 1015, 12, 4829, 29, 797, 304, 272, 1449, 1202, 370, 870, 734, 282, 17831, 1245, 10595, 339, 340, 440, 4829, 436, 440, 445, 14, 1093, 14246, 2594, 63, 17449, 3881, 26, 267, 372, 339, 340, 440, 4829, 26, 267, 340, 1015, 26, 288, 892, 63, 1328, 275, 1867, 78, 59, 1093, 14246, 2594, 14750, 2189, 450, 83, 14, 961, 3878, 911, 506, 4829, 315, 1015, 450, 83, 2122, 450, 334, 1328, 12, 1015, 9, 267, 587, 26, 288, 892, 63, 1328, 275, 1867, 78, 59, 1093, 14246, 2594, 14750, 2189, 450, 83, 14, 961, 3878, 911, 506, 4829, 315, 282, 6466, 4683, 2122, 450, 334, 1328, 9, 267, 892, 63, 1328, 275, 892, 63, 1328, 435, 298, 1487, 6444, 3598, 883, 506, 6980, 701, 4260, 17831, 63, 5451, 29, 797, 315, 3242, 14, 4128, 3134, 78, 60, 78, 2, 272, 587, 26, 267, 746, 2552, 14, 29107, 10994, 25832, 2189, 450, 83, 14, 221, 7754, 1678, 2195, 5232, 8858, 2122, 450, 1499, 9, 339, 8072, 275, 13390, 14, 3823, 8, 1222, 63, 1328, 12, 13734, 9, 272, 892, 63, 1328, 275, 1867, 78, 1674, 904, 8, 9130, 9, 435, 1867, 78, 2, 339, 340, 892, 63, 1328, 440, 315, 17831, 83, 26, 267, 2929, 8, 1222, 63, 1328, 12, 3164, 534, 6653, 11045, 297, 4635, 29, 549, 9, 267, 17831, 83, 59, 1222, 63, 1328, 61, 275, 413, 199, 199, 318, 5721, 8, 1328, 304, 272, 892, 63, 1328, 275, 1867, 78, 59, 9171, 2189, 450, 83, 2, 450, 1499, 272, 8072, 275, 13390, 14, 3823, 8, 1222, 63, 1328, 12, 13734, 9, 272, 892, 63, 1328, 275, 1867, 78, 1674, 904, 8, 9130, 9, 435, 1867, 78, 2, 272, 340, 892, 63, 1328, 440, 315, 3429, 561, 26, 267, 2929, 8, 1222, 63, 1328, 12, 3164, 534, 27454, 5861, 11045, 297, 4635, 29, 549, 9, 267, 3429, 561, 59, 1222, 63, 1328, 61, 275, 413, 199, 199, 318, 2656, 63, 3764, 8, 1328, 304, 272, 340, 445, 14, 12711, 63, 17449, 3881, 26, 267, 5721, 8, 1328, 9, 421, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 334, 67, 9, 6927, 12, 16922, 22453, 665, 22333, 14, 24247, 32, 6799, 14, 957, 30, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 2622, 199, 3, 199, 3, 2622, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 2622, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 2622, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 646, 13390, 199, 199, 504, 3242, 492, 5262, 465, 445, 199, 504, 3242, 492, 2552, 199, 504, 3242, 14, 11948, 492, 2929, 199, 199, 363, 452, 363, 275, 788, 6667, 297, 283, 3764, 297, 283, 2253, 63, 3764, 418, 199, 199, 3, 769, 402, 1006, 17831, 3788, 370, 7981, 9250, 2929, 199, 15383, 83, 275, 1052, 199, 19811, 275, 1052, 199, 199, 318, 5906, 8, 1328, 12, 1015, 12, 4829, 29, 797, 304, 272, 1449, 1202, 370, 870, 734, 282, 17831, 1245, 10595, 339, 340, 440, 4829, 436, 440, 445, 14, 1093, 14246, 2594, 63, 17449, 3881, 26, 267, 372, 339, 340, 440, 4829, 26, 267, 340, 1015, 26, 288, 892, 63, 1328, 275, 1867, 78, 59, 1093, 14246, 2594, 14750, 2189, 450, 83, 14, 961, 3878, 911, 506, 4829, 315, 1015, 450, 83, 2122, 450, 334, 1328, 12, 1015, 9, 267, 587, 26, 288, 892, 63, 1328, 275, 1867, 78, 59, 1093, 14246, 2594, 14750, 2189, 450, 83, 14, 961, 3878, 911, 506, 4829, 315, 282, 6466, 4683, 2122, 450, 334, 1328, 9, 267, 892, 63, 1328, 275, 892, 63, 1328, 435, 298, 1487, 6444, 3598, 883, 506, 6980, 701, 4260, 17831, 63, 5451, 29, 797, 315, 3242, 14, 4128, 3134, 78, 60, 78, 2, 272, 587, 26, 267, 746, 2552, 14, 29107, 10994, 25832, 2189, 450, 83, 14, 221, 7754, 1678, 2195, 5232, 8858, 2122, 450, 1499, 9, 339, 8072, 275, 13390, 14, 3823, 8, 1222, 63, 1328, 12, 13734, 9, 272, 892, 63, 1328, 275, 1867, 78, 1674, 904, 8, 9130, 9, 435, 1867, 78, 2, 339, 340, 892, 63, 1328, 440, 315, 17831, 83, 26, 267, 2929, 8, 1222, 63, 1328, 12, 3164, 534, 6653, 11045, 297, 4635, 29, 549, 9, 267, 17831, 83, 59, 1222, 63, 1328, 61, 275, 413, 199, 199, 318, 5721, 8, 1328, 304, 272, 892, 63, 1328, 275, 1867, 78, 59, 9171, 2189, 450, 83, 2, 450, 1499, 272, 8072, 275, 13390, 14, 3823, 8, 1222, 63, 1328, 12, 13734, 9, 272, 892, 63, 1328, 275, 1867, 78, 1674, 904, 8, 9130, 9, 435, 1867, 78, 2, 272, 340, 892, 63, 1328, 440, 315, 3429, 561, 26, 267, 2929, 8, 1222, 63, 1328, 12, 3164, 534, 27454, 5861, 11045, 297, 4635, 29, 549, 9, 267, 3429, 561, 59, 1222, 63, 1328, 61, 275, 413, 199, 199, 318, 2656, 63, 3764, 8, 1328, 304, 272, 340, 445, 14, 12711, 63, 17449, 3881, 26, 267, 5721, 8, 1328, 9, 421, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
Yangqing/caffe2
caffe2/experiments/python/funhash_op_test.py
4
2885
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################## from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np from scipy.sparse import coo_matrix from hypothesis import given import hypothesis.strategies as st from caffe2.python import core import caffe2.python.hypothesis_test_util as hu class TestFunHash(hu.HypothesisTestCase): @given(n_out=st.integers(min_value=5, max_value=20), n_in=st.integers(min_value=10, max_value=20), n_data=st.integers(min_value=2, max_value=8), n_weight=st.integers(min_value=8, max_value=15), n_alpha=st.integers(min_value=3, max_value=8), sparsity=st.floats(min_value=0.1, max_value=1.0), **hu.gcs) def test_funhash(self, n_out, n_in, n_data, n_weight, n_alpha, sparsity, gc, dc): A = np.random.rand(n_data, n_in) A[A > sparsity] = 0 A_coo = coo_matrix(A) val, key, seg = A_coo.data, A_coo.col, A_coo.row weight = np.random.rand(n_weight).astype(np.float32) alpha = np.random.rand(n_alpha).astype(np.float32) val = val.astype(np.float32) key = key.astype(np.int64) seg = seg.astype(np.int32) op = core.CreateOperator( 'FunHash', ['val', 'key', 'seg', 'weight', 'alpha'], ['out'], num_outputs=n_out) # Check over multiple devices self.assertDeviceChecks( dc, op, [val, key, seg, weight, alpha], [0]) # Gradient check wrt weight self.assertGradientChecks( gc, op, [val, key, seg, weight, alpha], 3, [0]) # Gradient check wrt alpha self.assertGradientChecks( gc, op, [val, key, seg, weight, alpha], 4, [0]) op2 = core.CreateOperator( 'FunHash', ['val', 'key', 'seg', 'weight'], ['out'], num_outputs=n_out) # Check over multiple devices self.assertDeviceChecks( dc, op2, [val, key, seg, weight], [0]) # Gradient check wrt weight self.assertGradientChecks( gc, op2, [val, key, seg, weight], 3, [0])
apache-2.0
[ 3, 1898, 334, 67, 9, 7800, 13, 1881, 12, 27107, 12, 3277, 14, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 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, 4605, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 504, 636, 2443, 363, 492, 4629, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 2680, 465, 980, 199, 504, 7026, 14, 4421, 492, 512, 79, 63, 3642, 199, 199, 504, 29268, 492, 1627, 199, 646, 29268, 14, 20694, 1500, 465, 410, 199, 199, 504, 1704, 2026, 18, 14, 1548, 492, 6170, 199, 646, 1704, 2026, 18, 14, 1548, 14, 3577, 555, 14925, 63, 396, 63, 1974, 465, 394, 85, 421, 199, 533, 1379, 19941, 3476, 8, 10616, 14, 21568, 555, 14925, 1746, 304, 272, 768, 11809, 8, 78, 63, 548, 29, 270, 14, 23931, 8, 827, 63, 585, 29, 21, 12, 1390, 63, 585, 29, 1165, 395, 1779, 302, 63, 262, 29, 270, 14, 23931, 8, 827, 63, 585, 29, 709, 12, 1390, 63, 585, 29, 1165, 395, 1779, 302, 63, 576, 29, 270, 14, 23931, 8, 827, 63, 585, 29, 18, 12, 1390, 63, 585, 29, 24, 395, 1779, 302, 63, 3463, 29, 270, 14, 23931, 8, 827, 63, 585, 29, 24, 12, 1390, 63, 585, 29, 1046, 395, 1779, 302, 63, 4468, 29, 270, 14, 23931, 8, 827, 63, 585, 29, 19, 12, 1390, 63, 585, 29, 24, 395, 1779, 28668, 3677, 29, 270, 14, 1609, 83, 8, 827, 63, 585, 29, 16, 14, 17, 12, 1390, 63, 585, 29, 17, 14, 16, 395, 1779, 1011, 10616, 14, 21757, 9, 272, 347, 511, 63, 7036, 2227, 8, 277, 12, 302, 63, 548, 12, 302, 63, 262, 12, 302, 63, 576, 12, 302, 63, 3463, 12, 302, 63, 4468, 12, 28668, 3677, 12, 2151, 9486, 12, 12326, 304, 267, 437, 275, 980, 14, 2355, 14, 3759, 8, 78, 63, 576, 12, 302, 63, 262, 9, 267, 437, 59, 33, 690, 28668, 3677, 61, 275, 378, 267, 437, 63, 22684, 275, 512, 79, 63, 3642, 8, 33, 9, 267, 1139, 12, 790, 12, 8812, 275, 437, 63, 22684, 14, 576, 12, 437, 63, 22684, 14, 761, 12, 437, 63, 22684, 14, 1143, 398, 5401, 275, 980, 14, 2355, 14, 3759, 8, 78, 63, 3463, 680, 6041, 8, 1590, 14, 1609, 708, 9, 267, 5131, 275, 980, 14, 2355, 14, 3759, 8, 78, 63, 4468, 680, 6041, 8, 1590, 14, 1609, 708, 9, 267, 1139, 275, 1139, 14, 6041, 8, 1590, 14, 1609, 708, 9, 267, 790, 275, 790, 14, 6041, 8, 1590, 14, 442, 772, 9, 267, 8812, 275, 8812, 14, 6041, 8, 1590, 14, 442, 708, 9, 398, 1687, 275, 6170, 14, 2499, 7961, 8, 288, 283, 19941, 3476, 297, 288, 788, 637, 297, 283, 498, 297, 283, 8359, 297, 283, 3463, 297, 283, 4468, 995, 288, 788, 548, 995, 288, 1967, 63, 4467, 29, 78, 63, 548, 9, 398, 327, 2670, 1806, 3663, 7256, 267, 291, 14, 479, 2510, 11834, 8, 288, 12326, 12, 1687, 12, 359, 637, 12, 790, 12, 8812, 12, 5401, 12, 5131, 467, 359, 16, 566, 267, 327, 19603, 1104, 23105, 5401, 267, 291, 14, 479, 9942, 11834, 8, 288, 9486, 12, 1687, 12, 359, 637, 12, 790, 12, 8812, 12, 5401, 12, 5131, 467, 650, 12, 359, 16, 566, 267, 327, 19603, 1104, 23105, 5131, 267, 291, 14, 479, 9942, 11834, 8, 288, 9486, 12, 1687, 12, 359, 637, 12, 790, 12, 8812, 12, 5401, 12, 5131, 467, 841, 12, 359, 16, 566, 398, 1687, 18, 275, 6170, 14, 2499, 7961, 8, 288, 283, 19941, 3476, 297, 288, 788, 637, 297, 283, 498, 297, 283, 8359, 297, 283, 3463, 995, 288, 788, 548, 995, 288, 1967, 63, 4467, 29, 78, 63, 548, 9, 398, 327, 2670, 1806, 3663, 7256, 267, 291, 14, 479, 2510, 11834, 8, 288, 12326, 12, 1687, 18, 12, 359, 637, 12, 790, 12, 8812, 12, 5401, 467, 359, 16, 566, 267, 327, 19603, 1104, 23105, 5401, 267, 291, 14, 479, 9942, 11834, 8, 288, 9486, 12, 1687, 18, 12, 359, 637, 12, 790, 12, 8812, 12, 5401, 467, 650, 12, 359, 16, 566, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1898, 334, 67, 9, 7800, 13, 1881, 12, 27107, 12, 3277, 14, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 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, 4605, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 504, 636, 2443, 363, 492, 4629, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 2680, 465, 980, 199, 504, 7026, 14, 4421, 492, 512, 79, 63, 3642, 199, 199, 504, 29268, 492, 1627, 199, 646, 29268, 14, 20694, 1500, 465, 410, 199, 199, 504, 1704, 2026, 18, 14, 1548, 492, 6170, 199, 646, 1704, 2026, 18, 14, 1548, 14, 3577, 555, 14925, 63, 396, 63, 1974, 465, 394, 85, 421, 199, 533, 1379, 19941, 3476, 8, 10616, 14, 21568, 555, 14925, 1746, 304, 272, 768, 11809, 8, 78, 63, 548, 29, 270, 14, 23931, 8, 827, 63, 585, 29, 21, 12, 1390, 63, 585, 29, 1165, 395, 1779, 302, 63, 262, 29, 270, 14, 23931, 8, 827, 63, 585, 29, 709, 12, 1390, 63, 585, 29, 1165, 395, 1779, 302, 63, 576, 29, 270, 14, 23931, 8, 827, 63, 585, 29, 18, 12, 1390, 63, 585, 29, 24, 395, 1779, 302, 63, 3463, 29, 270, 14, 23931, 8, 827, 63, 585, 29, 24, 12, 1390, 63, 585, 29, 1046, 395, 1779, 302, 63, 4468, 29, 270, 14, 23931, 8, 827, 63, 585, 29, 19, 12, 1390, 63, 585, 29, 24, 395, 1779, 28668, 3677, 29, 270, 14, 1609, 83, 8, 827, 63, 585, 29, 16, 14, 17, 12, 1390, 63, 585, 29, 17, 14, 16, 395, 1779, 1011, 10616, 14, 21757, 9, 272, 347, 511, 63, 7036, 2227, 8, 277, 12, 302, 63, 548, 12, 302, 63, 262, 12, 302, 63, 576, 12, 302, 63, 3463, 12, 302, 63, 4468, 12, 28668, 3677, 12, 2151, 9486, 12, 12326, 304, 267, 437, 275, 980, 14, 2355, 14, 3759, 8, 78, 63, 576, 12, 302, 63, 262, 9, 267, 437, 59, 33, 690, 28668, 3677, 61, 275, 378, 267, 437, 63, 22684, 275, 512, 79, 63, 3642, 8, 33, 9, 267, 1139, 12, 790, 12, 8812, 275, 437, 63, 22684, 14, 576, 12, 437, 63, 22684, 14, 761, 12, 437, 63, 22684, 14, 1143, 398, 5401, 275, 980, 14, 2355, 14, 3759, 8, 78, 63, 3463, 680, 6041, 8, 1590, 14, 1609, 708, 9, 267, 5131, 275, 980, 14, 2355, 14, 3759, 8, 78, 63, 4468, 680, 6041, 8, 1590, 14, 1609, 708, 9, 267, 1139, 275, 1139, 14, 6041, 8, 1590, 14, 1609, 708, 9, 267, 790, 275, 790, 14, 6041, 8, 1590, 14, 442, 772, 9, 267, 8812, 275, 8812, 14, 6041, 8, 1590, 14, 442, 708, 9, 398, 1687, 275, 6170, 14, 2499, 7961, 8, 288, 283, 19941, 3476, 297, 288, 788, 637, 297, 283, 498, 297, 283, 8359, 297, 283, 3463, 297, 283, 4468, 995, 288, 788, 548, 995, 288, 1967, 63, 4467, 29, 78, 63, 548, 9, 398, 327, 2670, 1806, 3663, 7256, 267, 291, 14, 479, 2510, 11834, 8, 288, 12326, 12, 1687, 12, 359, 637, 12, 790, 12, 8812, 12, 5401, 12, 5131, 467, 359, 16, 566, 267, 327, 19603, 1104, 23105, 5401, 267, 291, 14, 479, 9942, 11834, 8, 288, 9486, 12, 1687, 12, 359, 637, 12, 790, 12, 8812, 12, 5401, 12, 5131, 467, 650, 12, 359, 16, 566, 267, 327, 19603, 1104, 23105, 5131, 267, 291, 14, 479, 9942, 11834, 8, 288, 9486, 12, 1687, 12, 359, 637, 12, 790, 12, 8812, 12, 5401, 12, 5131, 467, 841, 12, 359, 16, 566, 398, 1687, 18, 275, 6170, 14, 2499, 7961, 8, 288, 283, 19941, 3476, 297, 288, 788, 637, 297, 283, 498, 297, 283, 8359, 297, 283, 3463, 995, 288, 788, 548, 995, 288, 1967, 63, 4467, 29, 78, 63, 548, 9, 398, 327, 2670, 1806, 3663, 7256, 267, 291, 14, 479, 2510, 11834, 8, 288, 12326, 12, 1687, 18, 12, 359, 637, 12, 790, 12, 8812, 12, 5401, 467, 359, 16, 566, 267, 327, 19603, 1104, 23105, 5401, 267, 291, 14, 479, 9942, 11834, 8, 288, 9486, 12, 1687, 18, 12, 359, 637, 12, 790, 12, 8812, 12, 5401, 467, 650, 12, 359, 16, 566, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
mzdaniel/oh-mainline
vendor/packages/twisted/twisted/internet/threads.py
25
3851
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Extended thread dispatching support. For basic support see reactor threading API docs. Maintainer: Itamar Shtull-Trauring """ import Queue from twisted.python import failure from twisted.internet import defer def deferToThreadPool(reactor, threadpool, f, *args, **kwargs): """ Call the function C{f} using a thread from the given threadpool and return the result as a Deferred. This function is only used by client code which is maintaining its own threadpool. To run a function in the reactor's threadpool, use C{deferToThread}. @param reactor: The reactor in whose main thread the Deferred will be invoked. @param threadpool: An object which supports the C{callInThreadWithCallback} method of C{twisted.python.threadpool.ThreadPool}. @param f: The function to call. @param *args: positional arguments to pass to f. @param **kwargs: keyword arguments to pass to f. @return: A Deferred which fires a callback with the result of f, or an errback with a L{twisted.python.failure.Failure} if f throws an exception. """ d = defer.Deferred() def onResult(success, result): if success: reactor.callFromThread(d.callback, result) else: reactor.callFromThread(d.errback, result) threadpool.callInThreadWithCallback(onResult, f, *args, **kwargs) return d def deferToThread(f, *args, **kwargs): """ Run a function in a thread and return the result as a Deferred. @param f: The function to call. @param *args: positional arguments to pass to f. @param **kwargs: keyword arguments to pass to f. @return: A Deferred which fires a callback with the result of f, or an errback with a L{twisted.python.failure.Failure} if f throws an exception. """ from twisted.internet import reactor return deferToThreadPool(reactor, reactor.getThreadPool(), f, *args, **kwargs) def _runMultiple(tupleList): """ Run a list of functions. """ for f, args, kwargs in tupleList: f(*args, **kwargs) def callMultipleInThread(tupleList): """ Run a list of functions in the same thread. tupleList should be a list of (function, argsList, kwargsDict) tuples. """ from twisted.internet import reactor reactor.callInThread(_runMultiple, tupleList) def blockingCallFromThread(reactor, f, *a, **kw): """ Run a function in the reactor from a thread, and wait for the result synchronously. If the function returns a L{Deferred}, wait for its result and return that. @param reactor: The L{IReactorThreads} provider which will be used to schedule the function call. @param f: the callable to run in the reactor thread @type f: any callable. @param a: the arguments to pass to C{f}. @param kw: the keyword arguments to pass to C{f}. @return: the result of the L{Deferred} returned by C{f}, or the result of C{f} if it returns anything other than a L{Deferred}. @raise: If C{f} raises a synchronous exception, C{blockingCallFromThread} will raise that exception. If C{f} returns a L{Deferred} which fires with a L{Failure}, C{blockingCallFromThread} will raise that failure's exception (see L{Failure.raiseException}). """ queue = Queue.Queue() def _callFromThread(): result = defer.maybeDeferred(f, *a, **kw) result.addBoth(queue.put) reactor.callFromThread(_callFromThread) result = queue.get() if isinstance(result, failure.Failure): result.raiseException() return result __all__ = ["deferToThread", "deferToThreadPool", "callMultipleInThread", "blockingCallFromThread"]
agpl-3.0
[ 3, 1898, 334, 67, 9, 17078, 8449, 26640, 14, 199, 3, 1666, 5113, 367, 2436, 14, 199, 199, 624, 199, 14107, 2462, 7634, 316, 2291, 14, 199, 199, 1858, 5678, 2291, 1937, 9655, 5796, 3261, 9149, 14, 199, 199, 11903, 8368, 281, 26, 2779, 455, 285, 428, 517, 979, 13, 2437, 4039, 199, 624, 199, 199, 646, 10703, 199, 199, 504, 7390, 14, 1548, 492, 5988, 199, 504, 7390, 14, 4901, 492, 10133, 421, 199, 318, 10133, 1378, 4436, 5453, 8, 13544, 12, 2462, 2293, 12, 289, 12, 627, 589, 12, 1011, 958, 304, 272, 408, 272, 6523, 314, 805, 445, 91, 70, 93, 1808, 282, 2462, 687, 314, 1627, 2462, 2293, 436, 372, 272, 314, 754, 465, 282, 17448, 14, 339, 961, 805, 365, 1454, 1202, 701, 1890, 1233, 1314, 365, 11075, 316, 2399, 5705, 272, 2462, 2293, 14, 221, 4005, 1255, 282, 805, 315, 314, 9655, 1159, 2462, 2293, 12, 675, 272, 445, 91, 11610, 1378, 4436, 5565, 339, 768, 635, 9655, 26, 710, 9655, 315, 7447, 2446, 2462, 314, 17448, 911, 506, 267, 10302, 14, 339, 768, 635, 2462, 2293, 26, 1626, 909, 1314, 5171, 314, 445, 91, 1250, 607, 4436, 28625, 93, 267, 1083, 402, 445, 91, 12145, 14, 1548, 14, 2671, 2293, 14, 4436, 5453, 5565, 339, 768, 635, 289, 26, 710, 805, 370, 1240, 14, 272, 768, 635, 627, 589, 26, 11333, 2368, 370, 986, 370, 289, 14, 272, 768, 635, 1011, 958, 26, 4252, 2368, 370, 986, 370, 289, 14, 339, 768, 1107, 26, 437, 17448, 1314, 28887, 282, 3233, 543, 314, 754, 402, 289, 12, 503, 376, 267, 2329, 894, 543, 282, 491, 91, 12145, 14, 1548, 14, 5328, 14, 6782, 93, 340, 289, 24266, 376, 267, 1919, 14, 272, 408, 272, 366, 275, 10133, 14, 9937, 342, 339, 347, 641, 2889, 8, 3742, 12, 754, 304, 267, 340, 3182, 26, 288, 9655, 14, 1250, 2532, 4436, 8, 68, 14, 3058, 12, 754, 9, 267, 587, 26, 288, 9655, 14, 1250, 2532, 4436, 8, 68, 14, 28940, 12, 754, 9, 339, 2462, 2293, 14, 1250, 607, 4436, 28625, 8, 265, 2889, 12, 289, 12, 627, 589, 12, 1011, 958, 9, 339, 372, 366, 421, 199, 318, 10133, 1378, 4436, 8, 70, 12, 627, 589, 12, 1011, 958, 304, 272, 408, 272, 3378, 282, 805, 315, 282, 2462, 436, 372, 314, 754, 465, 282, 17448, 14, 339, 768, 635, 289, 26, 710, 805, 370, 1240, 14, 272, 768, 635, 627, 589, 26, 11333, 2368, 370, 986, 370, 289, 14, 272, 768, 635, 1011, 958, 26, 4252, 2368, 370, 986, 370, 289, 14, 339, 768, 1107, 26, 437, 17448, 1314, 28887, 282, 3233, 543, 314, 754, 402, 289, 12, 272, 503, 376, 2329, 894, 543, 282, 491, 91, 12145, 14, 1548, 14, 5328, 14, 6782, 93, 340, 289, 24266, 272, 376, 1919, 14, 272, 408, 272, 687, 7390, 14, 4901, 492, 9655, 272, 372, 10133, 1378, 4436, 5453, 8, 13544, 12, 9655, 14, 362, 4436, 5453, 1062, 2490, 289, 12, 627, 589, 12, 1011, 958, 9, 421, 199, 318, 485, 1065, 8433, 8, 2960, 1296, 304, 272, 408, 272, 3378, 282, 769, 402, 3423, 14, 272, 408, 272, 367, 289, 12, 1249, 12, 2074, 315, 2008, 1296, 26, 267, 289, 2031, 589, 12, 1011, 958, 9, 421, 199, 318, 1240, 8433, 607, 4436, 8, 2960, 1296, 304, 272, 408, 272, 3378, 282, 769, 402, 3423, 315, 314, 2011, 2462, 14, 339, 2008, 1296, 1077, 506, 282, 769, 402, 334, 1593, 12, 1249, 1296, 12, 2074, 2141, 9, 6346, 14, 272, 408, 272, 687, 7390, 14, 4901, 492, 9655, 272, 9655, 14, 1250, 607, 4436, 1547, 1065, 8433, 12, 2008, 1296, 9, 421, 199, 318, 14592, 2176, 2532, 4436, 8, 13544, 12, 289, 12, 627, 65, 12, 1011, 829, 304, 272, 408, 272, 3378, 282, 805, 315, 314, 9655, 687, 282, 2462, 12, 436, 3618, 367, 314, 754, 272, 24248, 590, 14, 221, 982, 314, 805, 2529, 282, 491, 91, 9937, 1386, 3618, 367, 2399, 272, 754, 436, 372, 626, 14, 339, 768, 635, 9655, 26, 710, 491, 91, 30861, 22785, 93, 5022, 1314, 911, 506, 1202, 370, 267, 8732, 314, 805, 1240, 14, 272, 768, 635, 289, 26, 314, 4550, 370, 1255, 315, 314, 9655, 2462, 272, 768, 466, 289, 26, 1263, 4550, 14, 272, 768, 635, 282, 26, 314, 2368, 370, 986, 370, 445, 91, 70, 5565, 272, 768, 635, 4775, 26, 314, 4252, 2368, 370, 986, 370, 445, 91, 70, 5565, 339, 768, 1107, 26, 314, 754, 402, 314, 491, 91, 9937, 93, 2138, 701, 445, 91, 70, 1386, 503, 314, 754, 267, 402, 445, 91, 70, 93, 340, 652, 2529, 7003, 1163, 2419, 282, 491, 91, 9937, 5565, 339, 768, 3730, 26, 982, 445, 91, 70, 93, 6534, 282, 24248, 1919, 12, 267, 445, 91, 13091, 2176, 2532, 4436, 93, 911, 746, 626, 1919, 14, 221, 982, 445, 91, 70, 93, 267, 2529, 282, 491, 91, 9937, 93, 1314, 28887, 543, 282, 491, 91, 6782, 1386, 267, 445, 91, 13091, 2176, 2532, 4436, 93, 911, 746, 626, 5988, 1159, 1919, 334, 3239, 267, 491, 91, 6782, 14, 3730, 1726, 21385, 272, 408, 272, 4126, 275, 10703, 14, 3737, 342, 272, 347, 485, 1250, 2532, 4436, 837, 267, 754, 275, 10133, 14, 11853, 9937, 8, 70, 12, 627, 65, 12, 1011, 829, 9, 267, 754, 14, 525, 18088, 8, 1825, 14, 524, 9, 272, 9655, 14, 1250, 2532, 4436, 1547, 1250, 2532, 4436, 9, 272, 754, 275, 4126, 14, 362, 342, 272, 340, 1228, 8, 1099, 12, 5988, 14, 6782, 304, 267, 754, 14, 3730, 1726, 342, 272, 372, 754, 421, 199, 363, 452, 363, 275, 2097, 11610, 1378, 4436, 401, 298, 11610, 1378, 4436, 5453, 401, 298, 1250, 8433, 607, 4436, 401, 1779, 298, 13091, 2176, 2532, 4436, 937, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 17078, 8449, 26640, 14, 199, 3, 1666, 5113, 367, 2436, 14, 199, 199, 624, 199, 14107, 2462, 7634, 316, 2291, 14, 199, 199, 1858, 5678, 2291, 1937, 9655, 5796, 3261, 9149, 14, 199, 199, 11903, 8368, 281, 26, 2779, 455, 285, 428, 517, 979, 13, 2437, 4039, 199, 624, 199, 199, 646, 10703, 199, 199, 504, 7390, 14, 1548, 492, 5988, 199, 504, 7390, 14, 4901, 492, 10133, 421, 199, 318, 10133, 1378, 4436, 5453, 8, 13544, 12, 2462, 2293, 12, 289, 12, 627, 589, 12, 1011, 958, 304, 272, 408, 272, 6523, 314, 805, 445, 91, 70, 93, 1808, 282, 2462, 687, 314, 1627, 2462, 2293, 436, 372, 272, 314, 754, 465, 282, 17448, 14, 339, 961, 805, 365, 1454, 1202, 701, 1890, 1233, 1314, 365, 11075, 316, 2399, 5705, 272, 2462, 2293, 14, 221, 4005, 1255, 282, 805, 315, 314, 9655, 1159, 2462, 2293, 12, 675, 272, 445, 91, 11610, 1378, 4436, 5565, 339, 768, 635, 9655, 26, 710, 9655, 315, 7447, 2446, 2462, 314, 17448, 911, 506, 267, 10302, 14, 339, 768, 635, 2462, 2293, 26, 1626, 909, 1314, 5171, 314, 445, 91, 1250, 607, 4436, 28625, 93, 267, 1083, 402, 445, 91, 12145, 14, 1548, 14, 2671, 2293, 14, 4436, 5453, 5565, 339, 768, 635, 289, 26, 710, 805, 370, 1240, 14, 272, 768, 635, 627, 589, 26, 11333, 2368, 370, 986, 370, 289, 14, 272, 768, 635, 1011, 958, 26, 4252, 2368, 370, 986, 370, 289, 14, 339, 768, 1107, 26, 437, 17448, 1314, 28887, 282, 3233, 543, 314, 754, 402, 289, 12, 503, 376, 267, 2329, 894, 543, 282, 491, 91, 12145, 14, 1548, 14, 5328, 14, 6782, 93, 340, 289, 24266, 376, 267, 1919, 14, 272, 408, 272, 366, 275, 10133, 14, 9937, 342, 339, 347, 641, 2889, 8, 3742, 12, 754, 304, 267, 340, 3182, 26, 288, 9655, 14, 1250, 2532, 4436, 8, 68, 14, 3058, 12, 754, 9, 267, 587, 26, 288, 9655, 14, 1250, 2532, 4436, 8, 68, 14, 28940, 12, 754, 9, 339, 2462, 2293, 14, 1250, 607, 4436, 28625, 8, 265, 2889, 12, 289, 12, 627, 589, 12, 1011, 958, 9, 339, 372, 366, 421, 199, 318, 10133, 1378, 4436, 8, 70, 12, 627, 589, 12, 1011, 958, 304, 272, 408, 272, 3378, 282, 805, 315, 282, 2462, 436, 372, 314, 754, 465, 282, 17448, 14, 339, 768, 635, 289, 26, 710, 805, 370, 1240, 14, 272, 768, 635, 627, 589, 26, 11333, 2368, 370, 986, 370, 289, 14, 272, 768, 635, 1011, 958, 26, 4252, 2368, 370, 986, 370, 289, 14, 339, 768, 1107, 26, 437, 17448, 1314, 28887, 282, 3233, 543, 314, 754, 402, 289, 12, 272, 503, 376, 2329, 894, 543, 282, 491, 91, 12145, 14, 1548, 14, 5328, 14, 6782, 93, 340, 289, 24266, 272, 376, 1919, 14, 272, 408, 272, 687, 7390, 14, 4901, 492, 9655, 272, 372, 10133, 1378, 4436, 5453, 8, 13544, 12, 9655, 14, 362, 4436, 5453, 1062, 2490, 289, 12, 627, 589, 12, 1011, 958, 9, 421, 199, 318, 485, 1065, 8433, 8, 2960, 1296, 304, 272, 408, 272, 3378, 282, 769, 402, 3423, 14, 272, 408, 272, 367, 289, 12, 1249, 12, 2074, 315, 2008, 1296, 26, 267, 289, 2031, 589, 12, 1011, 958, 9, 421, 199, 318, 1240, 8433, 607, 4436, 8, 2960, 1296, 304, 272, 408, 272, 3378, 282, 769, 402, 3423, 315, 314, 2011, 2462, 14, 339, 2008, 1296, 1077, 506, 282, 769, 402, 334, 1593, 12, 1249, 1296, 12, 2074, 2141, 9, 6346, 14, 272, 408, 272, 687, 7390, 14, 4901, 492, 9655, 272, 9655, 14, 1250, 607, 4436, 1547, 1065, 8433, 12, 2008, 1296, 9, 421, 199, 318, 14592, 2176, 2532, 4436, 8, 13544, 12, 289, 12, 627, 65, 12, 1011, 829, 304, 272, 408, 272, 3378, 282, 805, 315, 314, 9655, 687, 282, 2462, 12, 436, 3618, 367, 314, 754, 272, 24248, 590, 14, 221, 982, 314, 805, 2529, 282, 491, 91, 9937, 1386, 3618, 367, 2399, 272, 754, 436, 372, 626, 14, 339, 768, 635, 9655, 26, 710, 491, 91, 30861, 22785, 93, 5022, 1314, 911, 506, 1202, 370, 267, 8732, 314, 805, 1240, 14, 272, 768, 635, 289, 26, 314, 4550, 370, 1255, 315, 314, 9655, 2462, 272, 768, 466, 289, 26, 1263, 4550, 14, 272, 768, 635, 282, 26, 314, 2368, 370, 986, 370, 445, 91, 70, 5565, 272, 768, 635, 4775, 26, 314, 4252, 2368, 370, 986, 370, 445, 91, 70, 5565, 339, 768, 1107, 26, 314, 754, 402, 314, 491, 91, 9937, 93, 2138, 701, 445, 91, 70, 1386, 503, 314, 754, 267, 402, 445, 91, 70, 93, 340, 652, 2529, 7003, 1163, 2419, 282, 491, 91, 9937, 5565, 339, 768, 3730, 26, 982, 445, 91, 70, 93, 6534, 282, 24248, 1919, 12, 267, 445, 91, 13091, 2176, 2532, 4436, 93, 911, 746, 626, 1919, 14, 221, 982, 445, 91, 70, 93, 267, 2529, 282, 491, 91, 9937, 93, 1314, 28887, 543, 282, 491, 91, 6782, 1386, 267, 445, 91, 13091, 2176, 2532, 4436, 93, 911, 746, 626, 5988, 1159, 1919, 334, 3239, 267, 491, 91, 6782, 14, 3730, 1726, 21385, 272, 408, 272, 4126, 275, 10703, 14, 3737, 342, 272, 347, 485, 1250, 2532, 4436, 837, 267, 754, 275, 10133, 14, 11853, 9937, 8, 70, 12, 627, 65, 12, 1011, 829, 9, 267, 754, 14, 525, 18088, 8, 1825, 14, 524, 9, 272, 9655, 14, 1250, 2532, 4436, 1547, 1250, 2532, 4436, 9, 272, 754, 275, 4126, 14, 362, 342, 272, 340, 1228, 8, 1099, 12, 5988, 14, 6782, 304, 267, 754, 14, 3730, 1726, 342, 272, 372, 754, 421, 199, 363, 452, 363, 275, 2097, 11610, 1378, 4436, 401, 298, 11610, 1378, 4436, 5453, 401, 298, 1250, 8433, 607, 4436, 401, 1779, 298, 13091, 2176, 2532, 4436, 937, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
michael-ball/sublime-text
sublime-text-3/Packages/Python PEP8 Autoformat/libs/py26/lib2to3/pgen2/grammar.py
119
5373
# Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """This module defines the data structures used to represent a grammar. These are a bit arcane because they are derived from the data structures used by Python's 'pgen' parser generator. There's also a table here mapping operators to their names in the token module; the Python tokenize module reports all operators as the fallback token code OP, but the parser needs the actual token code. """ # Python imports import pickle # Local imports from . import token, tokenize class Grammar(object): """Pgen parsing tables tables conversion class. Once initialized, this class supplies the grammar tables for the parsing engine implemented by parse.py. The parsing engine accesses the instance variables directly. The class here does not provide initialization of the tables; several subclasses exist to do this (see the conv and pgen modules). The load() method reads the tables from a pickle file, which is much faster than the other ways offered by subclasses. The pickle file is written by calling dump() (after loading the grammar tables using a subclass). The report() method prints a readable representation of the tables to stdout, for debugging. The instance variables are as follows: symbol2number -- a dict mapping symbol names to numbers. Symbol numbers are always 256 or higher, to distinguish them from token numbers, which are between 0 and 255 (inclusive). number2symbol -- a dict mapping numbers to symbol names; these two are each other's inverse. states -- a list of DFAs, where each DFA is a list of states, each state is is a list of arcs, and each arc is a (i, j) pair where i is a label and j is a state number. The DFA number is the index into this list. (This name is slightly confusing.) Final states are represented by a special arc of the form (0, j) where j is its own state number. dfas -- a dict mapping symbol numbers to (DFA, first) pairs, where DFA is an item from the states list above, and first is a set of tokens that can begin this grammar rule (represented by a dict whose values are always 1). labels -- a list of (x, y) pairs where x is either a token number or a symbol number, and y is either None or a string; the strings are keywords. The label number is the index in this list; label numbers are used to mark state transitions (arcs) in the DFAs. start -- the number of the grammar's start symbol. keywords -- a dict mapping keyword strings to arc labels. tokens -- a dict mapping token numbers to arc labels. """ def __init__(self): self.symbol2number = {} self.number2symbol = {} self.states = [] self.dfas = {} self.labels = [(0, "EMPTY")] self.keywords = {} self.tokens = {} self.symbol2label = {} self.start = 256 def dump(self, filename): """Dump the grammar tables to a pickle file.""" f = open(filename, "wb") pickle.dump(self.__dict__, f, 2) f.close() def load(self, filename): """Load the grammar tables from a pickle file.""" f = open(filename, "rb") d = pickle.load(f) f.close() self.__dict__.update(d) def copy(self): """ Copy the grammar. """ new = self.__class__() for dict_attr in ("symbol2number", "number2symbol", "dfas", "keywords", "tokens", "symbol2label"): setattr(new, dict_attr, getattr(self, dict_attr).copy()) new.labels = self.labels[:] new.states = self.states[:] new.start = self.start return new def report(self): """Dump the grammar tables to standard output, for debugging.""" from pprint import pprint print "s2n" pprint(self.symbol2number) print "n2s" pprint(self.number2symbol) print "states" pprint(self.states) print "dfas" pprint(self.dfas) print "labels" pprint(self.labels) print "start", self.start # Map from operator to number (since tokenize doesn't do this) opmap_raw = """ ( LPAR ) RPAR [ LSQB ] RSQB : COLON , COMMA ; SEMI + PLUS - MINUS * STAR / SLASH | VBAR & AMPER < LESS > GREATER = EQUAL . DOT % PERCENT ` BACKQUOTE { LBRACE } RBRACE @ AT == EQEQUAL != NOTEQUAL <> NOTEQUAL <= LESSEQUAL >= GREATEREQUAL ~ TILDE ^ CIRCUMFLEX << LEFTSHIFT >> RIGHTSHIFT ** DOUBLESTAR += PLUSEQUAL -= MINEQUAL *= STAREQUAL /= SLASHEQUAL %= PERCENTEQUAL &= AMPEREQUAL |= VBAREQUAL ^= CIRCUMFLEXEQUAL <<= LEFTSHIFTEQUAL >>= RIGHTSHIFTEQUAL **= DOUBLESTAREQUAL // DOUBLESLASH //= DOUBLESLASHEQUAL -> RARROW """ opmap = {} for line in opmap_raw.splitlines(): if line: op, name = line.split() opmap[op] = getattr(token, name)
unlicense
[ 3, 1898, 8353, 13, 9397, 6566, 279, 13863, 12, 3277, 14, 2900, 5924, 5702, 14, 199, 3, 3909, 370, 29770, 1334, 282, 17636, 28629, 14, 199, 199, 624, 2765, 859, 7890, 314, 666, 13955, 1202, 370, 2954, 282, 12528, 14, 199, 199, 20676, 787, 282, 4546, 601, 2425, 69, 2952, 2985, 787, 7131, 687, 314, 666, 199, 13547, 1202, 701, 2018, 1159, 283, 80, 2268, 7, 1798, 4306, 14, 199, 199, 10924, 1159, 2597, 282, 1817, 2348, 4412, 10211, 370, 3932, 1561, 315, 314, 199, 1418, 859, 27, 314, 2018, 13343, 859, 13924, 1006, 10211, 465, 314, 199, 10538, 1526, 1233, 9827, 12, 1325, 314, 1798, 4839, 314, 3503, 1526, 1233, 14, 199, 199, 624, 199, 199, 3, 2018, 8925, 199, 646, 5927, 199, 199, 3, 10111, 8925, 199, 504, 1275, 492, 1526, 12, 13343, 421, 199, 533, 10268, 9992, 8, 785, 304, 272, 408, 48, 2268, 6057, 6716, 6716, 8603, 1021, 14, 339, 19468, 10038, 12, 642, 1021, 4973, 6528, 314, 12528, 6716, 367, 314, 272, 6057, 6869, 6366, 701, 2198, 14, 647, 14, 221, 710, 6057, 6869, 272, 1066, 5804, 314, 1256, 2860, 5370, 14, 221, 710, 1021, 2348, 1630, 440, 272, 5647, 11097, 402, 314, 6716, 27, 9978, 9180, 2187, 370, 272, 886, 642, 334, 3239, 314, 8260, 436, 299, 2268, 4621, 680, 339, 710, 2248, 342, 1083, 11597, 314, 6716, 687, 282, 5927, 570, 12, 1314, 365, 272, 8298, 12930, 2419, 314, 1163, 15217, 402, 22941, 701, 9180, 14, 221, 710, 5927, 272, 570, 365, 5313, 701, 6358, 5461, 342, 334, 4399, 8697, 314, 12528, 272, 6716, 1808, 282, 5516, 680, 221, 710, 3622, 342, 1083, 14767, 282, 12701, 272, 6025, 402, 314, 6716, 370, 3839, 12, 367, 10201, 14, 339, 710, 1256, 2860, 787, 465, 11924, 26, 339, 5272, 18, 1955, 1553, 282, 1211, 4412, 5272, 1561, 370, 5579, 14, 221, 10080, 2151, 5579, 787, 3544, 7633, 503, 10948, 12, 370, 22237, 2151, 3062, 687, 1526, 5579, 12, 1314, 787, 3382, 378, 436, 2151, 5450, 334, 26062, 680, 339, 1329, 18, 5155, 1553, 282, 1211, 4412, 5579, 370, 5272, 1561, 27, 2151, 3520, 2877, 787, 1924, 1163, 1159, 11484, 14, 339, 6363, 263, 1553, 282, 769, 402, 577, 2078, 83, 12, 2382, 1924, 577, 2078, 365, 282, 769, 402, 2151, 6363, 12, 1924, 1174, 365, 365, 282, 769, 402, 601, 1259, 12, 436, 1924, 2151, 14972, 365, 282, 334, 73, 12, 1335, 9, 4092, 2382, 284, 365, 282, 1768, 436, 1335, 365, 2151, 282, 1174, 1329, 14, 221, 710, 577, 2078, 1329, 365, 314, 1478, 1901, 2151, 642, 769, 14, 221, 334, 2765, 536, 365, 18023, 3743, 4941, 4959, 2151, 21789, 6363, 787, 11159, 701, 282, 4539, 14972, 402, 2151, 314, 1824, 334, 16, 12, 1335, 9, 2382, 1335, 365, 2399, 5705, 1174, 1329, 14, 339, 4051, 305, 3515, 1553, 282, 1211, 4412, 5272, 5579, 370, 334, 36, 2078, 12, 1642, 9, 2151, 6342, 12, 2382, 577, 2078, 365, 376, 1242, 687, 314, 6363, 769, 2151, 3432, 12, 436, 1642, 365, 282, 663, 402, 4645, 626, 883, 2151, 5386, 642, 12528, 2332, 334, 264, 10317, 701, 282, 1211, 2151, 7447, 1338, 787, 3544, 413, 680, 339, 3628, 263, 1553, 282, 769, 402, 334, 88, 12, 612, 9, 6342, 2382, 671, 365, 1902, 282, 1526, 2151, 1329, 503, 282, 5272, 1329, 12, 436, 612, 365, 1902, 488, 2151, 503, 282, 1059, 27, 314, 3326, 787, 7681, 14, 221, 710, 1768, 2151, 1329, 365, 314, 1478, 315, 642, 769, 27, 1768, 5579, 2151, 787, 1202, 370, 2216, 1174, 19077, 334, 20672, 9, 315, 314, 2151, 577, 2078, 83, 14, 339, 1343, 260, 1553, 314, 1329, 402, 314, 12528, 1159, 1343, 5272, 14, 339, 7681, 420, 1553, 282, 1211, 4412, 4252, 3326, 370, 14972, 3628, 14, 339, 4645, 263, 1553, 282, 1211, 4412, 1526, 5579, 370, 14972, 3628, 14, 339, 408, 339, 347, 636, 826, 721, 277, 304, 267, 291, 14, 5155, 18, 1955, 275, 1052, 267, 291, 14, 1955, 18, 5155, 275, 1052, 267, 291, 14, 4981, 275, 942, 267, 291, 14, 1587, 305, 275, 1052, 267, 291, 14, 3512, 275, 3842, 16, 12, 298, 13993, 11323, 267, 291, 14, 7511, 275, 1052, 267, 291, 14, 4504, 275, 1052, 267, 291, 14, 5155, 18, 1302, 275, 1052, 267, 291, 14, 928, 275, 7633, 339, 347, 5461, 8, 277, 12, 1788, 304, 267, 408, 11772, 314, 12528, 6716, 370, 282, 5927, 570, 1041, 267, 289, 275, 1551, 8, 1501, 12, 298, 6603, 531, 267, 5927, 14, 2724, 8, 277, 855, 807, 3108, 289, 12, 499, 9, 267, 289, 14, 1600, 342, 339, 347, 2248, 8, 277, 12, 1788, 304, 267, 408, 6200, 314, 12528, 6716, 687, 282, 5927, 570, 1041, 267, 289, 275, 1551, 8, 1501, 12, 298, 4848, 531, 267, 366, 275, 5927, 14, 912, 8, 70, 9, 267, 289, 14, 1600, 342, 267, 291, 855, 807, 4343, 873, 8, 68, 9, 339, 347, 1331, 8, 277, 304, 267, 408, 267, 11247, 314, 12528, 14, 267, 408, 267, 892, 275, 291, 855, 533, 4533, 267, 367, 1211, 63, 962, 315, 1689, 5155, 18, 1955, 401, 298, 1955, 18, 5155, 401, 298, 1587, 305, 401, 298, 7511, 401, 2079, 298, 4504, 401, 298, 5155, 18, 1302, 2349, 288, 5371, 8, 1222, 12, 1211, 63, 962, 12, 2519, 8, 277, 12, 1211, 63, 962, 680, 1574, 1012, 267, 892, 14, 3512, 275, 291, 14, 3512, 5873, 267, 892, 14, 4981, 275, 291, 14, 4981, 5873, 267, 892, 14, 928, 275, 291, 14, 928, 267, 372, 892, 339, 347, 3622, 8, 277, 304, 267, 408, 11772, 314, 12528, 6716, 370, 4465, 1072, 12, 367, 10201, 1041, 267, 687, 10933, 492, 10933, 267, 870, 298, 83, 18, 78, 2, 267, 10933, 8, 277, 14, 5155, 18, 1955, 9, 267, 870, 298, 78, 18, 83, 2, 267, 10933, 8, 277, 14, 1955, 18, 5155, 9, 267, 870, 298, 4981, 2, 267, 10933, 8, 277, 14, 4981, 9, 267, 870, 298, 1587, 305, 2, 267, 10933, 8, 277, 14, 1587, 305, 9, 267, 870, 298, 3512, 2, 267, 10933, 8, 277, 14, 3512, 9, 267, 870, 298, 928, 401, 291, 14, 928, 421, 199, 3, 9672, 687, 4182, 370, 1329, 334, 8585, 13343, 3181, 1133, 886, 642 ]
[ 1898, 8353, 13, 9397, 6566, 279, 13863, 12, 3277, 14, 2900, 5924, 5702, 14, 199, 3, 3909, 370, 29770, 1334, 282, 17636, 28629, 14, 199, 199, 624, 2765, 859, 7890, 314, 666, 13955, 1202, 370, 2954, 282, 12528, 14, 199, 199, 20676, 787, 282, 4546, 601, 2425, 69, 2952, 2985, 787, 7131, 687, 314, 666, 199, 13547, 1202, 701, 2018, 1159, 283, 80, 2268, 7, 1798, 4306, 14, 199, 199, 10924, 1159, 2597, 282, 1817, 2348, 4412, 10211, 370, 3932, 1561, 315, 314, 199, 1418, 859, 27, 314, 2018, 13343, 859, 13924, 1006, 10211, 465, 314, 199, 10538, 1526, 1233, 9827, 12, 1325, 314, 1798, 4839, 314, 3503, 1526, 1233, 14, 199, 199, 624, 199, 199, 3, 2018, 8925, 199, 646, 5927, 199, 199, 3, 10111, 8925, 199, 504, 1275, 492, 1526, 12, 13343, 421, 199, 533, 10268, 9992, 8, 785, 304, 272, 408, 48, 2268, 6057, 6716, 6716, 8603, 1021, 14, 339, 19468, 10038, 12, 642, 1021, 4973, 6528, 314, 12528, 6716, 367, 314, 272, 6057, 6869, 6366, 701, 2198, 14, 647, 14, 221, 710, 6057, 6869, 272, 1066, 5804, 314, 1256, 2860, 5370, 14, 221, 710, 1021, 2348, 1630, 440, 272, 5647, 11097, 402, 314, 6716, 27, 9978, 9180, 2187, 370, 272, 886, 642, 334, 3239, 314, 8260, 436, 299, 2268, 4621, 680, 339, 710, 2248, 342, 1083, 11597, 314, 6716, 687, 282, 5927, 570, 12, 1314, 365, 272, 8298, 12930, 2419, 314, 1163, 15217, 402, 22941, 701, 9180, 14, 221, 710, 5927, 272, 570, 365, 5313, 701, 6358, 5461, 342, 334, 4399, 8697, 314, 12528, 272, 6716, 1808, 282, 5516, 680, 221, 710, 3622, 342, 1083, 14767, 282, 12701, 272, 6025, 402, 314, 6716, 370, 3839, 12, 367, 10201, 14, 339, 710, 1256, 2860, 787, 465, 11924, 26, 339, 5272, 18, 1955, 1553, 282, 1211, 4412, 5272, 1561, 370, 5579, 14, 221, 10080, 2151, 5579, 787, 3544, 7633, 503, 10948, 12, 370, 22237, 2151, 3062, 687, 1526, 5579, 12, 1314, 787, 3382, 378, 436, 2151, 5450, 334, 26062, 680, 339, 1329, 18, 5155, 1553, 282, 1211, 4412, 5579, 370, 5272, 1561, 27, 2151, 3520, 2877, 787, 1924, 1163, 1159, 11484, 14, 339, 6363, 263, 1553, 282, 769, 402, 577, 2078, 83, 12, 2382, 1924, 577, 2078, 365, 282, 769, 402, 2151, 6363, 12, 1924, 1174, 365, 365, 282, 769, 402, 601, 1259, 12, 436, 1924, 2151, 14972, 365, 282, 334, 73, 12, 1335, 9, 4092, 2382, 284, 365, 282, 1768, 436, 1335, 365, 2151, 282, 1174, 1329, 14, 221, 710, 577, 2078, 1329, 365, 314, 1478, 1901, 2151, 642, 769, 14, 221, 334, 2765, 536, 365, 18023, 3743, 4941, 4959, 2151, 21789, 6363, 787, 11159, 701, 282, 4539, 14972, 402, 2151, 314, 1824, 334, 16, 12, 1335, 9, 2382, 1335, 365, 2399, 5705, 1174, 1329, 14, 339, 4051, 305, 3515, 1553, 282, 1211, 4412, 5272, 5579, 370, 334, 36, 2078, 12, 1642, 9, 2151, 6342, 12, 2382, 577, 2078, 365, 376, 1242, 687, 314, 6363, 769, 2151, 3432, 12, 436, 1642, 365, 282, 663, 402, 4645, 626, 883, 2151, 5386, 642, 12528, 2332, 334, 264, 10317, 701, 282, 1211, 2151, 7447, 1338, 787, 3544, 413, 680, 339, 3628, 263, 1553, 282, 769, 402, 334, 88, 12, 612, 9, 6342, 2382, 671, 365, 1902, 282, 1526, 2151, 1329, 503, 282, 5272, 1329, 12, 436, 612, 365, 1902, 488, 2151, 503, 282, 1059, 27, 314, 3326, 787, 7681, 14, 221, 710, 1768, 2151, 1329, 365, 314, 1478, 315, 642, 769, 27, 1768, 5579, 2151, 787, 1202, 370, 2216, 1174, 19077, 334, 20672, 9, 315, 314, 2151, 577, 2078, 83, 14, 339, 1343, 260, 1553, 314, 1329, 402, 314, 12528, 1159, 1343, 5272, 14, 339, 7681, 420, 1553, 282, 1211, 4412, 4252, 3326, 370, 14972, 3628, 14, 339, 4645, 263, 1553, 282, 1211, 4412, 1526, 5579, 370, 14972, 3628, 14, 339, 408, 339, 347, 636, 826, 721, 277, 304, 267, 291, 14, 5155, 18, 1955, 275, 1052, 267, 291, 14, 1955, 18, 5155, 275, 1052, 267, 291, 14, 4981, 275, 942, 267, 291, 14, 1587, 305, 275, 1052, 267, 291, 14, 3512, 275, 3842, 16, 12, 298, 13993, 11323, 267, 291, 14, 7511, 275, 1052, 267, 291, 14, 4504, 275, 1052, 267, 291, 14, 5155, 18, 1302, 275, 1052, 267, 291, 14, 928, 275, 7633, 339, 347, 5461, 8, 277, 12, 1788, 304, 267, 408, 11772, 314, 12528, 6716, 370, 282, 5927, 570, 1041, 267, 289, 275, 1551, 8, 1501, 12, 298, 6603, 531, 267, 5927, 14, 2724, 8, 277, 855, 807, 3108, 289, 12, 499, 9, 267, 289, 14, 1600, 342, 339, 347, 2248, 8, 277, 12, 1788, 304, 267, 408, 6200, 314, 12528, 6716, 687, 282, 5927, 570, 1041, 267, 289, 275, 1551, 8, 1501, 12, 298, 4848, 531, 267, 366, 275, 5927, 14, 912, 8, 70, 9, 267, 289, 14, 1600, 342, 267, 291, 855, 807, 4343, 873, 8, 68, 9, 339, 347, 1331, 8, 277, 304, 267, 408, 267, 11247, 314, 12528, 14, 267, 408, 267, 892, 275, 291, 855, 533, 4533, 267, 367, 1211, 63, 962, 315, 1689, 5155, 18, 1955, 401, 298, 1955, 18, 5155, 401, 298, 1587, 305, 401, 298, 7511, 401, 2079, 298, 4504, 401, 298, 5155, 18, 1302, 2349, 288, 5371, 8, 1222, 12, 1211, 63, 962, 12, 2519, 8, 277, 12, 1211, 63, 962, 680, 1574, 1012, 267, 892, 14, 3512, 275, 291, 14, 3512, 5873, 267, 892, 14, 4981, 275, 291, 14, 4981, 5873, 267, 892, 14, 928, 275, 291, 14, 928, 267, 372, 892, 339, 347, 3622, 8, 277, 304, 267, 408, 11772, 314, 12528, 6716, 370, 4465, 1072, 12, 367, 10201, 1041, 267, 687, 10933, 492, 10933, 267, 870, 298, 83, 18, 78, 2, 267, 10933, 8, 277, 14, 5155, 18, 1955, 9, 267, 870, 298, 78, 18, 83, 2, 267, 10933, 8, 277, 14, 1955, 18, 5155, 9, 267, 870, 298, 4981, 2, 267, 10933, 8, 277, 14, 4981, 9, 267, 870, 298, 1587, 305, 2, 267, 10933, 8, 277, 14, 1587, 305, 9, 267, 870, 298, 3512, 2, 267, 10933, 8, 277, 14, 3512, 9, 267, 870, 298, 928, 401, 291, 14, 928, 421, 199, 3, 9672, 687, 4182, 370, 1329, 334, 8585, 13343, 3181, 1133, 886, 642, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
mbayon/TFG-MachineLearning
venv/lib/python3.6/site-packages/numpy/polynomial/hermite.py
7
57744
""" Objects for dealing with Hermite series. This module provides a number of objects (mostly functions) useful for dealing with Hermite series, including a `Hermite` class that encapsulates the usual arithmetic operations. (General information on how this module represents and works with such polynomials is in the docstring for its "parent" sub-package, `numpy.polynomial`). Constants --------- - `hermdomain` -- Hermite series default domain, [-1,1]. - `hermzero` -- Hermite series that evaluates identically to 0. - `hermone` -- Hermite series that evaluates identically to 1. - `hermx` -- Hermite series for the identity map, ``f(x) = x``. Arithmetic ---------- - `hermmulx` -- multiply a Hermite series in ``P_i(x)`` by ``x``. - `hermadd` -- add two Hermite series. - `hermsub` -- subtract one Hermite series from another. - `hermmul` -- multiply two Hermite series. - `hermdiv` -- divide one Hermite series by another. - `hermval` -- evaluate a Hermite series at given points. - `hermval2d` -- evaluate a 2D Hermite series at given points. - `hermval3d` -- evaluate a 3D Hermite series at given points. - `hermgrid2d` -- evaluate a 2D Hermite series on a Cartesian product. - `hermgrid3d` -- evaluate a 3D Hermite series on a Cartesian product. Calculus -------- - `hermder` -- differentiate a Hermite series. - `hermint` -- integrate a Hermite series. Misc Functions -------------- - `hermfromroots` -- create a Hermite series with specified roots. - `hermroots` -- find the roots of a Hermite series. - `hermvander` -- Vandermonde-like matrix for Hermite polynomials. - `hermvander2d` -- Vandermonde-like matrix for 2D power series. - `hermvander3d` -- Vandermonde-like matrix for 3D power series. - `hermgauss` -- Gauss-Hermite quadrature, points and weights. - `hermweight` -- Hermite weight function. - `hermcompanion` -- symmetrized companion matrix in Hermite form. - `hermfit` -- least-squares fit returning a Hermite series. - `hermtrim` -- trim leading coefficients from a Hermite series. - `hermline` -- Hermite series of given straight line. - `herm2poly` -- convert a Hermite series to a polynomial. - `poly2herm` -- convert a polynomial to a Hermite series. Classes ------- - `Hermite` -- A Hermite series class. See also -------- `numpy.polynomial` """ from __future__ import division, absolute_import, print_function import warnings import numpy as np import numpy.linalg as la from numpy.core.multiarray import normalize_axis_index from . import polyutils as pu from ._polybase import ABCPolyBase __all__ = [ 'hermzero', 'hermone', 'hermx', 'hermdomain', 'hermline', 'hermadd', 'hermsub', 'hermmulx', 'hermmul', 'hermdiv', 'hermpow', 'hermval', 'hermder', 'hermint', 'herm2poly', 'poly2herm', 'hermfromroots', 'hermvander', 'hermfit', 'hermtrim', 'hermroots', 'Hermite', 'hermval2d', 'hermval3d', 'hermgrid2d', 'hermgrid3d', 'hermvander2d', 'hermvander3d', 'hermcompanion', 'hermgauss', 'hermweight'] hermtrim = pu.trimcoef def poly2herm(pol): """ poly2herm(pol) Convert a polynomial to a Hermite series. Convert an array representing the coefficients of a polynomial (relative to the "standard" basis) ordered from lowest degree to highest, to an array of the coefficients of the equivalent Hermite series, ordered from lowest to highest degree. Parameters ---------- pol : array_like 1-D array containing the polynomial coefficients Returns ------- c : ndarray 1-D array containing the coefficients of the equivalent Hermite series. See Also -------- herm2poly Notes ----- The easy way to do conversions between polynomial basis sets is to use the convert method of a class instance. Examples -------- >>> from numpy.polynomial.hermite import poly2herm >>> poly2herm(np.arange(4)) array([ 1. , 2.75 , 0.5 , 0.375]) """ [pol] = pu.as_series([pol]) deg = len(pol) - 1 res = 0 for i in range(deg, -1, -1): res = hermadd(hermmulx(res), pol[i]) return res def herm2poly(c): """ Convert a Hermite series to a polynomial. Convert an array representing the coefficients of a Hermite series, ordered from lowest degree to highest, to an array of the coefficients of the equivalent polynomial (relative to the "standard" basis) ordered from lowest to highest degree. Parameters ---------- c : array_like 1-D array containing the Hermite series coefficients, ordered from lowest order term to highest. Returns ------- pol : ndarray 1-D array containing the coefficients of the equivalent polynomial (relative to the "standard" basis) ordered from lowest order term to highest. See Also -------- poly2herm Notes ----- The easy way to do conversions between polynomial basis sets is to use the convert method of a class instance. Examples -------- >>> from numpy.polynomial.hermite import herm2poly >>> herm2poly([ 1. , 2.75 , 0.5 , 0.375]) array([ 0., 1., 2., 3.]) """ from .polynomial import polyadd, polysub, polymulx [c] = pu.as_series([c]) n = len(c) if n == 1: return c if n == 2: c[1] *= 2 return c else: c0 = c[-2] c1 = c[-1] # i is the current degree of c1 for i in range(n - 1, 1, -1): tmp = c0 c0 = polysub(c[i - 2], c1*(2*(i - 1))) c1 = polyadd(tmp, polymulx(c1)*2) return polyadd(c0, polymulx(c1)*2) # # These are constant arrays are of integer type so as to be compatible # with the widest range of other types, such as Decimal. # # Hermite hermdomain = np.array([-1, 1]) # Hermite coefficients representing zero. hermzero = np.array([0]) # Hermite coefficients representing one. hermone = np.array([1]) # Hermite coefficients representing the identity x. hermx = np.array([0, 1/2]) def hermline(off, scl): """ Hermite series whose graph is a straight line. Parameters ---------- off, scl : scalars The specified line is given by ``off + scl*x``. Returns ------- y : ndarray This module's representation of the Hermite series for ``off + scl*x``. See Also -------- polyline, chebline Examples -------- >>> from numpy.polynomial.hermite import hermline, hermval >>> hermval(0,hermline(3, 2)) 3.0 >>> hermval(1,hermline(3, 2)) 5.0 """ if scl != 0: return np.array([off, scl/2]) else: return np.array([off]) def hermfromroots(roots): """ Generate a Hermite series with given roots. The function returns the coefficients of the polynomial .. math:: p(x) = (x - r_0) * (x - r_1) * ... * (x - r_n), in Hermite form, where the `r_n` are the roots specified in `roots`. If a zero has multiplicity n, then it must appear in `roots` n times. For instance, if 2 is a root of multiplicity three and 3 is a root of multiplicity 2, then `roots` looks something like [2, 2, 2, 3, 3]. The roots can appear in any order. If the returned coefficients are `c`, then .. math:: p(x) = c_0 + c_1 * H_1(x) + ... + c_n * H_n(x) The coefficient of the last term is not generally 1 for monic polynomials in Hermite form. Parameters ---------- roots : array_like Sequence containing the roots. Returns ------- out : ndarray 1-D array of coefficients. If all roots are real then `out` is a real array, if some of the roots are complex, then `out` is complex even if all the coefficients in the result are real (see Examples below). See Also -------- polyfromroots, legfromroots, lagfromroots, chebfromroots, hermefromroots. Examples -------- >>> from numpy.polynomial.hermite import hermfromroots, hermval >>> coef = hermfromroots((-1, 0, 1)) >>> hermval((-1, 0, 1), coef) array([ 0., 0., 0.]) >>> coef = hermfromroots((-1j, 1j)) >>> hermval((-1j, 1j), coef) array([ 0.+0.j, 0.+0.j]) """ if len(roots) == 0: return np.ones(1) else: [roots] = pu.as_series([roots], trim=False) roots.sort() p = [hermline(-r, 1) for r in roots] n = len(p) while n > 1: m, r = divmod(n, 2) tmp = [hermmul(p[i], p[i+m]) for i in range(m)] if r: tmp[0] = hermmul(tmp[0], p[-1]) p = tmp n = m return p[0] def hermadd(c1, c2): """ Add one Hermite series to another. Returns the sum of two Hermite series `c1` + `c2`. The arguments are sequences of coefficients ordered from lowest order term to highest, i.e., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``. Parameters ---------- c1, c2 : array_like 1-D arrays of Hermite series coefficients ordered from low to high. Returns ------- out : ndarray Array representing the Hermite series of their sum. See Also -------- hermsub, hermmul, hermdiv, hermpow Notes ----- Unlike multiplication, division, etc., the sum of two Hermite series is a Hermite series (without having to "reproject" the result onto the basis set) so addition, just like that of "standard" polynomials, is simply "component-wise." Examples -------- >>> from numpy.polynomial.hermite import hermadd >>> hermadd([1, 2, 3], [1, 2, 3, 4]) array([ 2., 4., 6., 4.]) """ # c1, c2 are trimmed copies [c1, c2] = pu.as_series([c1, c2]) if len(c1) > len(c2): c1[:c2.size] += c2 ret = c1 else: c2[:c1.size] += c1 ret = c2 return pu.trimseq(ret) def hermsub(c1, c2): """ Subtract one Hermite series from another. Returns the difference of two Hermite series `c1` - `c2`. The sequences of coefficients are from lowest order term to highest, i.e., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``. Parameters ---------- c1, c2 : array_like 1-D arrays of Hermite series coefficients ordered from low to high. Returns ------- out : ndarray Of Hermite series coefficients representing their difference. See Also -------- hermadd, hermmul, hermdiv, hermpow Notes ----- Unlike multiplication, division, etc., the difference of two Hermite series is a Hermite series (without having to "reproject" the result onto the basis set) so subtraction, just like that of "standard" polynomials, is simply "component-wise." Examples -------- >>> from numpy.polynomial.hermite import hermsub >>> hermsub([1, 2, 3, 4], [1, 2, 3]) array([ 0., 0., 0., 4.]) """ # c1, c2 are trimmed copies [c1, c2] = pu.as_series([c1, c2]) if len(c1) > len(c2): c1[:c2.size] -= c2 ret = c1 else: c2 = -c2 c2[:c1.size] += c1 ret = c2 return pu.trimseq(ret) def hermmulx(c): """Multiply a Hermite series by x. Multiply the Hermite series `c` by x, where x is the independent variable. Parameters ---------- c : array_like 1-D array of Hermite series coefficients ordered from low to high. Returns ------- out : ndarray Array representing the result of the multiplication. Notes ----- The multiplication uses the recursion relationship for Hermite polynomials in the form .. math:: xP_i(x) = (P_{i + 1}(x)/2 + i*P_{i - 1}(x)) Examples -------- >>> from numpy.polynomial.hermite import hermmulx >>> hermmulx([1, 2, 3]) array([ 2. , 6.5, 1. , 1.5]) """ # c is a trimmed copy [c] = pu.as_series([c]) # The zero series needs special treatment if len(c) == 1 and c[0] == 0: return c prd = np.empty(len(c) + 1, dtype=c.dtype) prd[0] = c[0]*0 prd[1] = c[0]/2 for i in range(1, len(c)): prd[i + 1] = c[i]/2 prd[i - 1] += c[i]*i return prd def hermmul(c1, c2): """ Multiply one Hermite series by another. Returns the product of two Hermite series `c1` * `c2`. The arguments are sequences of coefficients, from lowest order "term" to highest, e.g., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``. Parameters ---------- c1, c2 : array_like 1-D arrays of Hermite series coefficients ordered from low to high. Returns ------- out : ndarray Of Hermite series coefficients representing their product. See Also -------- hermadd, hermsub, hermdiv, hermpow Notes ----- In general, the (polynomial) product of two C-series results in terms that are not in the Hermite polynomial basis set. Thus, to express the product as a Hermite series, it is necessary to "reproject" the product onto said basis set, which may produce "unintuitive" (but correct) results; see Examples section below. Examples -------- >>> from numpy.polynomial.hermite import hermmul >>> hermmul([1, 2, 3], [0, 1, 2]) array([ 52., 29., 52., 7., 6.]) """ # s1, s2 are trimmed copies [c1, c2] = pu.as_series([c1, c2]) if len(c1) > len(c2): c = c2 xs = c1 else: c = c1 xs = c2 if len(c) == 1: c0 = c[0]*xs c1 = 0 elif len(c) == 2: c0 = c[0]*xs c1 = c[1]*xs else: nd = len(c) c0 = c[-2]*xs c1 = c[-1]*xs for i in range(3, len(c) + 1): tmp = c0 nd = nd - 1 c0 = hermsub(c[-i]*xs, c1*(2*(nd - 1))) c1 = hermadd(tmp, hermmulx(c1)*2) return hermadd(c0, hermmulx(c1)*2) def hermdiv(c1, c2): """ Divide one Hermite series by another. Returns the quotient-with-remainder of two Hermite series `c1` / `c2`. The arguments are sequences of coefficients from lowest order "term" to highest, e.g., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``. Parameters ---------- c1, c2 : array_like 1-D arrays of Hermite series coefficients ordered from low to high. Returns ------- [quo, rem] : ndarrays Of Hermite series coefficients representing the quotient and remainder. See Also -------- hermadd, hermsub, hermmul, hermpow Notes ----- In general, the (polynomial) division of one Hermite series by another results in quotient and remainder terms that are not in the Hermite polynomial basis set. Thus, to express these results as a Hermite series, it is necessary to "reproject" the results onto the Hermite basis set, which may produce "unintuitive" (but correct) results; see Examples section below. Examples -------- >>> from numpy.polynomial.hermite import hermdiv >>> hermdiv([ 52., 29., 52., 7., 6.], [0, 1, 2]) (array([ 1., 2., 3.]), array([ 0.])) >>> hermdiv([ 54., 31., 52., 7., 6.], [0, 1, 2]) (array([ 1., 2., 3.]), array([ 2., 2.])) >>> hermdiv([ 53., 30., 52., 7., 6.], [0, 1, 2]) (array([ 1., 2., 3.]), array([ 1., 1.])) """ # c1, c2 are trimmed copies [c1, c2] = pu.as_series([c1, c2]) if c2[-1] == 0: raise ZeroDivisionError() lc1 = len(c1) lc2 = len(c2) if lc1 < lc2: return c1[:1]*0, c1 elif lc2 == 1: return c1/c2[-1], c1[:1]*0 else: quo = np.empty(lc1 - lc2 + 1, dtype=c1.dtype) rem = c1 for i in range(lc1 - lc2, - 1, -1): p = hermmul([0]*i + [1], c2) q = rem[-1]/p[-1] rem = rem[:-1] - q*p[:-1] quo[i] = q return quo, pu.trimseq(rem) def hermpow(c, pow, maxpower=16): """Raise a Hermite series to a power. Returns the Hermite series `c` raised to the power `pow`. The argument `c` is a sequence of coefficients ordered from low to high. i.e., [1,2,3] is the series ``P_0 + 2*P_1 + 3*P_2.`` Parameters ---------- c : array_like 1-D array of Hermite series coefficients ordered from low to high. pow : integer Power to which the series will be raised maxpower : integer, optional Maximum power allowed. This is mainly to limit growth of the series to unmanageable size. Default is 16 Returns ------- coef : ndarray Hermite series of power. See Also -------- hermadd, hermsub, hermmul, hermdiv Examples -------- >>> from numpy.polynomial.hermite import hermpow >>> hermpow([1, 2, 3], 2) array([ 81., 52., 82., 12., 9.]) """ # c is a trimmed copy [c] = pu.as_series([c]) power = int(pow) if power != pow or power < 0: raise ValueError("Power must be a non-negative integer.") elif maxpower is not None and power > maxpower: raise ValueError("Power is too large") elif power == 0: return np.array([1], dtype=c.dtype) elif power == 1: return c else: # This can be made more efficient by using powers of two # in the usual way. prd = c for i in range(2, power + 1): prd = hermmul(prd, c) return prd def hermder(c, m=1, scl=1, axis=0): """ Differentiate a Hermite series. Returns the Hermite series coefficients `c` differentiated `m` times along `axis`. At each iteration the result is multiplied by `scl` (the scaling factor is for use in a linear change of variable). The argument `c` is an array of coefficients from low to high degree along each axis, e.g., [1,2,3] represents the series ``1*H_0 + 2*H_1 + 3*H_2`` while [[1,2],[1,2]] represents ``1*H_0(x)*H_0(y) + 1*H_1(x)*H_0(y) + 2*H_0(x)*H_1(y) + 2*H_1(x)*H_1(y)`` if axis=0 is ``x`` and axis=1 is ``y``. Parameters ---------- c : array_like Array of Hermite series coefficients. If `c` is multidimensional the different axis correspond to different variables with the degree in each axis given by the corresponding index. m : int, optional Number of derivatives taken, must be non-negative. (Default: 1) scl : scalar, optional Each differentiation is multiplied by `scl`. The end result is multiplication by ``scl**m``. This is for use in a linear change of variable. (Default: 1) axis : int, optional Axis over which the derivative is taken. (Default: 0). .. versionadded:: 1.7.0 Returns ------- der : ndarray Hermite series of the derivative. See Also -------- hermint Notes ----- In general, the result of differentiating a Hermite series does not resemble the same operation on a power series. Thus the result of this function may be "unintuitive," albeit correct; see Examples section below. Examples -------- >>> from numpy.polynomial.hermite import hermder >>> hermder([ 1. , 0.5, 0.5, 0.5]) array([ 1., 2., 3.]) >>> hermder([-0.5, 1./2., 1./8., 1./12., 1./16.], m=2) array([ 1., 2., 3.]) """ c = np.array(c, ndmin=1, copy=1) if c.dtype.char in '?bBhHiIlLqQpP': c = c.astype(np.double) cnt, iaxis = [int(t) for t in [m, axis]] if cnt != m: raise ValueError("The order of derivation must be integer") if cnt < 0: raise ValueError("The order of derivation must be non-negative") if iaxis != axis: raise ValueError("The axis must be integer") iaxis = normalize_axis_index(iaxis, c.ndim) if cnt == 0: return c c = np.rollaxis(c, iaxis) n = len(c) if cnt >= n: c = c[:1]*0 else: for i in range(cnt): n = n - 1 c *= scl der = np.empty((n,) + c.shape[1:], dtype=c.dtype) for j in range(n, 0, -1): der[j - 1] = (2*j)*c[j] c = der c = np.rollaxis(c, 0, iaxis + 1) return c def hermint(c, m=1, k=[], lbnd=0, scl=1, axis=0): """ Integrate a Hermite series. Returns the Hermite series coefficients `c` integrated `m` times from `lbnd` along `axis`. At each iteration the resulting series is **multiplied** by `scl` and an integration constant, `k`, is added. The scaling factor is for use in a linear change of variable. ("Buyer beware": note that, depending on what one is doing, one may want `scl` to be the reciprocal of what one might expect; for more information, see the Notes section below.) The argument `c` is an array of coefficients from low to high degree along each axis, e.g., [1,2,3] represents the series ``H_0 + 2*H_1 + 3*H_2`` while [[1,2],[1,2]] represents ``1*H_0(x)*H_0(y) + 1*H_1(x)*H_0(y) + 2*H_0(x)*H_1(y) + 2*H_1(x)*H_1(y)`` if axis=0 is ``x`` and axis=1 is ``y``. Parameters ---------- c : array_like Array of Hermite series coefficients. If c is multidimensional the different axis correspond to different variables with the degree in each axis given by the corresponding index. m : int, optional Order of integration, must be positive. (Default: 1) k : {[], list, scalar}, optional Integration constant(s). The value of the first integral at ``lbnd`` is the first value in the list, the value of the second integral at ``lbnd`` is the second value, etc. If ``k == []`` (the default), all constants are set to zero. If ``m == 1``, a single scalar can be given instead of a list. lbnd : scalar, optional The lower bound of the integral. (Default: 0) scl : scalar, optional Following each integration the result is *multiplied* by `scl` before the integration constant is added. (Default: 1) axis : int, optional Axis over which the integral is taken. (Default: 0). .. versionadded:: 1.7.0 Returns ------- S : ndarray Hermite series coefficients of the integral. Raises ------ ValueError If ``m < 0``, ``len(k) > m``, ``np.isscalar(lbnd) == False``, or ``np.isscalar(scl) == False``. See Also -------- hermder Notes ----- Note that the result of each integration is *multiplied* by `scl`. Why is this important to note? Say one is making a linear change of variable :math:`u = ax + b` in an integral relative to `x`. Then :math:`dx = du/a`, so one will need to set `scl` equal to :math:`1/a` - perhaps not what one would have first thought. Also note that, in general, the result of integrating a C-series needs to be "reprojected" onto the C-series basis set. Thus, typically, the result of this function is "unintuitive," albeit correct; see Examples section below. Examples -------- >>> from numpy.polynomial.hermite import hermint >>> hermint([1,2,3]) # integrate once, value 0 at 0. array([ 1. , 0.5, 0.5, 0.5]) >>> hermint([1,2,3], m=2) # integrate twice, value & deriv 0 at 0 array([-0.5 , 0.5 , 0.125 , 0.08333333, 0.0625 ]) >>> hermint([1,2,3], k=1) # integrate once, value 1 at 0. array([ 2. , 0.5, 0.5, 0.5]) >>> hermint([1,2,3], lbnd=-1) # integrate once, value 0 at -1 array([-2. , 0.5, 0.5, 0.5]) >>> hermint([1,2,3], m=2, k=[1,2], lbnd=-1) array([ 1.66666667, -0.5 , 0.125 , 0.08333333, 0.0625 ]) """ c = np.array(c, ndmin=1, copy=1) if c.dtype.char in '?bBhHiIlLqQpP': c = c.astype(np.double) if not np.iterable(k): k = [k] cnt, iaxis = [int(t) for t in [m, axis]] if cnt != m: raise ValueError("The order of integration must be integer") if cnt < 0: raise ValueError("The order of integration must be non-negative") if len(k) > cnt: raise ValueError("Too many integration constants") if iaxis != axis: raise ValueError("The axis must be integer") iaxis = normalize_axis_index(iaxis, c.ndim) if cnt == 0: return c c = np.rollaxis(c, iaxis) k = list(k) + [0]*(cnt - len(k)) for i in range(cnt): n = len(c) c *= scl if n == 1 and np.all(c[0] == 0): c[0] += k[i] else: tmp = np.empty((n + 1,) + c.shape[1:], dtype=c.dtype) tmp[0] = c[0]*0 tmp[1] = c[0]/2 for j in range(1, n): tmp[j + 1] = c[j]/(2*(j + 1)) tmp[0] += k[i] - hermval(lbnd, tmp) c = tmp c = np.rollaxis(c, 0, iaxis + 1) return c def hermval(x, c, tensor=True): """ Evaluate an Hermite series at points x. If `c` is of length `n + 1`, this function returns the value: .. math:: p(x) = c_0 * H_0(x) + c_1 * H_1(x) + ... + c_n * H_n(x) The parameter `x` is converted to an array only if it is a tuple or a list, otherwise it is treated as a scalar. In either case, either `x` or its elements must support multiplication and addition both with themselves and with the elements of `c`. If `c` is a 1-D array, then `p(x)` will have the same shape as `x`. If `c` is multidimensional, then the shape of the result depends on the value of `tensor`. If `tensor` is true the shape will be c.shape[1:] + x.shape. If `tensor` is false the shape will be c.shape[1:]. Note that scalars have shape (,). Trailing zeros in the coefficients will be used in the evaluation, so they should be avoided if efficiency is a concern. Parameters ---------- x : array_like, compatible object If `x` is a list or tuple, it is converted to an ndarray, otherwise it is left unchanged and treated as a scalar. In either case, `x` or its elements must support addition and multiplication with with themselves and with the elements of `c`. c : array_like Array of coefficients ordered so that the coefficients for terms of degree n are contained in c[n]. If `c` is multidimensional the remaining indices enumerate multiple polynomials. In the two dimensional case the coefficients may be thought of as stored in the columns of `c`. tensor : boolean, optional If True, the shape of the coefficient array is extended with ones on the right, one for each dimension of `x`. Scalars have dimension 0 for this action. The result is that every column of coefficients in `c` is evaluated for every element of `x`. If False, `x` is broadcast over the columns of `c` for the evaluation. This keyword is useful when `c` is multidimensional. The default value is True. .. versionadded:: 1.7.0 Returns ------- values : ndarray, algebra_like The shape of the return value is described above. See Also -------- hermval2d, hermgrid2d, hermval3d, hermgrid3d Notes ----- The evaluation uses Clenshaw recursion, aka synthetic division. Examples -------- >>> from numpy.polynomial.hermite import hermval >>> coef = [1,2,3] >>> hermval(1, coef) 11.0 >>> hermval([[1,2],[3,4]], coef) array([[ 11., 51.], [ 115., 203.]]) """ c = np.array(c, ndmin=1, copy=0) if c.dtype.char in '?bBhHiIlLqQpP': c = c.astype(np.double) if isinstance(x, (tuple, list)): x = np.asarray(x) if isinstance(x, np.ndarray) and tensor: c = c.reshape(c.shape + (1,)*x.ndim) x2 = x*2 if len(c) == 1: c0 = c[0] c1 = 0 elif len(c) == 2: c0 = c[0] c1 = c[1] else: nd = len(c) c0 = c[-2] c1 = c[-1] for i in range(3, len(c) + 1): tmp = c0 nd = nd - 1 c0 = c[-i] - c1*(2*(nd - 1)) c1 = tmp + c1*x2 return c0 + c1*x2 def hermval2d(x, y, c): """ Evaluate a 2-D Hermite series at points (x, y). This function returns the values: .. math:: p(x,y) = \\sum_{i,j} c_{i,j} * H_i(x) * H_j(y) The parameters `x` and `y` are converted to arrays only if they are tuples or a lists, otherwise they are treated as a scalars and they must have the same shape after conversion. In either case, either `x` and `y` or their elements must support multiplication and addition both with themselves and with the elements of `c`. If `c` is a 1-D array a one is implicitly appended to its shape to make it 2-D. The shape of the result will be c.shape[2:] + x.shape. Parameters ---------- x, y : array_like, compatible objects The two dimensional series is evaluated at the points `(x, y)`, where `x` and `y` must have the same shape. If `x` or `y` is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and if it isn't an ndarray it is treated as a scalar. c : array_like Array of coefficients ordered so that the coefficient of the term of multi-degree i,j is contained in ``c[i,j]``. If `c` has dimension greater than two the remaining indices enumerate multiple sets of coefficients. Returns ------- values : ndarray, compatible object The values of the two dimensional polynomial at points formed with pairs of corresponding values from `x` and `y`. See Also -------- hermval, hermgrid2d, hermval3d, hermgrid3d Notes ----- .. versionadded:: 1.7.0 """ try: x, y = np.array((x, y), copy=0) except: raise ValueError('x, y are incompatible') c = hermval(x, c) c = hermval(y, c, tensor=False) return c def hermgrid2d(x, y, c): """ Evaluate a 2-D Hermite series on the Cartesian product of x and y. This function returns the values: .. math:: p(a,b) = \\sum_{i,j} c_{i,j} * H_i(a) * H_j(b) where the points `(a, b)` consist of all pairs formed by taking `a` from `x` and `b` from `y`. The resulting points form a grid with `x` in the first dimension and `y` in the second. The parameters `x` and `y` are converted to arrays only if they are tuples or a lists, otherwise they are treated as a scalars. In either case, either `x` and `y` or their elements must support multiplication and addition both with themselves and with the elements of `c`. If `c` has fewer than two dimensions, ones are implicitly appended to its shape to make it 2-D. The shape of the result will be c.shape[2:] + x.shape. Parameters ---------- x, y : array_like, compatible objects The two dimensional series is evaluated at the points in the Cartesian product of `x` and `y`. If `x` or `y` is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and, if it isn't an ndarray, it is treated as a scalar. c : array_like Array of coefficients ordered so that the coefficients for terms of degree i,j are contained in ``c[i,j]``. If `c` has dimension greater than two the remaining indices enumerate multiple sets of coefficients. Returns ------- values : ndarray, compatible object The values of the two dimensional polynomial at points in the Cartesian product of `x` and `y`. See Also -------- hermval, hermval2d, hermval3d, hermgrid3d Notes ----- .. versionadded:: 1.7.0 """ c = hermval(x, c) c = hermval(y, c) return c def hermval3d(x, y, z, c): """ Evaluate a 3-D Hermite series at points (x, y, z). This function returns the values: .. math:: p(x,y,z) = \\sum_{i,j,k} c_{i,j,k} * H_i(x) * H_j(y) * H_k(z) The parameters `x`, `y`, and `z` are converted to arrays only if they are tuples or a lists, otherwise they are treated as a scalars and they must have the same shape after conversion. In either case, either `x`, `y`, and `z` or their elements must support multiplication and addition both with themselves and with the elements of `c`. If `c` has fewer than 3 dimensions, ones are implicitly appended to its shape to make it 3-D. The shape of the result will be c.shape[3:] + x.shape. Parameters ---------- x, y, z : array_like, compatible object The three dimensional series is evaluated at the points `(x, y, z)`, where `x`, `y`, and `z` must have the same shape. If any of `x`, `y`, or `z` is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and if it isn't an ndarray it is treated as a scalar. c : array_like Array of coefficients ordered so that the coefficient of the term of multi-degree i,j,k is contained in ``c[i,j,k]``. If `c` has dimension greater than 3 the remaining indices enumerate multiple sets of coefficients. Returns ------- values : ndarray, compatible object The values of the multidimensional polynomial on points formed with triples of corresponding values from `x`, `y`, and `z`. See Also -------- hermval, hermval2d, hermgrid2d, hermgrid3d Notes ----- .. versionadded:: 1.7.0 """ try: x, y, z = np.array((x, y, z), copy=0) except: raise ValueError('x, y, z are incompatible') c = hermval(x, c) c = hermval(y, c, tensor=False) c = hermval(z, c, tensor=False) return c def hermgrid3d(x, y, z, c): """ Evaluate a 3-D Hermite series on the Cartesian product of x, y, and z. This function returns the values: .. math:: p(a,b,c) = \\sum_{i,j,k} c_{i,j,k} * H_i(a) * H_j(b) * H_k(c) where the points `(a, b, c)` consist of all triples formed by taking `a` from `x`, `b` from `y`, and `c` from `z`. The resulting points form a grid with `x` in the first dimension, `y` in the second, and `z` in the third. The parameters `x`, `y`, and `z` are converted to arrays only if they are tuples or a lists, otherwise they are treated as a scalars. In either case, either `x`, `y`, and `z` or their elements must support multiplication and addition both with themselves and with the elements of `c`. If `c` has fewer than three dimensions, ones are implicitly appended to its shape to make it 3-D. The shape of the result will be c.shape[3:] + x.shape + y.shape + z.shape. Parameters ---------- x, y, z : array_like, compatible objects The three dimensional series is evaluated at the points in the Cartesian product of `x`, `y`, and `z`. If `x`,`y`, or `z` is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and, if it isn't an ndarray, it is treated as a scalar. c : array_like Array of coefficients ordered so that the coefficients for terms of degree i,j are contained in ``c[i,j]``. If `c` has dimension greater than two the remaining indices enumerate multiple sets of coefficients. Returns ------- values : ndarray, compatible object The values of the two dimensional polynomial at points in the Cartesian product of `x` and `y`. See Also -------- hermval, hermval2d, hermgrid2d, hermval3d Notes ----- .. versionadded:: 1.7.0 """ c = hermval(x, c) c = hermval(y, c) c = hermval(z, c) return c def hermvander(x, deg): """Pseudo-Vandermonde matrix of given degree. Returns the pseudo-Vandermonde matrix of degree `deg` and sample points `x`. The pseudo-Vandermonde matrix is defined by .. math:: V[..., i] = H_i(x), where `0 <= i <= deg`. The leading indices of `V` index the elements of `x` and the last index is the degree of the Hermite polynomial. If `c` is a 1-D array of coefficients of length `n + 1` and `V` is the array ``V = hermvander(x, n)``, then ``np.dot(V, c)`` and ``hermval(x, c)`` are the same up to roundoff. This equivalence is useful both for least squares fitting and for the evaluation of a large number of Hermite series of the same degree and sample points. Parameters ---------- x : array_like Array of points. The dtype is converted to float64 or complex128 depending on whether any of the elements are complex. If `x` is scalar it is converted to a 1-D array. deg : int Degree of the resulting matrix. Returns ------- vander : ndarray The pseudo-Vandermonde matrix. The shape of the returned matrix is ``x.shape + (deg + 1,)``, where The last index is the degree of the corresponding Hermite polynomial. The dtype will be the same as the converted `x`. Examples -------- >>> from numpy.polynomial.hermite import hermvander >>> x = np.array([-1, 0, 1]) >>> hermvander(x, 3) array([[ 1., -2., 2., 4.], [ 1., 0., -2., -0.], [ 1., 2., 2., -4.]]) """ ideg = int(deg) if ideg != deg: raise ValueError("deg must be integer") if ideg < 0: raise ValueError("deg must be non-negative") x = np.array(x, copy=0, ndmin=1) + 0.0 dims = (ideg + 1,) + x.shape dtyp = x.dtype v = np.empty(dims, dtype=dtyp) v[0] = x*0 + 1 if ideg > 0: x2 = x*2 v[1] = x2 for i in range(2, ideg + 1): v[i] = (v[i-1]*x2 - v[i-2]*(2*(i - 1))) return np.rollaxis(v, 0, v.ndim) def hermvander2d(x, y, deg): """Pseudo-Vandermonde matrix of given degrees. Returns the pseudo-Vandermonde matrix of degrees `deg` and sample points `(x, y)`. The pseudo-Vandermonde matrix is defined by .. math:: V[..., (deg[1] + 1)*i + j] = H_i(x) * H_j(y), where `0 <= i <= deg[0]` and `0 <= j <= deg[1]`. The leading indices of `V` index the points `(x, y)` and the last index encodes the degrees of the Hermite polynomials. If ``V = hermvander2d(x, y, [xdeg, ydeg])``, then the columns of `V` correspond to the elements of a 2-D coefficient array `c` of shape (xdeg + 1, ydeg + 1) in the order .. math:: c_{00}, c_{01}, c_{02} ... , c_{10}, c_{11}, c_{12} ... and ``np.dot(V, c.flat)`` and ``hermval2d(x, y, c)`` will be the same up to roundoff. This equivalence is useful both for least squares fitting and for the evaluation of a large number of 2-D Hermite series of the same degrees and sample points. Parameters ---------- x, y : array_like Arrays of point coordinates, all of the same shape. The dtypes will be converted to either float64 or complex128 depending on whether any of the elements are complex. Scalars are converted to 1-D arrays. deg : list of ints List of maximum degrees of the form [x_deg, y_deg]. Returns ------- vander2d : ndarray The shape of the returned matrix is ``x.shape + (order,)``, where :math:`order = (deg[0]+1)*(deg([1]+1)`. The dtype will be the same as the converted `x` and `y`. See Also -------- hermvander, hermvander3d. hermval2d, hermval3d Notes ----- .. versionadded:: 1.7.0 """ ideg = [int(d) for d in deg] is_valid = [id == d and id >= 0 for id, d in zip(ideg, deg)] if is_valid != [1, 1]: raise ValueError("degrees must be non-negative integers") degx, degy = ideg x, y = np.array((x, y), copy=0) + 0.0 vx = hermvander(x, degx) vy = hermvander(y, degy) v = vx[..., None]*vy[..., None,:] return v.reshape(v.shape[:-2] + (-1,)) def hermvander3d(x, y, z, deg): """Pseudo-Vandermonde matrix of given degrees. Returns the pseudo-Vandermonde matrix of degrees `deg` and sample points `(x, y, z)`. If `l, m, n` are the given degrees in `x, y, z`, then The pseudo-Vandermonde matrix is defined by .. math:: V[..., (m+1)(n+1)i + (n+1)j + k] = H_i(x)*H_j(y)*H_k(z), where `0 <= i <= l`, `0 <= j <= m`, and `0 <= j <= n`. The leading indices of `V` index the points `(x, y, z)` and the last index encodes the degrees of the Hermite polynomials. If ``V = hermvander3d(x, y, z, [xdeg, ydeg, zdeg])``, then the columns of `V` correspond to the elements of a 3-D coefficient array `c` of shape (xdeg + 1, ydeg + 1, zdeg + 1) in the order .. math:: c_{000}, c_{001}, c_{002},... , c_{010}, c_{011}, c_{012},... and ``np.dot(V, c.flat)`` and ``hermval3d(x, y, z, c)`` will be the same up to roundoff. This equivalence is useful both for least squares fitting and for the evaluation of a large number of 3-D Hermite series of the same degrees and sample points. Parameters ---------- x, y, z : array_like Arrays of point coordinates, all of the same shape. The dtypes will be converted to either float64 or complex128 depending on whether any of the elements are complex. Scalars are converted to 1-D arrays. deg : list of ints List of maximum degrees of the form [x_deg, y_deg, z_deg]. Returns ------- vander3d : ndarray The shape of the returned matrix is ``x.shape + (order,)``, where :math:`order = (deg[0]+1)*(deg([1]+1)*(deg[2]+1)`. The dtype will be the same as the converted `x`, `y`, and `z`. See Also -------- hermvander, hermvander3d. hermval2d, hermval3d Notes ----- .. versionadded:: 1.7.0 """ ideg = [int(d) for d in deg] is_valid = [id == d and id >= 0 for id, d in zip(ideg, deg)] if is_valid != [1, 1, 1]: raise ValueError("degrees must be non-negative integers") degx, degy, degz = ideg x, y, z = np.array((x, y, z), copy=0) + 0.0 vx = hermvander(x, degx) vy = hermvander(y, degy) vz = hermvander(z, degz) v = vx[..., None, None]*vy[..., None,:, None]*vz[..., None, None,:] return v.reshape(v.shape[:-3] + (-1,)) def hermfit(x, y, deg, rcond=None, full=False, w=None): """ Least squares fit of Hermite series to data. Return the coefficients of a Hermite series of degree `deg` that is the least squares fit to the data values `y` given at points `x`. If `y` is 1-D the returned coefficients will also be 1-D. If `y` is 2-D multiple fits are done, one for each column of `y`, and the resulting coefficients are stored in the corresponding columns of a 2-D return. The fitted polynomial(s) are in the form .. math:: p(x) = c_0 + c_1 * H_1(x) + ... + c_n * H_n(x), where `n` is `deg`. Parameters ---------- x : array_like, shape (M,) x-coordinates of the M sample points ``(x[i], y[i])``. y : array_like, shape (M,) or (M, K) y-coordinates of the sample points. Several data sets of sample points sharing the same x-coordinates can be fitted at once by passing in a 2D-array that contains one dataset per column. deg : int or 1-D array_like Degree(s) of the fitting polynomials. If `deg` is a single integer all terms up to and including the `deg`'th term are included in the fit. For NumPy versions >= 1.11.0 a list of integers specifying the degrees of the terms to include may be used instead. rcond : float, optional Relative condition number of the fit. Singular values smaller than this relative to the largest singular value will be ignored. The default value is len(x)*eps, where eps is the relative precision of the float type, about 2e-16 in most cases. full : bool, optional Switch determining nature of return value. When it is False (the default) just the coefficients are returned, when True diagnostic information from the singular value decomposition is also returned. w : array_like, shape (`M`,), optional Weights. If not None, the contribution of each point ``(x[i],y[i])`` to the fit is weighted by `w[i]`. Ideally the weights are chosen so that the errors of the products ``w[i]*y[i]`` all have the same variance. The default value is None. Returns ------- coef : ndarray, shape (M,) or (M, K) Hermite coefficients ordered from low to high. If `y` was 2-D, the coefficients for the data in column k of `y` are in column `k`. [residuals, rank, singular_values, rcond] : list These values are only returned if `full` = True resid -- sum of squared residuals of the least squares fit rank -- the numerical rank of the scaled Vandermonde matrix sv -- singular values of the scaled Vandermonde matrix rcond -- value of `rcond`. For more details, see `linalg.lstsq`. Warns ----- RankWarning The rank of the coefficient matrix in the least-squares fit is deficient. The warning is only raised if `full` = False. The warnings can be turned off by >>> import warnings >>> warnings.simplefilter('ignore', RankWarning) See Also -------- chebfit, legfit, lagfit, polyfit, hermefit hermval : Evaluates a Hermite series. hermvander : Vandermonde matrix of Hermite series. hermweight : Hermite weight function linalg.lstsq : Computes a least-squares fit from the matrix. scipy.interpolate.UnivariateSpline : Computes spline fits. Notes ----- The solution is the coefficients of the Hermite series `p` that minimizes the sum of the weighted squared errors .. math:: E = \\sum_j w_j^2 * |y_j - p(x_j)|^2, where the :math:`w_j` are the weights. This problem is solved by setting up the (typically) overdetermined matrix equation .. math:: V(x) * c = w * y, where `V` is the weighted pseudo Vandermonde matrix of `x`, `c` are the coefficients to be solved for, `w` are the weights, `y` are the observed values. This equation is then solved using the singular value decomposition of `V`. If some of the singular values of `V` are so small that they are neglected, then a `RankWarning` will be issued. This means that the coefficient values may be poorly determined. Using a lower order fit will usually get rid of the warning. The `rcond` parameter can also be set to a value smaller than its default, but the resulting fit may be spurious and have large contributions from roundoff error. Fits using Hermite series are probably most useful when the data can be approximated by ``sqrt(w(x)) * p(x)``, where `w(x)` is the Hermite weight. In that case the weight ``sqrt(w(x[i])`` should be used together with data values ``y[i]/sqrt(w(x[i])``. The weight function is available as `hermweight`. References ---------- .. [1] Wikipedia, "Curve fitting", http://en.wikipedia.org/wiki/Curve_fitting Examples -------- >>> from numpy.polynomial.hermite import hermfit, hermval >>> x = np.linspace(-10, 10) >>> err = np.random.randn(len(x))/10 >>> y = hermval(x, [1, 2, 3]) + err >>> hermfit(x, y, 2) array([ 0.97902637, 1.99849131, 3.00006 ]) """ x = np.asarray(x) + 0.0 y = np.asarray(y) + 0.0 deg = np.asarray(deg) # check arguments. if deg.ndim > 1 or deg.dtype.kind not in 'iu' or deg.size == 0: raise TypeError("deg must be an int or non-empty 1-D array of int") if deg.min() < 0: raise ValueError("expected deg >= 0") if x.ndim != 1: raise TypeError("expected 1D vector for x") if x.size == 0: raise TypeError("expected non-empty vector for x") if y.ndim < 1 or y.ndim > 2: raise TypeError("expected 1D or 2D array for y") if len(x) != len(y): raise TypeError("expected x and y to have same length") if deg.ndim == 0: lmax = deg order = lmax + 1 van = hermvander(x, lmax) else: deg = np.sort(deg) lmax = deg[-1] order = len(deg) van = hermvander(x, lmax)[:, deg] # set up the least squares matrices in transposed form lhs = van.T rhs = y.T if w is not None: w = np.asarray(w) + 0.0 if w.ndim != 1: raise TypeError("expected 1D vector for w") if len(x) != len(w): raise TypeError("expected x and w to have same length") # apply weights. Don't use inplace operations as they # can cause problems with NA. lhs = lhs * w rhs = rhs * w # set rcond if rcond is None: rcond = len(x)*np.finfo(x.dtype).eps # Determine the norms of the design matrix columns. if issubclass(lhs.dtype.type, np.complexfloating): scl = np.sqrt((np.square(lhs.real) + np.square(lhs.imag)).sum(1)) else: scl = np.sqrt(np.square(lhs).sum(1)) scl[scl == 0] = 1 # Solve the least squares problem. c, resids, rank, s = la.lstsq(lhs.T/scl, rhs.T, rcond) c = (c.T/scl).T # Expand c to include non-fitted coefficients which are set to zero if deg.ndim > 0: if c.ndim == 2: cc = np.zeros((lmax+1, c.shape[1]), dtype=c.dtype) else: cc = np.zeros(lmax+1, dtype=c.dtype) cc[deg] = c c = cc # warn on rank reduction if rank != order and not full: msg = "The fit may be poorly conditioned" warnings.warn(msg, pu.RankWarning, stacklevel=2) if full: return c, [resids, rank, s, rcond] else: return c def hermcompanion(c): """Return the scaled companion matrix of c. The basis polynomials are scaled so that the companion matrix is symmetric when `c` is an Hermite basis polynomial. This provides better eigenvalue estimates than the unscaled case and for basis polynomials the eigenvalues are guaranteed to be real if `numpy.linalg.eigvalsh` is used to obtain them. Parameters ---------- c : array_like 1-D array of Hermite series coefficients ordered from low to high degree. Returns ------- mat : ndarray Scaled companion matrix of dimensions (deg, deg). Notes ----- .. versionadded:: 1.7.0 """ # c is a trimmed copy [c] = pu.as_series([c]) if len(c) < 2: raise ValueError('Series must have maximum degree of at least 1.') if len(c) == 2: return np.array([[-.5*c[0]/c[1]]]) n = len(c) - 1 mat = np.zeros((n, n), dtype=c.dtype) scl = np.hstack((1., 1./np.sqrt(2.*np.arange(n - 1, 0, -1)))) scl = np.multiply.accumulate(scl)[::-1] top = mat.reshape(-1)[1::n+1] bot = mat.reshape(-1)[n::n+1] top[...] = np.sqrt(.5*np.arange(1, n)) bot[...] = top mat[:, -1] -= scl*c[:-1]/(2.0*c[-1]) return mat def hermroots(c): """ Compute the roots of a Hermite series. Return the roots (a.k.a. "zeros") of the polynomial .. math:: p(x) = \\sum_i c[i] * H_i(x). Parameters ---------- c : 1-D array_like 1-D array of coefficients. Returns ------- out : ndarray Array of the roots of the series. If all the roots are real, then `out` is also real, otherwise it is complex. See Also -------- polyroots, legroots, lagroots, chebroots, hermeroots Notes ----- The root estimates are obtained as the eigenvalues of the companion matrix, Roots far from the origin of the complex plane may have large errors due to the numerical instability of the series for such values. Roots with multiplicity greater than 1 will also show larger errors as the value of the series near such points is relatively insensitive to errors in the roots. Isolated roots near the origin can be improved by a few iterations of Newton's method. The Hermite series basis polynomials aren't powers of `x` so the results of this function may seem unintuitive. Examples -------- >>> from numpy.polynomial.hermite import hermroots, hermfromroots >>> coef = hermfromroots([-1, 0, 1]) >>> coef array([ 0. , 0.25 , 0. , 0.125]) >>> hermroots(coef) array([ -1.00000000e+00, -1.38777878e-17, 1.00000000e+00]) """ # c is a trimmed copy [c] = pu.as_series([c]) if len(c) <= 1: return np.array([], dtype=c.dtype) if len(c) == 2: return np.array([-.5*c[0]/c[1]]) m = hermcompanion(c) r = la.eigvals(m) r.sort() return r def _normed_hermite_n(x, n): """ Evaluate a normalized Hermite polynomial. Compute the value of the normalized Hermite polynomial of degree ``n`` at the points ``x``. Parameters ---------- x : ndarray of double. Points at which to evaluate the function n : int Degree of the normalized Hermite function to be evaluated. Returns ------- values : ndarray The shape of the return value is described above. Notes ----- .. versionadded:: 1.10.0 This function is needed for finding the Gauss points and integration weights for high degrees. The values of the standard Hermite functions overflow when n >= 207. """ if n == 0: return np.ones(x.shape)/np.sqrt(np.sqrt(np.pi)) c0 = 0. c1 = 1./np.sqrt(np.sqrt(np.pi)) nd = float(n) for i in range(n - 1): tmp = c0 c0 = -c1*np.sqrt((nd - 1.)/nd) c1 = tmp + c1*x*np.sqrt(2./nd) nd = nd - 1.0 return c0 + c1*x*np.sqrt(2) def hermgauss(deg): """ Gauss-Hermite quadrature. Computes the sample points and weights for Gauss-Hermite quadrature. These sample points and weights will correctly integrate polynomials of degree :math:`2*deg - 1` or less over the interval :math:`[-\\inf, \\inf]` with the weight function :math:`f(x) = \\exp(-x^2)`. Parameters ---------- deg : int Number of sample points and weights. It must be >= 1. Returns ------- x : ndarray 1-D ndarray containing the sample points. y : ndarray 1-D ndarray containing the weights. Notes ----- .. versionadded:: 1.7.0 The results have only been tested up to degree 100, higher degrees may be problematic. The weights are determined by using the fact that .. math:: w_k = c / (H'_n(x_k) * H_{n-1}(x_k)) where :math:`c` is a constant independent of :math:`k` and :math:`x_k` is the k'th root of :math:`H_n`, and then scaling the results to get the right value when integrating 1. """ ideg = int(deg) if ideg != deg or ideg < 1: raise ValueError("deg must be a non-negative integer") # first approximation of roots. We use the fact that the companion # matrix is symmetric in this case in order to obtain better zeros. c = np.array([0]*deg + [1], dtype=np.float64) m = hermcompanion(c) x = la.eigvalsh(m) # improve roots by one application of Newton dy = _normed_hermite_n(x, ideg) df = _normed_hermite_n(x, ideg - 1) * np.sqrt(2*ideg) x -= dy/df # compute the weights. We scale the factor to avoid possible numerical # overflow. fm = _normed_hermite_n(x, ideg - 1) fm /= np.abs(fm).max() w = 1/(fm * fm) # for Hermite we can also symmetrize w = (w + w[::-1])/2 x = (x - x[::-1])/2 # scale w to get the right value w *= np.sqrt(np.pi) / w.sum() return x, w def hermweight(x): """ Weight function of the Hermite polynomials. The weight function is :math:`\\exp(-x^2)` and the interval of integration is :math:`[-\\inf, \\inf]`. the Hermite polynomials are orthogonal, but not normalized, with respect to this weight function. Parameters ---------- x : array_like Values at which the weight function will be computed. Returns ------- w : ndarray The weight function at `x`. Notes ----- .. versionadded:: 1.7.0 """ w = np.exp(-x**2) return w # # Hermite series class # class Hermite(ABCPolyBase): """An Hermite series class. The Hermite class provides the standard Python numerical methods '+', '-', '*', '//', '%', 'divmod', '**', and '()' as well as the attributes and methods listed in the `ABCPolyBase` documentation. Parameters ---------- coef : array_like Hermite coefficients in order of increasing degree, i.e, ``(1, 2, 3)`` gives ``1*H_0(x) + 2*H_1(X) + 3*H_2(x)``. domain : (2,) array_like, optional Domain to use. The interval ``[domain[0], domain[1]]`` is mapped to the interval ``[window[0], window[1]]`` by shifting and scaling. The default value is [-1, 1]. window : (2,) array_like, optional Window, see `domain` for its use. The default value is [-1, 1]. .. versionadded:: 1.6.0 """ # Virtual Functions _add = staticmethod(hermadd) _sub = staticmethod(hermsub) _mul = staticmethod(hermmul) _div = staticmethod(hermdiv) _pow = staticmethod(hermpow) _val = staticmethod(hermval) _int = staticmethod(hermint) _der = staticmethod(hermder) _fit = staticmethod(hermfit) _line = staticmethod(hermline) _roots = staticmethod(hermroots) _fromroots = staticmethod(hermfromroots) # Virtual properties nickname = 'herm' domain = np.array(hermdomain) window = np.array(hermdomain)
mit
[ 624, 199, 11188, 367, 23654, 543, 26526, 6779, 14, 199, 199, 2765, 859, 6571, 282, 1329, 402, 2251, 334, 2786, 590, 3423, 9, 2997, 367, 199, 21245, 316, 543, 26526, 6779, 12, 5893, 282, 658, 40, 281, 19130, 64, 1021, 626, 199, 287, 12029, 15409, 314, 20195, 24166, 5331, 14, 221, 334, 14109, 2556, 199, 265, 4212, 642, 859, 8469, 436, 5419, 543, 4066, 27599, 365, 315, 314, 199, 12485, 367, 2399, 298, 1708, 2, 1007, 13, 2491, 12, 658, 4714, 14, 22104, 14963, 199, 199, 22185, 199, 9960, 199, 13, 658, 2523, 1064, 79, 973, 64, 1553, 26526, 6779, 849, 2881, 12, 5243, 17, 12, 17, 1055, 199, 13, 658, 2523, 77, 4262, 64, 1553, 26526, 6779, 626, 22014, 6120, 17269, 370, 378, 14, 199, 13, 658, 2523, 77, 368, 64, 1553, 26526, 6779, 626, 22014, 6120, 17269, 370, 413, 14, 199, 13, 658, 2523, 9457, 64, 1553, 26526, 6779, 367, 314, 8503, 2341, 12, 1124, 70, 8, 88, 9, 275, 671, 4345, 199, 199, 26291, 18764, 199, 9460, 199, 13, 658, 2523, 596, 348, 88, 64, 1553, 21699, 282, 26526, 6779, 315, 1124, 48, 63, 73, 8, 88, 9719, 701, 1124, 88, 4345, 199, 13, 658, 2523, 77, 525, 64, 1553, 1050, 2877, 26526, 6779, 14, 199, 13, 658, 2523, 706, 456, 64, 1553, 24129, 1373, 26526, 6779, 687, 4573, 14, 199, 13, 658, 2523, 596, 348, 64, 1553, 21699, 2877, 26526, 6779, 14, 199, 13, 658, 2523, 77, 3015, 64, 1553, 23003, 1373, 26526, 6779, 701, 4573, 14, 199, 13, 658, 2523, 77, 637, 64, 1553, 9352, 282, 26526, 6779, 737, 1627, 4501, 14, 199, 13, 658, 2523, 77, 637, 18, 68, 64, 1553, 9352, 282, 499, 36, 26526, 6779, 737, 1627, 4501, 14, 199, 13, 658, 2523, 77, 637, 19, 68, 64, 1553, 9352, 282, 650, 36, 26526, 6779, 737, 1627, 4501, 14, 199, 13, 658, 2523, 77, 3825, 18, 68, 64, 1553, 9352, 282, 499, 36, 26526, 6779, 641, 282, 14243, 19157, 3336, 14, 199, 13, 658, 2523, 77, 3825, 19, 68, 64, 1553, 9352, 282, 650, 36, 26526, 6779, 641, 282, 14243, 19157, 3336, 14, 199, 199, 13862, 527, 199, 518, 199, 13, 658, 2523, 77, 424, 64, 1553, 26796, 323, 282, 26526, 6779, 14, 199, 13, 658, 2523, 77, 442, 64, 1553, 21494, 282, 26526, 6779, 14, 199, 199, 29926, 17471, 199, 10965, 199, 13, 658, 2523, 77, 504, 12065, 64, 1553, 1218, 282, 26526, 6779, 543, 2013, 14361, 14, 199, 13, 658, 2523, 77, 12065, 64, 1553, 2342, 314, 14361, 402, 282, 26526, 6779, 14, 199, 13, 658, 2523, 12393, 11438, 64, 1553, 812, 11438, 2106, 271, 13, 2930, 3634, 367, 26526, 27599, 14, 199, 13, 658, 2523, 12393, 11438, 18, 68, 64, 1553, 812, 11438, 2106, 271, 13, 2930, 3634, 367, 499, 36, 7074, 6779, 14, 199, 13, 658, 2523, 12393, 11438, 19, 68, 64, 1553, 812, 11438, 2106, 271, 13, 2930, 3634, 367, 650, 36, 7074, 6779, 14, 199, 13, 658, 2523, 6649, 23822, 64, 1553, 598, 23822, 13, 40, 281, 19130, 16744, 30985, 12, 4501, 436, 4931, 14, 199, 13, 658, 2523, 77, 3463, 64, 1553, 26526, 5401, 805, 14, 199, 13, 658, 2523, 77, 863, 32012, 64, 1553, 4678, 3318, 7068, 1013, 32012, 3634, 315, 26526, 1824, 14, 199, 13, 658, 2523, 77, 3269, 64, 1553, 5210, 13, 20956, 5542, 8152, 282, 26526, 6779, 14, 199, 13, 658, 2523, 77, 12263, 64, 1553, 11639, 9186, 12343, 687, 282, 26526, 6779, 14, 199, 13, 658, 2523, 77, 604, 64, 1553, 26526, 6779, 402, 1627, 23669, 1004, 14, 199, 13, 658, 2523, 77, 18, 6023, 64, 1553, 3957, 282, 26526, 6779, 370, 282, 11849, 14, 199, 13, 658, 6023, 18, 2523, 77, 64, 1553, 3957, 282, 11849, 370, 282, 26526, 6779, 14, 199, 199, 15711, 199, 12797, 199, 13, 658, 40, 281, 19130, 64, 1553, 437, 26526, 6779, 1021, 14, 199, 199, 9295, 2597, 199, 518, 199, 64, 4714, 14, 22104, 64, 199, 199, 624, 199, 504, 636, 2443, 363, 492, 4629, 12, 3679, 63, 646, 12, 870, 63, 1593, 199, 199, 646, 3598, 199, 646, 2680, 465, 980, 199, 646, 2680, 14, 10096, 465, 1127, 199, 504, 2680, 14, 1018, 14, 23698, 492, 7666, 63, 3127, 63, 1080, 199, 199, 504, 1275, 492, 8446, 1208, 465, 18848, 199, 504, 13653, 6023, 1095, 492, 14840, 2890, 16242, 1563, 199, 199, 363, 452, 363, 275, 359, 272, 283, 2523, 77, 4262, 297, 283, 2523, 77, 368, 297, 283, 2523, 9457, 297, 283, 2523, 1064, 79, 973, 297, 283, 2523, 77, 604, 297, 283, 2523, 77, 525, 297, 272, 283, 2523, 706, 456, 297, 283, 2523, 596, 348, 88, 297, 283, 2523, 596, 348, 297, 283, 2523, 77, 3015, 297, 283, 2523, 311, 583, 297, 283, 2523, 77, 637, 297, 272, 283, 2523, 77, 424, 297, 283, 2523, 77, 442, 297, 283, 2523, 77, 18, 6023, 297, 283, 6023, 18, 2523, 77, 297, 283, 2523, 77, 504, 12065, 297, 272, 283, 2523, 12393, 11438, 297, 283, 2523, 77, 3269, 297, 283, 2523, 77, 12263, 297, 283, 2523, 77, 12065, 297, 283, 40, 281, 19130, 297, 272, 283, 2523, 77, 637, 18, 68, 297, 283, 2523, 77, 637, 19, 68, 297, 283, 2523, 77, 3825, 18, 68, 297, 283, 2523, 77, 3825, 19, 68, 297, 283, 2523, 12393, 11438, 18, 68, 297, 272, 283, 2523, 12393, 11438, 19, 68, 297, 283, 2523, 77, 863, 32012, 297, 283, 2523, 6649, 23822, 297, 283, 2523, 77, 3463, 418, 199, 199, 2523, 77, 12263, 275, 18848, 14, 12263, 8009, 421, 199, 318, 8446, 18, 2523, 77, 8, 2515, 304, 272, 408, 272, 8446, 18, 2523, 77, 8, 2515, 9, 339, 7905, 282, 11849, 370, 282, 26526, 6779, 14, 339, 7905, 376, 1625, 6144, 314, 12343, 402, 282, 11849, 334, 6188, 272, 370, 314, 298, 6807, 2, 5597, 9, 7741, 687, 18966, 13666, 370, 15356, 12, 370, 376, 272, 1625, 402, 314, 12343, 402, 314, 7353, 26526, 6779, 12, 7741, 272, 687, 18966, 370, 15356, 13666, 14, 339, 3897, 272, 4143, 272, 3708, 520, 1625, 63, 2930, 267, 413, 13, 36, 1625, 3035, 314, 11849, 12343, 339, 1803, 272, 5514, 272, 286, 520, 6800, 267, 413, 13, 36, 1625, 3035, 314 ]
[ 199, 11188, 367, 23654, 543, 26526, 6779, 14, 199, 199, 2765, 859, 6571, 282, 1329, 402, 2251, 334, 2786, 590, 3423, 9, 2997, 367, 199, 21245, 316, 543, 26526, 6779, 12, 5893, 282, 658, 40, 281, 19130, 64, 1021, 626, 199, 287, 12029, 15409, 314, 20195, 24166, 5331, 14, 221, 334, 14109, 2556, 199, 265, 4212, 642, 859, 8469, 436, 5419, 543, 4066, 27599, 365, 315, 314, 199, 12485, 367, 2399, 298, 1708, 2, 1007, 13, 2491, 12, 658, 4714, 14, 22104, 14963, 199, 199, 22185, 199, 9960, 199, 13, 658, 2523, 1064, 79, 973, 64, 1553, 26526, 6779, 849, 2881, 12, 5243, 17, 12, 17, 1055, 199, 13, 658, 2523, 77, 4262, 64, 1553, 26526, 6779, 626, 22014, 6120, 17269, 370, 378, 14, 199, 13, 658, 2523, 77, 368, 64, 1553, 26526, 6779, 626, 22014, 6120, 17269, 370, 413, 14, 199, 13, 658, 2523, 9457, 64, 1553, 26526, 6779, 367, 314, 8503, 2341, 12, 1124, 70, 8, 88, 9, 275, 671, 4345, 199, 199, 26291, 18764, 199, 9460, 199, 13, 658, 2523, 596, 348, 88, 64, 1553, 21699, 282, 26526, 6779, 315, 1124, 48, 63, 73, 8, 88, 9719, 701, 1124, 88, 4345, 199, 13, 658, 2523, 77, 525, 64, 1553, 1050, 2877, 26526, 6779, 14, 199, 13, 658, 2523, 706, 456, 64, 1553, 24129, 1373, 26526, 6779, 687, 4573, 14, 199, 13, 658, 2523, 596, 348, 64, 1553, 21699, 2877, 26526, 6779, 14, 199, 13, 658, 2523, 77, 3015, 64, 1553, 23003, 1373, 26526, 6779, 701, 4573, 14, 199, 13, 658, 2523, 77, 637, 64, 1553, 9352, 282, 26526, 6779, 737, 1627, 4501, 14, 199, 13, 658, 2523, 77, 637, 18, 68, 64, 1553, 9352, 282, 499, 36, 26526, 6779, 737, 1627, 4501, 14, 199, 13, 658, 2523, 77, 637, 19, 68, 64, 1553, 9352, 282, 650, 36, 26526, 6779, 737, 1627, 4501, 14, 199, 13, 658, 2523, 77, 3825, 18, 68, 64, 1553, 9352, 282, 499, 36, 26526, 6779, 641, 282, 14243, 19157, 3336, 14, 199, 13, 658, 2523, 77, 3825, 19, 68, 64, 1553, 9352, 282, 650, 36, 26526, 6779, 641, 282, 14243, 19157, 3336, 14, 199, 199, 13862, 527, 199, 518, 199, 13, 658, 2523, 77, 424, 64, 1553, 26796, 323, 282, 26526, 6779, 14, 199, 13, 658, 2523, 77, 442, 64, 1553, 21494, 282, 26526, 6779, 14, 199, 199, 29926, 17471, 199, 10965, 199, 13, 658, 2523, 77, 504, 12065, 64, 1553, 1218, 282, 26526, 6779, 543, 2013, 14361, 14, 199, 13, 658, 2523, 77, 12065, 64, 1553, 2342, 314, 14361, 402, 282, 26526, 6779, 14, 199, 13, 658, 2523, 12393, 11438, 64, 1553, 812, 11438, 2106, 271, 13, 2930, 3634, 367, 26526, 27599, 14, 199, 13, 658, 2523, 12393, 11438, 18, 68, 64, 1553, 812, 11438, 2106, 271, 13, 2930, 3634, 367, 499, 36, 7074, 6779, 14, 199, 13, 658, 2523, 12393, 11438, 19, 68, 64, 1553, 812, 11438, 2106, 271, 13, 2930, 3634, 367, 650, 36, 7074, 6779, 14, 199, 13, 658, 2523, 6649, 23822, 64, 1553, 598, 23822, 13, 40, 281, 19130, 16744, 30985, 12, 4501, 436, 4931, 14, 199, 13, 658, 2523, 77, 3463, 64, 1553, 26526, 5401, 805, 14, 199, 13, 658, 2523, 77, 863, 32012, 64, 1553, 4678, 3318, 7068, 1013, 32012, 3634, 315, 26526, 1824, 14, 199, 13, 658, 2523, 77, 3269, 64, 1553, 5210, 13, 20956, 5542, 8152, 282, 26526, 6779, 14, 199, 13, 658, 2523, 77, 12263, 64, 1553, 11639, 9186, 12343, 687, 282, 26526, 6779, 14, 199, 13, 658, 2523, 77, 604, 64, 1553, 26526, 6779, 402, 1627, 23669, 1004, 14, 199, 13, 658, 2523, 77, 18, 6023, 64, 1553, 3957, 282, 26526, 6779, 370, 282, 11849, 14, 199, 13, 658, 6023, 18, 2523, 77, 64, 1553, 3957, 282, 11849, 370, 282, 26526, 6779, 14, 199, 199, 15711, 199, 12797, 199, 13, 658, 40, 281, 19130, 64, 1553, 437, 26526, 6779, 1021, 14, 199, 199, 9295, 2597, 199, 518, 199, 64, 4714, 14, 22104, 64, 199, 199, 624, 199, 504, 636, 2443, 363, 492, 4629, 12, 3679, 63, 646, 12, 870, 63, 1593, 199, 199, 646, 3598, 199, 646, 2680, 465, 980, 199, 646, 2680, 14, 10096, 465, 1127, 199, 504, 2680, 14, 1018, 14, 23698, 492, 7666, 63, 3127, 63, 1080, 199, 199, 504, 1275, 492, 8446, 1208, 465, 18848, 199, 504, 13653, 6023, 1095, 492, 14840, 2890, 16242, 1563, 199, 199, 363, 452, 363, 275, 359, 272, 283, 2523, 77, 4262, 297, 283, 2523, 77, 368, 297, 283, 2523, 9457, 297, 283, 2523, 1064, 79, 973, 297, 283, 2523, 77, 604, 297, 283, 2523, 77, 525, 297, 272, 283, 2523, 706, 456, 297, 283, 2523, 596, 348, 88, 297, 283, 2523, 596, 348, 297, 283, 2523, 77, 3015, 297, 283, 2523, 311, 583, 297, 283, 2523, 77, 637, 297, 272, 283, 2523, 77, 424, 297, 283, 2523, 77, 442, 297, 283, 2523, 77, 18, 6023, 297, 283, 6023, 18, 2523, 77, 297, 283, 2523, 77, 504, 12065, 297, 272, 283, 2523, 12393, 11438, 297, 283, 2523, 77, 3269, 297, 283, 2523, 77, 12263, 297, 283, 2523, 77, 12065, 297, 283, 40, 281, 19130, 297, 272, 283, 2523, 77, 637, 18, 68, 297, 283, 2523, 77, 637, 19, 68, 297, 283, 2523, 77, 3825, 18, 68, 297, 283, 2523, 77, 3825, 19, 68, 297, 283, 2523, 12393, 11438, 18, 68, 297, 272, 283, 2523, 12393, 11438, 19, 68, 297, 283, 2523, 77, 863, 32012, 297, 283, 2523, 6649, 23822, 297, 283, 2523, 77, 3463, 418, 199, 199, 2523, 77, 12263, 275, 18848, 14, 12263, 8009, 421, 199, 318, 8446, 18, 2523, 77, 8, 2515, 304, 272, 408, 272, 8446, 18, 2523, 77, 8, 2515, 9, 339, 7905, 282, 11849, 370, 282, 26526, 6779, 14, 339, 7905, 376, 1625, 6144, 314, 12343, 402, 282, 11849, 334, 6188, 272, 370, 314, 298, 6807, 2, 5597, 9, 7741, 687, 18966, 13666, 370, 15356, 12, 370, 376, 272, 1625, 402, 314, 12343, 402, 314, 7353, 26526, 6779, 12, 7741, 272, 687, 18966, 370, 15356, 13666, 14, 339, 3897, 272, 4143, 272, 3708, 520, 1625, 63, 2930, 267, 413, 13, 36, 1625, 3035, 314, 11849, 12343, 339, 1803, 272, 5514, 272, 286, 520, 6800, 267, 413, 13, 36, 1625, 3035, 314, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
thefinn93/CouchPotatoServer
libs/requests/packages/chardet/big5freq.py
323
82588
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client 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 ######################### # Big5 frequency table # by Taiwan's Mandarin Promotion Council # <http://www.edu.tw:81/mandr/> # # 128 --> 0.42261 # 256 --> 0.57851 # 512 --> 0.74851 # 1024 --> 0.89384 # 2048 --> 0.97583 # # Ideal Distribution Ratio = 0.74851/(1-0.74851) =2.98 # Random Distribution Ration = 512/(5401-512)=0.105 # # Typical Distribution Ratio about 25% of Ideal one, still much higher than RDR BIG5_TYPICAL_DISTRIBUTION_RATIO = 0.75 #Char to FreqOrder table BIG5_TABLE_SIZE = 5376 Big5CharToFreqOrder = ( \ 1,1801,1506, 255,1431, 198, 9, 82, 6,5008, 177, 202,3681,1256,2821, 110, # 16 3814, 33,3274, 261, 76, 44,2114, 16,2946,2187,1176, 659,3971, 26,3451,2653, # 32 1198,3972,3350,4202, 410,2215, 302, 590, 361,1964, 8, 204, 58,4510,5009,1932, # 48 63,5010,5011, 317,1614, 75, 222, 159,4203,2417,1480,5012,3555,3091, 224,2822, # 64 3682, 3, 10,3973,1471, 29,2787,1135,2866,1940, 873, 130,3275,1123, 312,5013, # 80 4511,2052, 507, 252, 682,5014, 142,1915, 124, 206,2947, 34,3556,3204, 64, 604, # 96 5015,2501,1977,1978, 155,1991, 645, 641,1606,5016,3452, 337, 72, 406,5017, 80, # 112 630, 238,3205,1509, 263, 939,1092,2654, 756,1440,1094,3453, 449, 69,2987, 591, # 128 179,2096, 471, 115,2035,1844, 60, 50,2988, 134, 806,1869, 734,2036,3454, 180, # 144 995,1607, 156, 537,2907, 688,5018, 319,1305, 779,2145, 514,2379, 298,4512, 359, # 160 2502, 90,2716,1338, 663, 11, 906,1099,2553, 20,2441, 182, 532,1716,5019, 732, # 176 1376,4204,1311,1420,3206, 25,2317,1056, 113, 399, 382,1950, 242,3455,2474, 529, # 192 3276, 475,1447,3683,5020, 117, 21, 656, 810,1297,2300,2334,3557,5021, 126,4205, # 208 706, 456, 150, 613,4513, 71,1118,2037,4206, 145,3092, 85, 835, 486,2115,1246, # 224 1426, 428, 727,1285,1015, 800, 106, 623, 303,1281,5022,2128,2359, 347,3815, 221, # 240 3558,3135,5023,1956,1153,4207, 83, 296,1199,3093, 192, 624, 93,5024, 822,1898, # 256 2823,3136, 795,2065, 991,1554,1542,1592, 27, 43,2867, 859, 139,1456, 860,4514, # 272 437, 712,3974, 164,2397,3137, 695, 211,3037,2097, 195,3975,1608,3559,3560,3684, # 288 3976, 234, 811,2989,2098,3977,2233,1441,3561,1615,2380, 668,2077,1638, 305, 228, # 304 1664,4515, 467, 415,5025, 262,2099,1593, 239, 108, 300, 200,1033, 512,1247,2078, # 320 5026,5027,2176,3207,3685,2682, 593, 845,1062,3277, 88,1723,2038,3978,1951, 212, # 336 266, 152, 149, 468,1899,4208,4516, 77, 187,5028,3038, 37, 5,2990,5029,3979, # 352 5030,5031, 39,2524,4517,2908,3208,2079, 55, 148, 74,4518, 545, 483,1474,1029, # 368 1665, 217,1870,1531,3138,1104,2655,4209, 24, 172,3562, 900,3980,3563,3564,4519, # 384 32,1408,2824,1312, 329, 487,2360,2251,2717, 784,2683, 4,3039,3351,1427,1789, # 400 188, 109, 499,5032,3686,1717,1790, 888,1217,3040,4520,5033,3565,5034,3352,1520, # 416 3687,3981, 196,1034, 775,5035,5036, 929,1816, 249, 439, 38,5037,1063,5038, 794, # 432 3982,1435,2301, 46, 178,3278,2066,5039,2381,5040, 214,1709,4521, 804, 35, 707, # 448 324,3688,1601,2554, 140, 459,4210,5041,5042,1365, 839, 272, 978,2262,2580,3456, # 464 2129,1363,3689,1423, 697, 100,3094, 48, 70,1231, 495,3139,2196,5043,1294,5044, # 480 2080, 462, 586,1042,3279, 853, 256, 988, 185,2382,3457,1698, 434,1084,5045,3458, # 496 314,2625,2788,4522,2335,2336, 569,2285, 637,1817,2525, 757,1162,1879,1616,3459, # 512 287,1577,2116, 768,4523,1671,2868,3566,2526,1321,3816, 909,2418,5046,4211, 933, # 528 3817,4212,2053,2361,1222,4524, 765,2419,1322, 786,4525,5047,1920,1462,1677,2909, # 544 1699,5048,4526,1424,2442,3140,3690,2600,3353,1775,1941,3460,3983,4213, 309,1369, # 560 1130,2825, 364,2234,1653,1299,3984,3567,3985,3986,2656, 525,1085,3041, 902,2001, # 576 1475, 964,4527, 421,1845,1415,1057,2286, 940,1364,3141, 376,4528,4529,1381, 7, # 592 2527, 983,2383, 336,1710,2684,1846, 321,3461, 559,1131,3042,2752,1809,1132,1313, # 608 265,1481,1858,5049, 352,1203,2826,3280, 167,1089, 420,2827, 776, 792,1724,3568, # 624 4214,2443,3281,5050,4215,5051, 446, 229, 333,2753, 901,3818,1200,1557,4530,2657, # 640 1921, 395,2754,2685,3819,4216,1836, 125, 916,3209,2626,4531,5052,5053,3820,5054, # 656 5055,5056,4532,3142,3691,1133,2555,1757,3462,1510,2318,1409,3569,5057,2146, 438, # 672 2601,2910,2384,3354,1068, 958,3043, 461, 311,2869,2686,4217,1916,3210,4218,1979, # 688 383, 750,2755,2627,4219, 274, 539, 385,1278,1442,5058,1154,1965, 384, 561, 210, # 704 98,1295,2556,3570,5059,1711,2420,1482,3463,3987,2911,1257, 129,5060,3821, 642, # 720 523,2789,2790,2658,5061, 141,2235,1333, 68, 176, 441, 876, 907,4220, 603,2602, # 736 710, 171,3464, 404, 549, 18,3143,2398,1410,3692,1666,5062,3571,4533,2912,4534, # 752 5063,2991, 368,5064, 146, 366, 99, 871,3693,1543, 748, 807,1586,1185, 22,2263, # 768 379,3822,3211,5065,3212, 505,1942,2628,1992,1382,2319,5066, 380,2362, 218, 702, # 784 1818,1248,3465,3044,3572,3355,3282,5067,2992,3694, 930,3283,3823,5068, 59,5069, # 800 585, 601,4221, 497,3466,1112,1314,4535,1802,5070,1223,1472,2177,5071, 749,1837, # 816 690,1900,3824,1773,3988,1476, 429,1043,1791,2236,2117, 917,4222, 447,1086,1629, # 832 5072, 556,5073,5074,2021,1654, 844,1090, 105, 550, 966,1758,2828,1008,1783, 686, # 848 1095,5075,2287, 793,1602,5076,3573,2603,4536,4223,2948,2302,4537,3825, 980,2503, # 864 544, 353, 527,4538, 908,2687,2913,5077, 381,2629,1943,1348,5078,1341,1252, 560, # 880 3095,5079,3467,2870,5080,2054, 973, 886,2081, 143,4539,5081,5082, 157,3989, 496, # 896 4224, 57, 840, 540,2039,4540,4541,3468,2118,1445, 970,2264,1748,1966,2082,4225, # 912 3144,1234,1776,3284,2829,3695, 773,1206,2130,1066,2040,1326,3990,1738,1725,4226, # 928 279,3145, 51,1544,2604, 423,1578,2131,2067, 173,4542,1880,5083,5084,1583, 264, # 944 610,3696,4543,2444, 280, 154,5085,5086,5087,1739, 338,1282,3096, 693,2871,1411, # 960 1074,3826,2445,5088,4544,5089,5090,1240, 952,2399,5091,2914,1538,2688, 685,1483, # 976 4227,2475,1436, 953,4228,2055,4545, 671,2400, 79,4229,2446,3285, 608, 567,2689, # 992 3469,4230,4231,1691, 393,1261,1792,2401,5092,4546,5093,5094,5095,5096,1383,1672, # 1008 3827,3213,1464, 522,1119, 661,1150, 216, 675,4547,3991,1432,3574, 609,4548,2690, # 1024 2402,5097,5098,5099,4232,3045, 0,5100,2476, 315, 231,2447, 301,3356,4549,2385, # 1040 5101, 233,4233,3697,1819,4550,4551,5102, 96,1777,1315,2083,5103, 257,5104,1810, # 1056 3698,2718,1139,1820,4234,2022,1124,2164,2791,1778,2659,5105,3097, 363,1655,3214, # 1072 5106,2993,5107,5108,5109,3992,1567,3993, 718, 103,3215, 849,1443, 341,3357,2949, # 1088 1484,5110,1712, 127, 67, 339,4235,2403, 679,1412, 821,5111,5112, 834, 738, 351, # 1104 2994,2147, 846, 235,1497,1881, 418,1993,3828,2719, 186,1100,2148,2756,3575,1545, # 1120 1355,2950,2872,1377, 583,3994,4236,2581,2995,5113,1298,3699,1078,2557,3700,2363, # 1136 78,3829,3830, 267,1289,2100,2002,1594,4237, 348, 369,1274,2197,2178,1838,4552, # 1152 1821,2830,3701,2757,2288,2003,4553,2951,2758, 144,3358, 882,4554,3995,2759,3470, # 1168 4555,2915,5114,4238,1726, 320,5115,3996,3046, 788,2996,5116,2831,1774,1327,2873, # 1184 3997,2832,5117,1306,4556,2004,1700,3831,3576,2364,2660, 787,2023, 506, 824,3702, # 1200 534, 323,4557,1044,3359,2024,1901, 946,3471,5118,1779,1500,1678,5119,1882,4558, # 1216 165, 243,4559,3703,2528, 123, 683,4239, 764,4560, 36,3998,1793, 589,2916, 816, # 1232 626,1667,3047,2237,1639,1555,1622,3832,3999,5120,4000,2874,1370,1228,1933, 891, # 1248 2084,2917, 304,4240,5121, 292,2997,2720,3577, 691,2101,4241,1115,4561, 118, 662, # 1264 5122, 611,1156, 854,2386,1316,2875, 2, 386, 515,2918,5123,5124,3286, 868,2238, # 1280 1486, 855,2661, 785,2216,3048,5125,1040,3216,3578,5126,3146, 448,5127,1525,5128, # 1296 2165,4562,5129,3833,5130,4242,2833,3579,3147, 503, 818,4001,3148,1568, 814, 676, # 1312 1444, 306,1749,5131,3834,1416,1030, 197,1428, 805,2834,1501,4563,5132,5133,5134, # 1328 1994,5135,4564,5136,5137,2198, 13,2792,3704,2998,3149,1229,1917,5138,3835,2132, # 1344 5139,4243,4565,2404,3580,5140,2217,1511,1727,1120,5141,5142, 646,3836,2448, 307, # 1360 5143,5144,1595,3217,5145,5146,5147,3705,1113,1356,4002,1465,2529,2530,5148, 519, # 1376 5149, 128,2133, 92,2289,1980,5150,4003,1512, 342,3150,2199,5151,2793,2218,1981, # 1392 3360,4244, 290,1656,1317, 789, 827,2365,5152,3837,4566, 562, 581,4004,5153, 401, # 1408 4567,2252, 94,4568,5154,1399,2794,5155,1463,2025,4569,3218,1944,5156, 828,1105, # 1424 4245,1262,1394,5157,4246, 605,4570,5158,1784,2876,5159,2835, 819,2102, 578,2200, # 1440 2952,5160,1502, 436,3287,4247,3288,2836,4005,2919,3472,3473,5161,2721,2320,5162, # 1456 5163,2337,2068, 23,4571, 193, 826,3838,2103, 699,1630,4248,3098, 390,1794,1064, # 1472 3581,5164,1579,3099,3100,1400,5165,4249,1839,1640,2877,5166,4572,4573, 137,4250, # 1488 598,3101,1967, 780, 104, 974,2953,5167, 278, 899, 253, 402, 572, 504, 493,1339, # 1504 5168,4006,1275,4574,2582,2558,5169,3706,3049,3102,2253, 565,1334,2722, 863, 41, # 1520 5170,5171,4575,5172,1657,2338, 19, 463,2760,4251, 606,5173,2999,3289,1087,2085, # 1536 1323,2662,3000,5174,1631,1623,1750,4252,2691,5175,2878, 791,2723,2663,2339, 232, # 1552 2421,5176,3001,1498,5177,2664,2630, 755,1366,3707,3290,3151,2026,1609, 119,1918, # 1568 3474, 862,1026,4253,5178,4007,3839,4576,4008,4577,2265,1952,2477,5179,1125, 817, # 1584 4254,4255,4009,1513,1766,2041,1487,4256,3050,3291,2837,3840,3152,5180,5181,1507, # 1600 5182,2692, 733, 40,1632,1106,2879, 345,4257, 841,2531, 230,4578,3002,1847,3292, # 1616 3475,5183,1263, 986,3476,5184, 735, 879, 254,1137, 857, 622,1300,1180,1388,1562, # 1632 4010,4011,2954, 967,2761,2665,1349, 592,2134,1692,3361,3003,1995,4258,1679,4012, # 1648 1902,2188,5185, 739,3708,2724,1296,1290,5186,4259,2201,2202,1922,1563,2605,2559, # 1664 1871,2762,3004,5187, 435,5188, 343,1108, 596, 17,1751,4579,2239,3477,3709,5189, # 1680 4580, 294,3582,2955,1693, 477, 979, 281,2042,3583, 643,2043,3710,2631,2795,2266, # 1696 1031,2340,2135,2303,3584,4581, 367,1249,2560,5190,3585,5191,4582,1283,3362,2005, # 1712 240,1762,3363,4583,4584, 836,1069,3153, 474,5192,2149,2532, 268,3586,5193,3219, # 1728 1521,1284,5194,1658,1546,4260,5195,3587,3588,5196,4261,3364,2693,1685,4262, 961, # 1744 1673,2632, 190,2006,2203,3841,4585,4586,5197, 570,2504,3711,1490,5198,4587,2633, # 1760 3293,1957,4588, 584,1514, 396,1045,1945,5199,4589,1968,2449,5200,5201,4590,4013, # 1776 619,5202,3154,3294, 215,2007,2796,2561,3220,4591,3221,4592, 763,4263,3842,4593, # 1792 5203,5204,1958,1767,2956,3365,3712,1174, 452,1477,4594,3366,3155,5205,2838,1253, # 1808 2387,2189,1091,2290,4264, 492,5206, 638,1169,1825,2136,1752,4014, 648, 926,1021, # 1824 1324,4595, 520,4596, 997, 847,1007, 892,4597,3843,2267,1872,3713,2405,1785,4598, # 1840 1953,2957,3103,3222,1728,4265,2044,3714,4599,2008,1701,3156,1551, 30,2268,4266, # 1856 5207,2027,4600,3589,5208, 501,5209,4267, 594,3478,2166,1822,3590,3479,3591,3223, # 1872 829,2839,4268,5210,1680,3157,1225,4269,5211,3295,4601,4270,3158,2341,5212,4602, # 1888 4271,5213,4015,4016,5214,1848,2388,2606,3367,5215,4603, 374,4017, 652,4272,4273, # 1904 375,1140, 798,5216,5217,5218,2366,4604,2269, 546,1659, 138,3051,2450,4605,5219, # 1920 2254, 612,1849, 910, 796,3844,1740,1371, 825,3845,3846,5220,2920,2562,5221, 692, # 1936 444,3052,2634, 801,4606,4274,5222,1491, 244,1053,3053,4275,4276, 340,5223,4018, # 1952 1041,3005, 293,1168, 87,1357,5224,1539, 959,5225,2240, 721, 694,4277,3847, 219, # 1968 1478, 644,1417,3368,2666,1413,1401,1335,1389,4019,5226,5227,3006,2367,3159,1826, # 1984 730,1515, 184,2840, 66,4607,5228,1660,2958, 246,3369, 378,1457, 226,3480, 975, # 2000 4020,2959,1264,3592, 674, 696,5229, 163,5230,1141,2422,2167, 713,3593,3370,4608, # 2016 4021,5231,5232,1186, 15,5233,1079,1070,5234,1522,3224,3594, 276,1050,2725, 758, # 2032 1126, 653,2960,3296,5235,2342, 889,3595,4022,3104,3007, 903,1250,4609,4023,3481, # 2048 3596,1342,1681,1718, 766,3297, 286, 89,2961,3715,5236,1713,5237,2607,3371,3008, # 2064 5238,2962,2219,3225,2880,5239,4610,2505,2533, 181, 387,1075,4024, 731,2190,3372, # 2080 5240,3298, 310, 313,3482,2304, 770,4278, 54,3054, 189,4611,3105,3848,4025,5241, # 2096 1230,1617,1850, 355,3597,4279,4612,3373, 111,4280,3716,1350,3160,3483,3055,4281, # 2112 2150,3299,3598,5242,2797,4026,4027,3009, 722,2009,5243,1071, 247,1207,2343,2478, # 2128 1378,4613,2010, 864,1437,1214,4614, 373,3849,1142,2220, 667,4615, 442,2763,2563, # 2144 3850,4028,1969,4282,3300,1840, 837, 170,1107, 934,1336,1883,5244,5245,2119,4283, # 2160 2841, 743,1569,5246,4616,4284, 582,2389,1418,3484,5247,1803,5248, 357,1395,1729, # 2176 3717,3301,2423,1564,2241,5249,3106,3851,1633,4617,1114,2086,4285,1532,5250, 482, # 2192 2451,4618,5251,5252,1492, 833,1466,5253,2726,3599,1641,2842,5254,1526,1272,3718, # 2208 4286,1686,1795, 416,2564,1903,1954,1804,5255,3852,2798,3853,1159,2321,5256,2881, # 2224 4619,1610,1584,3056,2424,2764, 443,3302,1163,3161,5257,5258,4029,5259,4287,2506, # 2240 3057,4620,4030,3162,2104,1647,3600,2011,1873,4288,5260,4289, 431,3485,5261, 250, # 2256 97, 81,4290,5262,1648,1851,1558, 160, 848,5263, 866, 740,1694,5264,2204,2843, # 2272 3226,4291,4621,3719,1687, 950,2479, 426, 469,3227,3720,3721,4031,5265,5266,1188, # 2288 424,1996, 861,3601,4292,3854,2205,2694, 168,1235,3602,4293,5267,2087,1674,4622, # 2304 3374,3303, 220,2565,1009,5268,3855, 670,3010, 332,1208, 717,5269,5270,3603,2452, # 2320 4032,3375,5271, 513,5272,1209,2882,3376,3163,4623,1080,5273,5274,5275,5276,2534, # 2336 3722,3604, 815,1587,4033,4034,5277,3605,3486,3856,1254,4624,1328,3058,1390,4035, # 2352 1741,4036,3857,4037,5278, 236,3858,2453,3304,5279,5280,3723,3859,1273,3860,4625, # 2368 5281, 308,5282,4626, 245,4627,1852,2480,1307,2583, 430, 715,2137,2454,5283, 270, # 2384 199,2883,4038,5284,3606,2727,1753, 761,1754, 725,1661,1841,4628,3487,3724,5285, # 2400 5286, 587, 14,3305, 227,2608, 326, 480,2270, 943,2765,3607, 291, 650,1884,5287, # 2416 1702,1226, 102,1547, 62,3488, 904,4629,3489,1164,4294,5288,5289,1224,1548,2766, # 2432 391, 498,1493,5290,1386,1419,5291,2056,1177,4630, 813, 880,1081,2368, 566,1145, # 2448 4631,2291,1001,1035,2566,2609,2242, 394,1286,5292,5293,2069,5294, 86,1494,1730, # 2464 4039, 491,1588, 745, 897,2963, 843,3377,4040,2767,2884,3306,1768, 998,2221,2070, # 2480 397,1827,1195,1970,3725,3011,3378, 284,5295,3861,2507,2138,2120,1904,5296,4041, # 2496 2151,4042,4295,1036,3490,1905, 114,2567,4296, 209,1527,5297,5298,2964,2844,2635, # 2512 2390,2728,3164, 812,2568,5299,3307,5300,1559, 737,1885,3726,1210, 885, 28,2695, # 2528 3608,3862,5301,4297,1004,1780,4632,5302, 346,1982,2222,2696,4633,3863,1742, 797, # 2544 1642,4043,1934,1072,1384,2152, 896,4044,3308,3727,3228,2885,3609,5303,2569,1959, # 2560 4634,2455,1786,5304,5305,5306,4045,4298,1005,1308,3728,4299,2729,4635,4636,1528, # 2576 2610, 161,1178,4300,1983, 987,4637,1101,4301, 631,4046,1157,3229,2425,1343,1241, # 2592 1016,2243,2570, 372, 877,2344,2508,1160, 555,1935, 911,4047,5307, 466,1170, 169, # 2608 1051,2921,2697,3729,2481,3012,1182,2012,2571,1251,2636,5308, 992,2345,3491,1540, # 2624 2730,1201,2071,2406,1997,2482,5309,4638, 528,1923,2191,1503,1874,1570,2369,3379, # 2640 3309,5310, 557,1073,5311,1828,3492,2088,2271,3165,3059,3107, 767,3108,2799,4639, # 2656 1006,4302,4640,2346,1267,2179,3730,3230, 778,4048,3231,2731,1597,2667,5312,4641, # 2672 5313,3493,5314,5315,5316,3310,2698,1433,3311, 131, 95,1504,4049, 723,4303,3166, # 2688 1842,3610,2768,2192,4050,2028,2105,3731,5317,3013,4051,1218,5318,3380,3232,4052, # 2704 4304,2584, 248,1634,3864, 912,5319,2845,3732,3060,3865, 654, 53,5320,3014,5321, # 2720 1688,4642, 777,3494,1032,4053,1425,5322, 191, 820,2121,2846, 971,4643, 931,3233, # 2736 135, 664, 783,3866,1998, 772,2922,1936,4054,3867,4644,2923,3234, 282,2732, 640, # 2752 1372,3495,1127, 922, 325,3381,5323,5324, 711,2045,5325,5326,4055,2223,2800,1937, # 2768 4056,3382,2224,2255,3868,2305,5327,4645,3869,1258,3312,4057,3235,2139,2965,4058, # 2784 4059,5328,2225, 258,3236,4646, 101,1227,5329,3313,1755,5330,1391,3314,5331,2924, # 2800 2057, 893,5332,5333,5334,1402,4305,2347,5335,5336,3237,3611,5337,5338, 878,1325, # 2816 1781,2801,4647, 259,1385,2585, 744,1183,2272,4648,5339,4060,2509,5340, 684,1024, # 2832 4306,5341, 472,3612,3496,1165,3315,4061,4062, 322,2153, 881, 455,1695,1152,1340, # 2848 660, 554,2154,4649,1058,4650,4307, 830,1065,3383,4063,4651,1924,5342,1703,1919, # 2864 5343, 932,2273, 122,5344,4652, 947, 677,5345,3870,2637, 297,1906,1925,2274,4653, # 2880 2322,3316,5346,5347,4308,5348,4309, 84,4310, 112, 989,5349, 547,1059,4064, 701, # 2896 3613,1019,5350,4311,5351,3497, 942, 639, 457,2306,2456, 993,2966, 407, 851, 494, # 2912 4654,3384, 927,5352,1237,5353,2426,3385, 573,4312, 680, 921,2925,1279,1875, 285, # 2928 790,1448,1984, 719,2168,5354,5355,4655,4065,4066,1649,5356,1541, 563,5357,1077, # 2944 5358,3386,3061,3498, 511,3015,4067,4068,3733,4069,1268,2572,3387,3238,4656,4657, # 2960 5359, 535,1048,1276,1189,2926,2029,3167,1438,1373,2847,2967,1134,2013,5360,4313, # 2976 1238,2586,3109,1259,5361, 700,5362,2968,3168,3734,4314,5363,4315,1146,1876,1907, # 2992 4658,2611,4070, 781,2427, 132,1589, 203, 147, 273,2802,2407, 898,1787,2155,4071, # 3008 4072,5364,3871,2803,5365,5366,4659,4660,5367,3239,5368,1635,3872, 965,5369,1805, # 3024 2699,1516,3614,1121,1082,1329,3317,4073,1449,3873, 65,1128,2848,2927,2769,1590, # 3040 3874,5370,5371, 12,2668, 45, 976,2587,3169,4661, 517,2535,1013,1037,3240,5372, # 3056 3875,2849,5373,3876,5374,3499,5375,2612, 614,1999,2323,3877,3110,2733,2638,5376, # 3072 2588,4316, 599,1269,5377,1811,3735,5378,2700,3111, 759,1060, 489,1806,3388,3318, # 3088 1358,5379,5380,2391,1387,1215,2639,2256, 490,5381,5382,4317,1759,2392,2348,5383, # 3104 4662,3878,1908,4074,2640,1807,3241,4663,3500,3319,2770,2349, 874,5384,5385,3501, # 3120 3736,1859, 91,2928,3737,3062,3879,4664,5386,3170,4075,2669,5387,3502,1202,1403, # 3136 3880,2969,2536,1517,2510,4665,3503,2511,5388,4666,5389,2701,1886,1495,1731,4076, # 3152 2370,4667,5390,2030,5391,5392,4077,2702,1216, 237,2589,4318,2324,4078,3881,4668, # 3168 4669,2703,3615,3504, 445,4670,5393,5394,5395,5396,2771, 61,4079,3738,1823,4080, # 3184 5397, 687,2046, 935, 925, 405,2670, 703,1096,1860,2734,4671,4081,1877,1367,2704, # 3200 3389, 918,2106,1782,2483, 334,3320,1611,1093,4672, 564,3171,3505,3739,3390, 945, # 3216 2641,2058,4673,5398,1926, 872,4319,5399,3506,2705,3112, 349,4320,3740,4082,4674, # 3232 3882,4321,3741,2156,4083,4675,4676,4322,4677,2408,2047, 782,4084, 400, 251,4323, # 3248 1624,5400,5401, 277,3742, 299,1265, 476,1191,3883,2122,4324,4325,1109, 205,5402, # 3264 2590,1000,2157,3616,1861,5403,5404,5405,4678,5406,4679,2573, 107,2484,2158,4085, # 3280 3507,3172,5407,1533, 541,1301, 158, 753,4326,2886,3617,5408,1696, 370,1088,4327, # 3296 4680,3618, 579, 327, 440, 162,2244, 269,1938,1374,3508, 968,3063, 56,1396,3113, # 3312 2107,3321,3391,5409,1927,2159,4681,3016,5410,3619,5411,5412,3743,4682,2485,5413, # 3328 2804,5414,1650,4683,5415,2613,5416,5417,4086,2671,3392,1149,3393,4087,3884,4088, # 3344 5418,1076, 49,5419, 951,3242,3322,3323, 450,2850, 920,5420,1812,2805,2371,4328, # 3360 1909,1138,2372,3885,3509,5421,3243,4684,1910,1147,1518,2428,4685,3886,5422,4686, # 3376 2393,2614, 260,1796,3244,5423,5424,3887,3324, 708,5425,3620,1704,5426,3621,1351, # 3392 1618,3394,3017,1887, 944,4329,3395,4330,3064,3396,4331,5427,3744, 422, 413,1714, # 3408 3325, 500,2059,2350,4332,2486,5428,1344,1911, 954,5429,1668,5430,5431,4089,2409, # 3424 4333,3622,3888,4334,5432,2307,1318,2512,3114, 133,3115,2887,4687, 629, 31,2851, # 3440 2706,3889,4688, 850, 949,4689,4090,2970,1732,2089,4335,1496,1853,5433,4091, 620, # 3456 3245, 981,1242,3745,3397,1619,3746,1643,3326,2140,2457,1971,1719,3510,2169,5434, # 3472 3246,5435,5436,3398,1829,5437,1277,4690,1565,2048,5438,1636,3623,3116,5439, 869, # 3488 2852, 655,3890,3891,3117,4092,3018,3892,1310,3624,4691,5440,5441,5442,1733, 558, # 3504 4692,3747, 335,1549,3065,1756,4336,3748,1946,3511,1830,1291,1192, 470,2735,2108, # 3520 2806, 913,1054,4093,5443,1027,5444,3066,4094,4693, 982,2672,3399,3173,3512,3247, # 3536 3248,1947,2807,5445, 571,4694,5446,1831,5447,3625,2591,1523,2429,5448,2090, 984, # 3552 4695,3749,1960,5449,3750, 852, 923,2808,3513,3751, 969,1519, 999,2049,2325,1705, # 3568 5450,3118, 615,1662, 151, 597,4095,2410,2326,1049, 275,4696,3752,4337, 568,3753, # 3584 3626,2487,4338,3754,5451,2430,2275, 409,3249,5452,1566,2888,3514,1002, 769,2853, # 3600 194,2091,3174,3755,2226,3327,4339, 628,1505,5453,5454,1763,2180,3019,4096, 521, # 3616 1161,2592,1788,2206,2411,4697,4097,1625,4340,4341, 412, 42,3119, 464,5455,2642, # 3632 4698,3400,1760,1571,2889,3515,2537,1219,2207,3893,2643,2141,2373,4699,4700,3328, # 3648 1651,3401,3627,5456,5457,3628,2488,3516,5458,3756,5459,5460,2276,2092, 460,5461, # 3664 4701,5462,3020, 962, 588,3629, 289,3250,2644,1116, 52,5463,3067,1797,5464,5465, # 3680 5466,1467,5467,1598,1143,3757,4342,1985,1734,1067,4702,1280,3402, 465,4703,1572, # 3696 510,5468,1928,2245,1813,1644,3630,5469,4704,3758,5470,5471,2673,1573,1534,5472, # 3712 5473, 536,1808,1761,3517,3894,3175,2645,5474,5475,5476,4705,3518,2929,1912,2809, # 3728 5477,3329,1122, 377,3251,5478, 360,5479,5480,4343,1529, 551,5481,2060,3759,1769, # 3744 2431,5482,2930,4344,3330,3120,2327,2109,2031,4706,1404, 136,1468,1479, 672,1171, # 3760 3252,2308, 271,3176,5483,2772,5484,2050, 678,2736, 865,1948,4707,5485,2014,4098, # 3776 2971,5486,2737,2227,1397,3068,3760,4708,4709,1735,2931,3403,3631,5487,3895, 509, # 3792 2854,2458,2890,3896,5488,5489,3177,3178,4710,4345,2538,4711,2309,1166,1010, 552, # 3808 681,1888,5490,5491,2972,2973,4099,1287,1596,1862,3179, 358, 453, 736, 175, 478, # 3824 1117, 905,1167,1097,5492,1854,1530,5493,1706,5494,2181,3519,2292,3761,3520,3632, # 3840 4346,2093,4347,5495,3404,1193,2489,4348,1458,2193,2208,1863,1889,1421,3331,2932, # 3856 3069,2182,3521, 595,2123,5496,4100,5497,5498,4349,1707,2646, 223,3762,1359, 751, # 3872 3121, 183,3522,5499,2810,3021, 419,2374, 633, 704,3897,2394, 241,5500,5501,5502, # 3888 838,3022,3763,2277,2773,2459,3898,1939,2051,4101,1309,3122,2246,1181,5503,1136, # 3904 2209,3899,2375,1446,4350,2310,4712,5504,5505,4351,1055,2615, 484,3764,5506,4102, # 3920 625,4352,2278,3405,1499,4353,4103,5507,4104,4354,3253,2279,2280,3523,5508,5509, # 3936 2774, 808,2616,3765,3406,4105,4355,3123,2539, 526,3407,3900,4356, 955,5510,1620, # 3952 4357,2647,2432,5511,1429,3766,1669,1832, 994, 928,5512,3633,1260,5513,5514,5515, # 3968 1949,2293, 741,2933,1626,4358,2738,2460, 867,1184, 362,3408,1392,5516,5517,4106, # 3984 4359,1770,1736,3254,2934,4713,4714,1929,2707,1459,1158,5518,3070,3409,2891,1292, # 4000 1930,2513,2855,3767,1986,1187,2072,2015,2617,4360,5519,2574,2514,2170,3768,2490, # 4016 3332,5520,3769,4715,5521,5522, 666,1003,3023,1022,3634,4361,5523,4716,1814,2257, # 4032 574,3901,1603, 295,1535, 705,3902,4362, 283, 858, 417,5524,5525,3255,4717,4718, # 4048 3071,1220,1890,1046,2281,2461,4107,1393,1599, 689,2575, 388,4363,5526,2491, 802, # 4064 5527,2811,3903,2061,1405,2258,5528,4719,3904,2110,1052,1345,3256,1585,5529, 809, # 4080 5530,5531,5532, 575,2739,3524, 956,1552,1469,1144,2328,5533,2329,1560,2462,3635, # 4096 3257,4108, 616,2210,4364,3180,2183,2294,5534,1833,5535,3525,4720,5536,1319,3770, # 4112 3771,1211,3636,1023,3258,1293,2812,5537,5538,5539,3905, 607,2311,3906, 762,2892, # 4128 1439,4365,1360,4721,1485,3072,5540,4722,1038,4366,1450,2062,2648,4367,1379,4723, # 4144 2593,5541,5542,4368,1352,1414,2330,2935,1172,5543,5544,3907,3908,4724,1798,1451, # 4160 5545,5546,5547,5548,2936,4109,4110,2492,2351, 411,4111,4112,3637,3333,3124,4725, # 4176 1561,2674,1452,4113,1375,5549,5550, 47,2974, 316,5551,1406,1591,2937,3181,5552, # 4192 1025,2142,3125,3182, 354,2740, 884,2228,4369,2412, 508,3772, 726,3638, 996,2433, # 4208 3639, 729,5553, 392,2194,1453,4114,4726,3773,5554,5555,2463,3640,2618,1675,2813, # 4224 919,2352,2975,2353,1270,4727,4115, 73,5556,5557, 647,5558,3259,2856,2259,1550, # 4240 1346,3024,5559,1332, 883,3526,5560,5561,5562,5563,3334,2775,5564,1212, 831,1347, # 4256 4370,4728,2331,3909,1864,3073, 720,3910,4729,4730,3911,5565,4371,5566,5567,4731, # 4272 5568,5569,1799,4732,3774,2619,4733,3641,1645,2376,4734,5570,2938, 669,2211,2675, # 4288 2434,5571,2893,5572,5573,1028,3260,5574,4372,2413,5575,2260,1353,5576,5577,4735, # 4304 3183, 518,5578,4116,5579,4373,1961,5580,2143,4374,5581,5582,3025,2354,2355,3912, # 4320 516,1834,1454,4117,2708,4375,4736,2229,2620,1972,1129,3642,5583,2776,5584,2976, # 4336 1422, 577,1470,3026,1524,3410,5585,5586, 432,4376,3074,3527,5587,2594,1455,2515, # 4352 2230,1973,1175,5588,1020,2741,4118,3528,4737,5589,2742,5590,1743,1361,3075,3529, # 4368 2649,4119,4377,4738,2295, 895, 924,4378,2171, 331,2247,3076, 166,1627,3077,1098, # 4384 5591,1232,2894,2231,3411,4739, 657, 403,1196,2377, 542,3775,3412,1600,4379,3530, # 4400 5592,4740,2777,3261, 576, 530,1362,4741,4742,2540,2676,3776,4120,5593, 842,3913, # 4416 5594,2814,2032,1014,4121, 213,2709,3413, 665, 621,4380,5595,3777,2939,2435,5596, # 4432 2436,3335,3643,3414,4743,4381,2541,4382,4744,3644,1682,4383,3531,1380,5597, 724, # 4448 2282, 600,1670,5598,1337,1233,4745,3126,2248,5599,1621,4746,5600, 651,4384,5601, # 4464 1612,4385,2621,5602,2857,5603,2743,2312,3078,5604, 716,2464,3079, 174,1255,2710, # 4480 4122,3645, 548,1320,1398, 728,4123,1574,5605,1891,1197,3080,4124,5606,3081,3082, # 4496 3778,3646,3779, 747,5607, 635,4386,4747,5608,5609,5610,4387,5611,5612,4748,5613, # 4512 3415,4749,2437, 451,5614,3780,2542,2073,4388,2744,4389,4125,5615,1764,4750,5616, # 4528 4390, 350,4751,2283,2395,2493,5617,4391,4126,2249,1434,4127, 488,4752, 458,4392, # 4544 4128,3781, 771,1330,2396,3914,2576,3184,2160,2414,1553,2677,3185,4393,5618,2494, # 4560 2895,2622,1720,2711,4394,3416,4753,5619,2543,4395,5620,3262,4396,2778,5621,2016, # 4576 2745,5622,1155,1017,3782,3915,5623,3336,2313, 201,1865,4397,1430,5624,4129,5625, # 4592 5626,5627,5628,5629,4398,1604,5630, 414,1866, 371,2595,4754,4755,3532,2017,3127, # 4608 4756,1708, 960,4399, 887, 389,2172,1536,1663,1721,5631,2232,4130,2356,2940,1580, # 4624 5632,5633,1744,4757,2544,4758,4759,5634,4760,5635,2074,5636,4761,3647,3417,2896, # 4640 4400,5637,4401,2650,3418,2815, 673,2712,2465, 709,3533,4131,3648,4402,5638,1148, # 4656 502, 634,5639,5640,1204,4762,3649,1575,4763,2623,3783,5641,3784,3128, 948,3263, # 4672 121,1745,3916,1110,5642,4403,3083,2516,3027,4132,3785,1151,1771,3917,1488,4133, # 4688 1987,5643,2438,3534,5644,5645,2094,5646,4404,3918,1213,1407,2816, 531,2746,2545, # 4704 3264,1011,1537,4764,2779,4405,3129,1061,5647,3786,3787,1867,2897,5648,2018, 120, # 4720 4406,4407,2063,3650,3265,2314,3919,2678,3419,1955,4765,4134,5649,3535,1047,2713, # 4736 1266,5650,1368,4766,2858, 649,3420,3920,2546,2747,1102,2859,2679,5651,5652,2000, # 4752 5653,1111,3651,2977,5654,2495,3921,3652,2817,1855,3421,3788,5655,5656,3422,2415, # 4768 2898,3337,3266,3653,5657,2577,5658,3654,2818,4135,1460, 856,5659,3655,5660,2899, # 4784 2978,5661,2900,3922,5662,4408, 632,2517, 875,3923,1697,3924,2296,5663,5664,4767, # 4800 3028,1239, 580,4768,4409,5665, 914, 936,2075,1190,4136,1039,2124,5666,5667,5668, # 4816 5669,3423,1473,5670,1354,4410,3925,4769,2173,3084,4137, 915,3338,4411,4412,3339, # 4832 1605,1835,5671,2748, 398,3656,4413,3926,4138, 328,1913,2860,4139,3927,1331,4414, # 4848 3029, 937,4415,5672,3657,4140,4141,3424,2161,4770,3425, 524, 742, 538,3085,1012, # 4864 5673,5674,3928,2466,5675, 658,1103, 225,3929,5676,5677,4771,5678,4772,5679,3267, # 4880 1243,5680,4142, 963,2250,4773,5681,2714,3658,3186,5682,5683,2596,2332,5684,4774, # 4896 5685,5686,5687,3536, 957,3426,2547,2033,1931,2941,2467, 870,2019,3659,1746,2780, # 4912 2781,2439,2468,5688,3930,5689,3789,3130,3790,3537,3427,3791,5690,1179,3086,5691, # 4928 3187,2378,4416,3792,2548,3188,3131,2749,4143,5692,3428,1556,2549,2297, 977,2901, # 4944 2034,4144,1205,3429,5693,1765,3430,3189,2125,1271, 714,1689,4775,3538,5694,2333, # 4960 3931, 533,4417,3660,2184, 617,5695,2469,3340,3539,2315,5696,5697,3190,5698,5699, # 4976 3932,1988, 618, 427,2651,3540,3431,5700,5701,1244,1690,5702,2819,4418,4776,5703, # 4992 3541,4777,5704,2284,1576, 473,3661,4419,3432, 972,5705,3662,5706,3087,5707,5708, # 5008 4778,4779,5709,3793,4145,4146,5710, 153,4780, 356,5711,1892,2902,4420,2144, 408, # 5024 803,2357,5712,3933,5713,4421,1646,2578,2518,4781,4782,3934,5714,3935,4422,5715, # 5040 2416,3433, 752,5716,5717,1962,3341,2979,5718, 746,3030,2470,4783,4423,3794, 698, # 5056 4784,1893,4424,3663,2550,4785,3664,3936,5719,3191,3434,5720,1824,1302,4147,2715, # 5072 3937,1974,4425,5721,4426,3192, 823,1303,1288,1236,2861,3542,4148,3435, 774,3938, # 5088 5722,1581,4786,1304,2862,3939,4787,5723,2440,2162,1083,3268,4427,4149,4428, 344, # 5104 1173, 288,2316, 454,1683,5724,5725,1461,4788,4150,2597,5726,5727,4789, 985, 894, # 5120 5728,3436,3193,5729,1914,2942,3795,1989,5730,2111,1975,5731,4151,5732,2579,1194, # 5136 425,5733,4790,3194,1245,3796,4429,5734,5735,2863,5736, 636,4791,1856,3940, 760, # 5152 1800,5737,4430,2212,1508,4792,4152,1894,1684,2298,5738,5739,4793,4431,4432,2213, # 5168 479,5740,5741, 832,5742,4153,2496,5743,2980,2497,3797, 990,3132, 627,1815,2652, # 5184 4433,1582,4434,2126,2112,3543,4794,5744, 799,4435,3195,5745,4795,2113,1737,3031, # 5200 1018, 543, 754,4436,3342,1676,4796,4797,4154,4798,1489,5746,3544,5747,2624,2903, # 5216 4155,5748,5749,2981,5750,5751,5752,5753,3196,4799,4800,2185,1722,5754,3269,3270, # 5232 1843,3665,1715, 481, 365,1976,1857,5755,5756,1963,2498,4801,5757,2127,3666,3271, # 5248 433,1895,2064,2076,5758, 602,2750,5759,5760,5761,5762,5763,3032,1628,3437,5764, # 5264 3197,4802,4156,2904,4803,2519,5765,2551,2782,5766,5767,5768,3343,4804,2905,5769, # 5280 4805,5770,2864,4806,4807,1221,2982,4157,2520,5771,5772,5773,1868,1990,5774,5775, # 5296 5776,1896,5777,5778,4808,1897,4158, 318,5779,2095,4159,4437,5780,5781, 485,5782, # 5312 938,3941, 553,2680, 116,5783,3942,3667,5784,3545,2681,2783,3438,3344,2820,5785, # 5328 3668,2943,4160,1747,2944,2983,5786,5787, 207,5788,4809,5789,4810,2521,5790,3033, # 5344 890,3669,3943,5791,1878,3798,3439,5792,2186,2358,3440,1652,5793,5794,5795, 941, # 5360 2299, 208,3546,4161,2020, 330,4438,3944,2906,2499,3799,4439,4811,5796,5797,5798, # 5376 #last 512 #Everything below is of no interest for detection purpose 2522,1613,4812,5799,3345,3945,2523,5800,4162,5801,1637,4163,2471,4813,3946,5802, # 5392 2500,3034,3800,5803,5804,2195,4814,5805,2163,5806,5807,5808,5809,5810,5811,5812, # 5408 5813,5814,5815,5816,5817,5818,5819,5820,5821,5822,5823,5824,5825,5826,5827,5828, # 5424 5829,5830,5831,5832,5833,5834,5835,5836,5837,5838,5839,5840,5841,5842,5843,5844, # 5440 5845,5846,5847,5848,5849,5850,5851,5852,5853,5854,5855,5856,5857,5858,5859,5860, # 5456 5861,5862,5863,5864,5865,5866,5867,5868,5869,5870,5871,5872,5873,5874,5875,5876, # 5472 5877,5878,5879,5880,5881,5882,5883,5884,5885,5886,5887,5888,5889,5890,5891,5892, # 5488 5893,5894,5895,5896,5897,5898,5899,5900,5901,5902,5903,5904,5905,5906,5907,5908, # 5504 5909,5910,5911,5912,5913,5914,5915,5916,5917,5918,5919,5920,5921,5922,5923,5924, # 5520 5925,5926,5927,5928,5929,5930,5931,5932,5933,5934,5935,5936,5937,5938,5939,5940, # 5536 5941,5942,5943,5944,5945,5946,5947,5948,5949,5950,5951,5952,5953,5954,5955,5956, # 5552 5957,5958,5959,5960,5961,5962,5963,5964,5965,5966,5967,5968,5969,5970,5971,5972, # 5568 5973,5974,5975,5976,5977,5978,5979,5980,5981,5982,5983,5984,5985,5986,5987,5988, # 5584 5989,5990,5991,5992,5993,5994,5995,5996,5997,5998,5999,6000,6001,6002,6003,6004, # 5600 6005,6006,6007,6008,6009,6010,6011,6012,6013,6014,6015,6016,6017,6018,6019,6020, # 5616 6021,6022,6023,6024,6025,6026,6027,6028,6029,6030,6031,6032,6033,6034,6035,6036, # 5632 6037,6038,6039,6040,6041,6042,6043,6044,6045,6046,6047,6048,6049,6050,6051,6052, # 5648 6053,6054,6055,6056,6057,6058,6059,6060,6061,6062,6063,6064,6065,6066,6067,6068, # 5664 6069,6070,6071,6072,6073,6074,6075,6076,6077,6078,6079,6080,6081,6082,6083,6084, # 5680 6085,6086,6087,6088,6089,6090,6091,6092,6093,6094,6095,6096,6097,6098,6099,6100, # 5696 6101,6102,6103,6104,6105,6106,6107,6108,6109,6110,6111,6112,6113,6114,6115,6116, # 5712 6117,6118,6119,6120,6121,6122,6123,6124,6125,6126,6127,6128,6129,6130,6131,6132, # 5728 6133,6134,6135,6136,6137,6138,6139,6140,6141,6142,6143,6144,6145,6146,6147,6148, # 5744 6149,6150,6151,6152,6153,6154,6155,6156,6157,6158,6159,6160,6161,6162,6163,6164, # 5760 6165,6166,6167,6168,6169,6170,6171,6172,6173,6174,6175,6176,6177,6178,6179,6180, # 5776 6181,6182,6183,6184,6185,6186,6187,6188,6189,6190,6191,6192,6193,6194,6195,6196, # 5792 6197,6198,6199,6200,6201,6202,6203,6204,6205,6206,6207,6208,6209,6210,6211,6212, # 5808 6213,6214,6215,6216,6217,6218,6219,6220,6221,6222,6223,3670,6224,6225,6226,6227, # 5824 6228,6229,6230,6231,6232,6233,6234,6235,6236,6237,6238,6239,6240,6241,6242,6243, # 5840 6244,6245,6246,6247,6248,6249,6250,6251,6252,6253,6254,6255,6256,6257,6258,6259, # 5856 6260,6261,6262,6263,6264,6265,6266,6267,6268,6269,6270,6271,6272,6273,6274,6275, # 5872 6276,6277,6278,6279,6280,6281,6282,6283,6284,6285,4815,6286,6287,6288,6289,6290, # 5888 6291,6292,4816,6293,6294,6295,6296,6297,6298,6299,6300,6301,6302,6303,6304,6305, # 5904 6306,6307,6308,6309,6310,6311,4817,4818,6312,6313,6314,6315,6316,6317,6318,4819, # 5920 6319,6320,6321,6322,6323,6324,6325,6326,6327,6328,6329,6330,6331,6332,6333,6334, # 5936 6335,6336,6337,4820,6338,6339,6340,6341,6342,6343,6344,6345,6346,6347,6348,6349, # 5952 6350,6351,6352,6353,6354,6355,6356,6357,6358,6359,6360,6361,6362,6363,6364,6365, # 5968 6366,6367,6368,6369,6370,6371,6372,6373,6374,6375,6376,6377,6378,6379,6380,6381, # 5984 6382,6383,6384,6385,6386,6387,6388,6389,6390,6391,6392,6393,6394,6395,6396,6397, # 6000 6398,6399,6400,6401,6402,6403,6404,6405,6406,6407,6408,6409,6410,3441,6411,6412, # 6016 6413,6414,6415,6416,6417,6418,6419,6420,6421,6422,6423,6424,6425,4440,6426,6427, # 6032 6428,6429,6430,6431,6432,6433,6434,6435,6436,6437,6438,6439,6440,6441,6442,6443, # 6048 6444,6445,6446,6447,6448,6449,6450,6451,6452,6453,6454,4821,6455,6456,6457,6458, # 6064 6459,6460,6461,6462,6463,6464,6465,6466,6467,6468,6469,6470,6471,6472,6473,6474, # 6080 6475,6476,6477,3947,3948,6478,6479,6480,6481,3272,4441,6482,6483,6484,6485,4442, # 6096 6486,6487,6488,6489,6490,6491,6492,6493,6494,6495,6496,4822,6497,6498,6499,6500, # 6112 6501,6502,6503,6504,6505,6506,6507,6508,6509,6510,6511,6512,6513,6514,6515,6516, # 6128 6517,6518,6519,6520,6521,6522,6523,6524,6525,6526,6527,6528,6529,6530,6531,6532, # 6144 6533,6534,6535,6536,6537,6538,6539,6540,6541,6542,6543,6544,6545,6546,6547,6548, # 6160 6549,6550,6551,6552,6553,6554,6555,6556,2784,6557,4823,6558,6559,6560,6561,6562, # 6176 6563,6564,6565,6566,6567,6568,6569,3949,6570,6571,6572,4824,6573,6574,6575,6576, # 6192 6577,6578,6579,6580,6581,6582,6583,4825,6584,6585,6586,3950,2785,6587,6588,6589, # 6208 6590,6591,6592,6593,6594,6595,6596,6597,6598,6599,6600,6601,6602,6603,6604,6605, # 6224 6606,6607,6608,6609,6610,6611,6612,4826,6613,6614,6615,4827,6616,6617,6618,6619, # 6240 6620,6621,6622,6623,6624,6625,4164,6626,6627,6628,6629,6630,6631,6632,6633,6634, # 6256 3547,6635,4828,6636,6637,6638,6639,6640,6641,6642,3951,2984,6643,6644,6645,6646, # 6272 6647,6648,6649,4165,6650,4829,6651,6652,4830,6653,6654,6655,6656,6657,6658,6659, # 6288 6660,6661,6662,4831,6663,6664,6665,6666,6667,6668,6669,6670,6671,4166,6672,4832, # 6304 3952,6673,6674,6675,6676,4833,6677,6678,6679,4167,6680,6681,6682,3198,6683,6684, # 6320 6685,6686,6687,6688,6689,6690,6691,6692,6693,6694,6695,6696,6697,4834,6698,6699, # 6336 6700,6701,6702,6703,6704,6705,6706,6707,6708,6709,6710,6711,6712,6713,6714,6715, # 6352 6716,6717,6718,6719,6720,6721,6722,6723,6724,6725,6726,6727,6728,6729,6730,6731, # 6368 6732,6733,6734,4443,6735,6736,6737,6738,6739,6740,6741,6742,6743,6744,6745,4444, # 6384 6746,6747,6748,6749,6750,6751,6752,6753,6754,6755,6756,6757,6758,6759,6760,6761, # 6400 6762,6763,6764,6765,6766,6767,6768,6769,6770,6771,6772,6773,6774,6775,6776,6777, # 6416 6778,6779,6780,6781,4168,6782,6783,3442,6784,6785,6786,6787,6788,6789,6790,6791, # 6432 4169,6792,6793,6794,6795,6796,6797,6798,6799,6800,6801,6802,6803,6804,6805,6806, # 6448 6807,6808,6809,6810,6811,4835,6812,6813,6814,4445,6815,6816,4446,6817,6818,6819, # 6464 6820,6821,6822,6823,6824,6825,6826,6827,6828,6829,6830,6831,6832,6833,6834,6835, # 6480 3548,6836,6837,6838,6839,6840,6841,6842,6843,6844,6845,6846,4836,6847,6848,6849, # 6496 6850,6851,6852,6853,6854,3953,6855,6856,6857,6858,6859,6860,6861,6862,6863,6864, # 6512 6865,6866,6867,6868,6869,6870,6871,6872,6873,6874,6875,6876,6877,3199,6878,6879, # 6528 6880,6881,6882,4447,6883,6884,6885,6886,6887,6888,6889,6890,6891,6892,6893,6894, # 6544 6895,6896,6897,6898,6899,6900,6901,6902,6903,6904,4170,6905,6906,6907,6908,6909, # 6560 6910,6911,6912,6913,6914,6915,6916,6917,6918,6919,6920,6921,6922,6923,6924,6925, # 6576 6926,6927,4837,6928,6929,6930,6931,6932,6933,6934,6935,6936,3346,6937,6938,4838, # 6592 6939,6940,6941,4448,6942,6943,6944,6945,6946,4449,6947,6948,6949,6950,6951,6952, # 6608 6953,6954,6955,6956,6957,6958,6959,6960,6961,6962,6963,6964,6965,6966,6967,6968, # 6624 6969,6970,6971,6972,6973,6974,6975,6976,6977,6978,6979,6980,6981,6982,6983,6984, # 6640 6985,6986,6987,6988,6989,6990,6991,6992,6993,6994,3671,6995,6996,6997,6998,4839, # 6656 6999,7000,7001,7002,3549,7003,7004,7005,7006,7007,7008,7009,7010,7011,7012,7013, # 6672 7014,7015,7016,7017,7018,7019,7020,7021,7022,7023,7024,7025,7026,7027,7028,7029, # 6688 7030,4840,7031,7032,7033,7034,7035,7036,7037,7038,4841,7039,7040,7041,7042,7043, # 6704 7044,7045,7046,7047,7048,7049,7050,7051,7052,7053,7054,7055,7056,7057,7058,7059, # 6720 7060,7061,7062,7063,7064,7065,7066,7067,7068,7069,7070,2985,7071,7072,7073,7074, # 6736 7075,7076,7077,7078,7079,7080,4842,7081,7082,7083,7084,7085,7086,7087,7088,7089, # 6752 7090,7091,7092,7093,7094,7095,7096,7097,7098,7099,7100,7101,7102,7103,7104,7105, # 6768 7106,7107,7108,7109,7110,7111,7112,7113,7114,7115,7116,7117,7118,4450,7119,7120, # 6784 7121,7122,7123,7124,7125,7126,7127,7128,7129,7130,7131,7132,7133,7134,7135,7136, # 6800 7137,7138,7139,7140,7141,7142,7143,4843,7144,7145,7146,7147,7148,7149,7150,7151, # 6816 7152,7153,7154,7155,7156,7157,7158,7159,7160,7161,7162,7163,7164,7165,7166,7167, # 6832 7168,7169,7170,7171,7172,7173,7174,7175,7176,7177,7178,7179,7180,7181,7182,7183, # 6848 7184,7185,7186,7187,7188,4171,4172,7189,7190,7191,7192,7193,7194,7195,7196,7197, # 6864 7198,7199,7200,7201,7202,7203,7204,7205,7206,7207,7208,7209,7210,7211,7212,7213, # 6880 7214,7215,7216,7217,7218,7219,7220,7221,7222,7223,7224,7225,7226,7227,7228,7229, # 6896 7230,7231,7232,7233,7234,7235,7236,7237,7238,7239,7240,7241,7242,7243,7244,7245, # 6912 7246,7247,7248,7249,7250,7251,7252,7253,7254,7255,7256,7257,7258,7259,7260,7261, # 6928 7262,7263,7264,7265,7266,7267,7268,7269,7270,7271,7272,7273,7274,7275,7276,7277, # 6944 7278,7279,7280,7281,7282,7283,7284,7285,7286,7287,7288,7289,7290,7291,7292,7293, # 6960 7294,7295,7296,4844,7297,7298,7299,7300,7301,7302,7303,7304,7305,7306,7307,7308, # 6976 7309,7310,7311,7312,7313,7314,7315,7316,4451,7317,7318,7319,7320,7321,7322,7323, # 6992 7324,7325,7326,7327,7328,7329,7330,7331,7332,7333,7334,7335,7336,7337,7338,7339, # 7008 7340,7341,7342,7343,7344,7345,7346,7347,7348,7349,7350,7351,7352,7353,4173,7354, # 7024 7355,4845,7356,7357,7358,7359,7360,7361,7362,7363,7364,7365,7366,7367,7368,7369, # 7040 7370,7371,7372,7373,7374,7375,7376,7377,7378,7379,7380,7381,7382,7383,7384,7385, # 7056 7386,7387,7388,4846,7389,7390,7391,7392,7393,7394,7395,7396,7397,7398,7399,7400, # 7072 7401,7402,7403,7404,7405,3672,7406,7407,7408,7409,7410,7411,7412,7413,7414,7415, # 7088 7416,7417,7418,7419,7420,7421,7422,7423,7424,7425,7426,7427,7428,7429,7430,7431, # 7104 7432,7433,7434,7435,7436,7437,7438,7439,7440,7441,7442,7443,7444,7445,7446,7447, # 7120 7448,7449,7450,7451,7452,7453,4452,7454,3200,7455,7456,7457,7458,7459,7460,7461, # 7136 7462,7463,7464,7465,7466,7467,7468,7469,7470,7471,7472,7473,7474,4847,7475,7476, # 7152 7477,3133,7478,7479,7480,7481,7482,7483,7484,7485,7486,7487,7488,7489,7490,7491, # 7168 7492,7493,7494,7495,7496,7497,7498,7499,7500,7501,7502,3347,7503,7504,7505,7506, # 7184 7507,7508,7509,7510,7511,7512,7513,7514,7515,7516,7517,7518,7519,7520,7521,4848, # 7200 7522,7523,7524,7525,7526,7527,7528,7529,7530,7531,7532,7533,7534,7535,7536,7537, # 7216 7538,7539,7540,7541,7542,7543,7544,7545,7546,7547,7548,7549,3801,4849,7550,7551, # 7232 7552,7553,7554,7555,7556,7557,7558,7559,7560,7561,7562,7563,7564,7565,7566,7567, # 7248 7568,7569,3035,7570,7571,7572,7573,7574,7575,7576,7577,7578,7579,7580,7581,7582, # 7264 7583,7584,7585,7586,7587,7588,7589,7590,7591,7592,7593,7594,7595,7596,7597,7598, # 7280 7599,7600,7601,7602,7603,7604,7605,7606,7607,7608,7609,7610,7611,7612,7613,7614, # 7296 7615,7616,4850,7617,7618,3802,7619,7620,7621,7622,7623,7624,7625,7626,7627,7628, # 7312 7629,7630,7631,7632,4851,7633,7634,7635,7636,7637,7638,7639,7640,7641,7642,7643, # 7328 7644,7645,7646,7647,7648,7649,7650,7651,7652,7653,7654,7655,7656,7657,7658,7659, # 7344 7660,7661,7662,7663,7664,7665,7666,7667,7668,7669,7670,4453,7671,7672,7673,7674, # 7360 7675,7676,7677,7678,7679,7680,7681,7682,7683,7684,7685,7686,7687,7688,7689,7690, # 7376 7691,7692,7693,7694,7695,7696,7697,3443,7698,7699,7700,7701,7702,4454,7703,7704, # 7392 7705,7706,7707,7708,7709,7710,7711,7712,7713,2472,7714,7715,7716,7717,7718,7719, # 7408 7720,7721,7722,7723,7724,7725,7726,7727,7728,7729,7730,7731,3954,7732,7733,7734, # 7424 7735,7736,7737,7738,7739,7740,7741,7742,7743,7744,7745,7746,7747,7748,7749,7750, # 7440 3134,7751,7752,4852,7753,7754,7755,4853,7756,7757,7758,7759,7760,4174,7761,7762, # 7456 7763,7764,7765,7766,7767,7768,7769,7770,7771,7772,7773,7774,7775,7776,7777,7778, # 7472 7779,7780,7781,7782,7783,7784,7785,7786,7787,7788,7789,7790,7791,7792,7793,7794, # 7488 7795,7796,7797,7798,7799,7800,7801,7802,7803,7804,7805,4854,7806,7807,7808,7809, # 7504 7810,7811,7812,7813,7814,7815,7816,7817,7818,7819,7820,7821,7822,7823,7824,7825, # 7520 4855,7826,7827,7828,7829,7830,7831,7832,7833,7834,7835,7836,7837,7838,7839,7840, # 7536 7841,7842,7843,7844,7845,7846,7847,3955,7848,7849,7850,7851,7852,7853,7854,7855, # 7552 7856,7857,7858,7859,7860,3444,7861,7862,7863,7864,7865,7866,7867,7868,7869,7870, # 7568 7871,7872,7873,7874,7875,7876,7877,7878,7879,7880,7881,7882,7883,7884,7885,7886, # 7584 7887,7888,7889,7890,7891,4175,7892,7893,7894,7895,7896,4856,4857,7897,7898,7899, # 7600 7900,2598,7901,7902,7903,7904,7905,7906,7907,7908,4455,7909,7910,7911,7912,7913, # 7616 7914,3201,7915,7916,7917,7918,7919,7920,7921,4858,7922,7923,7924,7925,7926,7927, # 7632 7928,7929,7930,7931,7932,7933,7934,7935,7936,7937,7938,7939,7940,7941,7942,7943, # 7648 7944,7945,7946,7947,7948,7949,7950,7951,7952,7953,7954,7955,7956,7957,7958,7959, # 7664 7960,7961,7962,7963,7964,7965,7966,7967,7968,7969,7970,7971,7972,7973,7974,7975, # 7680 7976,7977,7978,7979,7980,7981,4859,7982,7983,7984,7985,7986,7987,7988,7989,7990, # 7696 7991,7992,7993,7994,7995,7996,4860,7997,7998,7999,8000,8001,8002,8003,8004,8005, # 7712 8006,8007,8008,8009,8010,8011,8012,8013,8014,8015,8016,4176,8017,8018,8019,8020, # 7728 8021,8022,8023,4861,8024,8025,8026,8027,8028,8029,8030,8031,8032,8033,8034,8035, # 7744 8036,4862,4456,8037,8038,8039,8040,4863,8041,8042,8043,8044,8045,8046,8047,8048, # 7760 8049,8050,8051,8052,8053,8054,8055,8056,8057,8058,8059,8060,8061,8062,8063,8064, # 7776 8065,8066,8067,8068,8069,8070,8071,8072,8073,8074,8075,8076,8077,8078,8079,8080, # 7792 8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095,8096, # 7808 8097,8098,8099,4864,4177,8100,8101,8102,8103,8104,8105,8106,8107,8108,8109,8110, # 7824 8111,8112,8113,8114,8115,8116,8117,8118,8119,8120,4178,8121,8122,8123,8124,8125, # 7840 8126,8127,8128,8129,8130,8131,8132,8133,8134,8135,8136,8137,8138,8139,8140,8141, # 7856 8142,8143,8144,8145,4865,4866,8146,8147,8148,8149,8150,8151,8152,8153,8154,8155, # 7872 8156,8157,8158,8159,8160,8161,8162,8163,8164,8165,4179,8166,8167,8168,8169,8170, # 7888 8171,8172,8173,8174,8175,8176,8177,8178,8179,8180,8181,4457,8182,8183,8184,8185, # 7904 8186,8187,8188,8189,8190,8191,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201, # 7920 8202,8203,8204,8205,8206,8207,8208,8209,8210,8211,8212,8213,8214,8215,8216,8217, # 7936 8218,8219,8220,8221,8222,8223,8224,8225,8226,8227,8228,8229,8230,8231,8232,8233, # 7952 8234,8235,8236,8237,8238,8239,8240,8241,8242,8243,8244,8245,8246,8247,8248,8249, # 7968 8250,8251,8252,8253,8254,8255,8256,3445,8257,8258,8259,8260,8261,8262,4458,8263, # 7984 8264,8265,8266,8267,8268,8269,8270,8271,8272,4459,8273,8274,8275,8276,3550,8277, # 8000 8278,8279,8280,8281,8282,8283,8284,8285,8286,8287,8288,8289,4460,8290,8291,8292, # 8016 8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,8304,8305,8306,8307,4867, # 8032 8308,8309,8310,8311,8312,3551,8313,8314,8315,8316,8317,8318,8319,8320,8321,8322, # 8048 8323,8324,8325,8326,4868,8327,8328,8329,8330,8331,8332,8333,8334,8335,8336,8337, # 8064 8338,8339,8340,8341,8342,8343,8344,8345,8346,8347,8348,8349,8350,8351,8352,8353, # 8080 8354,8355,8356,8357,8358,8359,8360,8361,8362,8363,4869,4461,8364,8365,8366,8367, # 8096 8368,8369,8370,4870,8371,8372,8373,8374,8375,8376,8377,8378,8379,8380,8381,8382, # 8112 8383,8384,8385,8386,8387,8388,8389,8390,8391,8392,8393,8394,8395,8396,8397,8398, # 8128 8399,8400,8401,8402,8403,8404,8405,8406,8407,8408,8409,8410,4871,8411,8412,8413, # 8144 8414,8415,8416,8417,8418,8419,8420,8421,8422,4462,8423,8424,8425,8426,8427,8428, # 8160 8429,8430,8431,8432,8433,2986,8434,8435,8436,8437,8438,8439,8440,8441,8442,8443, # 8176 8444,8445,8446,8447,8448,8449,8450,8451,8452,8453,8454,8455,8456,8457,8458,8459, # 8192 8460,8461,8462,8463,8464,8465,8466,8467,8468,8469,8470,8471,8472,8473,8474,8475, # 8208 8476,8477,8478,4180,8479,8480,8481,8482,8483,8484,8485,8486,8487,8488,8489,8490, # 8224 8491,8492,8493,8494,8495,8496,8497,8498,8499,8500,8501,8502,8503,8504,8505,8506, # 8240 8507,8508,8509,8510,8511,8512,8513,8514,8515,8516,8517,8518,8519,8520,8521,8522, # 8256 8523,8524,8525,8526,8527,8528,8529,8530,8531,8532,8533,8534,8535,8536,8537,8538, # 8272 8539,8540,8541,8542,8543,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,8554, # 8288 8555,8556,8557,8558,8559,8560,8561,8562,8563,8564,4872,8565,8566,8567,8568,8569, # 8304 8570,8571,8572,8573,4873,8574,8575,8576,8577,8578,8579,8580,8581,8582,8583,8584, # 8320 8585,8586,8587,8588,8589,8590,8591,8592,8593,8594,8595,8596,8597,8598,8599,8600, # 8336 8601,8602,8603,8604,8605,3803,8606,8607,8608,8609,8610,8611,8612,8613,4874,3804, # 8352 8614,8615,8616,8617,8618,8619,8620,8621,3956,8622,8623,8624,8625,8626,8627,8628, # 8368 8629,8630,8631,8632,8633,8634,8635,8636,8637,8638,2865,8639,8640,8641,8642,8643, # 8384 8644,8645,8646,8647,8648,8649,8650,8651,8652,8653,8654,8655,8656,4463,8657,8658, # 8400 8659,4875,4876,8660,8661,8662,8663,8664,8665,8666,8667,8668,8669,8670,8671,8672, # 8416 8673,8674,8675,8676,8677,8678,8679,8680,8681,4464,8682,8683,8684,8685,8686,8687, # 8432 8688,8689,8690,8691,8692,8693,8694,8695,8696,8697,8698,8699,8700,8701,8702,8703, # 8448 8704,8705,8706,8707,8708,8709,2261,8710,8711,8712,8713,8714,8715,8716,8717,8718, # 8464 8719,8720,8721,8722,8723,8724,8725,8726,8727,8728,8729,8730,8731,8732,8733,4181, # 8480 8734,8735,8736,8737,8738,8739,8740,8741,8742,8743,8744,8745,8746,8747,8748,8749, # 8496 8750,8751,8752,8753,8754,8755,8756,8757,8758,8759,8760,8761,8762,8763,4877,8764, # 8512 8765,8766,8767,8768,8769,8770,8771,8772,8773,8774,8775,8776,8777,8778,8779,8780, # 8528 8781,8782,8783,8784,8785,8786,8787,8788,4878,8789,4879,8790,8791,8792,4880,8793, # 8544 8794,8795,8796,8797,8798,8799,8800,8801,4881,8802,8803,8804,8805,8806,8807,8808, # 8560 8809,8810,8811,8812,8813,8814,8815,3957,8816,8817,8818,8819,8820,8821,8822,8823, # 8576 8824,8825,8826,8827,8828,8829,8830,8831,8832,8833,8834,8835,8836,8837,8838,8839, # 8592 8840,8841,8842,8843,8844,8845,8846,8847,4882,8848,8849,8850,8851,8852,8853,8854, # 8608 8855,8856,8857,8858,8859,8860,8861,8862,8863,8864,8865,8866,8867,8868,8869,8870, # 8624 8871,8872,8873,8874,8875,8876,8877,8878,8879,8880,8881,8882,8883,8884,3202,8885, # 8640 8886,8887,8888,8889,8890,8891,8892,8893,8894,8895,8896,8897,8898,8899,8900,8901, # 8656 8902,8903,8904,8905,8906,8907,8908,8909,8910,8911,8912,8913,8914,8915,8916,8917, # 8672 8918,8919,8920,8921,8922,8923,8924,4465,8925,8926,8927,8928,8929,8930,8931,8932, # 8688 4883,8933,8934,8935,8936,8937,8938,8939,8940,8941,8942,8943,2214,8944,8945,8946, # 8704 8947,8948,8949,8950,8951,8952,8953,8954,8955,8956,8957,8958,8959,8960,8961,8962, # 8720 8963,8964,8965,4884,8966,8967,8968,8969,8970,8971,8972,8973,8974,8975,8976,8977, # 8736 8978,8979,8980,8981,8982,8983,8984,8985,8986,8987,8988,8989,8990,8991,8992,4885, # 8752 8993,8994,8995,8996,8997,8998,8999,9000,9001,9002,9003,9004,9005,9006,9007,9008, # 8768 9009,9010,9011,9012,9013,9014,9015,9016,9017,9018,9019,9020,9021,4182,9022,9023, # 8784 9024,9025,9026,9027,9028,9029,9030,9031,9032,9033,9034,9035,9036,9037,9038,9039, # 8800 9040,9041,9042,9043,9044,9045,9046,9047,9048,9049,9050,9051,9052,9053,9054,9055, # 8816 9056,9057,9058,9059,9060,9061,9062,9063,4886,9064,9065,9066,9067,9068,9069,4887, # 8832 9070,9071,9072,9073,9074,9075,9076,9077,9078,9079,9080,9081,9082,9083,9084,9085, # 8848 9086,9087,9088,9089,9090,9091,9092,9093,9094,9095,9096,9097,9098,9099,9100,9101, # 8864 9102,9103,9104,9105,9106,9107,9108,9109,9110,9111,9112,9113,9114,9115,9116,9117, # 8880 9118,9119,9120,9121,9122,9123,9124,9125,9126,9127,9128,9129,9130,9131,9132,9133, # 8896 9134,9135,9136,9137,9138,9139,9140,9141,3958,9142,9143,9144,9145,9146,9147,9148, # 8912 9149,9150,9151,4888,9152,9153,9154,9155,9156,9157,9158,9159,9160,9161,9162,9163, # 8928 9164,9165,9166,9167,9168,9169,9170,9171,9172,9173,9174,9175,4889,9176,9177,9178, # 8944 9179,9180,9181,9182,9183,9184,9185,9186,9187,9188,9189,9190,9191,9192,9193,9194, # 8960 9195,9196,9197,9198,9199,9200,9201,9202,9203,4890,9204,9205,9206,9207,9208,9209, # 8976 9210,9211,9212,9213,9214,9215,9216,9217,9218,9219,9220,9221,9222,4466,9223,9224, # 8992 9225,9226,9227,9228,9229,9230,9231,9232,9233,9234,9235,9236,9237,9238,9239,9240, # 9008 9241,9242,9243,9244,9245,4891,9246,9247,9248,9249,9250,9251,9252,9253,9254,9255, # 9024 9256,9257,4892,9258,9259,9260,9261,4893,4894,9262,9263,9264,9265,9266,9267,9268, # 9040 9269,9270,9271,9272,9273,4467,9274,9275,9276,9277,9278,9279,9280,9281,9282,9283, # 9056 9284,9285,3673,9286,9287,9288,9289,9290,9291,9292,9293,9294,9295,9296,9297,9298, # 9072 9299,9300,9301,9302,9303,9304,9305,9306,9307,9308,9309,9310,9311,9312,9313,9314, # 9088 9315,9316,9317,9318,9319,9320,9321,9322,4895,9323,9324,9325,9326,9327,9328,9329, # 9104 9330,9331,9332,9333,9334,9335,9336,9337,9338,9339,9340,9341,9342,9343,9344,9345, # 9120 9346,9347,4468,9348,9349,9350,9351,9352,9353,9354,9355,9356,9357,9358,9359,9360, # 9136 9361,9362,9363,9364,9365,9366,9367,9368,9369,9370,9371,9372,9373,4896,9374,4469, # 9152 9375,9376,9377,9378,9379,4897,9380,9381,9382,9383,9384,9385,9386,9387,9388,9389, # 9168 9390,9391,9392,9393,9394,9395,9396,9397,9398,9399,9400,9401,9402,9403,9404,9405, # 9184 9406,4470,9407,2751,9408,9409,3674,3552,9410,9411,9412,9413,9414,9415,9416,9417, # 9200 9418,9419,9420,9421,4898,9422,9423,9424,9425,9426,9427,9428,9429,3959,9430,9431, # 9216 9432,9433,9434,9435,9436,4471,9437,9438,9439,9440,9441,9442,9443,9444,9445,9446, # 9232 9447,9448,9449,9450,3348,9451,9452,9453,9454,9455,9456,9457,9458,9459,9460,9461, # 9248 9462,9463,9464,9465,9466,9467,9468,9469,9470,9471,9472,4899,9473,9474,9475,9476, # 9264 9477,4900,9478,9479,9480,9481,9482,9483,9484,9485,9486,9487,9488,3349,9489,9490, # 9280 9491,9492,9493,9494,9495,9496,9497,9498,9499,9500,9501,9502,9503,9504,9505,9506, # 9296 9507,9508,9509,9510,9511,9512,9513,9514,9515,9516,9517,9518,9519,9520,4901,9521, # 9312 9522,9523,9524,9525,9526,4902,9527,9528,9529,9530,9531,9532,9533,9534,9535,9536, # 9328 9537,9538,9539,9540,9541,9542,9543,9544,9545,9546,9547,9548,9549,9550,9551,9552, # 9344 9553,9554,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568, # 9360 9569,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,9581,9582,9583,9584, # 9376 3805,9585,9586,9587,9588,9589,9590,9591,9592,9593,9594,9595,9596,9597,9598,9599, # 9392 9600,9601,9602,4903,9603,9604,9605,9606,9607,4904,9608,9609,9610,9611,9612,9613, # 9408 9614,4905,9615,9616,9617,9618,9619,9620,9621,9622,9623,9624,9625,9626,9627,9628, # 9424 9629,9630,9631,9632,4906,9633,9634,9635,9636,9637,9638,9639,9640,9641,9642,9643, # 9440 4907,9644,9645,9646,9647,9648,9649,9650,9651,9652,9653,9654,9655,9656,9657,9658, # 9456 9659,9660,9661,9662,9663,9664,9665,9666,9667,9668,9669,9670,9671,9672,4183,9673, # 9472 9674,9675,9676,9677,4908,9678,9679,9680,9681,4909,9682,9683,9684,9685,9686,9687, # 9488 9688,9689,9690,4910,9691,9692,9693,3675,9694,9695,9696,2945,9697,9698,9699,9700, # 9504 9701,9702,9703,9704,9705,4911,9706,9707,9708,9709,9710,9711,9712,9713,9714,9715, # 9520 9716,9717,9718,9719,9720,9721,9722,9723,9724,9725,9726,9727,9728,9729,9730,9731, # 9536 9732,9733,9734,9735,4912,9736,9737,9738,9739,9740,4913,9741,9742,9743,9744,9745, # 9552 9746,9747,9748,9749,9750,9751,9752,9753,9754,9755,9756,9757,9758,4914,9759,9760, # 9568 9761,9762,9763,9764,9765,9766,9767,9768,9769,9770,9771,9772,9773,9774,9775,9776, # 9584 9777,9778,9779,9780,9781,9782,4915,9783,9784,9785,9786,9787,9788,9789,9790,9791, # 9600 9792,9793,4916,9794,9795,9796,9797,9798,9799,9800,9801,9802,9803,9804,9805,9806, # 9616 9807,9808,9809,9810,9811,9812,9813,9814,9815,9816,9817,9818,9819,9820,9821,9822, # 9632 9823,9824,9825,9826,9827,9828,9829,9830,9831,9832,9833,9834,9835,9836,9837,9838, # 9648 9839,9840,9841,9842,9843,9844,9845,9846,9847,9848,9849,9850,9851,9852,9853,9854, # 9664 9855,9856,9857,9858,9859,9860,9861,9862,9863,9864,9865,9866,9867,9868,4917,9869, # 9680 9870,9871,9872,9873,9874,9875,9876,9877,9878,9879,9880,9881,9882,9883,9884,9885, # 9696 9886,9887,9888,9889,9890,9891,9892,4472,9893,9894,9895,9896,9897,3806,9898,9899, # 9712 9900,9901,9902,9903,9904,9905,9906,9907,9908,9909,9910,9911,9912,9913,9914,4918, # 9728 9915,9916,9917,4919,9918,9919,9920,9921,4184,9922,9923,9924,9925,9926,9927,9928, # 9744 9929,9930,9931,9932,9933,9934,9935,9936,9937,9938,9939,9940,9941,9942,9943,9944, # 9760 9945,9946,4920,9947,9948,9949,9950,9951,9952,9953,9954,9955,4185,9956,9957,9958, # 9776 9959,9960,9961,9962,9963,9964,9965,4921,9966,9967,9968,4473,9969,9970,9971,9972, # 9792 9973,9974,9975,9976,9977,4474,9978,9979,9980,9981,9982,9983,9984,9985,9986,9987, # 9808 9988,9989,9990,9991,9992,9993,9994,9995,9996,9997,9998,9999,10000,10001,10002,10003, # 9824 10004,10005,10006,10007,10008,10009,10010,10011,10012,10013,10014,10015,10016,10017,10018,10019, # 9840 10020,10021,4922,10022,4923,10023,10024,10025,10026,10027,10028,10029,10030,10031,10032,10033, # 9856 10034,10035,10036,10037,10038,10039,10040,10041,10042,10043,10044,10045,10046,10047,10048,4924, # 9872 10049,10050,10051,10052,10053,10054,10055,10056,10057,10058,10059,10060,10061,10062,10063,10064, # 9888 10065,10066,10067,10068,10069,10070,10071,10072,10073,10074,10075,10076,10077,10078,10079,10080, # 9904 10081,10082,10083,10084,10085,10086,10087,4475,10088,10089,10090,10091,10092,10093,10094,10095, # 9920 10096,10097,4476,10098,10099,10100,10101,10102,10103,10104,10105,10106,10107,10108,10109,10110, # 9936 10111,2174,10112,10113,10114,10115,10116,10117,10118,10119,10120,10121,10122,10123,10124,10125, # 9952 10126,10127,10128,10129,10130,10131,10132,10133,10134,10135,10136,10137,10138,10139,10140,3807, # 9968 4186,4925,10141,10142,10143,10144,10145,10146,10147,4477,4187,10148,10149,10150,10151,10152, # 9984 10153,4188,10154,10155,10156,10157,10158,10159,10160,10161,4926,10162,10163,10164,10165,10166, #10000 10167,10168,10169,10170,10171,10172,10173,10174,10175,10176,10177,10178,10179,10180,10181,10182, #10016 10183,10184,10185,10186,10187,10188,10189,10190,10191,10192,3203,10193,10194,10195,10196,10197, #10032 10198,10199,10200,4478,10201,10202,10203,10204,4479,10205,10206,10207,10208,10209,10210,10211, #10048 10212,10213,10214,10215,10216,10217,10218,10219,10220,10221,10222,10223,10224,10225,10226,10227, #10064 10228,10229,10230,10231,10232,10233,10234,4927,10235,10236,10237,10238,10239,10240,10241,10242, #10080 10243,10244,10245,10246,10247,10248,10249,10250,10251,10252,10253,10254,10255,10256,10257,10258, #10096 10259,10260,10261,10262,10263,10264,10265,10266,10267,10268,10269,10270,10271,10272,10273,4480, #10112 4928,4929,10274,10275,10276,10277,10278,10279,10280,10281,10282,10283,10284,10285,10286,10287, #10128 10288,10289,10290,10291,10292,10293,10294,10295,10296,10297,10298,10299,10300,10301,10302,10303, #10144 10304,10305,10306,10307,10308,10309,10310,10311,10312,10313,10314,10315,10316,10317,10318,10319, #10160 10320,10321,10322,10323,10324,10325,10326,10327,10328,10329,10330,10331,10332,10333,10334,4930, #10176 10335,10336,10337,10338,10339,10340,10341,10342,4931,10343,10344,10345,10346,10347,10348,10349, #10192 10350,10351,10352,10353,10354,10355,3088,10356,2786,10357,10358,10359,10360,4189,10361,10362, #10208 10363,10364,10365,10366,10367,10368,10369,10370,10371,10372,10373,10374,10375,4932,10376,10377, #10224 10378,10379,10380,10381,10382,10383,10384,10385,10386,10387,10388,10389,10390,10391,10392,4933, #10240 10393,10394,10395,4934,10396,10397,10398,10399,10400,10401,10402,10403,10404,10405,10406,10407, #10256 10408,10409,10410,10411,10412,3446,10413,10414,10415,10416,10417,10418,10419,10420,10421,10422, #10272 10423,4935,10424,10425,10426,10427,10428,10429,10430,4936,10431,10432,10433,10434,10435,10436, #10288 10437,10438,10439,10440,10441,10442,10443,4937,10444,10445,10446,10447,4481,10448,10449,10450, #10304 10451,10452,10453,10454,10455,10456,10457,10458,10459,10460,10461,10462,10463,10464,10465,10466, #10320 10467,10468,10469,10470,10471,10472,10473,10474,10475,10476,10477,10478,10479,10480,10481,10482, #10336 10483,10484,10485,10486,10487,10488,10489,10490,10491,10492,10493,10494,10495,10496,10497,10498, #10352 10499,10500,10501,10502,10503,10504,10505,4938,10506,10507,10508,10509,10510,2552,10511,10512, #10368 10513,10514,10515,10516,3447,10517,10518,10519,10520,10521,10522,10523,10524,10525,10526,10527, #10384 10528,10529,10530,10531,10532,10533,10534,10535,10536,10537,10538,10539,10540,10541,10542,10543, #10400 4482,10544,4939,10545,10546,10547,10548,10549,10550,10551,10552,10553,10554,10555,10556,10557, #10416 10558,10559,10560,10561,10562,10563,10564,10565,10566,10567,3676,4483,10568,10569,10570,10571, #10432 10572,3448,10573,10574,10575,10576,10577,10578,10579,10580,10581,10582,10583,10584,10585,10586, #10448 10587,10588,10589,10590,10591,10592,10593,10594,10595,10596,10597,10598,10599,10600,10601,10602, #10464 10603,10604,10605,10606,10607,10608,10609,10610,10611,10612,10613,10614,10615,10616,10617,10618, #10480 10619,10620,10621,10622,10623,10624,10625,10626,10627,4484,10628,10629,10630,10631,10632,4940, #10496 10633,10634,10635,10636,10637,10638,10639,10640,10641,10642,10643,10644,10645,10646,10647,10648, #10512 10649,10650,10651,10652,10653,10654,10655,10656,4941,10657,10658,10659,2599,10660,10661,10662, #10528 10663,10664,10665,10666,3089,10667,10668,10669,10670,10671,10672,10673,10674,10675,10676,10677, #10544 10678,10679,10680,4942,10681,10682,10683,10684,10685,10686,10687,10688,10689,10690,10691,10692, #10560 10693,10694,10695,10696,10697,4485,10698,10699,10700,10701,10702,10703,10704,4943,10705,3677, #10576 10706,10707,10708,10709,10710,10711,10712,4944,10713,10714,10715,10716,10717,10718,10719,10720, #10592 10721,10722,10723,10724,10725,10726,10727,10728,4945,10729,10730,10731,10732,10733,10734,10735, #10608 10736,10737,10738,10739,10740,10741,10742,10743,10744,10745,10746,10747,10748,10749,10750,10751, #10624 10752,10753,10754,10755,10756,10757,10758,10759,10760,10761,4946,10762,10763,10764,10765,10766, #10640 10767,4947,4948,10768,10769,10770,10771,10772,10773,10774,10775,10776,10777,10778,10779,10780, #10656 10781,10782,10783,10784,10785,10786,10787,10788,10789,10790,10791,10792,10793,10794,10795,10796, #10672 10797,10798,10799,10800,10801,10802,10803,10804,10805,10806,10807,10808,10809,10810,10811,10812, #10688 10813,10814,10815,10816,10817,10818,10819,10820,10821,10822,10823,10824,10825,10826,10827,10828, #10704 10829,10830,10831,10832,10833,10834,10835,10836,10837,10838,10839,10840,10841,10842,10843,10844, #10720 10845,10846,10847,10848,10849,10850,10851,10852,10853,10854,10855,10856,10857,10858,10859,10860, #10736 10861,10862,10863,10864,10865,10866,10867,10868,10869,10870,10871,10872,10873,10874,10875,10876, #10752 10877,10878,4486,10879,10880,10881,10882,10883,10884,10885,4949,10886,10887,10888,10889,10890, #10768 10891,10892,10893,10894,10895,10896,10897,10898,10899,10900,10901,10902,10903,10904,10905,10906, #10784 10907,10908,10909,10910,10911,10912,10913,10914,10915,10916,10917,10918,10919,4487,10920,10921, #10800 10922,10923,10924,10925,10926,10927,10928,10929,10930,10931,10932,4950,10933,10934,10935,10936, #10816 10937,10938,10939,10940,10941,10942,10943,10944,10945,10946,10947,10948,10949,4488,10950,10951, #10832 10952,10953,10954,10955,10956,10957,10958,10959,4190,10960,10961,10962,10963,10964,10965,10966, #10848 10967,10968,10969,10970,10971,10972,10973,10974,10975,10976,10977,10978,10979,10980,10981,10982, #10864 10983,10984,10985,10986,10987,10988,10989,10990,10991,10992,10993,10994,10995,10996,10997,10998, #10880 10999,11000,11001,11002,11003,11004,11005,11006,3960,11007,11008,11009,11010,11011,11012,11013, #10896 11014,11015,11016,11017,11018,11019,11020,11021,11022,11023,11024,11025,11026,11027,11028,11029, #10912 11030,11031,11032,4951,11033,11034,11035,11036,11037,11038,11039,11040,11041,11042,11043,11044, #10928 11045,11046,11047,4489,11048,11049,11050,11051,4952,11052,11053,11054,11055,11056,11057,11058, #10944 4953,11059,11060,11061,11062,11063,11064,11065,11066,11067,11068,11069,11070,11071,4954,11072, #10960 11073,11074,11075,11076,11077,11078,11079,11080,11081,11082,11083,11084,11085,11086,11087,11088, #10976 11089,11090,11091,11092,11093,11094,11095,11096,11097,11098,11099,11100,11101,11102,11103,11104, #10992 11105,11106,11107,11108,11109,11110,11111,11112,11113,11114,11115,3808,11116,11117,11118,11119, #11008 11120,11121,11122,11123,11124,11125,11126,11127,11128,11129,11130,11131,11132,11133,11134,4955, #11024 11135,11136,11137,11138,11139,11140,11141,11142,11143,11144,11145,11146,11147,11148,11149,11150, #11040 11151,11152,11153,11154,11155,11156,11157,11158,11159,11160,11161,4956,11162,11163,11164,11165, #11056 11166,11167,11168,11169,11170,11171,11172,11173,11174,11175,11176,11177,11178,11179,11180,4957, #11072 11181,11182,11183,11184,11185,11186,4958,11187,11188,11189,11190,11191,11192,11193,11194,11195, #11088 11196,11197,11198,11199,11200,3678,11201,11202,11203,11204,11205,11206,4191,11207,11208,11209, #11104 11210,11211,11212,11213,11214,11215,11216,11217,11218,11219,11220,11221,11222,11223,11224,11225, #11120 11226,11227,11228,11229,11230,11231,11232,11233,11234,11235,11236,11237,11238,11239,11240,11241, #11136 11242,11243,11244,11245,11246,11247,11248,11249,11250,11251,4959,11252,11253,11254,11255,11256, #11152 11257,11258,11259,11260,11261,11262,11263,11264,11265,11266,11267,11268,11269,11270,11271,11272, #11168 11273,11274,11275,11276,11277,11278,11279,11280,11281,11282,11283,11284,11285,11286,11287,11288, #11184 11289,11290,11291,11292,11293,11294,11295,11296,11297,11298,11299,11300,11301,11302,11303,11304, #11200 11305,11306,11307,11308,11309,11310,11311,11312,11313,11314,3679,11315,11316,11317,11318,4490, #11216 11319,11320,11321,11322,11323,11324,11325,11326,11327,11328,11329,11330,11331,11332,11333,11334, #11232 11335,11336,11337,11338,11339,11340,11341,11342,11343,11344,11345,11346,11347,4960,11348,11349, #11248 11350,11351,11352,11353,11354,11355,11356,11357,11358,11359,11360,11361,11362,11363,11364,11365, #11264 11366,11367,11368,11369,11370,11371,11372,11373,11374,11375,11376,11377,3961,4961,11378,11379, #11280 11380,11381,11382,11383,11384,11385,11386,11387,11388,11389,11390,11391,11392,11393,11394,11395, #11296 11396,11397,4192,11398,11399,11400,11401,11402,11403,11404,11405,11406,11407,11408,11409,11410, #11312 11411,4962,11412,11413,11414,11415,11416,11417,11418,11419,11420,11421,11422,11423,11424,11425, #11328 11426,11427,11428,11429,11430,11431,11432,11433,11434,11435,11436,11437,11438,11439,11440,11441, #11344 11442,11443,11444,11445,11446,11447,11448,11449,11450,11451,11452,11453,11454,11455,11456,11457, #11360 11458,11459,11460,11461,11462,11463,11464,11465,11466,11467,11468,11469,4963,11470,11471,4491, #11376 11472,11473,11474,11475,4964,11476,11477,11478,11479,11480,11481,11482,11483,11484,11485,11486, #11392 11487,11488,11489,11490,11491,11492,4965,11493,11494,11495,11496,11497,11498,11499,11500,11501, #11408 11502,11503,11504,11505,11506,11507,11508,11509,11510,11511,11512,11513,11514,11515,11516,11517, #11424 11518,11519,11520,11521,11522,11523,11524,11525,11526,11527,11528,11529,3962,11530,11531,11532, #11440 11533,11534,11535,11536,11537,11538,11539,11540,11541,11542,11543,11544,11545,11546,11547,11548, #11456 11549,11550,11551,11552,11553,11554,11555,11556,11557,11558,11559,11560,11561,11562,11563,11564, #11472 4193,4194,11565,11566,11567,11568,11569,11570,11571,11572,11573,11574,11575,11576,11577,11578, #11488 11579,11580,11581,11582,11583,11584,11585,11586,11587,11588,11589,11590,11591,4966,4195,11592, #11504 11593,11594,11595,11596,11597,11598,11599,11600,11601,11602,11603,11604,3090,11605,11606,11607, #11520 11608,11609,11610,4967,11611,11612,11613,11614,11615,11616,11617,11618,11619,11620,11621,11622, #11536 11623,11624,11625,11626,11627,11628,11629,11630,11631,11632,11633,11634,11635,11636,11637,11638, #11552 11639,11640,11641,11642,11643,11644,11645,11646,11647,11648,11649,11650,11651,11652,11653,11654, #11568 11655,11656,11657,11658,11659,11660,11661,11662,11663,11664,11665,11666,11667,11668,11669,11670, #11584 11671,11672,11673,11674,4968,11675,11676,11677,11678,11679,11680,11681,11682,11683,11684,11685, #11600 11686,11687,11688,11689,11690,11691,11692,11693,3809,11694,11695,11696,11697,11698,11699,11700, #11616 11701,11702,11703,11704,11705,11706,11707,11708,11709,11710,11711,11712,11713,11714,11715,11716, #11632 11717,11718,3553,11719,11720,11721,11722,11723,11724,11725,11726,11727,11728,11729,11730,4969, #11648 11731,11732,11733,11734,11735,11736,11737,11738,11739,11740,4492,11741,11742,11743,11744,11745, #11664 11746,11747,11748,11749,11750,11751,11752,4970,11753,11754,11755,11756,11757,11758,11759,11760, #11680 11761,11762,11763,11764,11765,11766,11767,11768,11769,11770,11771,11772,11773,11774,11775,11776, #11696 11777,11778,11779,11780,11781,11782,11783,11784,11785,11786,11787,11788,11789,11790,4971,11791, #11712 11792,11793,11794,11795,11796,11797,4972,11798,11799,11800,11801,11802,11803,11804,11805,11806, #11728 11807,11808,11809,11810,4973,11811,11812,11813,11814,11815,11816,11817,11818,11819,11820,11821, #11744 11822,11823,11824,11825,11826,11827,11828,11829,11830,11831,11832,11833,11834,3680,3810,11835, #11760 11836,4974,11837,11838,11839,11840,11841,11842,11843,11844,11845,11846,11847,11848,11849,11850, #11776 11851,11852,11853,11854,11855,11856,11857,11858,11859,11860,11861,11862,11863,11864,11865,11866, #11792 11867,11868,11869,11870,11871,11872,11873,11874,11875,11876,11877,11878,11879,11880,11881,11882, #11808 11883,11884,4493,11885,11886,11887,11888,11889,11890,11891,11892,11893,11894,11895,11896,11897, #11824 11898,11899,11900,11901,11902,11903,11904,11905,11906,11907,11908,11909,11910,11911,11912,11913, #11840 11914,11915,4975,11916,11917,11918,11919,11920,11921,11922,11923,11924,11925,11926,11927,11928, #11856 11929,11930,11931,11932,11933,11934,11935,11936,11937,11938,11939,11940,11941,11942,11943,11944, #11872 11945,11946,11947,11948,11949,4976,11950,11951,11952,11953,11954,11955,11956,11957,11958,11959, #11888 11960,11961,11962,11963,11964,11965,11966,11967,11968,11969,11970,11971,11972,11973,11974,11975, #11904 11976,11977,11978,11979,11980,11981,11982,11983,11984,11985,11986,11987,4196,11988,11989,11990, #11920 11991,11992,4977,11993,11994,11995,11996,11997,11998,11999,12000,12001,12002,12003,12004,12005, #11936 12006,12007,12008,12009,12010,12011,12012,12013,12014,12015,12016,12017,12018,12019,12020,12021, #11952 12022,12023,12024,12025,12026,12027,12028,12029,12030,12031,12032,12033,12034,12035,12036,12037, #11968 12038,12039,12040,12041,12042,12043,12044,12045,12046,12047,12048,12049,12050,12051,12052,12053, #11984 12054,12055,12056,12057,12058,12059,12060,12061,4978,12062,12063,12064,12065,12066,12067,12068, #12000 12069,12070,12071,12072,12073,12074,12075,12076,12077,12078,12079,12080,12081,12082,12083,12084, #12016 12085,12086,12087,12088,12089,12090,12091,12092,12093,12094,12095,12096,12097,12098,12099,12100, #12032 12101,12102,12103,12104,12105,12106,12107,12108,12109,12110,12111,12112,12113,12114,12115,12116, #12048 12117,12118,12119,12120,12121,12122,12123,4979,12124,12125,12126,12127,12128,4197,12129,12130, #12064 12131,12132,12133,12134,12135,12136,12137,12138,12139,12140,12141,12142,12143,12144,12145,12146, #12080 12147,12148,12149,12150,12151,12152,12153,12154,4980,12155,12156,12157,12158,12159,12160,4494, #12096 12161,12162,12163,12164,3811,12165,12166,12167,12168,12169,4495,12170,12171,4496,12172,12173, #12112 12174,12175,12176,3812,12177,12178,12179,12180,12181,12182,12183,12184,12185,12186,12187,12188, #12128 12189,12190,12191,12192,12193,12194,12195,12196,12197,12198,12199,12200,12201,12202,12203,12204, #12144 12205,12206,12207,12208,12209,12210,12211,12212,12213,12214,12215,12216,12217,12218,12219,12220, #12160 12221,4981,12222,12223,12224,12225,12226,12227,12228,12229,12230,12231,12232,12233,12234,12235, #12176 4982,12236,12237,12238,12239,12240,12241,12242,12243,12244,12245,4983,12246,12247,12248,12249, #12192 4984,12250,12251,12252,12253,12254,12255,12256,12257,12258,12259,12260,12261,12262,12263,12264, #12208 4985,12265,4497,12266,12267,12268,12269,12270,12271,12272,12273,12274,12275,12276,12277,12278, #12224 12279,12280,12281,12282,12283,12284,12285,12286,12287,4986,12288,12289,12290,12291,12292,12293, #12240 12294,12295,12296,2473,12297,12298,12299,12300,12301,12302,12303,12304,12305,12306,12307,12308, #12256 12309,12310,12311,12312,12313,12314,12315,12316,12317,12318,12319,3963,12320,12321,12322,12323, #12272 12324,12325,12326,12327,12328,12329,12330,12331,12332,4987,12333,12334,12335,12336,12337,12338, #12288 12339,12340,12341,12342,12343,12344,12345,12346,12347,12348,12349,12350,12351,12352,12353,12354, #12304 12355,12356,12357,12358,12359,3964,12360,12361,12362,12363,12364,12365,12366,12367,12368,12369, #12320 12370,3965,12371,12372,12373,12374,12375,12376,12377,12378,12379,12380,12381,12382,12383,12384, #12336 12385,12386,12387,12388,12389,12390,12391,12392,12393,12394,12395,12396,12397,12398,12399,12400, #12352 12401,12402,12403,12404,12405,12406,12407,12408,4988,12409,12410,12411,12412,12413,12414,12415, #12368 12416,12417,12418,12419,12420,12421,12422,12423,12424,12425,12426,12427,12428,12429,12430,12431, #12384 12432,12433,12434,12435,12436,12437,12438,3554,12439,12440,12441,12442,12443,12444,12445,12446, #12400 12447,12448,12449,12450,12451,12452,12453,12454,12455,12456,12457,12458,12459,12460,12461,12462, #12416 12463,12464,4989,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475,12476,12477, #12432 12478,12479,12480,4990,12481,12482,12483,12484,12485,12486,12487,12488,12489,4498,12490,12491, #12448 12492,12493,12494,12495,12496,12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507, #12464 12508,12509,12510,12511,12512,12513,12514,12515,12516,12517,12518,12519,12520,12521,12522,12523, #12480 12524,12525,12526,12527,12528,12529,12530,12531,12532,12533,12534,12535,12536,12537,12538,12539, #12496 12540,12541,12542,12543,12544,12545,12546,12547,12548,12549,12550,12551,4991,12552,12553,12554, #12512 12555,12556,12557,12558,12559,12560,12561,12562,12563,12564,12565,12566,12567,12568,12569,12570, #12528 12571,12572,12573,12574,12575,12576,12577,12578,3036,12579,12580,12581,12582,12583,3966,12584, #12544 12585,12586,12587,12588,12589,12590,12591,12592,12593,12594,12595,12596,12597,12598,12599,12600, #12560 12601,12602,12603,12604,12605,12606,12607,12608,12609,12610,12611,12612,12613,12614,12615,12616, #12576 12617,12618,12619,12620,12621,12622,12623,12624,12625,12626,12627,12628,12629,12630,12631,12632, #12592 12633,12634,12635,12636,12637,12638,12639,12640,12641,12642,12643,12644,12645,12646,4499,12647, #12608 12648,12649,12650,12651,12652,12653,12654,12655,12656,12657,12658,12659,12660,12661,12662,12663, #12624 12664,12665,12666,12667,12668,12669,12670,12671,12672,12673,12674,12675,12676,12677,12678,12679, #12640 12680,12681,12682,12683,12684,12685,12686,12687,12688,12689,12690,12691,12692,12693,12694,12695, #12656 12696,12697,12698,4992,12699,12700,12701,12702,12703,12704,12705,12706,12707,12708,12709,12710, #12672 12711,12712,12713,12714,12715,12716,12717,12718,12719,12720,12721,12722,12723,12724,12725,12726, #12688 12727,12728,12729,12730,12731,12732,12733,12734,12735,12736,12737,12738,12739,12740,12741,12742, #12704 12743,12744,12745,12746,12747,12748,12749,12750,12751,12752,12753,12754,12755,12756,12757,12758, #12720 12759,12760,12761,12762,12763,12764,12765,12766,12767,12768,12769,12770,12771,12772,12773,12774, #12736 12775,12776,12777,12778,4993,2175,12779,12780,12781,12782,12783,12784,12785,12786,4500,12787, #12752 12788,12789,12790,12791,12792,12793,12794,12795,12796,12797,12798,12799,12800,12801,12802,12803, #12768 12804,12805,12806,12807,12808,12809,12810,12811,12812,12813,12814,12815,12816,12817,12818,12819, #12784 12820,12821,12822,12823,12824,12825,12826,4198,3967,12827,12828,12829,12830,12831,12832,12833, #12800 12834,12835,12836,12837,12838,12839,12840,12841,12842,12843,12844,12845,12846,12847,12848,12849, #12816 12850,12851,12852,12853,12854,12855,12856,12857,12858,12859,12860,12861,4199,12862,12863,12864, #12832 12865,12866,12867,12868,12869,12870,12871,12872,12873,12874,12875,12876,12877,12878,12879,12880, #12848 12881,12882,12883,12884,12885,12886,12887,4501,12888,12889,12890,12891,12892,12893,12894,12895, #12864 12896,12897,12898,12899,12900,12901,12902,12903,12904,12905,12906,12907,12908,12909,12910,12911, #12880 12912,4994,12913,12914,12915,12916,12917,12918,12919,12920,12921,12922,12923,12924,12925,12926, #12896 12927,12928,12929,12930,12931,12932,12933,12934,12935,12936,12937,12938,12939,12940,12941,12942, #12912 12943,12944,12945,12946,12947,12948,12949,12950,12951,12952,12953,12954,12955,12956,1772,12957, #12928 12958,12959,12960,12961,12962,12963,12964,12965,12966,12967,12968,12969,12970,12971,12972,12973, #12944 12974,12975,12976,12977,12978,12979,12980,12981,12982,12983,12984,12985,12986,12987,12988,12989, #12960 12990,12991,12992,12993,12994,12995,12996,12997,4502,12998,4503,12999,13000,13001,13002,13003, #12976 4504,13004,13005,13006,13007,13008,13009,13010,13011,13012,13013,13014,13015,13016,13017,13018, #12992 13019,13020,13021,13022,13023,13024,13025,13026,13027,13028,13029,3449,13030,13031,13032,13033, #13008 13034,13035,13036,13037,13038,13039,13040,13041,13042,13043,13044,13045,13046,13047,13048,13049, #13024 13050,13051,13052,13053,13054,13055,13056,13057,13058,13059,13060,13061,13062,13063,13064,13065, #13040 13066,13067,13068,13069,13070,13071,13072,13073,13074,13075,13076,13077,13078,13079,13080,13081, #13056 13082,13083,13084,13085,13086,13087,13088,13089,13090,13091,13092,13093,13094,13095,13096,13097, #13072 13098,13099,13100,13101,13102,13103,13104,13105,13106,13107,13108,13109,13110,13111,13112,13113, #13088 13114,13115,13116,13117,13118,3968,13119,4995,13120,13121,13122,13123,13124,13125,13126,13127, #13104 4505,13128,13129,13130,13131,13132,13133,13134,4996,4506,13135,13136,13137,13138,13139,4997, #13120 13140,13141,13142,13143,13144,13145,13146,13147,13148,13149,13150,13151,13152,13153,13154,13155, #13136 13156,13157,13158,13159,4998,13160,13161,13162,13163,13164,13165,13166,13167,13168,13169,13170, #13152 13171,13172,13173,13174,13175,13176,4999,13177,13178,13179,13180,13181,13182,13183,13184,13185, #13168 13186,13187,13188,13189,13190,13191,13192,13193,13194,13195,13196,13197,13198,13199,13200,13201, #13184 13202,13203,13204,13205,13206,5000,13207,13208,13209,13210,13211,13212,13213,13214,13215,13216, #13200 13217,13218,13219,13220,13221,13222,13223,13224,13225,13226,13227,4200,5001,13228,13229,13230, #13216 13231,13232,13233,13234,13235,13236,13237,13238,13239,13240,3969,13241,13242,13243,13244,3970, #13232 13245,13246,13247,13248,13249,13250,13251,13252,13253,13254,13255,13256,13257,13258,13259,13260, #13248 13261,13262,13263,13264,13265,13266,13267,13268,3450,13269,13270,13271,13272,13273,13274,13275, #13264 13276,5002,13277,13278,13279,13280,13281,13282,13283,13284,13285,13286,13287,13288,13289,13290, #13280 13291,13292,13293,13294,13295,13296,13297,13298,13299,13300,13301,13302,3813,13303,13304,13305, #13296 13306,13307,13308,13309,13310,13311,13312,13313,13314,13315,13316,13317,13318,13319,13320,13321, #13312 13322,13323,13324,13325,13326,13327,13328,4507,13329,13330,13331,13332,13333,13334,13335,13336, #13328 13337,13338,13339,13340,13341,5003,13342,13343,13344,13345,13346,13347,13348,13349,13350,13351, #13344 13352,13353,13354,13355,13356,13357,13358,13359,13360,13361,13362,13363,13364,13365,13366,13367, #13360 5004,13368,13369,13370,13371,13372,13373,13374,13375,13376,13377,13378,13379,13380,13381,13382, #13376 13383,13384,13385,13386,13387,13388,13389,13390,13391,13392,13393,13394,13395,13396,13397,13398, #13392 13399,13400,13401,13402,13403,13404,13405,13406,13407,13408,13409,13410,13411,13412,13413,13414, #13408 13415,13416,13417,13418,13419,13420,13421,13422,13423,13424,13425,13426,13427,13428,13429,13430, #13424 13431,13432,4508,13433,13434,13435,4201,13436,13437,13438,13439,13440,13441,13442,13443,13444, #13440 13445,13446,13447,13448,13449,13450,13451,13452,13453,13454,13455,13456,13457,5005,13458,13459, #13456 13460,13461,13462,13463,13464,13465,13466,13467,13468,13469,13470,4509,13471,13472,13473,13474, #13472 13475,13476,13477,13478,13479,13480,13481,13482,13483,13484,13485,13486,13487,13488,13489,13490, #13488 13491,13492,13493,13494,13495,13496,13497,13498,13499,13500,13501,13502,13503,13504,13505,13506, #13504 13507,13508,13509,13510,13511,13512,13513,13514,13515,13516,13517,13518,13519,13520,13521,13522, #13520 13523,13524,13525,13526,13527,13528,13529,13530,13531,13532,13533,13534,13535,13536,13537,13538, #13536 13539,13540,13541,13542,13543,13544,13545,13546,13547,13548,13549,13550,13551,13552,13553,13554, #13552 13555,13556,13557,13558,13559,13560,13561,13562,13563,13564,13565,13566,13567,13568,13569,13570, #13568 13571,13572,13573,13574,13575,13576,13577,13578,13579,13580,13581,13582,13583,13584,13585,13586, #13584 13587,13588,13589,13590,13591,13592,13593,13594,13595,13596,13597,13598,13599,13600,13601,13602, #13600 13603,13604,13605,13606,13607,13608,13609,13610,13611,13612,13613,13614,13615,13616,13617,13618, #13616 13619,13620,13621,13622,13623,13624,13625,13626,13627,13628,13629,13630,13631,13632,13633,13634, #13632 13635,13636,13637,13638,13639,13640,13641,13642,5006,13643,13644,13645,13646,13647,13648,13649, #13648 13650,13651,5007,13652,13653,13654,13655,13656,13657,13658,13659,13660,13661,13662,13663,13664, #13664 13665,13666,13667,13668,13669,13670,13671,13672,13673,13674,13675,13676,13677,13678,13679,13680, #13680 13681,13682,13683,13684,13685,13686,13687,13688,13689,13690,13691,13692,13693,13694,13695,13696, #13696 13697,13698,13699,13700,13701,13702,13703,13704,13705,13706,13707,13708,13709,13710,13711,13712, #13712 13713,13714,13715,13716,13717,13718,13719,13720,13721,13722,13723,13724,13725,13726,13727,13728, #13728 13729,13730,13731,13732,13733,13734,13735,13736,13737,13738,13739,13740,13741,13742,13743,13744, #13744 13745,13746,13747,13748,13749,13750,13751,13752,13753,13754,13755,13756,13757,13758,13759,13760, #13760 13761,13762,13763,13764,13765,13766,13767,13768,13769,13770,13771,13772,13773,13774,3273,13775, #13776 13776,13777,13778,13779,13780,13781,13782,13783,13784,13785,13786,13787,13788,13789,13790,13791, #13792 13792,13793,13794,13795,13796,13797,13798,13799,13800,13801,13802,13803,13804,13805,13806,13807, #13808 13808,13809,13810,13811,13812,13813,13814,13815,13816,13817,13818,13819,13820,13821,13822,13823, #13824 13824,13825,13826,13827,13828,13829,13830,13831,13832,13833,13834,13835,13836,13837,13838,13839, #13840 13840,13841,13842,13843,13844,13845,13846,13847,13848,13849,13850,13851,13852,13853,13854,13855, #13856 13856,13857,13858,13859,13860,13861,13862,13863,13864,13865,13866,13867,13868,13869,13870,13871, #13872 13872,13873,13874,13875,13876,13877,13878,13879,13880,13881,13882,13883,13884,13885,13886,13887, #13888 13888,13889,13890,13891,13892,13893,13894,13895,13896,13897,13898,13899,13900,13901,13902,13903, #13904 13904,13905,13906,13907,13908,13909,13910,13911,13912,13913,13914,13915,13916,13917,13918,13919, #13920 13920,13921,13922,13923,13924,13925,13926,13927,13928,13929,13930,13931,13932,13933,13934,13935, #13936 13936,13937,13938,13939,13940,13941,13942,13943,13944,13945,13946,13947,13948,13949,13950,13951, #13952 13952,13953,13954,13955,13956,13957,13958,13959,13960,13961,13962,13963,13964,13965,13966,13967, #13968 13968,13969,13970,13971,13972) #13973
gpl-3.0
[ 6565, 16427, 5113, 8068, 11945, 199, 3, 710, 12769, 5495, 365, 17728, 13338, 707, 1890, 1233, 14, 199, 3, 221, 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, 221, 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, 221, 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, 221, 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, 3, 13123, 21, 9857, 1817, 199, 3, 701, 377, 5789, 20444, 1159, 603, 460, 285, 262, 27724, 23193, 1849, 1097, 382, 221, 199, 3, 665, 1014, 921, 1544, 14, 8654, 14, 8122, 26, 2835, 15, 10333, 82, 3133, 199, 3, 221, 199, 3, 7960, 221, 10541, 378, 14, 23814, 2976, 199, 3, 7633, 221, 10541, 378, 14, 1641, 22740, 199, 3, 10574, 221, 10541, 378, 14, 1342, 22740, 199, 3, 6619, 10541, 378, 14, 1407, 8188, 199, 3, 18427, 10541, 378, 14, 2576, 16793, 199, 3, 221, 199, 3, 473, 21245, 11839, 820, 32736, 275, 378, 14, 1342, 22740, 7985, 17, 13, 16, 14, 1342, 22740, 9, 275, 18, 14, 2905, 199, 3, 9571, 11839, 820, 425, 275, 10574, 7985, 1477, 614, 13, 7736, 23397, 16, 14, 7320, 199, 3, 221, 199, 3, 29267, 11839, 820, 32736, 3595, 5661, 5, 402, 473, 21245, 1373, 12, 5139, 8298, 10948, 2419, 820, 4564, 199, 199, 18643, 21, 63, 7034, 5974, 63, 24580, 26601, 63, 26566, 275, 378, 14, 2194, 199, 199, 3, 1610, 370, 481, 2103, 4738, 1817, 199, 18643, 21, 63, 8723, 63, 4305, 275, 959, 11452, 199, 199, 7279, 21, 18139, 13875, 4738, 275, 334, 971, 2043, 413, 12, 1085, 614, 12, 1046, 1690, 12, 5450, 12, 1079, 2192, 12, 413, 2905, 12, 257, 1749, 12, 221, 18051, 12, 257, 1227, 12, 5783, 24, 12, 413, 1138, 12, 19328, 12, 1344, 2835, 12, 713, 1367, 12, 1651, 2025, 12, 16814, 12, 327, 257, 3193, 199, 1703, 1079, 12, 221, 9404, 12, 708, 1342, 12, 499, 2976, 12, 221, 14646, 12, 221, 10868, 12, 18, 7636, 12, 221, 3193, 12, 1398, 2466, 12, 9252, 23, 12, 31989, 12, 1227, 1427, 12, 1355, 3172, 12, 221, 7875, 12, 1082, 2869, 12, 1479, 2481, 12, 327, 257, 4337, 199, 845, 2905, 12, 1355, 2819, 12, 1153, 1400, 12, 2260, 996, 12, 32321, 12, 1081, 1046, 12, 11485, 12, 959, 2710, 12, 650, 2976, 12, 1167, 772, 12, 257, 1695, 12, 14785, 12, 221, 13713, 12, 2322, 709, 12, 5783, 25, 12, 1167, 708, 12, 327, 257, 9615, 523, 13668, 12, 8216, 16, 12, 8216, 17, 12, 650, 1196, 12, 975, 1079, 12, 221, 13098, 12, 26485, 12, 413, 1427, 12, 20, 11341, 12, 1194, 1196, 12, 1079, 1257, 12, 8216, 18, 12, 10156, 21, 12, 1216, 3328, 12, 18565, 12, 29736, 12, 327, 257, 5049, 199, 1344, 2564, 12, 257, 650, 12, 221, 1616, 12, 1355, 2898, 12, 1079, 3172, 12, 221, 7349, 12, 1465, 1555, 12, 845, 1276, 12, 11125, 22, 12, 30614, 12, 10513, 19, 12, 21334, 12, 708, 2194, 12, 17, 4288, 12, 650, 713, 12, 8216, 19, 12, 327, 257, 5939, 199, 2322, 845, 12, 1165, 2528, 12, 959, 1780, 12, 27210, 12, 1227, 2564, 12, 8216, 20, 12, 31308, 12, 1167, 1046, 12, 25442, 12, 26761, 12, 1398, 2417, 12, 221, 8177, 12, 10156, 22, 12, 708, 966, 12, 221, 5049, 12, 1227, 966, 12, 327, 257, 15580, 199, 8216, 21, 12, 821, 614, 12, 1167, 1138, 12, 1167, 2277, 12, 29710, 12, 7155, 17, 12, 5049, 21, 12, 5049, 17, 12, 975, 1690, 12, 8216, 22, 12, 1082, 2528, 12, 650, 1401, 12, 221, 15323, 12, 841, 1690, 12, 8216, 23, 12, 221, 5939, 12, 327, 221, 20240, 199, 1227, 1216, 12, 27077, 12, 708, 1717, 12, 1046, 1643, 12, 499, 2766, 12, 1749, 1355, 12, 709, 2942, 12, 1479, 1477, 12, 1520, 1367, 12, 1079, 2167, 12, 709, 2635, 12, 1082, 2481, 12, 841, 1887, 12, 221, 14610, 12, 1398, 1555, 12, 959, 3328, 12, 327, 221, 7960, 199, 31420, 12, 1165, 2534, 12, 841, 3172, 12, 22560, 12, 1165, 1276, 12, 1085, 1602, 12, 221, 5212, 12, 221, 5238, 12, 1398, 1299, 12, 25956, 12, 5939, 22, 12, 1085, 1876, 12, 1520, 1082, 12, 1165, 1344, 12, 1082, 1477, 12, 13576, 12, 327, 221, 21771, 199, 8806, 21, 12, 975, 1780, 12, 32609, 12, 959, 1401, 12, 1398, 1780, 12, 1227, 1299, 12, 8216, 24, 12, 650, 1167, 12, 969, 1717, 12, 8375, 25, 12, 6886, 21, 12, 959, 1079, 12, 10638, 25, 12, 499, 2905, 12, 2322, 713, 12, 650, 1427, 12, 327, 221, 21235, 199, 27874, 12, 221, 9137, 12, 1465, 975, 12, 969, 1703, 12, 1227, 2766, 12, 221, 4119, 12, 1749, 1690, 12, 709, 1020, 12, 2299, 19, 12, 221, 3388, 12, 1194, 2953, 12, 413, 2564, 12, 959, 708, 12, 1196, 975, 12, 8216, 25, 12, 1520, 708, 12, 327, 221, 27827, 199, 969, 2114, 12, 2260, 966, 12, 969, 845, 12, 1079, 1165, 12, 708, 1690, 12, 221, 5661, 12, 1789, 1196, 12, 709 ]
[ 16427, 5113, 8068, 11945, 199, 3, 710, 12769, 5495, 365, 17728, 13338, 707, 1890, 1233, 14, 199, 3, 221, 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, 221, 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, 221, 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, 221, 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, 3, 13123, 21, 9857, 1817, 199, 3, 701, 377, 5789, 20444, 1159, 603, 460, 285, 262, 27724, 23193, 1849, 1097, 382, 221, 199, 3, 665, 1014, 921, 1544, 14, 8654, 14, 8122, 26, 2835, 15, 10333, 82, 3133, 199, 3, 221, 199, 3, 7960, 221, 10541, 378, 14, 23814, 2976, 199, 3, 7633, 221, 10541, 378, 14, 1641, 22740, 199, 3, 10574, 221, 10541, 378, 14, 1342, 22740, 199, 3, 6619, 10541, 378, 14, 1407, 8188, 199, 3, 18427, 10541, 378, 14, 2576, 16793, 199, 3, 221, 199, 3, 473, 21245, 11839, 820, 32736, 275, 378, 14, 1342, 22740, 7985, 17, 13, 16, 14, 1342, 22740, 9, 275, 18, 14, 2905, 199, 3, 9571, 11839, 820, 425, 275, 10574, 7985, 1477, 614, 13, 7736, 23397, 16, 14, 7320, 199, 3, 221, 199, 3, 29267, 11839, 820, 32736, 3595, 5661, 5, 402, 473, 21245, 1373, 12, 5139, 8298, 10948, 2419, 820, 4564, 199, 199, 18643, 21, 63, 7034, 5974, 63, 24580, 26601, 63, 26566, 275, 378, 14, 2194, 199, 199, 3, 1610, 370, 481, 2103, 4738, 1817, 199, 18643, 21, 63, 8723, 63, 4305, 275, 959, 11452, 199, 199, 7279, 21, 18139, 13875, 4738, 275, 334, 971, 2043, 413, 12, 1085, 614, 12, 1046, 1690, 12, 5450, 12, 1079, 2192, 12, 413, 2905, 12, 257, 1749, 12, 221, 18051, 12, 257, 1227, 12, 5783, 24, 12, 413, 1138, 12, 19328, 12, 1344, 2835, 12, 713, 1367, 12, 1651, 2025, 12, 16814, 12, 327, 257, 3193, 199, 1703, 1079, 12, 221, 9404, 12, 708, 1342, 12, 499, 2976, 12, 221, 14646, 12, 221, 10868, 12, 18, 7636, 12, 221, 3193, 12, 1398, 2466, 12, 9252, 23, 12, 31989, 12, 1227, 1427, 12, 1355, 3172, 12, 221, 7875, 12, 1082, 2869, 12, 1479, 2481, 12, 327, 257, 4337, 199, 845, 2905, 12, 1355, 2819, 12, 1153, 1400, 12, 2260, 996, 12, 32321, 12, 1081, 1046, 12, 11485, 12, 959, 2710, 12, 650, 2976, 12, 1167, 772, 12, 257, 1695, 12, 14785, 12, 221, 13713, 12, 2322, 709, 12, 5783, 25, 12, 1167, 708, 12, 327, 257, 9615, 523, 13668, 12, 8216, 16, 12, 8216, 17, 12, 650, 1196, 12, 975, 1079, 12, 221, 13098, 12, 26485, 12, 413, 1427, 12, 20, 11341, 12, 1194, 1196, 12, 1079, 1257, 12, 8216, 18, 12, 10156, 21, 12, 1216, 3328, 12, 18565, 12, 29736, 12, 327, 257, 5049, 199, 1344, 2564, 12, 257, 650, 12, 221, 1616, 12, 1355, 2898, 12, 1079, 3172, 12, 221, 7349, 12, 1465, 1555, 12, 845, 1276, 12, 11125, 22, 12, 30614, 12, 10513, 19, 12, 21334, 12, 708, 2194, 12, 17, 4288, 12, 650, 713, 12, 8216, 19, 12, 327, 257, 5939, 199, 2322, 845, 12, 1165, 2528, 12, 959, 1780, 12, 27210, 12, 1227, 2564, 12, 8216, 20, 12, 31308, 12, 1167, 1046, 12, 25442, 12, 26761, 12, 1398, 2417, 12, 221, 8177, 12, 10156, 22, 12, 708, 966, 12, 221, 5049, 12, 1227, 966, 12, 327, 257, 15580, 199, 8216, 21, 12, 821, 614, 12, 1167, 1138, 12, 1167, 2277, 12, 29710, 12, 7155, 17, 12, 5049, 21, 12, 5049, 17, 12, 975, 1690, 12, 8216, 22, 12, 1082, 2528, 12, 650, 1401, 12, 221, 15323, 12, 841, 1690, 12, 8216, 23, 12, 221, 5939, 12, 327, 221, 20240, 199, 1227, 1216, 12, 27077, 12, 708, 1717, 12, 1046, 1643, 12, 499, 2766, 12, 1749, 1355, 12, 709, 2942, 12, 1479, 1477, 12, 1520, 1367, 12, 1079, 2167, 12, 709, 2635, 12, 1082, 2481, 12, 841, 1887, 12, 221, 14610, 12, 1398, 1555, 12, 959, 3328, 12, 327, 221, 7960, 199, 31420, 12, 1165, 2534, 12, 841, 3172, 12, 22560, 12, 1165, 1276, 12, 1085, 1602, 12, 221, 5212, 12, 221, 5238, 12, 1398, 1299, 12, 25956, 12, 5939, 22, 12, 1085, 1876, 12, 1520, 1082, 12, 1165, 1344, 12, 1082, 1477, 12, 13576, 12, 327, 221, 21771, 199, 8806, 21, 12, 975, 1780, 12, 32609, 12, 959, 1401, 12, 1398, 1780, 12, 1227, 1299, 12, 8216, 24, 12, 650, 1167, 12, 969, 1717, 12, 8375, 25, 12, 6886, 21, 12, 959, 1079, 12, 10638, 25, 12, 499, 2905, 12, 2322, 713, 12, 650, 1427, 12, 327, 221, 21235, 199, 27874, 12, 221, 9137, 12, 1465, 975, 12, 969, 1703, 12, 1227, 2766, 12, 221, 4119, 12, 1749, 1690, 12, 709, 1020, 12, 2299, 19, 12, 221, 3388, 12, 1194, 2953, 12, 413, 2564, 12, 959, 708, 12, 1196, 975, 12, 8216, 25, 12, 1520, 708, 12, 327, 221, 27827, 199, 969, 2114, 12, 2260, 966, 12, 969, 845, 12, 1079, 1165, 12, 708, 1690, 12, 221, 5661, 12, 1789, 1196, 12, 709, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
wzhfy/spark
examples/src/main/python/mllib/power_iteration_clustering_example.py
27
1753
# # 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 pyspark import SparkContext # $example on$ from pyspark.mllib.clustering import PowerIterationClustering, PowerIterationClusteringModel # $example off$ if __name__ == "__main__": sc = SparkContext(appName="PowerIterationClusteringExample") # SparkContext # $example on$ # Load and parse the data data = sc.textFile("data/mllib/pic_data.txt") similarities = data.map(lambda line: tuple([float(x) for x in line.split(' ')])) # Cluster the data into two classes using PowerIterationClustering model = PowerIterationClustering.train(similarities, 2, 10) model.assignments().foreach(lambda x: print(str(x.id) + " -> " + str(x.cluster))) # Save and load model model.save(sc, "target/org/apache/spark/PythonPowerIterationClusteringExample/PICModel") sameModel = PowerIterationClusteringModel\ .load(sc, "target/org/apache/spark/PythonPowerIterationClusteringExample/PICModel") # $example off$ sc.stop()
apache-2.0
[ 3, 199, 3, 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 503, 1655, 199, 3, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 1854, 543, 199, 3, 642, 1736, 367, 4722, 2556, 12602, 4248, 12715, 14, 199, 3, 710, 14857, 12378, 642, 570, 370, 2047, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 199, 3, 334, 1589, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 199, 3, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 259, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 199, 199, 504, 15847, 492, 21769, 199, 3, 2672, 2694, 641, 4, 199, 504, 15847, 14, 25598, 14, 25802, 492, 18879, 8666, 31174, 12, 18879, 8666, 31174, 1685, 199, 3, 2672, 2694, 2331, 4, 199, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 272, 4061, 275, 21769, 8, 571, 985, 628, 6921, 8666, 31174, 9846, 531, 221, 327, 21769, 339, 327, 2672, 2694, 641, 4, 272, 327, 7190, 436, 2198, 314, 666, 272, 666, 275, 4061, 14, 505, 1173, 480, 576, 15, 25598, 15, 12475, 63, 576, 14, 2424, 531, 272, 4389, 382, 27894, 275, 666, 14, 1130, 8, 2734, 1004, 26, 2008, 779, 1609, 8, 88, 9, 367, 671, 315, 1004, 14, 1294, 360, 283, 19563, 339, 327, 16454, 314, 666, 1901, 2877, 3992, 1808, 18879, 8666, 31174, 272, 1402, 275, 18879, 8666, 31174, 14, 2834, 8, 5206, 382, 27894, 12, 499, 12, 1616, 9, 339, 1402, 14, 18922, 1252, 32591, 8, 2734, 671, 26, 870, 8, 495, 8, 88, 14, 344, 9, 435, 298, 1035, 298, 435, 620, 8, 88, 14, 4201, 1724, 339, 327, 11063, 436, 2248, 1402, 272, 1402, 14, 2117, 8, 551, 12, 298, 1375, 15, 1308, 15, 3796, 15, 9852, 15, 4718, 6921, 8666, 31174, 9846, 15, 26769, 1685, 531, 272, 2011, 1685, 275, 18879, 8666, 31174, 1685, 60, 267, 1275, 912, 8, 551, 12, 298, 1375, 15, 1308, 15, 3796, 15, 9852, 15, 4718, 6921, 8666, 31174, 9846, 15, 26769, 1685, 531, 272, 327, 2672, 2694, 2331, 4, 339, 4061, 14, 2379, 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 ]
[ 199, 3, 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 503, 1655, 199, 3, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 1854, 543, 199, 3, 642, 1736, 367, 4722, 2556, 12602, 4248, 12715, 14, 199, 3, 710, 14857, 12378, 642, 570, 370, 2047, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 199, 3, 334, 1589, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 199, 3, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 259, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 199, 199, 504, 15847, 492, 21769, 199, 3, 2672, 2694, 641, 4, 199, 504, 15847, 14, 25598, 14, 25802, 492, 18879, 8666, 31174, 12, 18879, 8666, 31174, 1685, 199, 3, 2672, 2694, 2331, 4, 199, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 272, 4061, 275, 21769, 8, 571, 985, 628, 6921, 8666, 31174, 9846, 531, 221, 327, 21769, 339, 327, 2672, 2694, 641, 4, 272, 327, 7190, 436, 2198, 314, 666, 272, 666, 275, 4061, 14, 505, 1173, 480, 576, 15, 25598, 15, 12475, 63, 576, 14, 2424, 531, 272, 4389, 382, 27894, 275, 666, 14, 1130, 8, 2734, 1004, 26, 2008, 779, 1609, 8, 88, 9, 367, 671, 315, 1004, 14, 1294, 360, 283, 19563, 339, 327, 16454, 314, 666, 1901, 2877, 3992, 1808, 18879, 8666, 31174, 272, 1402, 275, 18879, 8666, 31174, 14, 2834, 8, 5206, 382, 27894, 12, 499, 12, 1616, 9, 339, 1402, 14, 18922, 1252, 32591, 8, 2734, 671, 26, 870, 8, 495, 8, 88, 14, 344, 9, 435, 298, 1035, 298, 435, 620, 8, 88, 14, 4201, 1724, 339, 327, 11063, 436, 2248, 1402, 272, 1402, 14, 2117, 8, 551, 12, 298, 1375, 15, 1308, 15, 3796, 15, 9852, 15, 4718, 6921, 8666, 31174, 9846, 15, 26769, 1685, 531, 272, 2011, 1685, 275, 18879, 8666, 31174, 1685, 60, 267, 1275, 912, 8, 551, 12, 298, 1375, 15, 1308, 15, 3796, 15, 9852, 15, 4718, 6921, 8666, 31174, 9846, 15, 26769, 1685, 531, 272, 327, 2672, 2694, 2331, 4, 339, 4061, 14, 2379, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
arnavgosain/msm8x27
tools/perf/util/setup.py
4998
1330
#!/usr/bin/python2 from distutils.core import setup, Extension from os import getenv from distutils.command.build_ext import build_ext as _build_ext from distutils.command.install_lib import install_lib as _install_lib class build_ext(_build_ext): def finalize_options(self): _build_ext.finalize_options(self) self.build_lib = build_lib self.build_temp = build_tmp class install_lib(_install_lib): def finalize_options(self): _install_lib.finalize_options(self) self.build_dir = build_lib cflags = ['-fno-strict-aliasing', '-Wno-write-strings'] cflags += getenv('CFLAGS', '').split() build_lib = getenv('PYTHON_EXTBUILD_LIB') build_tmp = getenv('PYTHON_EXTBUILD_TMP') ext_sources = [f.strip() for f in file('util/python-ext-sources') if len(f.strip()) > 0 and f[0] != '#'] perf = Extension('perf', sources = ext_sources, include_dirs = ['util/include'], extra_compile_args = cflags, ) setup(name='perf', version='0.1', description='Interface with the Linux profiling infrastructure', author='Arnaldo Carvalho de Melo', author_email='acme@redhat.com', license='GPLv2', url='http://perf.wiki.kernel.org', ext_modules=[perf], cmdclass={'build_ext': build_ext, 'install_lib': install_lib})
gpl-2.0
[ 3381, 2647, 15, 1393, 15, 1548, 18, 199, 199, 504, 7065, 14, 1018, 492, 3272, 12, 13282, 199, 504, 747, 492, 29626, 199, 199, 504, 7065, 14, 1531, 14, 1506, 63, 832, 257, 492, 1900, 63, 832, 257, 465, 485, 1506, 63, 832, 199, 504, 7065, 14, 1531, 14, 3174, 63, 773, 492, 3907, 63, 773, 465, 485, 3174, 63, 773, 199, 199, 533, 1900, 63, 832, 1547, 1506, 63, 832, 304, 272, 347, 17284, 63, 1419, 8, 277, 304, 267, 485, 1506, 63, 832, 14, 14450, 63, 1419, 8, 277, 9, 267, 291, 14, 1506, 63, 773, 221, 275, 1900, 63, 773, 267, 291, 14, 1506, 63, 808, 275, 1900, 63, 2791, 199, 199, 533, 3907, 63, 773, 1547, 3174, 63, 773, 304, 272, 347, 17284, 63, 1419, 8, 277, 304, 267, 485, 3174, 63, 773, 14, 14450, 63, 1419, 8, 277, 9, 267, 291, 14, 1506, 63, 694, 275, 1900, 63, 773, 421, 199, 14002, 275, 11573, 70, 889, 13, 4768, 13, 3620, 316, 297, 2475, 55, 889, 13, 952, 13, 5465, 418, 199, 14002, 847, 29626, 360, 14804, 297, 12548, 1294, 342, 199, 199, 1506, 63, 773, 275, 29626, 360, 11720, 63, 2472, 8248, 63, 5617, 358, 199, 1506, 63, 2791, 275, 29626, 360, 11720, 63, 2472, 8248, 63, 17983, 358, 199, 199, 832, 63, 4553, 275, 359, 70, 14, 1913, 342, 367, 289, 315, 570, 360, 1974, 15, 1548, 13, 832, 13, 4553, 358, 1585, 198, 692, 822, 8, 70, 14, 1913, 1012, 690, 378, 436, 289, 59, 16, 61, 1137, 3943, 418, 199, 199, 9452, 275, 13282, 360, 9452, 297, 29294, 5274, 275, 1599, 63, 4553, 12, 29294, 2387, 63, 3220, 275, 788, 1974, 15, 2613, 995, 29294, 2402, 63, 2014, 63, 589, 275, 13426, 12, 326, 776, 199, 199, 2758, 8, 354, 534, 9452, 297, 489, 1015, 534, 16, 14, 17, 297, 489, 1369, 534, 4267, 543, 314, 10130, 30238, 28890, 6976, 297, 489, 4132, 534, 20498, 279, 1117, 14243, 637, 526, 477, 3194, 320, 297, 489, 4132, 63, 2123, 534, 18107, 32, 17164, 14, 957, 297, 489, 4190, 534, 28863, 18, 297, 489, 1166, 534, 1014, 921, 9452, 14, 6797, 14, 4989, 14, 1308, 297, 489, 1599, 63, 3112, 1524, 9452, 467, 489, 2088, 533, 3713, 1506, 63, 832, 356, 1900, 63, 832, 12, 283, 3174, 63, 773, 356, 3907, 63, 773, 1552, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2647, 15, 1393, 15, 1548, 18, 199, 199, 504, 7065, 14, 1018, 492, 3272, 12, 13282, 199, 504, 747, 492, 29626, 199, 199, 504, 7065, 14, 1531, 14, 1506, 63, 832, 257, 492, 1900, 63, 832, 257, 465, 485, 1506, 63, 832, 199, 504, 7065, 14, 1531, 14, 3174, 63, 773, 492, 3907, 63, 773, 465, 485, 3174, 63, 773, 199, 199, 533, 1900, 63, 832, 1547, 1506, 63, 832, 304, 272, 347, 17284, 63, 1419, 8, 277, 304, 267, 485, 1506, 63, 832, 14, 14450, 63, 1419, 8, 277, 9, 267, 291, 14, 1506, 63, 773, 221, 275, 1900, 63, 773, 267, 291, 14, 1506, 63, 808, 275, 1900, 63, 2791, 199, 199, 533, 3907, 63, 773, 1547, 3174, 63, 773, 304, 272, 347, 17284, 63, 1419, 8, 277, 304, 267, 485, 3174, 63, 773, 14, 14450, 63, 1419, 8, 277, 9, 267, 291, 14, 1506, 63, 694, 275, 1900, 63, 773, 421, 199, 14002, 275, 11573, 70, 889, 13, 4768, 13, 3620, 316, 297, 2475, 55, 889, 13, 952, 13, 5465, 418, 199, 14002, 847, 29626, 360, 14804, 297, 12548, 1294, 342, 199, 199, 1506, 63, 773, 275, 29626, 360, 11720, 63, 2472, 8248, 63, 5617, 358, 199, 1506, 63, 2791, 275, 29626, 360, 11720, 63, 2472, 8248, 63, 17983, 358, 199, 199, 832, 63, 4553, 275, 359, 70, 14, 1913, 342, 367, 289, 315, 570, 360, 1974, 15, 1548, 13, 832, 13, 4553, 358, 1585, 198, 692, 822, 8, 70, 14, 1913, 1012, 690, 378, 436, 289, 59, 16, 61, 1137, 3943, 418, 199, 199, 9452, 275, 13282, 360, 9452, 297, 29294, 5274, 275, 1599, 63, 4553, 12, 29294, 2387, 63, 3220, 275, 788, 1974, 15, 2613, 995, 29294, 2402, 63, 2014, 63, 589, 275, 13426, 12, 326, 776, 199, 199, 2758, 8, 354, 534, 9452, 297, 489, 1015, 534, 16, 14, 17, 297, 489, 1369, 534, 4267, 543, 314, 10130, 30238, 28890, 6976, 297, 489, 4132, 534, 20498, 279, 1117, 14243, 637, 526, 477, 3194, 320, 297, 489, 4132, 63, 2123, 534, 18107, 32, 17164, 14, 957, 297, 489, 4190, 534, 28863, 18, 297, 489, 1166, 534, 1014, 921, 9452, 14, 6797, 14, 4989, 14, 1308, 297, 489, 1599, 63, 3112, 1524, 9452, 467, 489, 2088, 533, 3713, 1506, 63, 832, 356, 1900, 63, 832, 12, 283, 3174, 63, 773, 356, 3907, 63, 773, 1552, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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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. """Runs Silo. Silo is a high performance, scalable in-memory database for modern multicore machines Documentation & code: https://github.com/stephentu/silo """ import logging from perfkitbenchmarker import flags from perfkitbenchmarker import regex_util from perfkitbenchmarker import sample from perfkitbenchmarker.packages import silo FLAGS = flags.FLAGS BENCHMARK_INFO = {'name': 'silo', 'description': 'Runs Silo', 'scratch_disk': False, 'num_machines': 1} flags.DEFINE_string('silo_benchmark', 'tpcc', 'benchmark to run with silo. Options include tpcc, ycsb,' ' queue, bid') AGG_THPUT_REGEX = \ r'(agg_throughput):\s+(\d+\.?\d*e?[+-]?\d*)\s+([a-z/]+)' PER_CORE_THPUT_REGEX = \ r'(avg_per_core_throughput):\s+(\d+\.?\d*e?[+-]?\d*)\s+([a-z/]+)' LAT_REGEX = r'(avg_latency):\s+(\d+\.?\d*e?[+-]?\d*)\s+([a-z]+)' def GetInfo(): return BENCHMARK_INFO def Prepare(benchmark_spec): """Install Silo on the target vm. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. """ vms = benchmark_spec.vms vm = vms[0] logging.info('Preparing Silo on %s', vm) vm.Install('silo') def ParseResults(results): """Result parser for Silo. This is what a smaple output looks like: --- table statistics --- table customer_0 size 30000 (+0 records) table customer_name_idx_0 size 30000 (+0 records) table district_0 size 10 (+0 records) table history_0 size 792182 (+762182 records) table item_0 size 100000 (+0 records) table new_order_0 size 122238 (+113238 records) table oorder_0 size 829578 (+799578 records) table oorder_c_id_idx_0 size 829578 (+799578 records) table order_line_0 size 8300509 (+8000949 records) table stock_0 size 100000 (+0 records) table stock_data_0 size 100000 (+0 records) table warehouse_0 size 1 (+0 records) --- benchmark statistics --- runtime: 30.0007 sec memory delta: 768.336 MB memory delta rate: 25.6106 MB/sec logical memory delta: 112.705 MB logical memory delta rate: 3.75673 MB/sec agg_nosync_throughput: 59150.1 ops/sec avg_nosync_per_core_throughput: 59150.1 ops/sec/core agg_throughput: 59150.1 ops/sec avg_per_core_throughput: 59150.1 ops/sec/core agg_persist_throughput: 59150.1 ops/sec avg_per_core_persist_throughput: 59150.1 ops/sec/core avg_latency: 0.0168378 ms avg_persist_latency: 0 ms agg_abort_rate: 0 aborts/sec avg_per_core_abort_rate: 0 aborts/sec/core txn breakdown: [[Delivery, 70967], [NewOrder, 799578], [OrderStatus, 70813], [Payment, 762182], [StockLevel, 71006]] --- system counters (for benchmark) --- --- perf counters (if enabled, for benchmark) --- --- allocator stats --- [allocator] ncpus=0 --------------------------------------- """ samples = [] # agg throughput match = regex_util.ExtractAllMatches(AGG_THPUT_REGEX, results)[0] samples.append(sample.Sample( match[0], float(match[1]), match[2])) # per core throughput match = regex_util.ExtractAllMatches(PER_CORE_THPUT_REGEX, results)[0] samples.append(sample.Sample( match[0], float(match[1]), match[2])) # avg latency match = regex_util.ExtractAllMatches(LAT_REGEX, results)[0] samples.append(sample.Sample( match[0], float(match[1]), match[2])) return samples def Run(benchmark_spec): """Run Silo on the target vm. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample objects. """ vms = benchmark_spec.vms vm = vms[0] nthreads = vm.num_cpus logging.info('Silo running on %s', vm) command = 'cd {0} && '\ 'out-perf.masstree/benchmarks/dbtest '\ '--bench {1} --num-threads {2} --verbose'.format( silo.SILO_DIR, FLAGS.silo_benchmark, nthreads) logging.info('Silo Results:') stdout, stderr = vm.RemoteCommand(command, should_log=True) return ParseResults(stderr) def Cleanup(benchmark_spec): """Cleanup Silo on the target vm. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. """ pass
apache-2.0
[ 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, 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, 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, 624, 16291, 428, 11737, 14, 199, 199, 51, 11737, 365, 282, 4721, 10238, 12, 5269, 461, 315, 13, 4844, 3050, 367, 818, 11641, 3510, 1018, 199, 26489, 199, 199, 17763, 1253, 1233, 26, 4178, 921, 5031, 14, 957, 15, 1597, 838, 484, 85, 15, 338, 320, 199, 624, 199, 199, 646, 2050, 199, 199, 504, 8582, 6065, 16571, 4211, 492, 3285, 199, 504, 8582, 6065, 16571, 4211, 492, 5163, 63, 1974, 199, 504, 8582, 6065, 16571, 4211, 492, 2690, 199, 504, 8582, 6065, 16571, 4211, 14, 5154, 492, 308, 11737, 199, 199, 4831, 275, 3285, 14, 4831, 199, 199, 34, 742, 1244, 10520, 63, 4531, 275, 791, 354, 356, 283, 338, 320, 297, 2116, 283, 1802, 356, 283, 16291, 428, 11737, 297, 2116, 283, 27393, 63, 4032, 356, 756, 12, 2116, 283, 1507, 63, 26489, 356, 413, 93, 199, 199, 2469, 14, 14603, 63, 875, 360, 338, 320, 63, 11861, 297, 283, 683, 2055, 297, 490, 283, 11861, 370, 1255, 543, 308, 11737, 14, 8394, 2387, 9253, 2055, 12, 612, 1259, 66, 2584, 490, 283, 4126, 12, 330, 344, 358, 199, 199, 14083, 63, 2080, 4013, 63, 10710, 275, 971, 272, 519, 6774, 13452, 63, 8304, 524, 17211, 83, 20900, 68, 11, 4537, 8995, 68, 10, 69, 26736, 16341, 22426, 68, 10, 2862, 83, 11, 779, 65, 13, 90, 15251, 3171, 199, 4227, 63, 24428, 63, 2080, 4013, 63, 10710, 275, 971, 272, 519, 6774, 8595, 63, 529, 63, 1018, 63, 8304, 524, 17211, 83, 20900, 68, 11, 4537, 8995, 68, 10, 69, 26736, 16341, 22426, 68, 10, 2862, 83, 11, 779, 65, 13, 90, 15251, 3171, 199, 20307, 63, 10710, 275, 519, 6774, 8595, 63, 19645, 17211, 83, 20900, 68, 11, 4537, 8995, 68, 10, 69, 26736, 16341, 22426, 68, 10, 2862, 83, 11, 779, 65, 13, 90, 29716, 421, 199, 318, 2372, 2354, 837, 523, 372, 699, 742, 1244, 10520, 63, 4531, 421, 199, 318, 17008, 8, 11861, 63, 1650, 304, 523, 408, 8154, 428, 11737, 641, 314, 1347, 4169, 14, 819, 3033, 26, 272, 12338, 63, 1650, 26, 710, 12338, 8929, 14, 22493, 1006, 666, 626, 365, 267, 1415, 370, 1255, 314, 12338, 14, 523, 408, 523, 22505, 275, 12338, 63, 1650, 14, 16092, 523, 4169, 275, 22505, 59, 16, 61, 523, 2050, 14, 815, 360, 2398, 462, 316, 428, 11737, 641, 450, 83, 297, 4169, 9, 523, 4169, 14, 8154, 360, 338, 320, 358, 421, 199, 318, 6077, 6579, 8, 2604, 304, 523, 408, 2889, 1798, 367, 428, 11737, 14, 819, 961, 365, 4052, 282, 308, 1130, 274, 1072, 10734, 2839, 26, 523, 10894, 1817, 11076, 10894, 523, 1817, 15229, 63, 16, 1568, 650, 993, 334, 11, 16, 5767, 9, 523, 1817, 15229, 63, 354, 63, 2996, 63, 16, 1568, 650, 993, 334, 11, 16, 5767, 9, 523, 1817, 487, 4768, 63, 16, 1568, 1616, 334, 11, 16, 5767, 9, 523, 1817, 7994, 63, 16, 1568, 1520, 2942, 12894, 334, 11, 2114, 9252, 18, 5767, 9, 523, 1817, 1242, 63, 16, 1568, 25761, 334, 11, 16, 5767, 9, 523, 1817, 892, 63, 1648, 63, 16, 1568, 413, 9485, 1703, 334, 11, 845, 708, 1703, 5767, 9, 523, 1817, 312, 1648, 63, 16, 1568, 1695, 1398, 14992, 334, 11, 31486, 14992, 5767, 9, 523, 1817, 312, 1648, 63, 67, 63, 344, 63, 2996, 63, 16, 1568, 1695, 1398, 14992, 334, 11, 31486, 14992, 5767, 9, 523, 1817, 1865, 63, 604, 63, 16, 1568, 1695, 5863, 6576, 334, 11, 15214, 15674, 5767, 9, 523, 1817, 10952, 63, 16, 1568, 25761, 334, 11, 16, 5767, 9, 523, 1817, 10952, 63, 576, 63, 16, 1568, 25761, 334, 11, 16, 5767, 9, 523, 1817, 13782, 63, 16, 1568, 413, 334, 11, 16, 5767, 9, 523, 10894, 12338, 11076, 10894, 523, 8836, 26, 4233, 14, 22530, 6513, 523, 4402, 5762, 26, 32404, 14, 12135, 19487, 523, 4402, 5762, 6634, 26, 5661, 14, 22, 7357, 19487, 15, 3321, 523, 11461, 4402, 5762, 26, 20240, 14, 23, 1717, 19487, 523, 11461, 4402, 5762, 6634, 26, 650, 14, 29152, 2898, 19487, 15, 3321, 523, 19408, 63, 12712, 1870, 63, 8304, 524, 26, 8155, 8251, 14, 17, 4156, 15, 3321, 523, 12402, 63, 12712, 1870, 63, 529, 63, 1018, 63, 8304, 524, 26, 8155, 8251, 14, 17, 4156, 15, 3321, 15, 1018, 523, 19408, 63, 8304, 524, 26, 8155, 8251, 14, 17, 4156, 15, 3321, 523, 12402, 63, 529, 63, 1018, 63, 8304, 524, 26, 8155, 8251, 14, 17, 4156, 15, 3321, 15, 1018, 523, 19408, 63, 23619, 63, 8304, 524, 26, 8155, 8251, 14, 17, 4156, 15, 3321, 523, 12402, 63, 529, 63, 1018, 63, 23619, 63, 8304, 524, 26, 8155, 8251, 14, 17, 4156, 15, 3321, 15, 1018, 523, 12402, 63, 19645, 26, 378, 14, 614, 2333, 12046, 6605, 523, 12402, 63, 23619, 63, 19645, 26, 378, 6605, 523, 19408, 63, 13845, 63, 1866, 26, 378, 12004, 83, 15, 3321, 523, 12402, 63, 529, 63, 1018, 63, 13845, 63, 1866, 26, 378, 12004, 83, 15, 3321, 15, 1018, 523, 23883, 2059, 2110, 26, 3474, 24640, 12, 1520, 1643, 1822, 467, 359, 4665, 4738, 12, 1520, 1020, 14992, 467, 359, 4738, 3694, 12, 1520, 2036, 969, 467, 523, 359, 22374, 12, 1520, 2789, 12894, 467, 359, 17103, 4670, 12, 1520, 1960, 22, 2677, 523, 10894, 2656, 21272, 334, 509, 12338, 9, 10894, 523, 10894, 8582, 21272, 334, 692, 5223, 12, 367, 12338, 9, 10894, 523, 10894, 741, 6354, 5020 ]
[ 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, 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, 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, 624, 16291, 428, 11737, 14, 199, 199, 51, 11737, 365, 282, 4721, 10238, 12, 5269, 461, 315, 13, 4844, 3050, 367, 818, 11641, 3510, 1018, 199, 26489, 199, 199, 17763, 1253, 1233, 26, 4178, 921, 5031, 14, 957, 15, 1597, 838, 484, 85, 15, 338, 320, 199, 624, 199, 199, 646, 2050, 199, 199, 504, 8582, 6065, 16571, 4211, 492, 3285, 199, 504, 8582, 6065, 16571, 4211, 492, 5163, 63, 1974, 199, 504, 8582, 6065, 16571, 4211, 492, 2690, 199, 504, 8582, 6065, 16571, 4211, 14, 5154, 492, 308, 11737, 199, 199, 4831, 275, 3285, 14, 4831, 199, 199, 34, 742, 1244, 10520, 63, 4531, 275, 791, 354, 356, 283, 338, 320, 297, 2116, 283, 1802, 356, 283, 16291, 428, 11737, 297, 2116, 283, 27393, 63, 4032, 356, 756, 12, 2116, 283, 1507, 63, 26489, 356, 413, 93, 199, 199, 2469, 14, 14603, 63, 875, 360, 338, 320, 63, 11861, 297, 283, 683, 2055, 297, 490, 283, 11861, 370, 1255, 543, 308, 11737, 14, 8394, 2387, 9253, 2055, 12, 612, 1259, 66, 2584, 490, 283, 4126, 12, 330, 344, 358, 199, 199, 14083, 63, 2080, 4013, 63, 10710, 275, 971, 272, 519, 6774, 13452, 63, 8304, 524, 17211, 83, 20900, 68, 11, 4537, 8995, 68, 10, 69, 26736, 16341, 22426, 68, 10, 2862, 83, 11, 779, 65, 13, 90, 15251, 3171, 199, 4227, 63, 24428, 63, 2080, 4013, 63, 10710, 275, 971, 272, 519, 6774, 8595, 63, 529, 63, 1018, 63, 8304, 524, 17211, 83, 20900, 68, 11, 4537, 8995, 68, 10, 69, 26736, 16341, 22426, 68, 10, 2862, 83, 11, 779, 65, 13, 90, 15251, 3171, 199, 20307, 63, 10710, 275, 519, 6774, 8595, 63, 19645, 17211, 83, 20900, 68, 11, 4537, 8995, 68, 10, 69, 26736, 16341, 22426, 68, 10, 2862, 83, 11, 779, 65, 13, 90, 29716, 421, 199, 318, 2372, 2354, 837, 523, 372, 699, 742, 1244, 10520, 63, 4531, 421, 199, 318, 17008, 8, 11861, 63, 1650, 304, 523, 408, 8154, 428, 11737, 641, 314, 1347, 4169, 14, 819, 3033, 26, 272, 12338, 63, 1650, 26, 710, 12338, 8929, 14, 22493, 1006, 666, 626, 365, 267, 1415, 370, 1255, 314, 12338, 14, 523, 408, 523, 22505, 275, 12338, 63, 1650, 14, 16092, 523, 4169, 275, 22505, 59, 16, 61, 523, 2050, 14, 815, 360, 2398, 462, 316, 428, 11737, 641, 450, 83, 297, 4169, 9, 523, 4169, 14, 8154, 360, 338, 320, 358, 421, 199, 318, 6077, 6579, 8, 2604, 304, 523, 408, 2889, 1798, 367, 428, 11737, 14, 819, 961, 365, 4052, 282, 308, 1130, 274, 1072, 10734, 2839, 26, 523, 10894, 1817, 11076, 10894, 523, 1817, 15229, 63, 16, 1568, 650, 993, 334, 11, 16, 5767, 9, 523, 1817, 15229, 63, 354, 63, 2996, 63, 16, 1568, 650, 993, 334, 11, 16, 5767, 9, 523, 1817, 487, 4768, 63, 16, 1568, 1616, 334, 11, 16, 5767, 9, 523, 1817, 7994, 63, 16, 1568, 1520, 2942, 12894, 334, 11, 2114, 9252, 18, 5767, 9, 523, 1817, 1242, 63, 16, 1568, 25761, 334, 11, 16, 5767, 9, 523, 1817, 892, 63, 1648, 63, 16, 1568, 413, 9485, 1703, 334, 11, 845, 708, 1703, 5767, 9, 523, 1817, 312, 1648, 63, 16, 1568, 1695, 1398, 14992, 334, 11, 31486, 14992, 5767, 9, 523, 1817, 312, 1648, 63, 67, 63, 344, 63, 2996, 63, 16, 1568, 1695, 1398, 14992, 334, 11, 31486, 14992, 5767, 9, 523, 1817, 1865, 63, 604, 63, 16, 1568, 1695, 5863, 6576, 334, 11, 15214, 15674, 5767, 9, 523, 1817, 10952, 63, 16, 1568, 25761, 334, 11, 16, 5767, 9, 523, 1817, 10952, 63, 576, 63, 16, 1568, 25761, 334, 11, 16, 5767, 9, 523, 1817, 13782, 63, 16, 1568, 413, 334, 11, 16, 5767, 9, 523, 10894, 12338, 11076, 10894, 523, 8836, 26, 4233, 14, 22530, 6513, 523, 4402, 5762, 26, 32404, 14, 12135, 19487, 523, 4402, 5762, 6634, 26, 5661, 14, 22, 7357, 19487, 15, 3321, 523, 11461, 4402, 5762, 26, 20240, 14, 23, 1717, 19487, 523, 11461, 4402, 5762, 6634, 26, 650, 14, 29152, 2898, 19487, 15, 3321, 523, 19408, 63, 12712, 1870, 63, 8304, 524, 26, 8155, 8251, 14, 17, 4156, 15, 3321, 523, 12402, 63, 12712, 1870, 63, 529, 63, 1018, 63, 8304, 524, 26, 8155, 8251, 14, 17, 4156, 15, 3321, 15, 1018, 523, 19408, 63, 8304, 524, 26, 8155, 8251, 14, 17, 4156, 15, 3321, 523, 12402, 63, 529, 63, 1018, 63, 8304, 524, 26, 8155, 8251, 14, 17, 4156, 15, 3321, 15, 1018, 523, 19408, 63, 23619, 63, 8304, 524, 26, 8155, 8251, 14, 17, 4156, 15, 3321, 523, 12402, 63, 529, 63, 1018, 63, 23619, 63, 8304, 524, 26, 8155, 8251, 14, 17, 4156, 15, 3321, 15, 1018, 523, 12402, 63, 19645, 26, 378, 14, 614, 2333, 12046, 6605, 523, 12402, 63, 23619, 63, 19645, 26, 378, 6605, 523, 19408, 63, 13845, 63, 1866, 26, 378, 12004, 83, 15, 3321, 523, 12402, 63, 529, 63, 1018, 63, 13845, 63, 1866, 26, 378, 12004, 83, 15, 3321, 15, 1018, 523, 23883, 2059, 2110, 26, 3474, 24640, 12, 1520, 1643, 1822, 467, 359, 4665, 4738, 12, 1520, 1020, 14992, 467, 359, 4738, 3694, 12, 1520, 2036, 969, 467, 523, 359, 22374, 12, 1520, 2789, 12894, 467, 359, 17103, 4670, 12, 1520, 1960, 22, 2677, 523, 10894, 2656, 21272, 334, 509, 12338, 9, 10894, 523, 10894, 8582, 21272, 334, 692, 5223, 12, 367, 12338, 9, 10894, 523, 10894, 741, 6354, 5020, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
sometallgit/AutoUploader
Python27/Lib/distutils/tests/test_dist.py
12
15852
# -*- coding: utf8 -*- """Tests for distutils.dist.""" import os import StringIO import sys import unittest import warnings import textwrap from distutils.dist import Distribution, fix_help_options from distutils.cmd import Command import distutils.dist from test.test_support import TESTFN, captured_stdout, run_unittest, unlink from distutils.tests import support from distutils import log class test_dist(Command): """Sample distutils extension command.""" user_options = [ ("sample-option=", "S", "help text"), ] def initialize_options(self): self.sample_option = None class TestDistribution(Distribution): """Distribution subclasses that avoids the default search for configuration files. The ._config_files attribute must be set before .parse_config_files() is called. """ def find_config_files(self): return self._config_files class DistributionTestCase(support.TempdirManager, support.LoggingSilencer, support.EnvironGuard, unittest.TestCase): def setUp(self): super(DistributionTestCase, self).setUp() self.argv = sys.argv, sys.argv[:] del sys.argv[1:] def tearDown(self): sys.argv = self.argv[0] sys.argv[:] = self.argv[1] super(DistributionTestCase, self).tearDown() def create_distribution(self, configfiles=()): d = TestDistribution() d._config_files = configfiles d.parse_config_files() d.parse_command_line() return d def test_debug_mode(self): with open(TESTFN, "w") as f: f.write("[global]\n") f.write("command_packages = foo.bar, splat") self.addCleanup(unlink, TESTFN) files = [TESTFN] sys.argv.append("build") with captured_stdout() as stdout: self.create_distribution(files) stdout.seek(0) self.assertEqual(stdout.read(), '') distutils.dist.DEBUG = True try: with captured_stdout() as stdout: self.create_distribution(files) stdout.seek(0) self.assertEqual(stdout.read(), '') finally: distutils.dist.DEBUG = False def test_command_packages_unspecified(self): sys.argv.append("build") d = self.create_distribution() self.assertEqual(d.get_command_packages(), ["distutils.command"]) def test_command_packages_cmdline(self): from distutils.tests.test_dist import test_dist sys.argv.extend(["--command-packages", "foo.bar,distutils.tests", "test_dist", "-Ssometext", ]) d = self.create_distribution() # let's actually try to load our test command: self.assertEqual(d.get_command_packages(), ["distutils.command", "foo.bar", "distutils.tests"]) cmd = d.get_command_obj("test_dist") self.assertIsInstance(cmd, test_dist) self.assertEqual(cmd.sample_option, "sometext") def test_command_packages_configfile(self): sys.argv.append("build") self.addCleanup(os.unlink, TESTFN) f = open(TESTFN, "w") try: print >> f, "[global]" print >> f, "command_packages = foo.bar, splat" finally: f.close() d = self.create_distribution([TESTFN]) self.assertEqual(d.get_command_packages(), ["distutils.command", "foo.bar", "splat"]) # ensure command line overrides config: sys.argv[1:] = ["--command-packages", "spork", "build"] d = self.create_distribution([TESTFN]) self.assertEqual(d.get_command_packages(), ["distutils.command", "spork"]) # Setting --command-packages to '' should cause the default to # be used even if a config file specified something else: sys.argv[1:] = ["--command-packages", "", "build"] d = self.create_distribution([TESTFN]) self.assertEqual(d.get_command_packages(), ["distutils.command"]) def test_write_pkg_file(self): # Check DistributionMetadata handling of Unicode fields tmp_dir = self.mkdtemp() my_file = os.path.join(tmp_dir, 'f') klass = Distribution dist = klass(attrs={'author': u'Mister Café', 'name': 'my.package', 'maintainer': u'Café Junior', 'description': u'Café torréfié', 'long_description': u'Héhéhé'}) # let's make sure the file can be written # with Unicode fields. they are encoded with # PKG_INFO_ENCODING dist.metadata.write_pkg_file(open(my_file, 'w')) # regular ascii is of course always usable dist = klass(attrs={'author': 'Mister Cafe', 'name': 'my.package', 'maintainer': 'Cafe Junior', 'description': 'Cafe torrefie', 'long_description': 'Hehehe'}) my_file2 = os.path.join(tmp_dir, 'f2') dist.metadata.write_pkg_file(open(my_file2, 'w')) def test_empty_options(self): # an empty options dictionary should not stay in the # list of attributes # catching warnings warns = [] def _warn(msg): warns.append(msg) self.addCleanup(setattr, warnings, 'warn', warnings.warn) warnings.warn = _warn dist = Distribution(attrs={'author': 'xxx', 'name': 'xxx', 'version': 'xxx', 'url': 'xxxx', 'options': {}}) self.assertEqual(len(warns), 0) self.assertNotIn('options', dir(dist)) def test_finalize_options(self): attrs = {'keywords': 'one,two', 'platforms': 'one,two'} dist = Distribution(attrs=attrs) dist.finalize_options() # finalize_option splits platforms and keywords self.assertEqual(dist.metadata.platforms, ['one', 'two']) self.assertEqual(dist.metadata.keywords, ['one', 'two']) def test_get_command_packages(self): dist = Distribution() self.assertEqual(dist.command_packages, None) cmds = dist.get_command_packages() self.assertEqual(cmds, ['distutils.command']) self.assertEqual(dist.command_packages, ['distutils.command']) dist.command_packages = 'one,two' cmds = dist.get_command_packages() self.assertEqual(cmds, ['distutils.command', 'one', 'two']) def test_announce(self): # make sure the level is known dist = Distribution() args = ('ok',) kwargs = {'level': 'ok2'} self.assertRaises(ValueError, dist.announce, args, kwargs) def test_find_config_files_disable(self): # Ticket #1180: Allow user to disable their home config file. temp_home = self.mkdtemp() if os.name == 'posix': user_filename = os.path.join(temp_home, ".pydistutils.cfg") else: user_filename = os.path.join(temp_home, "pydistutils.cfg") with open(user_filename, 'w') as f: f.write('[distutils]\n') def _expander(path): return temp_home old_expander = os.path.expanduser os.path.expanduser = _expander try: d = distutils.dist.Distribution() all_files = d.find_config_files() d = distutils.dist.Distribution(attrs={'script_args': ['--no-user-cfg']}) files = d.find_config_files() finally: os.path.expanduser = old_expander # make sure --no-user-cfg disables the user cfg file self.assertEqual(len(all_files)-1, len(files)) class MetadataTestCase(support.TempdirManager, support.EnvironGuard, unittest.TestCase): def setUp(self): super(MetadataTestCase, self).setUp() self.argv = sys.argv, sys.argv[:] def tearDown(self): sys.argv = self.argv[0] sys.argv[:] = self.argv[1] super(MetadataTestCase, self).tearDown() def test_classifier(self): attrs = {'name': 'Boa', 'version': '3.0', 'classifiers': ['Programming Language :: Python :: 3']} dist = Distribution(attrs) meta = self.format_metadata(dist) self.assertIn('Metadata-Version: 1.1', meta) def test_download_url(self): attrs = {'name': 'Boa', 'version': '3.0', 'download_url': 'http://example.org/boa'} dist = Distribution(attrs) meta = self.format_metadata(dist) self.assertIn('Metadata-Version: 1.1', meta) def test_long_description(self): long_desc = textwrap.dedent("""\ example:: We start here and continue here and end here.""") attrs = {"name": "package", "version": "1.0", "long_description": long_desc} dist = Distribution(attrs) meta = self.format_metadata(dist) meta = meta.replace('\n' + 8 * ' ', '\n') self.assertIn(long_desc, meta) def test_simple_metadata(self): attrs = {"name": "package", "version": "1.0"} dist = Distribution(attrs) meta = self.format_metadata(dist) self.assertIn("Metadata-Version: 1.0", meta) self.assertNotIn("provides:", meta.lower()) self.assertNotIn("requires:", meta.lower()) self.assertNotIn("obsoletes:", meta.lower()) def test_provides(self): attrs = {"name": "package", "version": "1.0", "provides": ["package", "package.sub"]} dist = Distribution(attrs) self.assertEqual(dist.metadata.get_provides(), ["package", "package.sub"]) self.assertEqual(dist.get_provides(), ["package", "package.sub"]) meta = self.format_metadata(dist) self.assertIn("Metadata-Version: 1.1", meta) self.assertNotIn("requires:", meta.lower()) self.assertNotIn("obsoletes:", meta.lower()) def test_provides_illegal(self): self.assertRaises(ValueError, Distribution, {"name": "package", "version": "1.0", "provides": ["my.pkg (splat)"]}) def test_requires(self): attrs = {"name": "package", "version": "1.0", "requires": ["other", "another (==1.0)"]} dist = Distribution(attrs) self.assertEqual(dist.metadata.get_requires(), ["other", "another (==1.0)"]) self.assertEqual(dist.get_requires(), ["other", "another (==1.0)"]) meta = self.format_metadata(dist) self.assertIn("Metadata-Version: 1.1", meta) self.assertNotIn("provides:", meta.lower()) self.assertIn("Requires: other", meta) self.assertIn("Requires: another (==1.0)", meta) self.assertNotIn("obsoletes:", meta.lower()) def test_requires_illegal(self): self.assertRaises(ValueError, Distribution, {"name": "package", "version": "1.0", "requires": ["my.pkg (splat)"]}) def test_obsoletes(self): attrs = {"name": "package", "version": "1.0", "obsoletes": ["other", "another (<1.0)"]} dist = Distribution(attrs) self.assertEqual(dist.metadata.get_obsoletes(), ["other", "another (<1.0)"]) self.assertEqual(dist.get_obsoletes(), ["other", "another (<1.0)"]) meta = self.format_metadata(dist) self.assertIn("Metadata-Version: 1.1", meta) self.assertNotIn("provides:", meta.lower()) self.assertNotIn("requires:", meta.lower()) self.assertIn("Obsoletes: other", meta) self.assertIn("Obsoletes: another (<1.0)", meta) def test_obsoletes_illegal(self): self.assertRaises(ValueError, Distribution, {"name": "package", "version": "1.0", "obsoletes": ["my.pkg (splat)"]}) def format_metadata(self, dist): sio = StringIO.StringIO() dist.metadata.write_pkg_file(sio) return sio.getvalue() def test_custom_pydistutils(self): # fixes #2166 # make sure pydistutils.cfg is found if os.name == 'posix': user_filename = ".pydistutils.cfg" else: user_filename = "pydistutils.cfg" temp_dir = self.mkdtemp() user_filename = os.path.join(temp_dir, user_filename) f = open(user_filename, 'w') try: f.write('.') finally: f.close() try: dist = Distribution() # linux-style if sys.platform in ('linux', 'darwin'): os.environ['HOME'] = temp_dir files = dist.find_config_files() self.assertIn(user_filename, files) # win32-style if sys.platform == 'win32': # home drive should be found os.environ['HOME'] = temp_dir files = dist.find_config_files() self.assertIn(user_filename, files, '%r not found in %r' % (user_filename, files)) finally: os.remove(user_filename) def test_fix_help_options(self): help_tuples = [('a', 'b', 'c', 'd'), (1, 2, 3, 4)] fancy_options = fix_help_options(help_tuples) self.assertEqual(fancy_options[0], ('a', 'b', 'c')) self.assertEqual(fancy_options[1], (1, 2, 3)) def test_show_help(self): # smoke test, just makes sure some help is displayed self.addCleanup(log.set_threshold, log._global_log.threshold) dist = Distribution() sys.argv = [] dist.help = 1 dist.script_name = 'setup.py' with captured_stdout() as s: dist.parse_command_line() output = [line for line in s.getvalue().split('\n') if line.strip() != ''] self.assertTrue(output) def test_read_metadata(self): attrs = {"name": "package", "version": "1.0", "long_description": "desc", "description": "xxx", "download_url": "http://example.com", "keywords": ['one', 'two'], "requires": ['foo']} dist = Distribution(attrs) metadata = dist.metadata # write it then reloads it PKG_INFO = StringIO.StringIO() metadata.write_pkg_file(PKG_INFO) PKG_INFO.seek(0) metadata.read_pkg_file(PKG_INFO) self.assertEqual(metadata.name, "package") self.assertEqual(metadata.version, "1.0") self.assertEqual(metadata.description, "xxx") self.assertEqual(metadata.download_url, 'http://example.com') self.assertEqual(metadata.keywords, ['one', 'two']) self.assertEqual(metadata.platforms, ['UNKNOWN']) self.assertEqual(metadata.obsoletes, None) self.assertEqual(metadata.requires, ['foo']) def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(DistributionTestCase)) suite.addTest(unittest.makeSuite(MetadataTestCase)) return suite if __name__ == "__main__": run_unittest(test_suite())
mit
[ 3, 1882, 2803, 26, 2774, 24, 1882, 199, 199, 624, 2925, 367, 7065, 14, 2686, 1041, 199, 646, 747, 199, 646, 5228, 199, 646, 984, 199, 646, 2882, 199, 646, 3598, 199, 646, 13390, 199, 199, 504, 7065, 14, 2686, 492, 11839, 12, 5325, 63, 3437, 63, 1419, 199, 504, 7065, 14, 1760, 492, 5817, 199, 646, 7065, 14, 2686, 199, 504, 511, 14, 396, 63, 4058, 492, 25788, 12, 17487, 63, 2703, 12, 1255, 63, 2796, 12, 17002, 199, 504, 7065, 14, 2219, 492, 2291, 199, 504, 7065, 492, 943, 421, 199, 533, 511, 63, 2686, 8, 3110, 304, 272, 408, 8176, 7065, 3329, 1414, 1041, 339, 922, 63, 1419, 275, 359, 267, 1689, 3271, 13, 1422, 11107, 298, 51, 401, 298, 3437, 1318, 1288, 267, 1622, 339, 347, 8265, 63, 1419, 8, 277, 304, 267, 291, 14, 3271, 63, 1422, 275, 488, 421, 199, 533, 1379, 8580, 8, 8580, 304, 272, 408, 8580, 9180, 626, 23674, 314, 849, 2754, 367, 272, 2897, 1584, 14, 339, 710, 13653, 888, 63, 1725, 2225, 1471, 506, 663, 2544, 272, 1275, 1122, 63, 888, 63, 1725, 342, 365, 2797, 14, 272, 408, 339, 347, 2342, 63, 888, 63, 1725, 8, 277, 304, 267, 372, 291, 423, 888, 63, 1725, 421, 199, 533, 11839, 1746, 8, 4058, 14, 6530, 694, 2988, 12, 2574, 2291, 14, 14054, 51, 441, 78, 2247, 12, 2574, 2291, 14, 23027, 18183, 12, 2574, 2882, 14, 1746, 304, 339, 347, 3613, 8, 277, 304, 267, 1613, 8, 8580, 1746, 12, 291, 680, 5996, 342, 267, 291, 14, 3020, 275, 984, 14, 3020, 12, 984, 14, 3020, 5873, 267, 2150, 984, 14, 3020, 59, 17, 2938, 339, 347, 6766, 8, 277, 304, 267, 984, 14, 3020, 275, 291, 14, 3020, 59, 16, 61, 267, 984, 14, 3020, 5873, 275, 291, 14, 3020, 59, 17, 61, 267, 1613, 8, 8580, 1746, 12, 291, 680, 12336, 342, 339, 347, 1218, 63, 4972, 8, 277, 12, 1101, 1725, 23603, 267, 366, 275, 1379, 8580, 342, 267, 366, 423, 888, 63, 1725, 275, 1101, 1725, 267, 366, 14, 1122, 63, 888, 63, 1725, 342, 267, 366, 14, 1122, 63, 1531, 63, 604, 342, 267, 372, 366, 339, 347, 511, 63, 1757, 63, 632, 8, 277, 304, 267, 543, 1551, 8, 10179, 12, 298, 87, 531, 465, 289, 26, 288, 289, 14, 952, 10994, 2966, 7272, 78, 531, 288, 289, 14, 952, 480, 1531, 63, 5154, 275, 3925, 14, 1700, 12, 308, 14156, 531, 267, 291, 14, 12808, 8, 7162, 12, 25788, 9, 398, 1584, 275, 359, 10179, 61, 267, 984, 14, 3020, 14, 740, 480, 1506, 531, 398, 543, 17487, 63, 2703, 342, 465, 3839, 26, 288, 291, 14, 981, 63, 4972, 8, 1725, 9, 267, 3839, 14, 5507, 8, 16, 9, 267, 291, 14, 629, 8, 2703, 14, 739, 1062, 4074, 267, 7065, 14, 2686, 14, 5287, 275, 715, 267, 862, 26, 288, 543, 17487, 63, 2703, 342, 465, 3839, 26, 355, 291, 14, 981, 63, 4972, 8, 1725, 9, 288, 3839, 14, 5507, 8, 16, 9, 288, 291, 14, 629, 8, 2703, 14, 739, 1062, 4074, 267, 3753, 26, 288, 7065, 14, 2686, 14, 5287, 275, 756, 339, 347, 511, 63, 1531, 63, 5154, 63, 324, 10085, 8, 277, 304, 267, 984, 14, 3020, 14, 740, 480, 1506, 531, 267, 366, 275, 291, 14, 981, 63, 4972, 342, 267, 291, 14, 629, 8, 68, 14, 362, 63, 1531, 63, 5154, 1062, 2097, 13350, 14, 1531, 3135, 339, 347, 511, 63, 1531, 63, 5154, 63, 15612, 8, 277, 304, 267, 687, 7065, 14, 2219, 14, 396, 63, 2686, 492, 511, 63, 2686, 267, 984, 14, 3020, 14, 2880, 5234, 306, 1531, 13, 5154, 401, 586, 298, 1421, 14, 1700, 12, 13350, 14, 2219, 401, 586, 298, 396, 63, 2686, 401, 586, 3905, 51, 3972, 505, 401, 586, 4794, 267, 366, 275, 291, 14, 981, 63, 4972, 342, 267, 327, 4691, 1159, 5965, 862, 370, 2248, 4154, 511, 1414, 26, 267, 291, 14, 629, 8, 68, 14, 362, 63, 1531, 63, 5154, 1062, 586, 2097, 13350, 14, 1531, 401, 298, 1421, 14, 1700, 401, 298, 13350, 14, 2219, 3135, 267, 2088, 275, 366, 14, 362, 63, 1531, 63, 1113, 480, 396, 63, 2686, 531, 267, 291, 14, 6926, 8, 1760, 12, 511, 63, 2686, 9, 267, 291, 14, 629, 8, 1760, 14, 3271, 63, 1422, 12, 298, 3972, 505, 531, 339, 347, 511, 63, 1531, 63, 5154, 63, 29217, 8, 277, 304, 267, 984, 14, 3020, 14, 740, 480, 1506, 531, 267, 291, 14, 12808, 8, 736, 14, 7162, 12, 25788, 9, 267, 289, 275, 1551, 8, 10179, 12, 298, 87, 531, 267, 862, 26, 288, 870, 4331, 289, 12, 7369, 2966, 8480, 288, 870, 4331, 289, 12, 298, 1531, 63, 5154, 275, 3925, 14, 1700, 12, 308, 14156, 2, 267, 3753, 26, 288, 289, 14, 1600, 342, 398, 366, 275, 291, 14, 981, 63, 4972, 779, 10179, 566, 267, 291, 14, 629, 8, 68, 14, 362, 63, 1531, 63, 5154, 1062, 586, 2097, 13350, 14, 1531, 401, 298, 1421, 14, 1700, 401, 298, 681, 4452, 3135, 398, 327, 4868, 1414, 1004, 10580, 1101, 26, 267, 984, 14, 3020, 59, 17, 2938, 275, 22448, 1531, 13, 5154, 401, 298, 681, 4708, 401, 298, 1506, 937, 267, 366, 275, 291, 14, 981, 63, 4972, 779, 10179, 566, 267, 291, 14, 629, 8, 68, 14, 362, 63, 1531, 63, 5154, 1062, 586, 2097, 13350, 14, 1531, 401, 298, 681, 4708, 3135, 398, 327, 13510, 1553, 1531, 13, 5154, 370, 2125, 1077, 7675, 314, 849, 370, 267, 327, 506, 1202, 2755, 340, 282, 1101, 570, 2013, 6020, 587, 26, 267, 984, 14, 3020, 59, 17, 2938, 275, 22448, 1531, 13, 5154, 401, 4873, 298, 1506, 937, 267, 366, 275, 291, 14, 981, 63, 4972, 779, 10179, 566, 267, 291, 14, 629, 8, 68, 14, 362, 63, 1531, 63, 5154, 1062, 2097, 13350, 14, 1531, 3135, 339, 347, 511, 63, 952, 63, 4600, 63, 493, 8, 277, 304, 267, 327, 2670, 11839, 5142, 7252, 402, 6140, 1504, 267, 3529, 63, 694, 275, 291, 14, 11983, 342, 267, 3002, 63, 493, 275, 747, 14, 515, 14, 904, 8, 2791, 63, 694, 12, 283 ]
[ 1882, 2803, 26, 2774, 24, 1882, 199, 199, 624, 2925, 367, 7065, 14, 2686, 1041, 199, 646, 747, 199, 646, 5228, 199, 646, 984, 199, 646, 2882, 199, 646, 3598, 199, 646, 13390, 199, 199, 504, 7065, 14, 2686, 492, 11839, 12, 5325, 63, 3437, 63, 1419, 199, 504, 7065, 14, 1760, 492, 5817, 199, 646, 7065, 14, 2686, 199, 504, 511, 14, 396, 63, 4058, 492, 25788, 12, 17487, 63, 2703, 12, 1255, 63, 2796, 12, 17002, 199, 504, 7065, 14, 2219, 492, 2291, 199, 504, 7065, 492, 943, 421, 199, 533, 511, 63, 2686, 8, 3110, 304, 272, 408, 8176, 7065, 3329, 1414, 1041, 339, 922, 63, 1419, 275, 359, 267, 1689, 3271, 13, 1422, 11107, 298, 51, 401, 298, 3437, 1318, 1288, 267, 1622, 339, 347, 8265, 63, 1419, 8, 277, 304, 267, 291, 14, 3271, 63, 1422, 275, 488, 421, 199, 533, 1379, 8580, 8, 8580, 304, 272, 408, 8580, 9180, 626, 23674, 314, 849, 2754, 367, 272, 2897, 1584, 14, 339, 710, 13653, 888, 63, 1725, 2225, 1471, 506, 663, 2544, 272, 1275, 1122, 63, 888, 63, 1725, 342, 365, 2797, 14, 272, 408, 339, 347, 2342, 63, 888, 63, 1725, 8, 277, 304, 267, 372, 291, 423, 888, 63, 1725, 421, 199, 533, 11839, 1746, 8, 4058, 14, 6530, 694, 2988, 12, 2574, 2291, 14, 14054, 51, 441, 78, 2247, 12, 2574, 2291, 14, 23027, 18183, 12, 2574, 2882, 14, 1746, 304, 339, 347, 3613, 8, 277, 304, 267, 1613, 8, 8580, 1746, 12, 291, 680, 5996, 342, 267, 291, 14, 3020, 275, 984, 14, 3020, 12, 984, 14, 3020, 5873, 267, 2150, 984, 14, 3020, 59, 17, 2938, 339, 347, 6766, 8, 277, 304, 267, 984, 14, 3020, 275, 291, 14, 3020, 59, 16, 61, 267, 984, 14, 3020, 5873, 275, 291, 14, 3020, 59, 17, 61, 267, 1613, 8, 8580, 1746, 12, 291, 680, 12336, 342, 339, 347, 1218, 63, 4972, 8, 277, 12, 1101, 1725, 23603, 267, 366, 275, 1379, 8580, 342, 267, 366, 423, 888, 63, 1725, 275, 1101, 1725, 267, 366, 14, 1122, 63, 888, 63, 1725, 342, 267, 366, 14, 1122, 63, 1531, 63, 604, 342, 267, 372, 366, 339, 347, 511, 63, 1757, 63, 632, 8, 277, 304, 267, 543, 1551, 8, 10179, 12, 298, 87, 531, 465, 289, 26, 288, 289, 14, 952, 10994, 2966, 7272, 78, 531, 288, 289, 14, 952, 480, 1531, 63, 5154, 275, 3925, 14, 1700, 12, 308, 14156, 531, 267, 291, 14, 12808, 8, 7162, 12, 25788, 9, 398, 1584, 275, 359, 10179, 61, 267, 984, 14, 3020, 14, 740, 480, 1506, 531, 398, 543, 17487, 63, 2703, 342, 465, 3839, 26, 288, 291, 14, 981, 63, 4972, 8, 1725, 9, 267, 3839, 14, 5507, 8, 16, 9, 267, 291, 14, 629, 8, 2703, 14, 739, 1062, 4074, 267, 7065, 14, 2686, 14, 5287, 275, 715, 267, 862, 26, 288, 543, 17487, 63, 2703, 342, 465, 3839, 26, 355, 291, 14, 981, 63, 4972, 8, 1725, 9, 288, 3839, 14, 5507, 8, 16, 9, 288, 291, 14, 629, 8, 2703, 14, 739, 1062, 4074, 267, 3753, 26, 288, 7065, 14, 2686, 14, 5287, 275, 756, 339, 347, 511, 63, 1531, 63, 5154, 63, 324, 10085, 8, 277, 304, 267, 984, 14, 3020, 14, 740, 480, 1506, 531, 267, 366, 275, 291, 14, 981, 63, 4972, 342, 267, 291, 14, 629, 8, 68, 14, 362, 63, 1531, 63, 5154, 1062, 2097, 13350, 14, 1531, 3135, 339, 347, 511, 63, 1531, 63, 5154, 63, 15612, 8, 277, 304, 267, 687, 7065, 14, 2219, 14, 396, 63, 2686, 492, 511, 63, 2686, 267, 984, 14, 3020, 14, 2880, 5234, 306, 1531, 13, 5154, 401, 586, 298, 1421, 14, 1700, 12, 13350, 14, 2219, 401, 586, 298, 396, 63, 2686, 401, 586, 3905, 51, 3972, 505, 401, 586, 4794, 267, 366, 275, 291, 14, 981, 63, 4972, 342, 267, 327, 4691, 1159, 5965, 862, 370, 2248, 4154, 511, 1414, 26, 267, 291, 14, 629, 8, 68, 14, 362, 63, 1531, 63, 5154, 1062, 586, 2097, 13350, 14, 1531, 401, 298, 1421, 14, 1700, 401, 298, 13350, 14, 2219, 3135, 267, 2088, 275, 366, 14, 362, 63, 1531, 63, 1113, 480, 396, 63, 2686, 531, 267, 291, 14, 6926, 8, 1760, 12, 511, 63, 2686, 9, 267, 291, 14, 629, 8, 1760, 14, 3271, 63, 1422, 12, 298, 3972, 505, 531, 339, 347, 511, 63, 1531, 63, 5154, 63, 29217, 8, 277, 304, 267, 984, 14, 3020, 14, 740, 480, 1506, 531, 267, 291, 14, 12808, 8, 736, 14, 7162, 12, 25788, 9, 267, 289, 275, 1551, 8, 10179, 12, 298, 87, 531, 267, 862, 26, 288, 870, 4331, 289, 12, 7369, 2966, 8480, 288, 870, 4331, 289, 12, 298, 1531, 63, 5154, 275, 3925, 14, 1700, 12, 308, 14156, 2, 267, 3753, 26, 288, 289, 14, 1600, 342, 398, 366, 275, 291, 14, 981, 63, 4972, 779, 10179, 566, 267, 291, 14, 629, 8, 68, 14, 362, 63, 1531, 63, 5154, 1062, 586, 2097, 13350, 14, 1531, 401, 298, 1421, 14, 1700, 401, 298, 681, 4452, 3135, 398, 327, 4868, 1414, 1004, 10580, 1101, 26, 267, 984, 14, 3020, 59, 17, 2938, 275, 22448, 1531, 13, 5154, 401, 298, 681, 4708, 401, 298, 1506, 937, 267, 366, 275, 291, 14, 981, 63, 4972, 779, 10179, 566, 267, 291, 14, 629, 8, 68, 14, 362, 63, 1531, 63, 5154, 1062, 586, 2097, 13350, 14, 1531, 401, 298, 681, 4708, 3135, 398, 327, 13510, 1553, 1531, 13, 5154, 370, 2125, 1077, 7675, 314, 849, 370, 267, 327, 506, 1202, 2755, 340, 282, 1101, 570, 2013, 6020, 587, 26, 267, 984, 14, 3020, 59, 17, 2938, 275, 22448, 1531, 13, 5154, 401, 4873, 298, 1506, 937, 267, 366, 275, 291, 14, 981, 63, 4972, 779, 10179, 566, 267, 291, 14, 629, 8, 68, 14, 362, 63, 1531, 63, 5154, 1062, 2097, 13350, 14, 1531, 3135, 339, 347, 511, 63, 952, 63, 4600, 63, 493, 8, 277, 304, 267, 327, 2670, 11839, 5142, 7252, 402, 6140, 1504, 267, 3529, 63, 694, 275, 291, 14, 11983, 342, 267, 3002, 63, 493, 275, 747, 14, 515, 14, 904, 8, 2791, 63, 694, 12, 283, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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 ]
alexsanjoseph/duolingo-save-streak
chardet/sjisprober.py
290
3774
######################## 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 SJISDistributionAnalysis from .jpcntx import SJISContextAnalysis from .mbcssm import SJIS_SM_MODEL from .enums import ProbingState, MachineState class SJISProber(MultiByteCharSetProber): def __init__(self): super(SJISProber, self).__init__() self.coding_sm = CodingStateMachine(SJIS_SM_MODEL) self.distribution_analyzer = SJISDistributionAnalysis() self.context_analyzer = SJISContextAnalysis() self.reset() def reset(self): super(SJISProber, self).reset() self.context_analyzer.reset() @property def charset_name(self): return self.context_analyzer.charset_name @property def language(self): return "Japanese" def feed(self, byte_str): for i in range(len(byte_str)): coding_state = self.coding_sm.next_state(byte_str[i]) if coding_state == MachineState.ERROR: self.logger.debug('%s %s prober hit error at byte %s', self.charset_name, self.language, i) self._state = ProbingState.NOT_ME break elif coding_state == MachineState.ITS_ME: self._state = ProbingState.FOUND_IT break elif coding_state == MachineState.START: char_len = self.coding_sm.get_current_charlen() if i == 0: self._last_char[1] = byte_str[0] self.context_analyzer.feed(self._last_char[2 - char_len:], char_len) self.distribution_analyzer.feed(self._last_char, char_len) else: self.context_analyzer.feed(byte_str[i + 1 - char_len:i + 3 - char_len], char_len) self.distribution_analyzer.feed(byte_str[i - 1:i + 1], char_len) self._last_char[0] = byte_str[-1] if self.state == ProbingState.DETECTING: if (self.context_analyzer.got_enough_data() and (self.get_confidence() > self.SHORTCUT_THRESHOLD)): self._state = ProbingState.FOUND_IT return self.state def get_confidence(self): context_conf = self.context_analyzer.get_confidence() distrib_conf = self.distribution_analyzer.get_confidence() return max(context_conf, distrib_conf)
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, 428, 22290, 24906, 199, 504, 1275, 74, 2352, 343, 88, 492, 428, 22290, 2998, 13182, 199, 504, 1275, 887, 3919, 77, 492, 428, 22290, 63, 4029, 63, 11429, 199, 504, 1275, 19921, 492, 2165, 10911, 2223, 12, 18722, 2223, 421, 199, 533, 428, 22290, 8029, 8, 3947, 21312, 304, 272, 347, 636, 826, 721, 277, 304, 267, 1613, 8, 51, 22290, 8029, 12, 291, 2843, 826, 4533, 267, 291, 14, 1523, 63, 3300, 275, 30539, 8, 51, 22290, 63, 4029, 63, 11429, 9, 267, 291, 14, 4972, 63, 17965, 275, 428, 22290, 24906, 342, 267, 291, 14, 1100, 63, 17965, 275, 428, 22290, 2998, 13182, 342, 267, 291, 14, 3958, 342, 339, 347, 5305, 8, 277, 304, 267, 1613, 8, 51, 22290, 8029, 12, 291, 680, 3958, 342, 267, 291, 14, 1100, 63, 17965, 14, 3958, 342, 339, 768, 1829, 272, 347, 5960, 63, 354, 8, 277, 304, 267, 372, 291, 14, 1100, 63, 17965, 14, 6043, 63, 354, 339, 768, 1829, 272, 347, 2637, 8, 277, 304, 267, 372, 298, 42, 30699, 2, 339, 347, 4733, 8, 277, 12, 3696, 63, 495, 304, 267, 367, 284, 315, 1425, 8, 552, 8, 4414, 63, 495, 2298, 288, 2803, 63, 929, 275, 291, 14, 1523, 63, 3300, 14, 2184, 63, 929, 8, 4414, 63, 495, 59, 73, 566, 288, 340, 2803, 63, 929, 508, 18722, 2223, 14, 3170, 26, 355, 291, 14, 2921, 14, 1757, 3508, 83, 450, 83, 16118, 9793, 1125, 737, 3696, 450, 83, 297, 3303, 291, 14, 6043, 63, 354, 12, 291, 14, 3671, 12, 284, 9, 355, 291, 423, 929, 275, 2165, 10911, 2223, 14, 4609, 63, 3635, 355, 2059, 288, 916, 2803, 63, 929, 508, 18722, 2223, 14, 5930, 63, 3635, 26, 355, 291, 423, 929, 275, 2165, 10911, 2223, 14, 13945, 63, 649, 355, 2059, 288, 916, 2803, 63, 929, 508, 18722, 2223, 14, 7363, 26, 355, 1495, 63, 552, 275, 291, 14, 1523, 63, 3300, 14, 362, 63, 1818, 63, 1560, 552, 342, 355, 340, 284, 508, 378, 26, 490, 291, 423, 2019, 63, 1560, 59, 17, 61, 275, 3696, 63, 495, 59, 16, 61, 490, 291, 14, 1100, 63, 17965, 14, 3871, 8, 277, 423, 2019, 63, 1560, 59, 18, 446, 1495, 63, 552, 8429, 6901, 1495, 63, 552, 9, 490, 291, 14, 4972, 63, 17965, 14, 3871, 8, 277, 423, 2019, 63, 1560, 12, 1495, 63, 552, 9, 355, 587, 26, 490, 291, 14, 1100, 63, 17965, 14, 3871, 8, 4414, 63, 495, 59, 73, 435, 413, 446, 1495, 63, 552, 26, 73, 435, 650, 9144, 446, 1495, 63, 552, 467, 1495, 63, 552, 9, 490, 291, 14, 4972, 63, 17965, 14, 3871, 8, 4414, 63, 495, 59, 73, 446, 413, 26, 73, 435, 413, 467, 8105, 1495, 63, 552, 9, 398, 291, 423, 2019, 63, 1560, 59, 16, 61, 275, 3696, 63, 495, 1988, 17, 61, 398, 340, 291, 14, 929, 508, 2165, 10911, 2223, 14, 17442, 3582, 1206, 26, 288, 340, 334, 277, 14, 1100, 63, 17965, 14, 7808, 63, 30881, 63, 576, 342, 436, 2049, 334, 277, 14, 362, 63, 13969, 342, 690, 291, 14, 13003, 24678, 63, 19307, 2298, 355, 291, 423, 929, 275, 2165, 10911, 2223, 14, 13945, 63, 649, 398, 372, 291, 14, 929, 339, 347, 664, 63, 13969, 8, 277, 304, 267, 1067, 63, 2190, 275, 291, 14, 1100, 63, 17965, 14, 362, 63, 13969, 342, 267, 29573, 63, 2190, 275, 291, 14, 4972, 63, 17965, 14, 362, 63, 13969, 342, 267, 372, 1390, 8, 1100, 63, 2190, 12, 29573, 63, 2190, 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 ]
[ 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, 428, 22290, 24906, 199, 504, 1275, 74, 2352, 343, 88, 492, 428, 22290, 2998, 13182, 199, 504, 1275, 887, 3919, 77, 492, 428, 22290, 63, 4029, 63, 11429, 199, 504, 1275, 19921, 492, 2165, 10911, 2223, 12, 18722, 2223, 421, 199, 533, 428, 22290, 8029, 8, 3947, 21312, 304, 272, 347, 636, 826, 721, 277, 304, 267, 1613, 8, 51, 22290, 8029, 12, 291, 2843, 826, 4533, 267, 291, 14, 1523, 63, 3300, 275, 30539, 8, 51, 22290, 63, 4029, 63, 11429, 9, 267, 291, 14, 4972, 63, 17965, 275, 428, 22290, 24906, 342, 267, 291, 14, 1100, 63, 17965, 275, 428, 22290, 2998, 13182, 342, 267, 291, 14, 3958, 342, 339, 347, 5305, 8, 277, 304, 267, 1613, 8, 51, 22290, 8029, 12, 291, 680, 3958, 342, 267, 291, 14, 1100, 63, 17965, 14, 3958, 342, 339, 768, 1829, 272, 347, 5960, 63, 354, 8, 277, 304, 267, 372, 291, 14, 1100, 63, 17965, 14, 6043, 63, 354, 339, 768, 1829, 272, 347, 2637, 8, 277, 304, 267, 372, 298, 42, 30699, 2, 339, 347, 4733, 8, 277, 12, 3696, 63, 495, 304, 267, 367, 284, 315, 1425, 8, 552, 8, 4414, 63, 495, 2298, 288, 2803, 63, 929, 275, 291, 14, 1523, 63, 3300, 14, 2184, 63, 929, 8, 4414, 63, 495, 59, 73, 566, 288, 340, 2803, 63, 929, 508, 18722, 2223, 14, 3170, 26, 355, 291, 14, 2921, 14, 1757, 3508, 83, 450, 83, 16118, 9793, 1125, 737, 3696, 450, 83, 297, 3303, 291, 14, 6043, 63, 354, 12, 291, 14, 3671, 12, 284, 9, 355, 291, 423, 929, 275, 2165, 10911, 2223, 14, 4609, 63, 3635, 355, 2059, 288, 916, 2803, 63, 929, 508, 18722, 2223, 14, 5930, 63, 3635, 26, 355, 291, 423, 929, 275, 2165, 10911, 2223, 14, 13945, 63, 649, 355, 2059, 288, 916, 2803, 63, 929, 508, 18722, 2223, 14, 7363, 26, 355, 1495, 63, 552, 275, 291, 14, 1523, 63, 3300, 14, 362, 63, 1818, 63, 1560, 552, 342, 355, 340, 284, 508, 378, 26, 490, 291, 423, 2019, 63, 1560, 59, 17, 61, 275, 3696, 63, 495, 59, 16, 61, 490, 291, 14, 1100, 63, 17965, 14, 3871, 8, 277, 423, 2019, 63, 1560, 59, 18, 446, 1495, 63, 552, 8429, 6901, 1495, 63, 552, 9, 490, 291, 14, 4972, 63, 17965, 14, 3871, 8, 277, 423, 2019, 63, 1560, 12, 1495, 63, 552, 9, 355, 587, 26, 490, 291, 14, 1100, 63, 17965, 14, 3871, 8, 4414, 63, 495, 59, 73, 435, 413, 446, 1495, 63, 552, 26, 73, 435, 650, 9144, 446, 1495, 63, 552, 467, 1495, 63, 552, 9, 490, 291, 14, 4972, 63, 17965, 14, 3871, 8, 4414, 63, 495, 59, 73, 446, 413, 26, 73, 435, 413, 467, 8105, 1495, 63, 552, 9, 398, 291, 423, 2019, 63, 1560, 59, 16, 61, 275, 3696, 63, 495, 1988, 17, 61, 398, 340, 291, 14, 929, 508, 2165, 10911, 2223, 14, 17442, 3582, 1206, 26, 288, 340, 334, 277, 14, 1100, 63, 17965, 14, 7808, 63, 30881, 63, 576, 342, 436, 2049, 334, 277, 14, 362, 63, 13969, 342, 690, 291, 14, 13003, 24678, 63, 19307, 2298, 355, 291, 423, 929, 275, 2165, 10911, 2223, 14, 13945, 63, 649, 398, 372, 291, 14, 929, 339, 347, 664, 63, 13969, 8, 277, 304, 267, 1067, 63, 2190, 275, 291, 14, 1100, 63, 17965, 14, 362, 63, 13969, 342, 267, 29573, 63, 2190, 275, 291, 14, 4972, 63, 17965, 14, 362, 63, 13969, 342, 267, 372, 1390, 8, 1100, 63, 2190, 12, 29573, 63, 2190, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
farhi-naz/phantomjs
src/qt/qtwebkit/Tools/Scripts/webkitpy/common/net/irc/ircbot.py
127
4228
# Copyright (c) 2010 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. from webkitpy.common.config import irc as config_irc from webkitpy.common.thread.messagepump import MessagePump, MessagePumpDelegate from webkitpy.thirdparty.autoinstalled.irc import ircbot from webkitpy.thirdparty.autoinstalled.irc import irclib class IRCBotDelegate(object): def irc_message_received(self, nick, message): raise NotImplementedError, "subclasses must implement" def irc_nickname(self): raise NotImplementedError, "subclasses must implement" def irc_password(self): raise NotImplementedError, "subclasses must implement" class IRCBot(ircbot.SingleServerIRCBot, MessagePumpDelegate): # FIXME: We should get this information from a config file. def __init__(self, message_queue, delegate): self._message_queue = message_queue self._delegate = delegate ircbot.SingleServerIRCBot.__init__( self, [( config_irc.server, config_irc.port, self._delegate.irc_password() )], self._delegate.irc_nickname(), self._delegate.irc_nickname()) self._channel = config_irc.channel # ircbot.SingleServerIRCBot methods def on_nicknameinuse(self, connection, event): connection.nick(connection.get_nickname() + "_") def on_welcome(self, connection, event): connection.join(self._channel) self._message_pump = MessagePump(self, self._message_queue) def on_pubmsg(self, connection, event): nick = irclib.nm_to_n(event.source()) request = event.arguments()[0] if not irclib.irc_lower(request).startswith(irclib.irc_lower(connection.get_nickname())): return if len(request) <= len(connection.get_nickname()): return # Some IRC clients, like xchat-gnome, default to using a comma # when addressing someone. vocative_separator = request[len(connection.get_nickname())] if vocative_separator == ':': request = request.split(':', 1) elif vocative_separator == ',': request = request.split(',', 1) else: return if len(request) > 1: response = self._delegate.irc_message_received(nick, request[1]) if response: connection.privmsg(self._channel, response) # MessagePumpDelegate methods def schedule(self, interval, callback): self.connection.execute_delayed(interval, callback) def message_available(self, message): self.connection.privmsg(self._channel, message) def final_message_delivered(self): self.die()
bsd-3-clause
[ 3, 1898, 334, 67, 9, 7129, 4475, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 199, 3, 10114, 436, 675, 315, 1350, 436, 3366, 4513, 12, 543, 503, 1928, 199, 3, 7100, 12, 787, 8211, 2741, 626, 314, 2569, 3704, 787, 199, 3, 7647, 26, 199, 3, 199, 3, 258, 627, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 3, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 3, 258, 627, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 199, 3, 4248, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 199, 3, 315, 314, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 199, 3, 4084, 14, 199, 3, 258, 627, 11443, 314, 536, 402, 4475, 3277, 14, 6590, 314, 1561, 402, 2399, 199, 3, 8417, 1443, 506, 1202, 370, 10692, 503, 10016, 7585, 7131, 687, 199, 3, 642, 2032, 1928, 2488, 6791, 5313, 4983, 14, 199, 3, 199, 3, 5749, 4141, 2281, 7049, 6515, 2334, 5877, 8164, 2401, 6483, 199, 3, 298, 1179, 2281, 2, 2401, 1821, 7168, 1549, 5292, 2990, 12, 6931, 12, 5400, 2845, 199, 3, 5471, 2296, 12, 2334, 5292, 2990, 1634, 3169, 2401, 3092, 2381, 199, 3, 437, 3115, 3104, 9315, 9706, 14, 1621, 4825, 6461, 7000, 2334, 5877, 199, 3, 11489, 1549, 6483, 6262, 7024, 2381, 1821, 8703, 12, 9168, 12, 9716, 12, 199, 3, 8820, 12, 9836, 12, 1549, 9110, 6736, 334, 6446, 12, 5400, 2845, 199, 3, 5471, 2296, 12, 9838, 1634, 9103, 9764, 1549, 9714, 27, 9102, 1634, 4815, 12, 199, 3, 7126, 12, 1549, 9206, 27, 1549, 9748, 9831, 9, 9802, 9817, 2401, 5258, 1821, 199, 3, 9815, 1634, 5603, 12, 7061, 1621, 7066, 12, 9644, 5603, 12, 1549, 7056, 199, 3, 334, 6446, 9254, 1549, 7334, 9, 7043, 1621, 1821, 9683, 5738, 1634, 2334, 4815, 199, 3, 1634, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 9726, 1634, 9712, 9784, 14, 199, 199, 504, 18007, 14, 2330, 14, 888, 492, 22157, 465, 1101, 63, 5958, 199, 199, 504, 18007, 14, 2330, 14, 2671, 14, 1188, 29547, 492, 6430, 48, 1220, 12, 6430, 48, 1220, 21553, 199, 504, 18007, 14, 11470, 7522, 14, 2495, 7657, 14, 5958, 492, 22157, 3018, 199, 504, 18007, 14, 11470, 7522, 14, 2495, 7657, 14, 5958, 492, 22157, 773, 421, 199, 533, 473, 8205, 14026, 21553, 8, 785, 304, 272, 347, 22157, 63, 1188, 63, 9226, 8, 277, 12, 14900, 12, 1245, 304, 267, 746, 4279, 12, 298, 19094, 1471, 5669, 2, 339, 347, 22157, 63, 18544, 8, 277, 304, 267, 746, 4279, 12, 298, 19094, 1471, 5669, 2, 339, 347, 22157, 63, 2060, 8, 277, 304, 267, 746, 4279, 12, 298, 19094, 1471, 5669, 2, 421, 199, 533, 473, 8205, 14026, 8, 723, 2894, 357, 14, 7200, 3120, 3927, 9956, 357, 12, 6430, 48, 1220, 21553, 304, 272, 327, 7600, 26, 2136, 1077, 664, 642, 2556, 687, 282, 1101, 570, 14, 272, 347, 636, 826, 721, 277, 12, 326, 1245, 63, 1825, 12, 326, 13080, 304, 267, 291, 423, 1188, 63, 1825, 275, 1245, 63, 1825, 267, 291, 423, 15286, 275, 13080, 267, 22157, 3018, 14, 7200, 3120, 3927, 9956, 357, 855, 826, 721, 288, 291, 12, 288, 3842, 355, 1101, 63, 5958, 14, 1000, 12, 355, 1101, 63, 5958, 14, 719, 12, 355, 291, 423, 15286, 14, 5958, 63, 2060, 342, 288, 776, 467, 288, 291, 423, 15286, 14, 5958, 63, 18544, 1062, 288, 291, 423, 15286, 14, 5958, 63, 18544, 1012, 267, 291, 423, 2775, 275, 1101, 63, 5958, 14, 2775, 339, 327, 22157, 3018, 14, 7200, 3120, 3927, 9956, 357, 3102, 339, 347, 641, 63, 18544, 262, 1180, 8, 277, 12, 1950, 12, 1566, 304, 267, 1950, 14, 11082, 8, 2105, 14, 362, 63, 18544, 342, 435, 2668, 531, 339, 347, 641, 63, 28508, 8, 277, 12, 1950, 12, 1566, 304, 267, 1950, 14, 904, 8, 277, 423, 2775, 9, 267, 291, 423, 1188, 63, 29547, 275, 6430, 48, 1220, 8, 277, 12, 291, 423, 1188, 63, 1825, 9, 339, 347, 641, 63, 5645, 1328, 8, 277, 12, 1950, 12, 1566, 304, 267, 14900, 275, 22157, 773, 14, 10756, 63, 475, 63, 78, 8, 1430, 14, 1365, 1012, 267, 1056, 275, 1566, 14, 4958, 3430, 16, 61, 398, 340, 440, 22157, 773, 14, 5958, 63, 2325, 8, 1069, 680, 2460, 8, 5958, 773, 14, 5958, 63, 2325, 8, 2105, 14, 362, 63, 18544, 28256, 288, 372, 398, 340, 822, 8, 1069, 9, 2695, 822, 8, 2105, 14, 362, 63, 18544, 5109, 288, 372, 398, 327, 6601, 473, 8205, 13431, 12, 2839, 671, 10289, 13, 784, 1377, 12, 849, 370, 1808, 282, 10029, 267, 327, 1380, 2287, 316, 17122, 14, 267, 373, 679, 1905, 63, 9896, 275, 1056, 59, 552, 8, 2105, 14, 362, 63, 18544, 24821, 267, 340, 373, 679, 1905, 63, 9896, 508, 7596, 356, 288, 1056, 275, 1056, 14, 1294, 16451, 413, 9, 267, 916, 373, 679, 1905, 63, 9896, 508, 1656, 356, 288, 1056, 275, 1056, 14, 1294, 32718, 413, 9, 267, 587, 26, 288, 372, 398, 340, 822, 8, 1069, 9, 690, 413, 26, 288, 1177, 275, 291, 423, 15286, 14, 5958, 63, 1188, 63, 9226, 8, 11082, 12, 1056, 59, 17, 566, 288, 340, 1177, 26, 355, 1950, 14, 10605, 1328, 8, 277, 423, 2775, 12, 1177, 9, 339, 327, 6430, 48, 1220, 21553, 3102, 339, 347, 8732, 8, 277, 12, 6252, 12, 3233, 304, 267, 291, 14, 2105, 14, 2526, 63, 21830, 8, 4284, 12, 3233, 9, 339, 347, 1245, 63, 4561, 8, 277, 12, 1245, 304, 267, 291, 14, 2105, 14, 10605, 1328, 8, 277, 423, 2775, 12, 1245, 9, 339, 347, 4242, 63, 1188, 63, 30480, 8, 277, 304, 267, 291, 14, 15130, 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 ]
[ 1898, 334, 67, 9, 7129, 4475, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 199, 3, 10114, 436, 675, 315, 1350, 436, 3366, 4513, 12, 543, 503, 1928, 199, 3, 7100, 12, 787, 8211, 2741, 626, 314, 2569, 3704, 787, 199, 3, 7647, 26, 199, 3, 199, 3, 258, 627, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 3, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 3, 258, 627, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 199, 3, 4248, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 199, 3, 315, 314, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 199, 3, 4084, 14, 199, 3, 258, 627, 11443, 314, 536, 402, 4475, 3277, 14, 6590, 314, 1561, 402, 2399, 199, 3, 8417, 1443, 506, 1202, 370, 10692, 503, 10016, 7585, 7131, 687, 199, 3, 642, 2032, 1928, 2488, 6791, 5313, 4983, 14, 199, 3, 199, 3, 5749, 4141, 2281, 7049, 6515, 2334, 5877, 8164, 2401, 6483, 199, 3, 298, 1179, 2281, 2, 2401, 1821, 7168, 1549, 5292, 2990, 12, 6931, 12, 5400, 2845, 199, 3, 5471, 2296, 12, 2334, 5292, 2990, 1634, 3169, 2401, 3092, 2381, 199, 3, 437, 3115, 3104, 9315, 9706, 14, 1621, 4825, 6461, 7000, 2334, 5877, 199, 3, 11489, 1549, 6483, 6262, 7024, 2381, 1821, 8703, 12, 9168, 12, 9716, 12, 199, 3, 8820, 12, 9836, 12, 1549, 9110, 6736, 334, 6446, 12, 5400, 2845, 199, 3, 5471, 2296, 12, 9838, 1634, 9103, 9764, 1549, 9714, 27, 9102, 1634, 4815, 12, 199, 3, 7126, 12, 1549, 9206, 27, 1549, 9748, 9831, 9, 9802, 9817, 2401, 5258, 1821, 199, 3, 9815, 1634, 5603, 12, 7061, 1621, 7066, 12, 9644, 5603, 12, 1549, 7056, 199, 3, 334, 6446, 9254, 1549, 7334, 9, 7043, 1621, 1821, 9683, 5738, 1634, 2334, 4815, 199, 3, 1634, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 9726, 1634, 9712, 9784, 14, 199, 199, 504, 18007, 14, 2330, 14, 888, 492, 22157, 465, 1101, 63, 5958, 199, 199, 504, 18007, 14, 2330, 14, 2671, 14, 1188, 29547, 492, 6430, 48, 1220, 12, 6430, 48, 1220, 21553, 199, 504, 18007, 14, 11470, 7522, 14, 2495, 7657, 14, 5958, 492, 22157, 3018, 199, 504, 18007, 14, 11470, 7522, 14, 2495, 7657, 14, 5958, 492, 22157, 773, 421, 199, 533, 473, 8205, 14026, 21553, 8, 785, 304, 272, 347, 22157, 63, 1188, 63, 9226, 8, 277, 12, 14900, 12, 1245, 304, 267, 746, 4279, 12, 298, 19094, 1471, 5669, 2, 339, 347, 22157, 63, 18544, 8, 277, 304, 267, 746, 4279, 12, 298, 19094, 1471, 5669, 2, 339, 347, 22157, 63, 2060, 8, 277, 304, 267, 746, 4279, 12, 298, 19094, 1471, 5669, 2, 421, 199, 533, 473, 8205, 14026, 8, 723, 2894, 357, 14, 7200, 3120, 3927, 9956, 357, 12, 6430, 48, 1220, 21553, 304, 272, 327, 7600, 26, 2136, 1077, 664, 642, 2556, 687, 282, 1101, 570, 14, 272, 347, 636, 826, 721, 277, 12, 326, 1245, 63, 1825, 12, 326, 13080, 304, 267, 291, 423, 1188, 63, 1825, 275, 1245, 63, 1825, 267, 291, 423, 15286, 275, 13080, 267, 22157, 3018, 14, 7200, 3120, 3927, 9956, 357, 855, 826, 721, 288, 291, 12, 288, 3842, 355, 1101, 63, 5958, 14, 1000, 12, 355, 1101, 63, 5958, 14, 719, 12, 355, 291, 423, 15286, 14, 5958, 63, 2060, 342, 288, 776, 467, 288, 291, 423, 15286, 14, 5958, 63, 18544, 1062, 288, 291, 423, 15286, 14, 5958, 63, 18544, 1012, 267, 291, 423, 2775, 275, 1101, 63, 5958, 14, 2775, 339, 327, 22157, 3018, 14, 7200, 3120, 3927, 9956, 357, 3102, 339, 347, 641, 63, 18544, 262, 1180, 8, 277, 12, 1950, 12, 1566, 304, 267, 1950, 14, 11082, 8, 2105, 14, 362, 63, 18544, 342, 435, 2668, 531, 339, 347, 641, 63, 28508, 8, 277, 12, 1950, 12, 1566, 304, 267, 1950, 14, 904, 8, 277, 423, 2775, 9, 267, 291, 423, 1188, 63, 29547, 275, 6430, 48, 1220, 8, 277, 12, 291, 423, 1188, 63, 1825, 9, 339, 347, 641, 63, 5645, 1328, 8, 277, 12, 1950, 12, 1566, 304, 267, 14900, 275, 22157, 773, 14, 10756, 63, 475, 63, 78, 8, 1430, 14, 1365, 1012, 267, 1056, 275, 1566, 14, 4958, 3430, 16, 61, 398, 340, 440, 22157, 773, 14, 5958, 63, 2325, 8, 1069, 680, 2460, 8, 5958, 773, 14, 5958, 63, 2325, 8, 2105, 14, 362, 63, 18544, 28256, 288, 372, 398, 340, 822, 8, 1069, 9, 2695, 822, 8, 2105, 14, 362, 63, 18544, 5109, 288, 372, 398, 327, 6601, 473, 8205, 13431, 12, 2839, 671, 10289, 13, 784, 1377, 12, 849, 370, 1808, 282, 10029, 267, 327, 1380, 2287, 316, 17122, 14, 267, 373, 679, 1905, 63, 9896, 275, 1056, 59, 552, 8, 2105, 14, 362, 63, 18544, 24821, 267, 340, 373, 679, 1905, 63, 9896, 508, 7596, 356, 288, 1056, 275, 1056, 14, 1294, 16451, 413, 9, 267, 916, 373, 679, 1905, 63, 9896, 508, 1656, 356, 288, 1056, 275, 1056, 14, 1294, 32718, 413, 9, 267, 587, 26, 288, 372, 398, 340, 822, 8, 1069, 9, 690, 413, 26, 288, 1177, 275, 291, 423, 15286, 14, 5958, 63, 1188, 63, 9226, 8, 11082, 12, 1056, 59, 17, 566, 288, 340, 1177, 26, 355, 1950, 14, 10605, 1328, 8, 277, 423, 2775, 12, 1177, 9, 339, 327, 6430, 48, 1220, 21553, 3102, 339, 347, 8732, 8, 277, 12, 6252, 12, 3233, 304, 267, 291, 14, 2105, 14, 2526, 63, 21830, 8, 4284, 12, 3233, 9, 339, 347, 1245, 63, 4561, 8, 277, 12, 1245, 304, 267, 291, 14, 2105, 14, 10605, 1328, 8, 277, 423, 2775, 12, 1245, 9, 339, 347, 4242, 63, 1188, 63, 30480, 8, 277, 304, 267, 291, 14, 15130, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
bsmrstu-warriors/Moytri--The-Drone-Aider
Lib/site-packages/scipy/linalg/special_matrices.py
55
15621
import math import numpy as np #----------------------------------------------------------------------------- # matrix construction functions #----------------------------------------------------------------------------- def tri(N, M=None, k=0, dtype=None): """ Construct (N, M) matrix filled with ones at and below the k-th diagonal. The matrix has A[i,j] == 1 for i <= j + k Parameters ---------- N : integer The size of the first dimension of the matrix. M : integer or None The size of the second dimension of the matrix. If `M` is None, `M = N` is assumed. k : integer Number of subdiagonal below which matrix is filled with ones. `k` = 0 is the main diagonal, `k` < 0 subdiagonal and `k` > 0 superdiagonal. dtype : dtype Data type of the matrix. Returns ------- A : array, shape (N, M) Examples -------- >>> from scipy.linalg import tri >>> tri(3, 5, 2, dtype=int) array([[1, 1, 1, 0, 0], [1, 1, 1, 1, 0], [1, 1, 1, 1, 1]]) >>> tri(3, 5, -1, dtype=int) array([[0, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 1, 0, 0, 0]]) """ if M is None: M = N if type(M) == type('d'): #pearu: any objections to remove this feature? # As tri(N,'d') is equivalent to tri(N,dtype='d') dtype = M M = N m = np.greater_equal(np.subtract.outer(np.arange(N), np.arange(M)),-k) if dtype is None: return m else: return m.astype(dtype) def tril(m, k=0): """Construct a copy of a matrix with elements above the k-th diagonal zeroed. Parameters ---------- m : array Matrix whose elements to return k : integer Diagonal above which to zero elements. k == 0 is the main diagonal, k < 0 subdiagonal and k > 0 superdiagonal. Returns ------- A : array, shape m.shape, dtype m.dtype Examples -------- >>> from scipy.linalg import tril >>> tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) array([[ 0, 0, 0], [ 4, 0, 0], [ 7, 8, 0], [10, 11, 12]]) """ m = np.asarray(m) out = tri(m.shape[0], m.shape[1], k=k, dtype=m.dtype.char)*m return out def triu(m, k=0): """Construct a copy of a matrix with elements below the k-th diagonal zeroed. Parameters ---------- m : array Matrix whose elements to return k : integer Diagonal below which to zero elements. k == 0 is the main diagonal, k < 0 subdiagonal and k > 0 superdiagonal. Returns ------- A : array, shape m.shape, dtype m.dtype Examples -------- >>> from scipy.linalg import tril >>> triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) array([[ 1, 2, 3], [ 4, 5, 6], [ 0, 8, 9], [ 0, 0, 12]]) """ m = np.asarray(m) out = (1-tri(m.shape[0], m.shape[1], k-1, m.dtype.char))*m return out def toeplitz(c, r=None): """ Construct a Toeplitz matrix. The Toeplitz matrix has constant diagonals, with c as its first column and r as its first row. If r is not given, ``r == conjugate(c)`` is assumed. Parameters ---------- c : array_like First column of the matrix. Whatever the actual shape of `c`, it will be converted to a 1-D array. r : array_like First row of the matrix. If None, ``r = conjugate(c)`` is assumed; in this case, if c[0] is real, the result is a Hermitian matrix. r[0] is ignored; the first row of the returned matrix is ``[c[0], r[1:]]``. Whatever the actual shape of `r`, it will be converted to a 1-D array. Returns ------- A : array, shape (len(c), len(r)) The Toeplitz matrix. Dtype is the same as ``(c[0] + r[0]).dtype``. See also -------- circulant : circulant matrix hankel : Hankel matrix Notes ----- The behavior when `c` or `r` is a scalar, or when `c` is complex and `r` is None, was changed in version 0.8.0. The behavior in previous versions was undocumented and is no longer supported. Examples -------- >>> from scipy.linalg import toeplitz >>> toeplitz([1,2,3], [1,4,5,6]) array([[1, 4, 5, 6], [2, 1, 4, 5], [3, 2, 1, 4]]) >>> toeplitz([1.0, 2+3j, 4-1j]) array([[ 1.+0.j, 2.-3.j, 4.+1.j], [ 2.+3.j, 1.+0.j, 2.-3.j], [ 4.-1.j, 2.+3.j, 1.+0.j]]) """ c = np.asarray(c).ravel() if r is None: r = c.conjugate() else: r = np.asarray(r).ravel() # Form a 1D array of values to be used in the matrix, containing a reversed # copy of r[1:], followed by c. vals = np.concatenate((r[-1:0:-1], c)) a, b = np.ogrid[0:len(c), len(r)-1:-1:-1] indx = a + b # `indx` is a 2D array of indices into the 1D array `vals`, arranged so that # `vals[indx]` is the Toeplitz matrix. return vals[indx] def circulant(c): """ Construct a circulant matrix. Parameters ---------- c : array_like 1-D array, the first column of the matrix. Returns ------- A : array, shape (len(c), len(c)) A circulant matrix whose first column is `c`. See also -------- toeplitz : Toeplitz matrix hankel : Hankel matrix Notes ----- .. versionadded:: 0.8.0 Examples -------- >>> from scipy.linalg import circulant >>> circulant([1, 2, 3]) array([[1, 3, 2], [2, 1, 3], [3, 2, 1]]) """ c = np.asarray(c).ravel() a, b = np.ogrid[0:len(c), 0:-len(c):-1] indx = a + b # `indx` is a 2D array of indices into `c`, arranged so that `c[indx]` is # the circulant matrix. return c[indx] def hankel(c, r=None): """ Construct a Hankel matrix. The Hankel matrix has constant anti-diagonals, with `c` as its first column and `r` as its last row. If `r` is not given, then `r = zeros_like(c)` is assumed. Parameters ---------- c : array_like First column of the matrix. Whatever the actual shape of `c`, it will be converted to a 1-D array. r : array_like, 1D Last row of the matrix. If None, ``r = zeros_like(c)`` is assumed. r[0] is ignored; the last row of the returned matrix is ``[c[-1], r[1:]]``. Whatever the actual shape of `r`, it will be converted to a 1-D array. Returns ------- A : array, shape (len(c), len(r)) The Hankel matrix. Dtype is the same as ``(c[0] + r[0]).dtype``. See also -------- toeplitz : Toeplitz matrix circulant : circulant matrix Examples -------- >>> from scipy.linalg import hankel >>> hankel([1, 17, 99]) array([[ 1, 17, 99], [17, 99, 0], [99, 0, 0]]) >>> hankel([1,2,3,4], [4,7,7,8,9]) array([[1, 2, 3, 4, 7], [2, 3, 4, 7, 7], [3, 4, 7, 7, 8], [4, 7, 7, 8, 9]]) """ c = np.asarray(c).ravel() if r is None: r = np.zeros_like(c) else: r = np.asarray(r).ravel() # Form a 1D array of values to be used in the matrix, containing `c` # followed by r[1:]. vals = np.concatenate((c, r[1:])) a, b = np.ogrid[0:len(c), 0:len(r)] indx = a + b # `indx` is a 2D array of indices into the 1D array `vals`, arranged so that # `vals[indx]` is the Hankel matrix. return vals[indx] def hadamard(n, dtype=int): """ Construct a Hadamard matrix. `hadamard(n)` constructs an n-by-n Hadamard matrix, using Sylvester's construction. `n` must be a power of 2. Parameters ---------- n : int The order of the matrix. `n` must be a power of 2. dtype : numpy dtype The data type of the array to be constructed. Returns ------- H : ndarray with shape (n, n) The Hadamard matrix. Notes ----- .. versionadded:: 0.8.0 Examples -------- >>> hadamard(2, dtype=complex) array([[ 1.+0.j, 1.+0.j], [ 1.+0.j, -1.-0.j]]) >>> hadamard(4) array([[ 1, 1, 1, 1], [ 1, -1, 1, -1], [ 1, 1, -1, -1], [ 1, -1, -1, 1]]) """ # This function is a slightly modified version of the # function contributed by Ivo in ticket #675. if n < 1: lg2 = 0 else: lg2 = int(math.log(n, 2)) if 2 ** lg2 != n: raise ValueError("n must be an positive integer, and n must be power of 2") H = np.array([[1]], dtype=dtype) # Sylvester's construction for i in range(0, lg2): H = np.vstack((np.hstack((H, H)), np.hstack((H, -H)))) return H def leslie(f, s): """ Create a Leslie matrix. Given the length n array of fecundity coefficients `f` and the length n-1 array of survival coefficents `s`, return the associated Leslie matrix. Parameters ---------- f : array_like The "fecundity" coefficients, has to be 1-D. s : array_like The "survival" coefficients, has to be 1-D. The length of `s` must be one less than the length of `f`, and it must be at least 1. Returns ------- L : ndarray Returns a 2-D ndarray of shape ``(n, n)``, where `n` is the length of `f`. The array is zero except for the first row, which is `f`, and the first sub-diagonal, which is `s`. The data-type of the array will be the data-type of ``f[0]+s[0]``. Notes ----- .. versionadded:: 0.8.0 The Leslie matrix is used to model discrete-time, age-structured population growth [1]_ [2]_. In a population with `n` age classes, two sets of parameters define a Leslie matrix: the `n` "fecundity coefficients", which give the number of offspring per-capita produced by each age class, and the `n` - 1 "survival coefficients", which give the per-capita survival rate of each age class. References ---------- .. [1] P. H. Leslie, On the use of matrices in certain population mathematics, Biometrika, Vol. 33, No. 3, 183--212 (Nov. 1945) .. [2] P. H. Leslie, Some further notes on the use of matrices in population mathematics, Biometrika, Vol. 35, No. 3/4, 213--245 (Dec. 1948) Examples -------- >>> leslie([0.1, 2.0, 1.0, 0.1], [0.2, 0.8, 0.7]) array([[ 0.1, 2. , 1. , 0.1], [ 0.2, 0. , 0. , 0. ], [ 0. , 0.8, 0. , 0. ], [ 0. , 0. , 0.7, 0. ]]) """ f = np.atleast_1d(f) s = np.atleast_1d(s) if f.ndim != 1: raise ValueError("Incorrect shape for f. f must be one-dimensional") if s.ndim != 1: raise ValueError("Incorrect shape for s. s must be one-dimensional") if f.size != s.size + 1: raise ValueError("Incorrect lengths for f and s. The length" " of s must be one less than the length of f.") if s.size == 0: raise ValueError("The length of s must be at least 1.") tmp = f[0] + s[0] n = f.size a = np.zeros((n,n), dtype=tmp.dtype) a[0] = f a[range(1,n), range(0,n-1)] = s return a def all_mat(*args): return map(np.matrix,args) def kron(a,b): """Kronecker product of a and b. The result is the block matrix:: a[0,0]*b a[0,1]*b ... a[0,-1]*b a[1,0]*b a[1,1]*b ... a[1,-1]*b ... a[-1,0]*b a[-1,1]*b ... a[-1,-1]*b Parameters ---------- a : array, shape (M, N) b : array, shape (P, Q) Returns ------- A : array, shape (M*P, N*Q) Kronecker product of a and b Examples -------- >>> from scipy import kron, array >>> kron(array([[1,2],[3,4]]), array([[1,1,1]])) array([[1, 1, 1, 2, 2, 2], [3, 3, 3, 4, 4, 4]]) """ if not a.flags['CONTIGUOUS']: a = np.reshape(a, a.shape) if not b.flags['CONTIGUOUS']: b = np.reshape(b, b.shape) o = np.outer(a,b) o = o.reshape(a.shape + b.shape) return np.concatenate(np.concatenate(o, axis=1), axis=1) def block_diag(*arrs): """ Create a block diagonal matrix from provided arrays. Given the inputs `A`, `B` and `C`, the output will have these arrays arranged on the diagonal:: [[A, 0, 0], [0, B, 0], [0, 0, C]] Parameters ---------- A, B, C, ... : array_like, up to 2-D Input arrays. A 1-D array or array_like sequence of length `n`is treated as a 2-D array with shape ``(1,n)``. Returns ------- D : ndarray Array with `A`, `B`, `C`, ... on the diagonal. `D` has the same dtype as `A`. Notes ----- If all the input arrays are square, the output is known as a block diagonal matrix. Examples -------- >>> A = [[1, 0], ... [0, 1]] >>> B = [[3, 4, 5], ... [6, 7, 8]] >>> C = [[7]] >>> block_diag(A, B, C) [[1 0 0 0 0 0] [0 1 0 0 0 0] [0 0 3 4 5 0] [0 0 6 7 8 0] [0 0 0 0 0 7]] >>> block_diag(1.0, [2, 3], [[4, 5], [6, 7]]) array([[ 1., 0., 0., 0., 0.], [ 0., 2., 3., 0., 0.], [ 0., 0., 0., 4., 5.], [ 0., 0., 0., 6., 7.]]) """ if arrs == (): arrs = ([],) arrs = [np.atleast_2d(a) for a in arrs] bad_args = [k for k in range(len(arrs)) if arrs[k].ndim > 2] if bad_args: raise ValueError("arguments in the following positions have dimension " "greater than 2: %s" % bad_args) shapes = np.array([a.shape for a in arrs]) out = np.zeros(np.sum(shapes, axis=0), dtype=arrs[0].dtype) r, c = 0, 0 for i, (rr, cc) in enumerate(shapes): out[r:r + rr, c:c + cc] = arrs[i] r += rr c += cc return out def companion(a): """ Create a companion matrix. Create the companion matrix [1]_ associated with the polynomial whose coefficients are given in `a`. Parameters ---------- a : array_like 1-D array of polynomial coefficients. The length of `a` must be at least two, and ``a[0]`` must not be zero. Returns ------- c : ndarray A square array of shape ``(n-1, n-1)``, where `n` is the length of `a`. The first row of `c` is ``-a[1:]/a[0]``, and the first sub-diagonal is all ones. The data-type of the array is the same as the data-type of ``1.0*a[0]``. Raises ------ ValueError If any of the following are true: a) ``a.ndim != 1``; b) ``a.size < 2``; c) ``a[0] == 0``. Notes ----- .. versionadded:: 0.8.0 References ---------- .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: Cambridge University Press, 1999, pp. 146-7. Examples -------- >>> from scipy.linalg import companion >>> companion([1, -10, 31, -30]) array([[ 10., -31., 30.], [ 1., 0., 0.], [ 0., 1., 0.]]) """ a = np.atleast_1d(a) if a.ndim != 1: raise ValueError("Incorrect shape for `a`. `a` must be one-dimensional.") if a.size < 2: raise ValueError("The length of `a` must be at least 2.") if a[0] == 0: raise ValueError("The first coefficient in `a` must not be zero.") first_row = -a[1:]/(1.0*a[0]) n = a.size c = np.zeros((n-1, n-1), dtype=first_row.dtype) c[0] = first_row c[range(1,n-1), range(0, n-2)] = 1 return c
gpl-3.0
[ 199, 646, 3473, 199, 646, 2680, 465, 980, 199, 199, 18045, 199, 3, 3634, 14538, 3423, 199, 18045, 199, 199, 318, 3229, 8, 46, 12, 603, 29, 403, 12, 1022, 29, 16, 12, 2152, 29, 403, 304, 272, 408, 272, 9215, 334, 46, 12, 603, 9, 3634, 13457, 543, 7869, 737, 436, 5084, 314, 1022, 13, 273, 16788, 14, 339, 710, 3634, 965, 437, 59, 73, 12, 74, 61, 508, 413, 367, 284, 2695, 1335, 435, 1022, 339, 3897, 272, 4143, 272, 653, 520, 3000, 267, 710, 1568, 402, 314, 1642, 6240, 402, 314, 3634, 14, 272, 603, 520, 3000, 503, 488, 267, 710, 1568, 402, 314, 3499, 6240, 402, 314, 3634, 14, 982, 658, 45, 64, 365, 488, 12, 267, 658, 45, 275, 653, 64, 365, 10826, 14, 272, 1022, 520, 3000, 267, 4860, 402, 1007, 20057, 5084, 1314, 3634, 365, 13457, 543, 7869, 14, 267, 658, 75, 64, 275, 378, 365, 314, 2446, 16788, 12, 658, 75, 64, 665, 378, 1007, 20057, 436, 658, 75, 64, 690, 378, 267, 1613, 20057, 14, 272, 2152, 520, 2152, 267, 3918, 730, 402, 314, 3634, 14, 339, 1803, 272, 5514, 272, 437, 520, 1625, 12, 2215, 334, 46, 12, 603, 9, 339, 6058, 272, 3001, 272, 1306, 687, 7026, 14, 10096, 492, 3229, 272, 1306, 3229, 8, 19, 12, 959, 12, 499, 12, 2152, 29, 442, 9, 272, 1625, 4038, 17, 12, 413, 12, 413, 12, 378, 12, 378, 467, 1779, 359, 17, 12, 413, 12, 413, 12, 413, 12, 378, 467, 1779, 359, 17, 12, 413, 12, 413, 12, 413, 12, 413, 3934, 272, 1306, 3229, 8, 19, 12, 959, 12, 446, 17, 12, 2152, 29, 442, 9, 272, 1625, 4038, 16, 12, 378, 12, 378, 12, 378, 12, 378, 467, 1779, 359, 17, 12, 378, 12, 378, 12, 378, 12, 378, 467, 1779, 359, 17, 12, 413, 12, 378, 12, 378, 12, 378, 3934, 339, 408, 272, 340, 603, 365, 488, 26, 603, 275, 653, 272, 340, 730, 8, 45, 9, 508, 730, 360, 68, 735, 267, 327, 16343, 85, 26, 1263, 1559, 69, 2452, 370, 2813, 642, 3878, 31, 267, 327, 755, 3709, 3229, 8, 46, 2584, 68, 358, 365, 7353, 370, 3229, 8, 46, 12, 2271, 534, 68, 358, 267, 2152, 275, 603, 267, 603, 275, 653, 272, 333, 275, 980, 14, 13154, 63, 1452, 8, 1590, 14, 25719, 14, 7837, 8, 1590, 14, 5605, 8, 46, 395, 980, 14, 5605, 8, 45, 1826, 13, 75, 9, 272, 340, 2152, 365, 488, 26, 267, 372, 333, 272, 587, 26, 267, 372, 333, 14, 6041, 8, 2271, 9, 199, 199, 318, 3229, 76, 8, 77, 12, 1022, 29, 16, 304, 272, 408, 11493, 282, 1331, 402, 282, 3634, 543, 4008, 3432, 314, 1022, 13, 273, 16788, 4697, 379, 14, 339, 3897, 272, 4143, 272, 333, 520, 1625, 267, 8449, 7447, 4008, 370, 372, 272, 1022, 520, 3000, 267, 3757, 643, 8125, 3432, 1314, 370, 4697, 4008, 14, 267, 1022, 508, 378, 365, 314, 2446, 16788, 12, 1022, 665, 378, 1007, 20057, 436, 1022, 690, 378, 1613, 20057, 14, 339, 1803, 272, 5514, 272, 437, 520, 1625, 12, 2215, 333, 14, 1392, 12, 2152, 333, 14, 2271, 339, 6058, 272, 3001, 272, 1306, 687, 7026, 14, 10096, 492, 3229, 76, 272, 1306, 3229, 76, 4038, 17, 12, 18, 12, 19, 6922, 20, 12, 21, 12, 22, 6922, 23, 12, 24, 12, 25, 6922, 709, 12, 845, 12, 713, 2365, 446, 17, 9, 272, 1625, 4038, 378, 12, 221, 378, 12, 221, 378, 467, 1779, 359, 841, 12, 221, 378, 12, 221, 378, 467, 1779, 359, 1520, 12, 221, 1695, 12, 221, 378, 467, 1779, 359, 709, 12, 4119, 12, 3144, 3934, 339, 408, 272, 333, 275, 980, 14, 8748, 8, 77, 9, 272, 734, 275, 3229, 8, 77, 14, 1392, 59, 16, 467, 333, 14, 1392, 59, 17, 467, 1022, 29, 75, 12, 2152, 29, 77, 14, 2271, 14, 1560, 3342, 77, 272, 372, 734, 199, 199, 318, 3229, 85, 8, 77, 12, 1022, 29, 16, 304, 272, 408, 11493, 282, 1331, 402, 282, 3634, 543, 4008, 5084, 314, 1022, 13, 273, 16788, 4697, 379, 14, 339, 3897, 272, 4143, 272, 333, 520, 1625, 267, 8449, 7447, 4008, 370, 372, 272, 1022, 520, 3000, 267, 3757, 643, 8125, 5084, 1314, 370, 4697, 4008, 14, 267, 1022, 508, 378, 365, 314, 2446, 16788, 12, 1022, 665, 378, 1007, 20057, 436, 1022, 690, 378, 1613, 20057, 14, 339, 1803, 272, 5514, 272, 437, 520, 1625, 12, 2215, 333, 14, 1392, 12, 2152, 333, 14, 2271, 339, 6058, 272, 3001, 272, 1306, 687, 7026, 14, 10096, 492, 3229, 76, 272, 1306, 3229, 85, 4038, 17, 12, 18, 12, 19, 6922, 20, 12, 21, 12, 22, 6922, 23, 12, 24, 12, 25, 6922, 709, 12, 845, 12, 713, 2365, 446, 17, 9, 272, 1625, 4038, 413, 12, 221, 499, 12, 221, 650, 467, 1779, 359, 841, 12, 221, 959, 12, 221, 1227, 467, 1779, 359, 378, 12, 221, 1695, 12, 221, 1749, 467, 1779, 359, 378, 12, 221, 378, 12, 3144, 3934, 339, 408, 272, 333, 275, 980, 14, 8748, 8, 77, 9, 272, 734, 275, 334, 17, 13, 599, 8, 77, 14, 1392, 59, 16, 467, 333, 14, 1392, 59, 17, 467, 1022, 13, 17, 12, 333, 14, 2271, 14, 1560, 19198, 77, 272, 372, 734, 421, 199, 318, 370, 1545, 29382, 8, 67, 12, 519, 29, 403, 304, 272, 408, 272, 9215, 282, 4005, 1545, 29382, 3634, 14, 339, 710, 4005, 1545, 29382, 3634, 965, 4413, 8348, 265, 2551, 12, 543, 286, 465, 2399, 1642, 2763, 272, 436, 519, 465, 2399, 1642, 1962, 14, 221, 982, 519, 365, 440, 1627, 12, 1124, 82, 508, 27246, 8, 67, 9719, 365, 272, 10826, 14, 339, 3897, 272, 4143, 272, 286, 520, 1625, 63, 2930, 267, 7758, 2763, 402, 314, 3634, 14, 221, 2816, 12359, 314, 3503, 2215, 402, 658, 67, 3559, 652, 267, 911, 506, 6702, 370, 282, 413, 13, 36, 1625, 14, 272, 519, 520, 1625, 63, 2930, 267, 7758, 1962, 402, 314, 3634, 14, 982, 488, 12, 1124, 82, 275, 27246, 8, 67, 9719, 365, 10826, 27, 267, 315, 642, 1930, 12, 340, 286, 59 ]
[ 646, 3473, 199, 646, 2680, 465, 980, 199, 199, 18045, 199, 3, 3634, 14538, 3423, 199, 18045, 199, 199, 318, 3229, 8, 46, 12, 603, 29, 403, 12, 1022, 29, 16, 12, 2152, 29, 403, 304, 272, 408, 272, 9215, 334, 46, 12, 603, 9, 3634, 13457, 543, 7869, 737, 436, 5084, 314, 1022, 13, 273, 16788, 14, 339, 710, 3634, 965, 437, 59, 73, 12, 74, 61, 508, 413, 367, 284, 2695, 1335, 435, 1022, 339, 3897, 272, 4143, 272, 653, 520, 3000, 267, 710, 1568, 402, 314, 1642, 6240, 402, 314, 3634, 14, 272, 603, 520, 3000, 503, 488, 267, 710, 1568, 402, 314, 3499, 6240, 402, 314, 3634, 14, 982, 658, 45, 64, 365, 488, 12, 267, 658, 45, 275, 653, 64, 365, 10826, 14, 272, 1022, 520, 3000, 267, 4860, 402, 1007, 20057, 5084, 1314, 3634, 365, 13457, 543, 7869, 14, 267, 658, 75, 64, 275, 378, 365, 314, 2446, 16788, 12, 658, 75, 64, 665, 378, 1007, 20057, 436, 658, 75, 64, 690, 378, 267, 1613, 20057, 14, 272, 2152, 520, 2152, 267, 3918, 730, 402, 314, 3634, 14, 339, 1803, 272, 5514, 272, 437, 520, 1625, 12, 2215, 334, 46, 12, 603, 9, 339, 6058, 272, 3001, 272, 1306, 687, 7026, 14, 10096, 492, 3229, 272, 1306, 3229, 8, 19, 12, 959, 12, 499, 12, 2152, 29, 442, 9, 272, 1625, 4038, 17, 12, 413, 12, 413, 12, 378, 12, 378, 467, 1779, 359, 17, 12, 413, 12, 413, 12, 413, 12, 378, 467, 1779, 359, 17, 12, 413, 12, 413, 12, 413, 12, 413, 3934, 272, 1306, 3229, 8, 19, 12, 959, 12, 446, 17, 12, 2152, 29, 442, 9, 272, 1625, 4038, 16, 12, 378, 12, 378, 12, 378, 12, 378, 467, 1779, 359, 17, 12, 378, 12, 378, 12, 378, 12, 378, 467, 1779, 359, 17, 12, 413, 12, 378, 12, 378, 12, 378, 3934, 339, 408, 272, 340, 603, 365, 488, 26, 603, 275, 653, 272, 340, 730, 8, 45, 9, 508, 730, 360, 68, 735, 267, 327, 16343, 85, 26, 1263, 1559, 69, 2452, 370, 2813, 642, 3878, 31, 267, 327, 755, 3709, 3229, 8, 46, 2584, 68, 358, 365, 7353, 370, 3229, 8, 46, 12, 2271, 534, 68, 358, 267, 2152, 275, 603, 267, 603, 275, 653, 272, 333, 275, 980, 14, 13154, 63, 1452, 8, 1590, 14, 25719, 14, 7837, 8, 1590, 14, 5605, 8, 46, 395, 980, 14, 5605, 8, 45, 1826, 13, 75, 9, 272, 340, 2152, 365, 488, 26, 267, 372, 333, 272, 587, 26, 267, 372, 333, 14, 6041, 8, 2271, 9, 199, 199, 318, 3229, 76, 8, 77, 12, 1022, 29, 16, 304, 272, 408, 11493, 282, 1331, 402, 282, 3634, 543, 4008, 3432, 314, 1022, 13, 273, 16788, 4697, 379, 14, 339, 3897, 272, 4143, 272, 333, 520, 1625, 267, 8449, 7447, 4008, 370, 372, 272, 1022, 520, 3000, 267, 3757, 643, 8125, 3432, 1314, 370, 4697, 4008, 14, 267, 1022, 508, 378, 365, 314, 2446, 16788, 12, 1022, 665, 378, 1007, 20057, 436, 1022, 690, 378, 1613, 20057, 14, 339, 1803, 272, 5514, 272, 437, 520, 1625, 12, 2215, 333, 14, 1392, 12, 2152, 333, 14, 2271, 339, 6058, 272, 3001, 272, 1306, 687, 7026, 14, 10096, 492, 3229, 76, 272, 1306, 3229, 76, 4038, 17, 12, 18, 12, 19, 6922, 20, 12, 21, 12, 22, 6922, 23, 12, 24, 12, 25, 6922, 709, 12, 845, 12, 713, 2365, 446, 17, 9, 272, 1625, 4038, 378, 12, 221, 378, 12, 221, 378, 467, 1779, 359, 841, 12, 221, 378, 12, 221, 378, 467, 1779, 359, 1520, 12, 221, 1695, 12, 221, 378, 467, 1779, 359, 709, 12, 4119, 12, 3144, 3934, 339, 408, 272, 333, 275, 980, 14, 8748, 8, 77, 9, 272, 734, 275, 3229, 8, 77, 14, 1392, 59, 16, 467, 333, 14, 1392, 59, 17, 467, 1022, 29, 75, 12, 2152, 29, 77, 14, 2271, 14, 1560, 3342, 77, 272, 372, 734, 199, 199, 318, 3229, 85, 8, 77, 12, 1022, 29, 16, 304, 272, 408, 11493, 282, 1331, 402, 282, 3634, 543, 4008, 5084, 314, 1022, 13, 273, 16788, 4697, 379, 14, 339, 3897, 272, 4143, 272, 333, 520, 1625, 267, 8449, 7447, 4008, 370, 372, 272, 1022, 520, 3000, 267, 3757, 643, 8125, 5084, 1314, 370, 4697, 4008, 14, 267, 1022, 508, 378, 365, 314, 2446, 16788, 12, 1022, 665, 378, 1007, 20057, 436, 1022, 690, 378, 1613, 20057, 14, 339, 1803, 272, 5514, 272, 437, 520, 1625, 12, 2215, 333, 14, 1392, 12, 2152, 333, 14, 2271, 339, 6058, 272, 3001, 272, 1306, 687, 7026, 14, 10096, 492, 3229, 76, 272, 1306, 3229, 85, 4038, 17, 12, 18, 12, 19, 6922, 20, 12, 21, 12, 22, 6922, 23, 12, 24, 12, 25, 6922, 709, 12, 845, 12, 713, 2365, 446, 17, 9, 272, 1625, 4038, 413, 12, 221, 499, 12, 221, 650, 467, 1779, 359, 841, 12, 221, 959, 12, 221, 1227, 467, 1779, 359, 378, 12, 221, 1695, 12, 221, 1749, 467, 1779, 359, 378, 12, 221, 378, 12, 3144, 3934, 339, 408, 272, 333, 275, 980, 14, 8748, 8, 77, 9, 272, 734, 275, 334, 17, 13, 599, 8, 77, 14, 1392, 59, 16, 467, 333, 14, 1392, 59, 17, 467, 1022, 13, 17, 12, 333, 14, 2271, 14, 1560, 19198, 77, 272, 372, 734, 421, 199, 318, 370, 1545, 29382, 8, 67, 12, 519, 29, 403, 304, 272, 408, 272, 9215, 282, 4005, 1545, 29382, 3634, 14, 339, 710, 4005, 1545, 29382, 3634, 965, 4413, 8348, 265, 2551, 12, 543, 286, 465, 2399, 1642, 2763, 272, 436, 519, 465, 2399, 1642, 1962, 14, 221, 982, 519, 365, 440, 1627, 12, 1124, 82, 508, 27246, 8, 67, 9719, 365, 272, 10826, 14, 339, 3897, 272, 4143, 272, 286, 520, 1625, 63, 2930, 267, 7758, 2763, 402, 314, 3634, 14, 221, 2816, 12359, 314, 3503, 2215, 402, 658, 67, 3559, 652, 267, 911, 506, 6702, 370, 282, 413, 13, 36, 1625, 14, 272, 519, 520, 1625, 63, 2930, 267, 7758, 1962, 402, 314, 3634, 14, 982, 488, 12, 1124, 82, 275, 27246, 8, 67, 9719, 365, 10826, 27, 267, 315, 642, 1930, 12, 340, 286, 59, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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k] <= a[2*k+1] and a[k] <= a[2*k+2] for all k, counting elements from 0. For the sake of comparison, non-existing elements are considered to be infinite. The interesting property of a heap is that a[0] is always its smallest element. Usage: heap = [] # creates an empty heap heappush(heap, item) # pushes a new item on the heap item = heappop(heap) # pops the smallest item from the heap item = heap[0] # smallest item on the heap without popping it heapify(x) # transforms list into a heap, in-place, in linear time item = heapreplace(heap, item) # pops and returns smallest item, and adds # new item; the heap size is unchanged Our API differs from textbook heap algorithms as follows: - We use 0-based indexing. This makes the relationship between the index for a node and the indexes for its children slightly less obvious, but is more suitable since Python uses 0-based indexing. - Our heappop() method returns the smallest item, not the largest. These two make it possible to view the heap as a regular Python list without surprises: heap[0] is the smallest item, and heap.sort() maintains the heap invariant! """ # Original code by Kevin O'Connor, augmented by Tim Peters and Raymond Hettinger __about__ = """Heap queues [explanation by François Pinard] Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for all k, counting elements from 0. For the sake of comparison, non-existing elements are considered to be infinite. The interesting property of a heap is that a[0] is always its smallest element. The strange invariant above is meant to be an efficient memory representation for a tournament. The numbers below are `k', not a[k]: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 In the tree above, each cell `k' is topping `2*k+1' and `2*k+2'. In an usual binary tournament we see in sports, each cell is the winner over the two cells it tops, and we can trace the winner down the tree to see all opponents s/he had. However, in many computer applications of such tournaments, we do not need to trace the history of a winner. To be more memory efficient, when a winner is promoted, we try to replace it by something else at a lower level, and the rule becomes that a cell and the two cells it tops contain three different items, but the top cell "wins" over the two topped cells. If this heap invariant is protected at all time, index 0 is clearly the overall winner. The simplest algorithmic way to remove it and find the "next" winner is to move some loser (let's say cell 30 in the diagram above) into the 0 position, and then percolate this new 0 down the tree, exchanging values, until the invariant is re-established. This is clearly logarithmic on the total number of items in the tree. By iterating over all items, you get an O(n ln n) sort. A nice feature of this sort is that you can efficiently insert new items while the sort is going on, provided that the inserted items are not "better" than the last 0'th element you extracted. This is especially useful in simulation contexts, where the tree holds all incoming events, and the "win" condition means the smallest scheduled time. When an event schedule other events for execution, they are scheduled into the future, so they can easily go into the heap. So, a heap is a good structure for implementing schedulers (this is what I used for my MIDI sequencer :-). Various structures for implementing schedulers have been extensively studied, and heaps are good for this, as they are reasonably speedy, the speed is almost constant, and the worst case is not much different than the average case. However, there are other representations which are more efficient overall, yet the worst cases might be terrible. Heaps are also very useful in big disk sorts. You most probably all know that a big sort implies producing "runs" (which are pre-sorted sequences, which size is usually related to the amount of CPU memory), followed by a merging passes for these runs, which merging is often very cleverly organised[1]. It is very important that the initial sort produces the longest runs possible. Tournaments are a good way to that. If, using all the memory available to hold a tournament, you replace and percolate items that happen to fit the current run, you'll produce runs which are twice the size of the memory for random input, and much better for input fuzzily ordered. Moreover, if you output the 0'th item on disk and get an input which may not fit in the current tournament (because the value "wins" over the last output value), it cannot fit in the heap, so the size of the heap decreases. The freed memory could be cleverly reused immediately for progressively building a second heap, which grows at exactly the same rate the first heap is melting. When the first heap completely vanishes, you switch heaps and start a new run. Clever and quite effective! In a word, heaps are useful memory structures to know. I use them in a few applications, and I think it is good to keep a `heap' module around. :-) -------------------- [1] The disk balancing algorithms which are current, nowadays, are more annoying than clever, and this is a consequence of the seeking capabilities of the disks. On devices which cannot seek, like big tape drives, the story was quite different, and one had to be very clever to ensure (far in advance) that each tape movement will be the most effective possible (that is, will best participate at "progressing" the merge). Some tapes were even able to read backwards, and this was also used to avoid the rewinding time. Believe me, real good tape sorts were quite spectacular to watch! From all times, sorting has always been a Great Art! :-) """ __all__ = ['heappush', 'heappop', 'heapify', 'heapreplace', 'merge', 'nlargest', 'nsmallest', 'heappushpop'] from itertools import islice, count, tee, chain def heappush(heap, item): """Push item onto heap, maintaining the heap invariant.""" heap.append(item) _siftdown(heap, 0, len(heap)-1) def heappop(heap): """Pop the smallest item off the heap, maintaining the heap invariant.""" lastelt = heap.pop() # raises appropriate IndexError if heap is empty if heap: returnitem = heap[0] heap[0] = lastelt _siftup(heap, 0) else: returnitem = lastelt return returnitem def heapreplace(heap, item): """Pop and return the current smallest value, and add the new item. This is more efficient than heappop() followed by heappush(), and can be more appropriate when using a fixed-size heap. Note that the value returned may be larger than item! That constrains reasonable uses of this routine unless written as part of a conditional replacement: if item > heap[0]: item = heapreplace(heap, item) """ returnitem = heap[0] # raises appropriate IndexError if heap is empty heap[0] = item _siftup(heap, 0) return returnitem def heappushpop(heap, item): """Fast version of a heappush followed by a heappop.""" if heap and heap[0] < item: item, heap[0] = heap[0], item _siftup(heap, 0) return item def heapify(x): """Transform list into a heap, in-place, in O(len(x)) time.""" n = len(x) # Transform bottom-up. The largest index there's any point to looking at # is the largest with a child index in-range, so must have 2*i + 1 < n, # or i < (n-1)/2. If n is even = 2*j, this is (2*j-1)/2 = j-1/2 so # j-1 is the largest, which is n//2 - 1. If n is odd = 2*j+1, this is # (2*j+1-1)/2 = j so j-1 is the largest, and that's again n//2-1. for i in reversed(range(n//2)): _siftup(x, i) def _heappushpop_max(heap, item): """Maxheap version of a heappush followed by a heappop.""" if heap and item < heap[0]: item, heap[0] = heap[0], item _siftup_max(heap, 0) return item def _heapify_max(x): """Transform list into a maxheap, in-place, in O(len(x)) time.""" n = len(x) for i in reversed(range(n//2)): _siftup_max(x, i) def nlargest(n, iterable): """Find the n largest elements in a dataset. Equivalent to: sorted(iterable, reverse=True)[:n] """ if n < 0: return [] it = iter(iterable) result = list(islice(it, n)) if not result: return result heapify(result) _heappushpop = heappushpop for elem in it: _heappushpop(result, elem) result.sort(reverse=True) return result def nsmallest(n, iterable): """Find the n smallest elements in a dataset. Equivalent to: sorted(iterable)[:n] """ if n < 0: return [] it = iter(iterable) result = list(islice(it, n)) if not result: return result _heapify_max(result) _heappushpop = _heappushpop_max for elem in it: _heappushpop(result, elem) result.sort() return result # 'heap' is a heap at all indices >= startpos, except possibly for pos. pos # is the index of a leaf with a possibly out-of-order value. Restore the # heap invariant. def _siftdown(heap, startpos, pos): newitem = heap[pos] # Follow the path to the root, moving parents down until finding a place # newitem fits. while pos > startpos: parentpos = (pos - 1) >> 1 parent = heap[parentpos] if newitem < parent: heap[pos] = parent pos = parentpos continue break heap[pos] = newitem # The child indices of heap index pos are already heaps, and we want to make # a heap at index pos too. We do this by bubbling the smaller child of # pos up (and so on with that child's children, etc) until hitting a leaf, # then using _siftdown to move the oddball originally at index pos into place. # # We *could* break out of the loop as soon as we find a pos where newitem <= # both its children, but turns out that's not a good idea, and despite that # many books write the algorithm that way. During a heap pop, the last array # element is sifted in, and that tends to be large, so that comparing it # against values starting from the root usually doesn't pay (= usually doesn't # get us out of the loop early). See Knuth, Volume 3, where this is # explained and quantified in an exercise. # # Cutting the # of comparisons is important, since these routines have no # way to extract "the priority" from an array element, so that intelligence # is likely to be hiding in custom comparison methods, or in array elements # storing (priority, record) tuples. Comparisons are thus potentially # expensive. # # On random arrays of length 1000, making this change cut the number of # comparisons made by heapify() a little, and those made by exhaustive # heappop() a lot, in accord with theory. Here are typical results from 3 # runs (3 just to demonstrate how small the variance is): # # Compares needed by heapify Compares needed by 1000 heappops # -------------------------- -------------------------------- # 1837 cut to 1663 14996 cut to 8680 # 1855 cut to 1659 14966 cut to 8678 # 1847 cut to 1660 15024 cut to 8703 # # Building the heap by using heappush() 1000 times instead required # 2198, 2148, and 2219 compares: heapify() is more efficient, when # you can use it. # # The total compares needed by list.sort() on the same lists were 8627, # 8627, and 8632 (this should be compared to the sum of heapify() and # heappop() compares): list.sort() is (unsurprisingly!) more efficient # for sorting. def _siftup(heap, pos): endpos = len(heap) startpos = pos newitem = heap[pos] # Bubble up the smaller child until hitting a leaf. childpos = 2*pos + 1 # leftmost child position while childpos < endpos: # Set childpos to index of smaller child. rightpos = childpos + 1 if rightpos < endpos and not heap[childpos] < heap[rightpos]: childpos = rightpos # Move the smaller child up. heap[pos] = heap[childpos] pos = childpos childpos = 2*pos + 1 # The leaf at pos is empty now. Put newitem there, and bubble it up # to its final resting place (by sifting its parents down). heap[pos] = newitem _siftdown(heap, startpos, pos) def _siftdown_max(heap, startpos, pos): 'Maxheap variant of _siftdown' newitem = heap[pos] # Follow the path to the root, moving parents down until finding a place # newitem fits. while pos > startpos: parentpos = (pos - 1) >> 1 parent = heap[parentpos] if parent < newitem: heap[pos] = parent pos = parentpos continue break heap[pos] = newitem def _siftup_max(heap, pos): 'Maxheap variant of _siftup' endpos = len(heap) startpos = pos newitem = heap[pos] # Bubble up the larger child until hitting a leaf. childpos = 2*pos + 1 # leftmost child position while childpos < endpos: # Set childpos to index of larger child. rightpos = childpos + 1 if rightpos < endpos and not heap[rightpos] < heap[childpos]: childpos = rightpos # Move the larger child up. heap[pos] = heap[childpos] pos = childpos childpos = 2*pos + 1 # The leaf at pos is empty now. Put newitem there, and bubble it up # to its final resting place (by sifting its parents down). heap[pos] = newitem _siftdown_max(heap, startpos, pos) # If available, use C implementation try: from _heapq import * except ImportError: pass def merge(*iterables): '''Merge multiple sorted inputs into a single sorted output. Similar to sorted(itertools.chain(*iterables)) but returns a generator, does not pull the data into memory all at once, and assumes that each of the input streams is already sorted (smallest to largest). >>> list(merge([1,3,5,7], [0,2,4,8], [5,10,15,20], [], [25])) [0, 1, 2, 3, 4, 5, 5, 7, 8, 10, 15, 20, 25] ''' _heappop, _heapreplace, _StopIteration = heappop, heapreplace, StopIteration _len = len h = [] h_append = h.append for itnum, it in enumerate(map(iter, iterables)): try: next = it.__next__ h_append([next(), itnum, next]) except _StopIteration: pass heapify(h) while _len(h) > 1: try: while True: v, itnum, next = s = h[0] yield v s[0] = next() # raises StopIteration when exhausted _heapreplace(h, s) # restore heap condition except _StopIteration: _heappop(h) # remove empty iterator if h: # fast case when only a single iterator remains v, itnum, next = h[0] yield v yield from next.__self__ # Extend the implementations of nsmallest and nlargest to use a key= argument _nsmallest = nsmallest def nsmallest(n, iterable, key=None): """Find the n smallest elements in a dataset. Equivalent to: sorted(iterable, key=key)[:n] """ # Short-cut for n==1 is to use min() when len(iterable)>0 if n == 1: it = iter(iterable) head = list(islice(it, 1)) if not head: return [] if key is None: return [min(chain(head, it))] return [min(chain(head, it), key=key)] # When n>=size, it's faster to use sorted() try: size = len(iterable) except (TypeError, AttributeError): pass else: if n >= size: return sorted(iterable, key=key)[:n] # When key is none, use simpler decoration if key is None: it = zip(iterable, count()) # decorate result = _nsmallest(n, it) return [r[0] for r in result] # undecorate # General case, slowest method in1, in2 = tee(iterable) it = zip(map(key, in1), count(), in2) # decorate result = _nsmallest(n, it) return [r[2] for r in result] # undecorate _nlargest = nlargest def nlargest(n, iterable, key=None): """Find the n largest elements in a dataset. Equivalent to: sorted(iterable, key=key, reverse=True)[:n] """ # Short-cut for n==1 is to use max() when len(iterable)>0 if n == 1: it = iter(iterable) head = list(islice(it, 1)) if not head: return [] if key is None: return [max(chain(head, it))] return [max(chain(head, it), key=key)] # When n>=size, it's faster to use sorted() try: size = len(iterable) except (TypeError, AttributeError): pass else: if n >= size: return sorted(iterable, key=key, reverse=True)[:n] # When key is none, use simpler decoration if key is None: it = zip(iterable, count(0,-1)) # decorate result = _nlargest(n, it) return [r[0] for r in result] # undecorate # General case, slowest method in1, in2 = tee(iterable) it = zip(map(key, in1), count(0,-1), in2) # decorate result = _nlargest(n, it) return [r[2] for r in result] # undecorate if __name__ == "__main__": # Simple sanity test heap = [] data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0] for item in data: heappush(heap, item) sort = [] while heap: sort.append(heappop(heap)) print(sort) import doctest doctest.testmod()
gpl-2.0
[ 624, 19777, 4126, 5563, 334, 65, 14, 75, 14, 65, 14, 7464, 4126, 680, 199, 199, 1966, 7461, 787, 6572, 367, 1314, 282, 59, 75, 61, 2695, 282, 59, 18, 10, 75, 11, 17, 61, 436, 282, 59, 75, 61, 2695, 282, 59, 18, 10, 75, 11, 18, 61, 367, 199, 452, 1022, 12, 23190, 4008, 687, 378, 14, 221, 2104, 314, 308, 1728, 402, 9132, 12, 199, 2865, 13, 5952, 4008, 787, 8652, 370, 506, 15258, 14, 221, 710, 19604, 199, 1829, 402, 282, 13295, 365, 626, 282, 59, 16, 61, 365, 3544, 2399, 18604, 1819, 14, 199, 199, 7692, 26, 199, 199, 12492, 275, 942, 3322, 327, 8491, 376, 2701, 13295, 199, 426, 571, 2084, 8, 12492, 12, 1242, 9, 327, 6675, 397, 282, 892, 1242, 641, 314, 13295, 199, 1053, 275, 946, 571, 411, 8, 12492, 9, 327, 299, 1483, 314, 18604, 1242, 687, 314, 13295, 199, 1053, 275, 13295, 59, 16, 61, 755, 327, 18604, 1242, 641, 314, 13295, 1928, 4560, 4073, 652, 199, 12492, 2021, 8, 88, 9, 3698, 327, 18501, 769, 1901, 282, 13295, 12, 315, 13, 2778, 12, 315, 7798, 900, 199, 1053, 275, 13295, 1814, 8, 12492, 12, 1242, 9, 327, 299, 1483, 436, 2529, 18604, 1242, 12, 436, 9584, 3044, 327, 892, 1242, 27, 314, 13295, 1568, 365, 14874, 199, 199, 47, 300, 3261, 22754, 687, 1318, 2706, 13295, 18036, 465, 11924, 26, 199, 199, 13, 2136, 675, 378, 13, 6788, 16356, 14, 221, 961, 7704, 314, 8931, 3382, 314, 523, 1478, 367, 282, 1031, 436, 314, 10507, 367, 2399, 4978, 18023, 6656, 523, 25259, 12, 1325, 365, 1655, 11233, 3967, 2018, 4440, 378, 13, 6788, 16356, 14, 199, 199, 13, 25119, 946, 571, 411, 342, 1083, 2529, 314, 18604, 1242, 12, 440, 314, 17451, 14, 199, 199, 20676, 2877, 1852, 652, 3962, 370, 2455, 314, 13295, 465, 282, 5578, 2018, 769, 199, 7395, 6296, 1359, 874, 26, 13295, 59, 16, 61, 365, 314, 18604, 1242, 12, 436, 13295, 14, 3191, 342, 199, 20180, 83, 314, 13295, 30326, 1, 199, 624, 199, 199, 3, 12769, 1233, 701, 25645, 11908, 593, 7, 714, 6505, 12, 18336, 2509, 701, 26244, 11379, 878, 436, 30703, 2106, 68, 869, 386, 1337, 281, 199, 199, 363, 10254, 363, 275, 408, 19777, 21366, 199, 199, 59, 15228, 701, 481, 1312, 15368, 79, 374, 26486, 1005, 61, 199, 199, 1966, 7461, 787, 6572, 367, 1314, 282, 59, 75, 61, 2695, 282, 59, 18, 10, 75, 11, 17, 61, 436, 282, 59, 75, 61, 2695, 282, 59, 18, 10, 75, 11, 18, 61, 367, 199, 452, 1022, 12, 23190, 4008, 687, 378, 14, 221, 2104, 314, 308, 1728, 402, 9132, 12, 199, 2865, 13, 5952, 4008, 787, 8652, 370, 506, 15258, 14, 221, 710, 19604, 199, 1829, 402, 282, 13295, 365, 626, 282, 59, 16, 61, 365, 3544, 2399, 18604, 1819, 14, 199, 199, 1918, 620, 618, 30326, 3432, 365, 18329, 370, 506, 376, 13402, 4402, 199, 22903, 367, 282, 370, 23474, 14, 221, 710, 5579, 5084, 787, 658, 75, 297, 440, 282, 59, 75, 2189, 199, 3521, 378, 199, 2116, 413, 2476, 499, 8592, 650, 5185, 841, 4483, 959, 5185, 1227, 2541, 1520, 755, 1695, 755, 1749, 755, 1616, 420, 4119, 420, 3144, 420, 4944, 420, 4329, 339, 4114, 3193, 257, 5557, 6155, 257, 5851, 3388, 257, 7829, 6928, 257, 6546, 5504, 257, 5661, 7875, 257, 8087, 7294, 257, 7349, 4233, 421, 199, 607, 314, 3123, 3432, 12, 1924, 4917, 658, 75, 7, 365, 370, 3637, 658, 18, 10, 75, 11, 17, 7, 436, 658, 18, 10, 75, 11, 18, 1370, 221, 1010, 199, 290, 20195, 3366, 370, 23474, 781, 1937, 315, 308, 5203, 12, 1924, 4917, 365, 314, 4747, 1372, 199, 1883, 314, 2877, 10106, 652, 370, 1190, 12, 436, 781, 883, 3307, 314, 4747, 1372, 3224, 314, 3123, 199, 475, 1937, 1006, 1687, 10339, 83, 308, 15, 426, 10530, 14, 221, 9738, 12, 315, 5002, 24189, 13103, 199, 1618, 4066, 370, 23474, 83, 12, 781, 886, 440, 1929, 370, 3307, 314, 7994, 402, 282, 4747, 1372, 14, 199, 1378, 506, 1655, 4402, 13402, 12, 1380, 282, 4747, 1372, 365, 8023, 5731, 12, 781, 862, 370, 199, 1814, 652, 701, 6020, 587, 737, 282, 5117, 2166, 12, 436, 314, 2332, 15410, 199, 9099, 282, 4917, 436, 314, 2877, 10106, 652, 370, 1190, 1395, 7795, 3365, 2974, 12, 199, 7911, 314, 2746, 4917, 298, 2676, 83, 2, 1806, 314, 2877, 2746, 1915, 10106, 14, 199, 199, 3917, 642, 13295, 30326, 365, 17819, 737, 1006, 900, 12, 1478, 378, 365, 5436, 590, 199, 1589, 20347, 4747, 1372, 14, 221, 710, 3486, 270, 5563, 530, 4340, 370, 2813, 652, 436, 199, 1623, 314, 298, 2184, 2, 4747, 1372, 365, 370, 4057, 2005, 560, 332, 334, 2723, 1159, 14722, 4917, 4233, 315, 314, 199, 32189, 3432, 9, 1901, 314, 378, 3421, 12, 436, 2066, 1126, 331, 750, 642, 892, 378, 3224, 199, 1589, 3123, 12, 444, 29131, 1338, 12, 5133, 314, 30326, 365, 295, 13, 597, 13306, 379, 14, 199, 2765, 365, 5436, 590, 943, 18327, 15003, 641, 314, 3141, 1329, 402, 2974, 315, 314, 3123, 14, 199, 2175, 25012, 1806, 1006, 2974, 12, 1265, 664, 376, 593, 8, 78, 10359, 302, 9, 4069, 14, 199, 199, 33, 14213, 3878, 402, 642, 4069, 365, 626, 1265, 883, 30427, 5518, 892, 199, 1744, 1830, 314, 4069, 365, 9995, 641, 12, 2741, 626, 314, 11788, 2974, 787, 199, 1397, 298, 9549, 351, 2, 2419, 314, 2061, 378, 1133, 72, 1819, 1265, 12509, 14, 221, 961, 365, 199, 397, 910, 1183, 2997, 315, 17625, 18191, 12, 2382, 314, 3123, 15164, 1006, 199, 15994, 4474, 12, 436, 314, 298, 2676, 2, 5558, 4910, 314, 18604, 18416, 199, 521, 14, 221, 3979, 376, 1566, 8732, 1163, 4474, 367, 6451, 12, 2985, 787, 199, 19274, 1901, 314, 6466, 12, 880, 2985, 883, 16174, 2621, 1901, 314, 13295, 14, 221, 2002, 12, 282, 199, 12492, 365, 282, 6954, 5523, 367, 18234, 8732, 2393, 334, 3749, 365, 4052, 473, 199, 2972, 367, 3002, 603, 28904, 542, 1514, 2247, 22901, 680, 199, 199, 9958, 1785, 13955, 367, 18234, 8732, 2393, 1172, 2757, 2178, 9840, 199, 270, 14525, 379, 12, 436, 946, 7461, 787, 6954 ]
[ 19777, 4126, 5563, 334, 65, 14, 75, 14, 65, 14, 7464, 4126, 680, 199, 199, 1966, 7461, 787, 6572, 367, 1314, 282, 59, 75, 61, 2695, 282, 59, 18, 10, 75, 11, 17, 61, 436, 282, 59, 75, 61, 2695, 282, 59, 18, 10, 75, 11, 18, 61, 367, 199, 452, 1022, 12, 23190, 4008, 687, 378, 14, 221, 2104, 314, 308, 1728, 402, 9132, 12, 199, 2865, 13, 5952, 4008, 787, 8652, 370, 506, 15258, 14, 221, 710, 19604, 199, 1829, 402, 282, 13295, 365, 626, 282, 59, 16, 61, 365, 3544, 2399, 18604, 1819, 14, 199, 199, 7692, 26, 199, 199, 12492, 275, 942, 3322, 327, 8491, 376, 2701, 13295, 199, 426, 571, 2084, 8, 12492, 12, 1242, 9, 327, 6675, 397, 282, 892, 1242, 641, 314, 13295, 199, 1053, 275, 946, 571, 411, 8, 12492, 9, 327, 299, 1483, 314, 18604, 1242, 687, 314, 13295, 199, 1053, 275, 13295, 59, 16, 61, 755, 327, 18604, 1242, 641, 314, 13295, 1928, 4560, 4073, 652, 199, 12492, 2021, 8, 88, 9, 3698, 327, 18501, 769, 1901, 282, 13295, 12, 315, 13, 2778, 12, 315, 7798, 900, 199, 1053, 275, 13295, 1814, 8, 12492, 12, 1242, 9, 327, 299, 1483, 436, 2529, 18604, 1242, 12, 436, 9584, 3044, 327, 892, 1242, 27, 314, 13295, 1568, 365, 14874, 199, 199, 47, 300, 3261, 22754, 687, 1318, 2706, 13295, 18036, 465, 11924, 26, 199, 199, 13, 2136, 675, 378, 13, 6788, 16356, 14, 221, 961, 7704, 314, 8931, 3382, 314, 523, 1478, 367, 282, 1031, 436, 314, 10507, 367, 2399, 4978, 18023, 6656, 523, 25259, 12, 1325, 365, 1655, 11233, 3967, 2018, 4440, 378, 13, 6788, 16356, 14, 199, 199, 13, 25119, 946, 571, 411, 342, 1083, 2529, 314, 18604, 1242, 12, 440, 314, 17451, 14, 199, 199, 20676, 2877, 1852, 652, 3962, 370, 2455, 314, 13295, 465, 282, 5578, 2018, 769, 199, 7395, 6296, 1359, 874, 26, 13295, 59, 16, 61, 365, 314, 18604, 1242, 12, 436, 13295, 14, 3191, 342, 199, 20180, 83, 314, 13295, 30326, 1, 199, 624, 199, 199, 3, 12769, 1233, 701, 25645, 11908, 593, 7, 714, 6505, 12, 18336, 2509, 701, 26244, 11379, 878, 436, 30703, 2106, 68, 869, 386, 1337, 281, 199, 199, 363, 10254, 363, 275, 408, 19777, 21366, 199, 199, 59, 15228, 701, 481, 1312, 15368, 79, 374, 26486, 1005, 61, 199, 199, 1966, 7461, 787, 6572, 367, 1314, 282, 59, 75, 61, 2695, 282, 59, 18, 10, 75, 11, 17, 61, 436, 282, 59, 75, 61, 2695, 282, 59, 18, 10, 75, 11, 18, 61, 367, 199, 452, 1022, 12, 23190, 4008, 687, 378, 14, 221, 2104, 314, 308, 1728, 402, 9132, 12, 199, 2865, 13, 5952, 4008, 787, 8652, 370, 506, 15258, 14, 221, 710, 19604, 199, 1829, 402, 282, 13295, 365, 626, 282, 59, 16, 61, 365, 3544, 2399, 18604, 1819, 14, 199, 199, 1918, 620, 618, 30326, 3432, 365, 18329, 370, 506, 376, 13402, 4402, 199, 22903, 367, 282, 370, 23474, 14, 221, 710, 5579, 5084, 787, 658, 75, 297, 440, 282, 59, 75, 2189, 199, 3521, 378, 199, 2116, 413, 2476, 499, 8592, 650, 5185, 841, 4483, 959, 5185, 1227, 2541, 1520, 755, 1695, 755, 1749, 755, 1616, 420, 4119, 420, 3144, 420, 4944, 420, 4329, 339, 4114, 3193, 257, 5557, 6155, 257, 5851, 3388, 257, 7829, 6928, 257, 6546, 5504, 257, 5661, 7875, 257, 8087, 7294, 257, 7349, 4233, 421, 199, 607, 314, 3123, 3432, 12, 1924, 4917, 658, 75, 7, 365, 370, 3637, 658, 18, 10, 75, 11, 17, 7, 436, 658, 18, 10, 75, 11, 18, 1370, 221, 1010, 199, 290, 20195, 3366, 370, 23474, 781, 1937, 315, 308, 5203, 12, 1924, 4917, 365, 314, 4747, 1372, 199, 1883, 314, 2877, 10106, 652, 370, 1190, 12, 436, 781, 883, 3307, 314, 4747, 1372, 3224, 314, 3123, 199, 475, 1937, 1006, 1687, 10339, 83, 308, 15, 426, 10530, 14, 221, 9738, 12, 315, 5002, 24189, 13103, 199, 1618, 4066, 370, 23474, 83, 12, 781, 886, 440, 1929, 370, 3307, 314, 7994, 402, 282, 4747, 1372, 14, 199, 1378, 506, 1655, 4402, 13402, 12, 1380, 282, 4747, 1372, 365, 8023, 5731, 12, 781, 862, 370, 199, 1814, 652, 701, 6020, 587, 737, 282, 5117, 2166, 12, 436, 314, 2332, 15410, 199, 9099, 282, 4917, 436, 314, 2877, 10106, 652, 370, 1190, 1395, 7795, 3365, 2974, 12, 199, 7911, 314, 2746, 4917, 298, 2676, 83, 2, 1806, 314, 2877, 2746, 1915, 10106, 14, 199, 199, 3917, 642, 13295, 30326, 365, 17819, 737, 1006, 900, 12, 1478, 378, 365, 5436, 590, 199, 1589, 20347, 4747, 1372, 14, 221, 710, 3486, 270, 5563, 530, 4340, 370, 2813, 652, 436, 199, 1623, 314, 298, 2184, 2, 4747, 1372, 365, 370, 4057, 2005, 560, 332, 334, 2723, 1159, 14722, 4917, 4233, 315, 314, 199, 32189, 3432, 9, 1901, 314, 378, 3421, 12, 436, 2066, 1126, 331, 750, 642, 892, 378, 3224, 199, 1589, 3123, 12, 444, 29131, 1338, 12, 5133, 314, 30326, 365, 295, 13, 597, 13306, 379, 14, 199, 2765, 365, 5436, 590, 943, 18327, 15003, 641, 314, 3141, 1329, 402, 2974, 315, 314, 3123, 14, 199, 2175, 25012, 1806, 1006, 2974, 12, 1265, 664, 376, 593, 8, 78, 10359, 302, 9, 4069, 14, 199, 199, 33, 14213, 3878, 402, 642, 4069, 365, 626, 1265, 883, 30427, 5518, 892, 199, 1744, 1830, 314, 4069, 365, 9995, 641, 12, 2741, 626, 314, 11788, 2974, 787, 199, 1397, 298, 9549, 351, 2, 2419, 314, 2061, 378, 1133, 72, 1819, 1265, 12509, 14, 221, 961, 365, 199, 397, 910, 1183, 2997, 315, 17625, 18191, 12, 2382, 314, 3123, 15164, 1006, 199, 15994, 4474, 12, 436, 314, 298, 2676, 2, 5558, 4910, 314, 18604, 18416, 199, 521, 14, 221, 3979, 376, 1566, 8732, 1163, 4474, 367, 6451, 12, 2985, 787, 199, 19274, 1901, 314, 6466, 12, 880, 2985, 883, 16174, 2621, 1901, 314, 13295, 14, 221, 2002, 12, 282, 199, 12492, 365, 282, 6954, 5523, 367, 18234, 8732, 2393, 334, 3749, 365, 4052, 473, 199, 2972, 367, 3002, 603, 28904, 542, 1514, 2247, 22901, 680, 199, 199, 9958, 1785, 13955, 367, 18234, 8732, 2393, 1172, 2757, 2178, 9840, 199, 270, 14525, 379, 12, 436, 946, 7461, 787, 6954, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
idncom/odoo
addons/base_iban/__openerp__.py
260
1724
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## { 'name': 'IBAN Bank Accounts', 'version': '1.0', 'category': 'Hidden/Dependency', 'description': """ This module installs the base for IBAN (International Bank Account Number) bank accounts and checks for it's validity. ====================================================================================================================== The ability to extract the correctly represented local accounts from IBAN accounts with a single statement. """, 'author': 'OpenERP SA', 'website': 'https://www.odoo.com', 'depends': ['base'], 'data': ['base_iban_data.xml' , 'base_iban_view.xml'], 'installable': True, 'auto_install': False, } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
agpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 259, 7653, 12, 3232, 5800, 8259, 9274, 199, 3, 259, 1898, 334, 35, 9, 8353, 13, 6542, 11947, 12361, 8642, 1014, 921, 9864, 14, 1235, 10121, 199, 3, 199, 3, 259, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 259, 652, 1334, 314, 2895, 402, 314, 1664, 4265, 1696, 1684, 844, 465, 199, 3, 259, 3267, 701, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 199, 3, 259, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 4265, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 4265, 1696, 1684, 844, 199, 3, 259, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 4605, 199, 91, 272, 283, 354, 356, 283, 2100, 879, 28721, 4473, 6851, 297, 272, 283, 1023, 356, 283, 17, 14, 16, 297, 272, 283, 3710, 356, 283, 14983, 15, 14403, 297, 272, 283, 1802, 356, 408, 199, 2765, 859, 25801, 314, 1300, 367, 473, 34, 879, 334, 30886, 28721, 9973, 4860, 9, 16297, 12639, 436, 5920, 367, 652, 1159, 25667, 14, 199, 5695, 12813, 23476, 199, 199, 1918, 21255, 370, 5536, 314, 6657, 11159, 2257, 12639, 687, 473, 34, 879, 12639, 221, 199, 1045, 282, 2849, 5164, 14, 272, 10327, 272, 283, 2502, 356, 283, 25347, 13950, 297, 272, 283, 7360, 356, 283, 2859, 921, 1544, 14, 22058, 14, 957, 297, 272, 283, 8912, 356, 788, 1095, 995, 272, 283, 576, 356, 788, 1095, 63, 1892, 290, 63, 576, 14, 1652, 7, 2360, 283, 1095, 63, 1892, 290, 63, 1345, 14, 1652, 995, 272, 283, 21762, 356, 715, 12, 272, 283, 2495, 63, 3174, 356, 756, 12, 199, 93, 199, 3, 6695, 26, 10379, 26, 10558, 26, 6492, 29, 20, 26, 10503, 29, 20, 26, 10425, 29, 20, 26, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 259, 7653, 12, 3232, 5800, 8259, 9274, 199, 3, 259, 1898, 334, 35, 9, 8353, 13, 6542, 11947, 12361, 8642, 1014, 921, 9864, 14, 1235, 10121, 199, 3, 199, 3, 259, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 259, 652, 1334, 314, 2895, 402, 314, 1664, 4265, 1696, 1684, 844, 465, 199, 3, 259, 3267, 701, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 199, 3, 259, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 4265, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 4265, 1696, 1684, 844, 199, 3, 259, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 4605, 199, 91, 272, 283, 354, 356, 283, 2100, 879, 28721, 4473, 6851, 297, 272, 283, 1023, 356, 283, 17, 14, 16, 297, 272, 283, 3710, 356, 283, 14983, 15, 14403, 297, 272, 283, 1802, 356, 408, 199, 2765, 859, 25801, 314, 1300, 367, 473, 34, 879, 334, 30886, 28721, 9973, 4860, 9, 16297, 12639, 436, 5920, 367, 652, 1159, 25667, 14, 199, 5695, 12813, 23476, 199, 199, 1918, 21255, 370, 5536, 314, 6657, 11159, 2257, 12639, 687, 473, 34, 879, 12639, 221, 199, 1045, 282, 2849, 5164, 14, 272, 10327, 272, 283, 2502, 356, 283, 25347, 13950, 297, 272, 283, 7360, 356, 283, 2859, 921, 1544, 14, 22058, 14, 957, 297, 272, 283, 8912, 356, 788, 1095, 995, 272, 283, 576, 356, 788, 1095, 63, 1892, 290, 63, 576, 14, 1652, 7, 2360, 283, 1095, 63, 1892, 290, 63, 1345, 14, 1652, 995, 272, 283, 21762, 356, 715, 12, 272, 283, 2495, 63, 3174, 356, 756, 12, 199, 93, 199, 3, 6695, 26, 10379, 26, 10558, 26, 6492, 29, 20, 26, 10503, 29, 20, 26, 10425, 29, 20, 26, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
googlevr/tilt-brush-toolkit
tests/test_tilt.py
1
3871
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import contextlib import os import shutil import unittest from tiltbrush.tilt import Tilt @contextlib.contextmanager def copy_of_tilt(tilt_file='data/sketch1.tilt', as_filename=False): """Returns a mutate-able copy of tilt_file, and removes it when done.""" base = os.path.abspath(os.path.dirname(__file__)) full_filename = os.path.join(base, tilt_file) tmp_filename = os.path.splitext(full_filename)[0] + '_tmp.tilt' shutil.copy(src=full_filename, dst=tmp_filename) try: if as_filename: yield tmp_filename else: yield Tilt(tmp_filename) finally: if os.path.exists(tmp_filename): os.unlink(tmp_filename) def as_float32(f): import struct return struct.unpack('f', struct.pack('f', f))[0] class TestTiltMutations(unittest.TestCase): def test_as_directory(self): # Test Tilt.as_directory with copy_of_tilt(as_filename=True) as tilt_filename: with Tilt.as_directory(tilt_filename): self.assertTrue(os.path.isdir(tilt_filename)) self.assertTrue(os.path.exists(os.path.join(tilt_filename, 'metadata.json'))) def test_can_mutate_metadata(self): import uuid random_guid = str(uuid.uuid4()) with copy_of_tilt() as tilt: with tilt.mutable_metadata() as dct: # Check that they are different references dct['EnvironmentPreset'] = random_guid self.assertNotEqual( tilt.metadata['EnvironmentPreset'], dct['EnvironmentPreset']) # Check that it's copied back on exit from mutable_metadata self.assertEqual(tilt.metadata['EnvironmentPreset'], random_guid) # Check that the mutations persist tilt2 = Tilt(tilt.filename) self.assertEqual(tilt2.metadata['EnvironmentPreset'], random_guid) def test_can_del_sketch(self): # Test that "del tilt.sketch" forces it to re-load from disk with copy_of_tilt() as tilt: stroke = tilt.sketch.strokes[0] del tilt.sketch stroke2 = tilt.sketch.strokes[0] assert stroke is not stroke2 def test_mutate_control_point(self): # Test that control point mutations are saved with copy_of_tilt() as tilt: stroke = tilt.sketch.strokes[0] new_y = as_float32(stroke.controlpoints[0].position[1] + 3) stroke.controlpoints[0].position[1] = new_y tilt.write_sketch() del tilt.sketch self.assertEqual(tilt.sketch.strokes[0].controlpoints[0].position[1], new_y) def test_stroke_extension(self): # Test that control point extensions can be added and removed with copy_of_tilt() as tilt: stroke = tilt.sketch.strokes[0] # This sketch was made before stroke scale was a thing self.assertEqual(stroke.flags, 0) self.assertRaises(AttributeError, (lambda: stroke.scale)) # Test adding some extension data stroke.scale = 1.25 self.assertEqual(stroke.scale, 1.25) # Test removing extension data del stroke.flags self.assertRaises(AttributeError (lambda: stroke.flags)) # Test that the changes survive a save+load tilt.write_sketch() stroke2 = Tilt(tilt.filename).sketch.strokes[0] self.assertEqual(stroke2.scale, 1.25) self.assertRaises(AttributeError (lambda: stroke2.flags)) if __name__ == '__main__': unittest.main()
apache-2.0
[ 3, 1898, 7800, 4475, 3277, 14, 2900, 5924, 5702, 14, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 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, 15502, 199, 646, 747, 199, 646, 5145, 199, 646, 2882, 199, 199, 504, 221, 20075, 22302, 14, 20075, 492, 377, 4803, 421, 199, 32, 23464, 14, 14237, 199, 318, 1331, 63, 1618, 63, 20075, 8, 20075, 63, 493, 534, 576, 15, 1339, 2367, 17, 14, 20075, 297, 465, 63, 1501, 29, 797, 304, 523, 408, 3407, 282, 31173, 13, 461, 1331, 402, 221, 20075, 63, 493, 12, 436, 14185, 652, 1380, 4224, 1041, 523, 1300, 275, 747, 14, 515, 14, 4832, 8, 736, 14, 515, 14, 3475, 3460, 493, 8964, 523, 2615, 63, 1501, 275, 747, 14, 515, 14, 904, 8, 1095, 12, 221, 20075, 63, 493, 9, 523, 3529, 63, 1501, 275, 747, 14, 515, 14, 7973, 8, 2861, 63, 1501, 2788, 16, 61, 435, 2513, 2791, 14, 20075, 7, 523, 5145, 14, 1574, 8, 2164, 29, 2861, 63, 1501, 12, 5042, 29, 2791, 63, 1501, 9, 523, 862, 26, 272, 340, 465, 63, 1501, 26, 489, 1995, 3529, 63, 1501, 272, 587, 26, 489, 1995, 377, 4803, 8, 2791, 63, 1501, 9, 523, 3753, 26, 272, 340, 747, 14, 515, 14, 2444, 8, 2791, 63, 1501, 304, 489, 747, 14, 7162, 8, 2791, 63, 1501, 9, 421, 199, 318, 465, 63, 1609, 708, 8, 70, 304, 523, 492, 2702, 523, 372, 2702, 14, 5301, 360, 70, 297, 2702, 14, 1389, 360, 70, 297, 289, 11515, 16, 61, 421, 199, 533, 1379, 52, 4803, 22539, 1298, 8, 2796, 14, 1746, 304, 523, 347, 511, 63, 305, 63, 3619, 8, 277, 304, 272, 327, 1379, 377, 4803, 14, 305, 63, 3619, 272, 543, 1331, 63, 1618, 63, 20075, 8, 305, 63, 1501, 29, 549, 9, 465, 221, 20075, 63, 1501, 26, 489, 543, 377, 4803, 14, 305, 63, 3619, 8, 20075, 63, 1501, 304, 267, 291, 14, 1815, 8, 736, 14, 515, 14, 6027, 8, 20075, 63, 1501, 430, 267, 291, 14, 1815, 8, 736, 14, 515, 14, 2444, 8, 736, 14, 515, 14, 904, 8, 20075, 63, 1501, 12, 283, 2343, 14, 1001, 7058, 819, 347, 511, 63, 2425, 63, 6552, 323, 63, 2343, 8, 277, 304, 272, 492, 5377, 272, 2196, 63, 9473, 275, 620, 8, 2580, 14, 2580, 20, 1012, 272, 543, 1331, 63, 1618, 63, 20075, 342, 465, 221, 20075, 26, 489, 543, 221, 20075, 14, 17404, 63, 2343, 342, 465, 16354, 26, 267, 327, 2670, 626, 2985, 787, 3365, 6941, 267, 16354, 459, 8263, 2398, 409, 418, 275, 2196, 63, 9473, 267, 291, 14, 7418, 8, 881, 221, 20075, 14, 2343, 459, 8263, 2398, 409, 995, 16354, 459, 8263, 2398, 409, 1105, 489, 327, 2670, 626, 652, 1159, 8876, 1771, 641, 4458, 687, 17194, 63, 2343, 489, 291, 14, 629, 8, 20075, 14, 2343, 459, 8263, 2398, 409, 995, 2196, 63, 9473, 9, 489, 327, 2670, 626, 314, 8567, 1298, 22400, 489, 221, 20075, 18, 275, 377, 4803, 8, 20075, 14, 1501, 9, 489, 291, 14, 629, 8, 20075, 18, 14, 2343, 459, 8263, 2398, 409, 995, 2196, 63, 9473, 9, 819, 347, 511, 63, 2425, 63, 2264, 63, 1339, 2367, 8, 277, 304, 272, 327, 1379, 626, 298, 2264, 221, 20075, 14, 1339, 2367, 2, 25983, 652, 370, 295, 13, 912, 687, 4543, 272, 543, 1331, 63, 1618, 63, 20075, 342, 465, 221, 20075, 26, 489, 22824, 275, 221, 20075, 14, 1339, 2367, 14, 24627, 9246, 59, 16, 61, 489, 2150, 221, 20075, 14, 1339, 2367, 489, 22824, 18, 275, 221, 20075, 14, 1339, 2367, 14, 24627, 9246, 59, 16, 61, 489, 702, 22824, 365, 440, 22824, 18, 27404, 347, 511, 63, 6552, 323, 63, 2785, 63, 1403, 8, 277, 304, 272, 327, 1379, 626, 3304, 2376, 8567, 1298, 787, 6290, 272, 543, 1331, 63, 1618, 63, 20075, 342, 465, 221, 20075, 26, 489, 22824, 275, 221, 20075, 14, 1339, 2367, 14, 24627, 9246, 59, 16, 61, 489, 892, 63, 89, 275, 465, 63, 1609, 708, 8, 11473, 14, 2785, 3438, 59, 16, 1055, 3124, 59, 17, 61, 435, 650, 9, 489, 22824, 14, 2785, 3438, 59, 16, 1055, 3124, 59, 17, 61, 275, 892, 63, 89, 489, 221, 20075, 14, 952, 63, 1339, 2367, 342, 489, 2150, 221, 20075, 14, 1339, 2367, 489, 291, 14, 629, 8, 20075, 14, 1339, 2367, 14, 24627, 9246, 59, 16, 1055, 2785, 3438, 59, 16, 1055, 3124, 59, 17, 467, 892, 63, 89, 9, 819, 347, 511, 63, 11473, 63, 3435, 8, 277, 304, 272, 327, 1379, 626, 3304, 2376, 5478, 883, 506, 3483, 436, 4829, 272, 543, 1331, 63, 1618, 63, 20075, 342, 465, 221, 20075, 26, 489, 22824, 275, 221, 20075, 14, 1339, 2367, 14, 24627, 9246, 59, 16, 61, 489, 327, 961, 2386, 2367, 1990, 6326, 2544, 22824, 4666, 1990, 282, 8377, 489, 291, 14, 629, 8, 11473, 14, 2469, 12, 378, 9, 489, 291, 14, 1855, 8, 10227, 12, 334, 2734, 26, 22824, 14, 3467, 430, 489, 327, 1379, 7791, 2005, 3329, 666, 489, 22824, 14, 3467, 275, 413, 14, 821, 489, 291, 14, 629, 8, 11473, 14, 3467, 12, 413, 14, 821, 9, 489, 327, 1379, 12881, 3329, 666, 489, 2150, 22824, 14, 2469, 489, 291, 14, 1855, 8, 10227, 334, 2734, 26, 22824, 14, 2469, 430, 489, 327, 1379, 626, 314, 4493, 6296, 433, 432, 282, 3354, 11, 912, 489, 221, 20075, 14, 952, 63, 1339, 2367, 342, 489, 22824, 18 ]
[ 1898, 7800, 4475, 3277, 14, 2900, 5924, 5702, 14, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 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, 15502, 199, 646, 747, 199, 646, 5145, 199, 646, 2882, 199, 199, 504, 221, 20075, 22302, 14, 20075, 492, 377, 4803, 421, 199, 32, 23464, 14, 14237, 199, 318, 1331, 63, 1618, 63, 20075, 8, 20075, 63, 493, 534, 576, 15, 1339, 2367, 17, 14, 20075, 297, 465, 63, 1501, 29, 797, 304, 523, 408, 3407, 282, 31173, 13, 461, 1331, 402, 221, 20075, 63, 493, 12, 436, 14185, 652, 1380, 4224, 1041, 523, 1300, 275, 747, 14, 515, 14, 4832, 8, 736, 14, 515, 14, 3475, 3460, 493, 8964, 523, 2615, 63, 1501, 275, 747, 14, 515, 14, 904, 8, 1095, 12, 221, 20075, 63, 493, 9, 523, 3529, 63, 1501, 275, 747, 14, 515, 14, 7973, 8, 2861, 63, 1501, 2788, 16, 61, 435, 2513, 2791, 14, 20075, 7, 523, 5145, 14, 1574, 8, 2164, 29, 2861, 63, 1501, 12, 5042, 29, 2791, 63, 1501, 9, 523, 862, 26, 272, 340, 465, 63, 1501, 26, 489, 1995, 3529, 63, 1501, 272, 587, 26, 489, 1995, 377, 4803, 8, 2791, 63, 1501, 9, 523, 3753, 26, 272, 340, 747, 14, 515, 14, 2444, 8, 2791, 63, 1501, 304, 489, 747, 14, 7162, 8, 2791, 63, 1501, 9, 421, 199, 318, 465, 63, 1609, 708, 8, 70, 304, 523, 492, 2702, 523, 372, 2702, 14, 5301, 360, 70, 297, 2702, 14, 1389, 360, 70, 297, 289, 11515, 16, 61, 421, 199, 533, 1379, 52, 4803, 22539, 1298, 8, 2796, 14, 1746, 304, 523, 347, 511, 63, 305, 63, 3619, 8, 277, 304, 272, 327, 1379, 377, 4803, 14, 305, 63, 3619, 272, 543, 1331, 63, 1618, 63, 20075, 8, 305, 63, 1501, 29, 549, 9, 465, 221, 20075, 63, 1501, 26, 489, 543, 377, 4803, 14, 305, 63, 3619, 8, 20075, 63, 1501, 304, 267, 291, 14, 1815, 8, 736, 14, 515, 14, 6027, 8, 20075, 63, 1501, 430, 267, 291, 14, 1815, 8, 736, 14, 515, 14, 2444, 8, 736, 14, 515, 14, 904, 8, 20075, 63, 1501, 12, 283, 2343, 14, 1001, 7058, 819, 347, 511, 63, 2425, 63, 6552, 323, 63, 2343, 8, 277, 304, 272, 492, 5377, 272, 2196, 63, 9473, 275, 620, 8, 2580, 14, 2580, 20, 1012, 272, 543, 1331, 63, 1618, 63, 20075, 342, 465, 221, 20075, 26, 489, 543, 221, 20075, 14, 17404, 63, 2343, 342, 465, 16354, 26, 267, 327, 2670, 626, 2985, 787, 3365, 6941, 267, 16354, 459, 8263, 2398, 409, 418, 275, 2196, 63, 9473, 267, 291, 14, 7418, 8, 881, 221, 20075, 14, 2343, 459, 8263, 2398, 409, 995, 16354, 459, 8263, 2398, 409, 1105, 489, 327, 2670, 626, 652, 1159, 8876, 1771, 641, 4458, 687, 17194, 63, 2343, 489, 291, 14, 629, 8, 20075, 14, 2343, 459, 8263, 2398, 409, 995, 2196, 63, 9473, 9, 489, 327, 2670, 626, 314, 8567, 1298, 22400, 489, 221, 20075, 18, 275, 377, 4803, 8, 20075, 14, 1501, 9, 489, 291, 14, 629, 8, 20075, 18, 14, 2343, 459, 8263, 2398, 409, 995, 2196, 63, 9473, 9, 819, 347, 511, 63, 2425, 63, 2264, 63, 1339, 2367, 8, 277, 304, 272, 327, 1379, 626, 298, 2264, 221, 20075, 14, 1339, 2367, 2, 25983, 652, 370, 295, 13, 912, 687, 4543, 272, 543, 1331, 63, 1618, 63, 20075, 342, 465, 221, 20075, 26, 489, 22824, 275, 221, 20075, 14, 1339, 2367, 14, 24627, 9246, 59, 16, 61, 489, 2150, 221, 20075, 14, 1339, 2367, 489, 22824, 18, 275, 221, 20075, 14, 1339, 2367, 14, 24627, 9246, 59, 16, 61, 489, 702, 22824, 365, 440, 22824, 18, 27404, 347, 511, 63, 6552, 323, 63, 2785, 63, 1403, 8, 277, 304, 272, 327, 1379, 626, 3304, 2376, 8567, 1298, 787, 6290, 272, 543, 1331, 63, 1618, 63, 20075, 342, 465, 221, 20075, 26, 489, 22824, 275, 221, 20075, 14, 1339, 2367, 14, 24627, 9246, 59, 16, 61, 489, 892, 63, 89, 275, 465, 63, 1609, 708, 8, 11473, 14, 2785, 3438, 59, 16, 1055, 3124, 59, 17, 61, 435, 650, 9, 489, 22824, 14, 2785, 3438, 59, 16, 1055, 3124, 59, 17, 61, 275, 892, 63, 89, 489, 221, 20075, 14, 952, 63, 1339, 2367, 342, 489, 2150, 221, 20075, 14, 1339, 2367, 489, 291, 14, 629, 8, 20075, 14, 1339, 2367, 14, 24627, 9246, 59, 16, 1055, 2785, 3438, 59, 16, 1055, 3124, 59, 17, 467, 892, 63, 89, 9, 819, 347, 511, 63, 11473, 63, 3435, 8, 277, 304, 272, 327, 1379, 626, 3304, 2376, 5478, 883, 506, 3483, 436, 4829, 272, 543, 1331, 63, 1618, 63, 20075, 342, 465, 221, 20075, 26, 489, 22824, 275, 221, 20075, 14, 1339, 2367, 14, 24627, 9246, 59, 16, 61, 489, 327, 961, 2386, 2367, 1990, 6326, 2544, 22824, 4666, 1990, 282, 8377, 489, 291, 14, 629, 8, 11473, 14, 2469, 12, 378, 9, 489, 291, 14, 1855, 8, 10227, 12, 334, 2734, 26, 22824, 14, 3467, 430, 489, 327, 1379, 7791, 2005, 3329, 666, 489, 22824, 14, 3467, 275, 413, 14, 821, 489, 291, 14, 629, 8, 11473, 14, 3467, 12, 413, 14, 821, 9, 489, 327, 1379, 12881, 3329, 666, 489, 2150, 22824, 14, 2469, 489, 291, 14, 1855, 8, 10227, 334, 2734, 26, 22824, 14, 2469, 430, 489, 327, 1379, 626, 314, 4493, 6296, 433, 432, 282, 3354, 11, 912, 489, 221, 20075, 14, 952, 63, 1339, 2367, 342, 489, 22824, 18, 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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.base import ModelBase from django.db.models.query import QuerySet from django.shortcuts import get_object_or_404 from django.http import Http404 from guardian.exceptions import GuardianError from tastypie import http from tastypie.bundle import Bundle from django.http import HttpRequest from tastypie.exceptions import ImmediateHttpResponse def permission_required(perm, lookup_variables=None, **kwargs): """ Decorator for views that checks whether a user has a particular permission enabled. Optionally, instances for which check should be made may be passed as an second argument or as a tuple parameters. :param check_static: if set to ``Model``, the permissions will be checked in calling to Model.static_has_perms() instead of calling to has_perms(). Defaults to ``None``. Examples:: @permission_required('join', (Agora, 'id', 'id')) def join(self, request): agora = get_object_or_404(Agora, id=id) agora.members.append(request.user) return self.success() @permission_required('create', check_static=Agora) def obj_create(self, bundle, request=None, **kwargs): user = get_object_or_404(User, username=username) return user.get_absolute_url() """ check_static = kwargs.pop('check_static', None) if check_static: lookup_variables = [check_static] # Check if perm is given as string in order not to decorate # view function itself which makes debugging harder if not isinstance(perm, basestring): raise GuardianError("First argument must be in format: " "'app_label.codename or a callable which return similar string'") def decorator(view_func): def wrapped(*args, **kwargs): # if more than one parameter is passed to the decorator we try to # fetch object for which check would be made obj = None request = None if 'request' in kwargs: request = kwargs['request'] elif 'bundle' in kwargs: request = kwargs['bundle'].request else: for arg in args: if isinstance(arg, HttpRequest): request = arg break elif isinstance(arg, Bundle) and isinstance(arg.request, HttpRequest): request = arg.request break if lookup_variables: model, lookups = lookup_variables[0], lookup_variables[1:] # Parse model if isinstance(model, basestring): splitted = model.split('.') if len(splitted) != 2: raise GuardianError("If model should be looked up from " "string it needs format: 'app_label.ModelClass'") model = get_model(*splitted) elif issubclass(model.__class__, (Model, ModelBase, QuerySet)): pass else: raise GuardianError("First lookup argument must always be " "a model, string pointing at app/model or queryset. " "Given: %s (type: %s)" % (model, type(model))) # Parse lookups if len(lookups) % 2 != 0: raise GuardianError("Lookup variables must be provided " "as pairs of lookup_string and view_arg") lookup_dict = {} for lookup, view_arg in zip(lookups[::2], lookups[1::2]): if view_arg not in kwargs: raise GuardianError("Argument %s was not passed " "into view function" % view_arg) lookup_dict[lookup] = kwargs[view_arg] if not check_static: try: obj = get_object_or_404(model, **lookup_dict) except Http404: raise ImmediateHttpResponse(response=http.HttpNotFound()) has_perms = False if request: if check_static: has_perms = model.static_has_perms(perm, request.user) else: has_perms = obj.has_perms(perm, request.user) if not has_perms: raise ImmediateHttpResponse(response=http.HttpForbidden()) return view_func(*args, **kwargs) return wraps(view_func)(wrapped) return decorator
agpl-3.0
[ 504, 9143, 492, 14018, 199, 504, 1639, 14, 697, 14, 992, 492, 5822, 12, 664, 63, 1238, 199, 504, 1639, 14, 697, 14, 992, 14, 1095, 492, 5822, 1563, 199, 504, 1639, 14, 697, 14, 992, 14, 1131, 492, 18397, 199, 504, 1639, 14, 17469, 492, 664, 63, 785, 63, 269, 63, 5188, 199, 504, 1639, 14, 1014, 492, 4760, 5188, 199, 199, 504, 8129, 31186, 14, 3924, 492, 12436, 31186, 547, 199, 199, 504, 307, 27352, 9890, 492, 1455, 199, 504, 307, 27352, 9890, 14, 6469, 492, 29311, 199, 504, 1639, 14, 1014, 492, 20730, 199, 504, 307, 27352, 9890, 14, 3924, 492, 473, 77, 5050, 16287, 421, 199, 318, 4983, 63, 2427, 8, 8220, 12, 4237, 63, 3669, 29, 403, 12, 1011, 958, 304, 272, 408, 272, 30684, 367, 6858, 626, 5920, 3775, 282, 922, 965, 282, 6770, 4983, 272, 5223, 14, 339, 22383, 12, 4454, 367, 1314, 1104, 1077, 506, 6326, 1443, 506, 3032, 465, 376, 272, 3499, 1423, 503, 465, 282, 2008, 2633, 14, 339, 520, 635, 1104, 63, 1986, 26, 340, 663, 370, 1124, 1685, 4542, 314, 3443, 911, 506, 272, 7923, 315, 6358, 370, 5822, 14, 1986, 63, 1989, 63, 12068, 342, 3140, 402, 6358, 370, 272, 965, 63, 12068, 1252, 7827, 370, 1124, 403, 4345, 339, 6058, 447, 339, 768, 5693, 63, 2427, 360, 904, 297, 334, 33, 2904, 65, 12, 283, 344, 297, 283, 344, 1333, 272, 347, 4263, 8, 277, 12, 1056, 304, 267, 1839, 11131, 275, 664, 63, 785, 63, 269, 63, 5188, 8, 33, 2904, 65, 12, 1305, 29, 344, 9, 267, 1839, 11131, 14, 6334, 14, 740, 8, 1069, 14, 751, 9, 267, 372, 291, 14, 3742, 342, 339, 768, 5693, 63, 2427, 360, 981, 297, 1104, 63, 1986, 29, 33, 2904, 65, 9, 272, 347, 1559, 63, 981, 8, 277, 12, 8844, 12, 1056, 29, 403, 12, 1011, 958, 304, 267, 922, 275, 664, 63, 785, 63, 269, 63, 5188, 8, 1899, 12, 3434, 29, 2473, 9, 267, 372, 922, 14, 362, 63, 6116, 63, 633, 342, 339, 408, 272, 1104, 63, 1986, 275, 2074, 14, 1935, 360, 1074, 63, 1986, 297, 488, 9, 339, 340, 1104, 63, 1986, 26, 267, 4237, 63, 3669, 275, 359, 1074, 63, 1986, 61, 339, 327, 2670, 340, 10869, 365, 1627, 465, 1059, 315, 1865, 440, 370, 24774, 272, 327, 2455, 805, 6337, 1314, 7704, 10201, 12159, 424, 272, 340, 440, 1228, 8, 8220, 12, 7116, 304, 267, 746, 12436, 31186, 547, 480, 7147, 1423, 1471, 506, 315, 1475, 26, 298, 288, 3546, 571, 63, 1302, 14, 11879, 503, 282, 4550, 1314, 372, 8545, 1059, 9859, 339, 347, 7531, 8, 1345, 63, 1532, 304, 267, 347, 8072, 2031, 589, 12, 1011, 958, 304, 288, 327, 340, 1655, 2419, 1373, 2725, 365, 3032, 370, 314, 7531, 781, 862, 370, 288, 327, 5267, 909, 367, 1314, 1104, 3955, 506, 6326, 288, 1559, 275, 488, 288, 1056, 275, 488, 288, 340, 283, 1069, 7, 315, 2074, 26, 355, 1056, 275, 2074, 459, 1069, 418, 288, 916, 283, 6469, 7, 315, 2074, 26, 355, 1056, 275, 2074, 459, 6469, 2278, 1069, 288, 587, 26, 355, 367, 1680, 315, 1249, 26, 490, 340, 1228, 8, 1273, 12, 20730, 304, 717, 1056, 275, 1680, 717, 2059, 490, 916, 1228, 8, 1273, 12, 29311, 9, 436, 1228, 8, 1273, 14, 1069, 12, 20730, 304, 717, 1056, 275, 1680, 14, 1069, 717, 2059, 953, 340, 4237, 63, 3669, 26, 355, 1402, 12, 16807, 275, 4237, 63, 3669, 59, 16, 467, 4237, 63, 3669, 59, 17, 2938, 355, 327, 6077, 1402, 355, 340, 1228, 8, 1238, 12, 7116, 304, 490, 30183, 275, 1402, 14, 1294, 7563, 490, 340, 822, 8, 1294, 471, 9, 1137, 499, 26, 717, 746, 12436, 31186, 547, 480, 3917, 1402, 1077, 506, 21182, 1536, 687, 298, 1169, 298, 875, 652, 4839, 1475, 26, 283, 571, 63, 1302, 14, 1685, 2543, 9859, 490, 1402, 275, 664, 63, 1238, 2031, 1294, 471, 9, 355, 916, 11602, 8, 1238, 855, 533, 3108, 334, 1685, 12, 5822, 1563, 12, 18397, 2298, 490, 986, 355, 587, 26, 490, 746, 12436, 31186, 547, 480, 7147, 4237, 1423, 1471, 3544, 506, 298, 717, 298, 65, 1402, 12, 1059, 20686, 737, 1145, 15, 1238, 503, 7594, 14, 298, 717, 298, 13735, 26, 450, 83, 334, 466, 26, 450, 83, 2924, 450, 334, 1238, 12, 730, 8, 1238, 1724, 355, 327, 6077, 16807, 355, 340, 822, 8, 17438, 9, 450, 499, 1137, 378, 26, 490, 746, 12436, 31186, 547, 480, 7521, 2860, 1471, 506, 2741, 298, 717, 298, 305, 6342, 402, 4237, 63, 875, 436, 2455, 63, 1273, 531, 355, 4237, 63, 807, 275, 1052, 355, 367, 4237, 12, 2455, 63, 1273, 315, 3482, 8, 17438, 10345, 18, 467, 16807, 59, 17, 447, 18, 4682, 490, 340, 2455, 63, 1273, 440, 315, 2074, 26, 717, 746, 12436, 31186, 547, 480, 5201, 450, 83, 1990, 440, 3032, 298, 1169, 298, 9924, 2455, 805, 2, 450, 2455, 63, 1273, 9, 490, 4237, 63, 807, 59, 3892, 61, 275, 2074, 59, 1345, 63, 1273, 61, 2234, 340, 440, 1104, 63, 1986, 26, 490, 862, 26, 717, 1559, 275, 664, 63, 785, 63, 269, 63, 5188, 8, 1238, 12, 1011, 3892, 63, 807, 9, 490, 871, 4760, 5188, 26, 717, 746, 473, 77, 5050, 16287, 8, 1310, 29, 1014, 14, 5779, 4667, 1012, 953, 965, 63, 12068, 275, 756, 288, 340, 1056, 26, 355, 340, 1104, 63, 1986, 26, 490, 965, 63, 12068, 275, 1402, 14, 1986, 63, 1989, 63, 12068, 8, 8220, 12, 1056, 14, 751, 9, 355, 587, 26, 490, 965, 63, 12068, 275, 1559, 14, 1989, 63, 12068, 8, 8220, 12, 1056, 14, 751, 9, 953, 340, 440, 965, 63, 12068, 26, 355, 746, 473, 77, 5050, 16287, 8, 1310, 29, 1014, 14, 5779, 17454, 1012, 953, 372, 2455, 63, 1532, 2031, 589, 12, 1011, 958, 9, 267, 372, 14018, 8, 1345, 63, 1532, 5130, 9130, 9, 272, 372, 7531, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 9143, 492, 14018, 199, 504, 1639, 14, 697, 14, 992, 492, 5822, 12, 664, 63, 1238, 199, 504, 1639, 14, 697, 14, 992, 14, 1095, 492, 5822, 1563, 199, 504, 1639, 14, 697, 14, 992, 14, 1131, 492, 18397, 199, 504, 1639, 14, 17469, 492, 664, 63, 785, 63, 269, 63, 5188, 199, 504, 1639, 14, 1014, 492, 4760, 5188, 199, 199, 504, 8129, 31186, 14, 3924, 492, 12436, 31186, 547, 199, 199, 504, 307, 27352, 9890, 492, 1455, 199, 504, 307, 27352, 9890, 14, 6469, 492, 29311, 199, 504, 1639, 14, 1014, 492, 20730, 199, 504, 307, 27352, 9890, 14, 3924, 492, 473, 77, 5050, 16287, 421, 199, 318, 4983, 63, 2427, 8, 8220, 12, 4237, 63, 3669, 29, 403, 12, 1011, 958, 304, 272, 408, 272, 30684, 367, 6858, 626, 5920, 3775, 282, 922, 965, 282, 6770, 4983, 272, 5223, 14, 339, 22383, 12, 4454, 367, 1314, 1104, 1077, 506, 6326, 1443, 506, 3032, 465, 376, 272, 3499, 1423, 503, 465, 282, 2008, 2633, 14, 339, 520, 635, 1104, 63, 1986, 26, 340, 663, 370, 1124, 1685, 4542, 314, 3443, 911, 506, 272, 7923, 315, 6358, 370, 5822, 14, 1986, 63, 1989, 63, 12068, 342, 3140, 402, 6358, 370, 272, 965, 63, 12068, 1252, 7827, 370, 1124, 403, 4345, 339, 6058, 447, 339, 768, 5693, 63, 2427, 360, 904, 297, 334, 33, 2904, 65, 12, 283, 344, 297, 283, 344, 1333, 272, 347, 4263, 8, 277, 12, 1056, 304, 267, 1839, 11131, 275, 664, 63, 785, 63, 269, 63, 5188, 8, 33, 2904, 65, 12, 1305, 29, 344, 9, 267, 1839, 11131, 14, 6334, 14, 740, 8, 1069, 14, 751, 9, 267, 372, 291, 14, 3742, 342, 339, 768, 5693, 63, 2427, 360, 981, 297, 1104, 63, 1986, 29, 33, 2904, 65, 9, 272, 347, 1559, 63, 981, 8, 277, 12, 8844, 12, 1056, 29, 403, 12, 1011, 958, 304, 267, 922, 275, 664, 63, 785, 63, 269, 63, 5188, 8, 1899, 12, 3434, 29, 2473, 9, 267, 372, 922, 14, 362, 63, 6116, 63, 633, 342, 339, 408, 272, 1104, 63, 1986, 275, 2074, 14, 1935, 360, 1074, 63, 1986, 297, 488, 9, 339, 340, 1104, 63, 1986, 26, 267, 4237, 63, 3669, 275, 359, 1074, 63, 1986, 61, 339, 327, 2670, 340, 10869, 365, 1627, 465, 1059, 315, 1865, 440, 370, 24774, 272, 327, 2455, 805, 6337, 1314, 7704, 10201, 12159, 424, 272, 340, 440, 1228, 8, 8220, 12, 7116, 304, 267, 746, 12436, 31186, 547, 480, 7147, 1423, 1471, 506, 315, 1475, 26, 298, 288, 3546, 571, 63, 1302, 14, 11879, 503, 282, 4550, 1314, 372, 8545, 1059, 9859, 339, 347, 7531, 8, 1345, 63, 1532, 304, 267, 347, 8072, 2031, 589, 12, 1011, 958, 304, 288, 327, 340, 1655, 2419, 1373, 2725, 365, 3032, 370, 314, 7531, 781, 862, 370, 288, 327, 5267, 909, 367, 1314, 1104, 3955, 506, 6326, 288, 1559, 275, 488, 288, 1056, 275, 488, 288, 340, 283, 1069, 7, 315, 2074, 26, 355, 1056, 275, 2074, 459, 1069, 418, 288, 916, 283, 6469, 7, 315, 2074, 26, 355, 1056, 275, 2074, 459, 6469, 2278, 1069, 288, 587, 26, 355, 367, 1680, 315, 1249, 26, 490, 340, 1228, 8, 1273, 12, 20730, 304, 717, 1056, 275, 1680, 717, 2059, 490, 916, 1228, 8, 1273, 12, 29311, 9, 436, 1228, 8, 1273, 14, 1069, 12, 20730, 304, 717, 1056, 275, 1680, 14, 1069, 717, 2059, 953, 340, 4237, 63, 3669, 26, 355, 1402, 12, 16807, 275, 4237, 63, 3669, 59, 16, 467, 4237, 63, 3669, 59, 17, 2938, 355, 327, 6077, 1402, 355, 340, 1228, 8, 1238, 12, 7116, 304, 490, 30183, 275, 1402, 14, 1294, 7563, 490, 340, 822, 8, 1294, 471, 9, 1137, 499, 26, 717, 746, 12436, 31186, 547, 480, 3917, 1402, 1077, 506, 21182, 1536, 687, 298, 1169, 298, 875, 652, 4839, 1475, 26, 283, 571, 63, 1302, 14, 1685, 2543, 9859, 490, 1402, 275, 664, 63, 1238, 2031, 1294, 471, 9, 355, 916, 11602, 8, 1238, 855, 533, 3108, 334, 1685, 12, 5822, 1563, 12, 18397, 2298, 490, 986, 355, 587, 26, 490, 746, 12436, 31186, 547, 480, 7147, 4237, 1423, 1471, 3544, 506, 298, 717, 298, 65, 1402, 12, 1059, 20686, 737, 1145, 15, 1238, 503, 7594, 14, 298, 717, 298, 13735, 26, 450, 83, 334, 466, 26, 450, 83, 2924, 450, 334, 1238, 12, 730, 8, 1238, 1724, 355, 327, 6077, 16807, 355, 340, 822, 8, 17438, 9, 450, 499, 1137, 378, 26, 490, 746, 12436, 31186, 547, 480, 7521, 2860, 1471, 506, 2741, 298, 717, 298, 305, 6342, 402, 4237, 63, 875, 436, 2455, 63, 1273, 531, 355, 4237, 63, 807, 275, 1052, 355, 367, 4237, 12, 2455, 63, 1273, 315, 3482, 8, 17438, 10345, 18, 467, 16807, 59, 17, 447, 18, 4682, 490, 340, 2455, 63, 1273, 440, 315, 2074, 26, 717, 746, 12436, 31186, 547, 480, 5201, 450, 83, 1990, 440, 3032, 298, 1169, 298, 9924, 2455, 805, 2, 450, 2455, 63, 1273, 9, 490, 4237, 63, 807, 59, 3892, 61, 275, 2074, 59, 1345, 63, 1273, 61, 2234, 340, 440, 1104, 63, 1986, 26, 490, 862, 26, 717, 1559, 275, 664, 63, 785, 63, 269, 63, 5188, 8, 1238, 12, 1011, 3892, 63, 807, 9, 490, 871, 4760, 5188, 26, 717, 746, 473, 77, 5050, 16287, 8, 1310, 29, 1014, 14, 5779, 4667, 1012, 953, 965, 63, 12068, 275, 756, 288, 340, 1056, 26, 355, 340, 1104, 63, 1986, 26, 490, 965, 63, 12068, 275, 1402, 14, 1986, 63, 1989, 63, 12068, 8, 8220, 12, 1056, 14, 751, 9, 355, 587, 26, 490, 965, 63, 12068, 275, 1559, 14, 1989, 63, 12068, 8, 8220, 12, 1056, 14, 751, 9, 953, 340, 440, 965, 63, 12068, 26, 355, 746, 473, 77, 5050, 16287, 8, 1310, 29, 1014, 14, 5779, 17454, 1012, 953, 372, 2455, 63, 1532, 2031, 589, 12, 1011, 958, 9, 267, 372, 14018, 8, 1345, 63, 1532, 5130, 9130, 9, 272, 372, 7531, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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 ]
iphoting/healthchecks
hc/accounts/migrations/0001_initial.py
2
1144
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings class Migration(migrations.Migration): dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)] operations = [ migrations.CreateModel( name="Profile", fields=[ ( "id", models.AutoField( auto_created=True, serialize=False, verbose_name="ID", primary_key=True, ), ), ("next_report_date", models.DateTimeField(null=True, blank=True)), ("reports_allowed", models.BooleanField(default=True)), ( "user", models.OneToOneField( blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE, ), ), ], ) ]
bsd-3-clause
[ 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, 199, 504, 1639, 14, 2190, 492, 2202, 421, 199, 533, 12090, 8, 7685, 14, 9816, 304, 339, 5124, 275, 359, 7685, 14, 31925, 63, 8575, 8, 1751, 14, 5580, 63, 3791, 63, 11429, 1874, 339, 5331, 275, 359, 267, 6180, 14, 14907, 8, 288, 536, 628, 5736, 401, 288, 1504, 1524, 355, 334, 490, 298, 344, 401, 490, 1709, 14, 4378, 8, 717, 2599, 63, 3966, 29, 549, 12, 717, 8437, 29, 797, 12, 717, 3376, 63, 354, 628, 998, 401, 717, 5062, 63, 498, 29, 549, 12, 490, 2318, 355, 2318, 355, 1689, 2184, 63, 3070, 63, 602, 401, 1709, 14, 4626, 8, 2307, 29, 549, 12, 4596, 29, 549, 1826, 355, 1689, 15629, 63, 6541, 401, 1709, 14, 5036, 8, 885, 29, 549, 1826, 355, 334, 490, 298, 751, 401, 490, 1709, 14, 14298, 8, 717, 4596, 29, 549, 12, 717, 370, 29, 1751, 14, 5580, 63, 3791, 63, 11429, 12, 717, 2973, 29, 549, 12, 717, 641, 63, 1807, 29, 992, 14, 10855, 12, 490, 2318, 355, 2318, 288, 2156, 267, 776, 272, 1622, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 199, 504, 1639, 14, 2190, 492, 2202, 421, 199, 533, 12090, 8, 7685, 14, 9816, 304, 339, 5124, 275, 359, 7685, 14, 31925, 63, 8575, 8, 1751, 14, 5580, 63, 3791, 63, 11429, 1874, 339, 5331, 275, 359, 267, 6180, 14, 14907, 8, 288, 536, 628, 5736, 401, 288, 1504, 1524, 355, 334, 490, 298, 344, 401, 490, 1709, 14, 4378, 8, 717, 2599, 63, 3966, 29, 549, 12, 717, 8437, 29, 797, 12, 717, 3376, 63, 354, 628, 998, 401, 717, 5062, 63, 498, 29, 549, 12, 490, 2318, 355, 2318, 355, 1689, 2184, 63, 3070, 63, 602, 401, 1709, 14, 4626, 8, 2307, 29, 549, 12, 4596, 29, 549, 1826, 355, 1689, 15629, 63, 6541, 401, 1709, 14, 5036, 8, 885, 29, 549, 1826, 355, 334, 490, 298, 751, 401, 490, 1709, 14, 14298, 8, 717, 4596, 29, 549, 12, 717, 370, 29, 1751, 14, 5580, 63, 3791, 63, 11429, 12, 717, 2973, 29, 549, 12, 717, 641, 63, 1807, 29, 992, 14, 10855, 12, 490, 2318, 355, 2318, 288, 2156, 267, 776, 272, 1622, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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 ]
hjjeon0608/mbed_for_W7500P
workspace_tools/host_tests/host_tests_plugins/__init__.py
30
2604
""" mbed SDK Copyright (c) 2011-2013 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 host_test_registry # This plugins provide 'flashing' methods to host test scripts import module_copy_mbed import module_copy_shell import module_copy_silabs #import module_copy_firefox #import module_copy_mps2 # Plugins used to reset certain platform import module_reset_mbed import module_reset_silabs #import module_reset_mps2 # Plugin registry instance HOST_TEST_PLUGIN_REGISTRY = host_test_registry.HostTestRegistry() # Static plugin registration # Some plugins are commented out if they are not stable or not commonly used HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_mbed.load_plugin()) HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_shell.load_plugin()) HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_mbed.load_plugin()) #HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_firefox.load_plugin()) # Extra platforms support #HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_mps2.load_plugin()) #HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_mps2.load_plugin()) HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_silabs.load_plugin()) HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_silabs.load_plugin()) # TODO: extend plugin loading to files with name module_*.py loaded ad-hoc ############################################################################### # Functional interface for host test plugin registry ############################################################################### def call_plugin(type, capability, *args, **kwargs): """ Interface to call plugin registry functional way """ return HOST_TEST_PLUGIN_REGISTRY.call_plugin(type, capability, *args, **kwargs) def get_plugin_caps(type): """ Returns list of all capabilities for plugin family with the same type. If there are no capabilities empty list is returned """ return HOST_TEST_PLUGIN_REGISTRY.get_plugin_caps(type) def print_plugin_info(): """ Prints plugins' information in user friendly way """ print HOST_TEST_PLUGIN_REGISTRY
apache-2.0
[ 624, 199, 3665, 15610, 199, 7384, 334, 67, 9, 7760, 13, 6965, 27155, 23954, 199, 199, 31661, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 13297, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 5556, 1443, 3332, 282, 1331, 402, 314, 844, 737, 339, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 199, 5524, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 16832, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 29946, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 9295, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3097, 1298, 1334, 314, 844, 14, 199, 624, 199, 199, 646, 1591, 63, 396, 63, 5189, 199, 199, 3, 961, 8963, 5647, 283, 11331, 316, 7, 3102, 370, 1591, 511, 10554, 199, 646, 859, 63, 1574, 63, 3665, 199, 646, 859, 63, 1574, 63, 5641, 199, 646, 859, 63, 1574, 63, 20329, 2101, 199, 3, 646, 859, 63, 1574, 63, 15394, 199, 3, 646, 859, 63, 1574, 63, 13408, 18, 199, 199, 3, 30317, 1202, 370, 5305, 9842, 4298, 199, 646, 859, 63, 3958, 63, 3665, 199, 646, 859, 63, 3958, 63, 20329, 2101, 199, 3, 646, 859, 63, 3958, 63, 13408, 18, 421, 199, 3, 11349, 7086, 1256, 199, 5449, 63, 2864, 63, 19108, 63, 25304, 57, 275, 1591, 63, 396, 63, 5189, 14, 4965, 774, 10899, 342, 199, 199, 3, 13599, 3589, 10991, 199, 3, 6601, 8963, 787, 21804, 734, 340, 2985, 787, 440, 17830, 503, 440, 28829, 1202, 199, 5449, 63, 2864, 63, 19108, 63, 25304, 57, 14, 2683, 63, 2718, 8, 578, 63, 1574, 63, 3665, 14, 912, 63, 2718, 1012, 199, 5449, 63, 2864, 63, 19108, 63, 25304, 57, 14, 2683, 63, 2718, 8, 578, 63, 1574, 63, 5641, 14, 912, 63, 2718, 1012, 199, 5449, 63, 2864, 63, 19108, 63, 25304, 57, 14, 2683, 63, 2718, 8, 578, 63, 3958, 63, 3665, 14, 912, 63, 2718, 1012, 199, 3, 5449, 63, 2864, 63, 19108, 63, 25304, 57, 14, 2683, 63, 2718, 8, 578, 63, 1574, 63, 15394, 14, 912, 63, 2718, 1012, 199, 199, 3, 11177, 10677, 2291, 199, 3, 5449, 63, 2864, 63, 19108, 63, 25304, 57, 14, 2683, 63, 2718, 8, 578, 63, 1574, 63, 13408, 18, 14, 912, 63, 2718, 1012, 199, 3, 5449, 63, 2864, 63, 19108, 63, 25304, 57, 14, 2683, 63, 2718, 8, 578, 63, 3958, 63, 13408, 18, 14, 912, 63, 2718, 1012, 199, 5449, 63, 2864, 63, 19108, 63, 25304, 57, 14, 2683, 63, 2718, 8, 578, 63, 1574, 63, 20329, 2101, 14, 912, 63, 2718, 1012, 199, 5449, 63, 2864, 63, 19108, 63, 25304, 57, 14, 2683, 63, 2718, 8, 578, 63, 3958, 63, 20329, 2101, 14, 912, 63, 2718, 1012, 199, 199, 3, 3254, 26, 12247, 3589, 8697, 370, 1584, 543, 536, 859, 63, 4856, 647, 6511, 1503, 13, 20402, 199, 199, 11490, 199, 3, 6801, 279, 3217, 367, 1591, 511, 3589, 7086, 199, 11490, 199, 318, 1240, 63, 2718, 8, 466, 12, 19854, 12, 627, 589, 12, 1011, 958, 304, 272, 408, 14816, 370, 1240, 3589, 7086, 22380, 4340, 272, 408, 272, 372, 25741, 63, 2864, 63, 19108, 63, 25304, 57, 14, 1250, 63, 2718, 8, 466, 12, 19854, 12, 627, 589, 12, 1011, 958, 9, 199, 199, 318, 664, 63, 2718, 63, 12029, 8, 466, 304, 272, 408, 1803, 769, 402, 1006, 14918, 367, 3589, 9614, 543, 314, 2011, 730, 14, 267, 982, 2337, 787, 949, 14918, 2701, 769, 365, 2138, 272, 408, 272, 372, 25741, 63, 2864, 63, 19108, 63, 25304, 57, 14, 362, 63, 2718, 63, 12029, 8, 466, 9, 199, 199, 318, 870, 63, 2718, 63, 815, 837, 272, 408, 9101, 83, 8963, 7, 2556, 315, 922, 21428, 4340, 272, 408, 272, 870, 25741, 63, 2864, 63, 19108, 63, 25304, 57, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 3665, 15610, 199, 7384, 334, 67, 9, 7760, 13, 6965, 27155, 23954, 199, 199, 31661, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 13297, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 5556, 1443, 3332, 282, 1331, 402, 314, 844, 737, 339, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 199, 5524, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 16832, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 29946, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 9295, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3097, 1298, 1334, 314, 844, 14, 199, 624, 199, 199, 646, 1591, 63, 396, 63, 5189, 199, 199, 3, 961, 8963, 5647, 283, 11331, 316, 7, 3102, 370, 1591, 511, 10554, 199, 646, 859, 63, 1574, 63, 3665, 199, 646, 859, 63, 1574, 63, 5641, 199, 646, 859, 63, 1574, 63, 20329, 2101, 199, 3, 646, 859, 63, 1574, 63, 15394, 199, 3, 646, 859, 63, 1574, 63, 13408, 18, 199, 199, 3, 30317, 1202, 370, 5305, 9842, 4298, 199, 646, 859, 63, 3958, 63, 3665, 199, 646, 859, 63, 3958, 63, 20329, 2101, 199, 3, 646, 859, 63, 3958, 63, 13408, 18, 421, 199, 3, 11349, 7086, 1256, 199, 5449, 63, 2864, 63, 19108, 63, 25304, 57, 275, 1591, 63, 396, 63, 5189, 14, 4965, 774, 10899, 342, 199, 199, 3, 13599, 3589, 10991, 199, 3, 6601, 8963, 787, 21804, 734, 340, 2985, 787, 440, 17830, 503, 440, 28829, 1202, 199, 5449, 63, 2864, 63, 19108, 63, 25304, 57, 14, 2683, 63, 2718, 8, 578, 63, 1574, 63, 3665, 14, 912, 63, 2718, 1012, 199, 5449, 63, 2864, 63, 19108, 63, 25304, 57, 14, 2683, 63, 2718, 8, 578, 63, 1574, 63, 5641, 14, 912, 63, 2718, 1012, 199, 5449, 63, 2864, 63, 19108, 63, 25304, 57, 14, 2683, 63, 2718, 8, 578, 63, 3958, 63, 3665, 14, 912, 63, 2718, 1012, 199, 3, 5449, 63, 2864, 63, 19108, 63, 25304, 57, 14, 2683, 63, 2718, 8, 578, 63, 1574, 63, 15394, 14, 912, 63, 2718, 1012, 199, 199, 3, 11177, 10677, 2291, 199, 3, 5449, 63, 2864, 63, 19108, 63, 25304, 57, 14, 2683, 63, 2718, 8, 578, 63, 1574, 63, 13408, 18, 14, 912, 63, 2718, 1012, 199, 3, 5449, 63, 2864, 63, 19108, 63, 25304, 57, 14, 2683, 63, 2718, 8, 578, 63, 3958, 63, 13408, 18, 14, 912, 63, 2718, 1012, 199, 5449, 63, 2864, 63, 19108, 63, 25304, 57, 14, 2683, 63, 2718, 8, 578, 63, 1574, 63, 20329, 2101, 14, 912, 63, 2718, 1012, 199, 5449, 63, 2864, 63, 19108, 63, 25304, 57, 14, 2683, 63, 2718, 8, 578, 63, 3958, 63, 20329, 2101, 14, 912, 63, 2718, 1012, 199, 199, 3, 3254, 26, 12247, 3589, 8697, 370, 1584, 543, 536, 859, 63, 4856, 647, 6511, 1503, 13, 20402, 199, 199, 11490, 199, 3, 6801, 279, 3217, 367, 1591, 511, 3589, 7086, 199, 11490, 199, 318, 1240, 63, 2718, 8, 466, 12, 19854, 12, 627, 589, 12, 1011, 958, 304, 272, 408, 14816, 370, 1240, 3589, 7086, 22380, 4340, 272, 408, 272, 372, 25741, 63, 2864, 63, 19108, 63, 25304, 57, 14, 1250, 63, 2718, 8, 466, 12, 19854, 12, 627, 589, 12, 1011, 958, 9, 199, 199, 318, 664, 63, 2718, 63, 12029, 8, 466, 304, 272, 408, 1803, 769, 402, 1006, 14918, 367, 3589, 9614, 543, 314, 2011, 730, 14, 267, 982, 2337, 787, 949, 14918, 2701, 769, 365, 2138, 272, 408, 272, 372, 25741, 63, 2864, 63, 19108, 63, 25304, 57, 14, 362, 63, 2718, 63, 12029, 8, 466, 9, 199, 199, 318, 870, 63, 2718, 63, 815, 837, 272, 408, 9101, 83, 8963, 7, 2556, 315, 922, 21428, 4340, 272, 408, 272, 870, 25741, 63, 2864, 63, 19108, 63, 25304, 57, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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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 ]
jbonofre/incubator-beam
sdks/python/apache_beam/examples/wordcount_debugging.py
6
6617
# # 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. # """An example that verifies the counts and includes best practices. On top of the basic concepts in the wordcount example, this workflow introduces logging to Cloud Logging, and using assertions in a Dataflow pipeline. To execute this pipeline locally, specify a local output file or output prefix on GCS:: --output [YOUR_LOCAL_FILE | gs://YOUR_OUTPUT_PREFIX] To execute this pipeline using the Google Cloud Dataflow service, specify pipeline configuration:: --project YOUR_PROJECT_ID --staging_location gs://YOUR_STAGING_DIRECTORY --temp_location gs://YOUR_TEMP_DIRECTORY --job_name YOUR_JOB_NAME --runner DataflowRunner and an output prefix on GCS:: --output gs://YOUR_OUTPUT_PREFIX """ from __future__ import absolute_import import argparse import logging import re import apache_beam as beam from apache_beam.io import ReadFromText from apache_beam.io import WriteToText from apache_beam.metrics import Metrics from apache_beam.options.pipeline_options import PipelineOptions from apache_beam.options.pipeline_options import SetupOptions from apache_beam.testing.util import assert_that from apache_beam.testing.util import equal_to class FilterTextFn(beam.DoFn): """A DoFn that filters for a specific key based on a regular expression.""" def __init__(self, pattern): super(FilterTextFn, self).__init__() self.pattern = pattern # A custom metric can track values in your pipeline as it runs. Those # values will be available in the monitoring system of the runner used # to run the pipeline. These metrics below track the number of # matched and unmatched words. self.matched_words = Metrics.counter(self.__class__, 'matched_words') self.umatched_words = Metrics.counter(self.__class__, 'umatched_words') def process(self, element): word, _ = element if re.match(self.pattern, word): # Log at INFO level each element we match. When executing this pipeline # using the Dataflow service, these log lines will appear in the Cloud # Logging UI. logging.info('Matched %s', word) self.matched_words.inc() yield element else: # Log at the "DEBUG" level each element that is not matched. Different log # levels can be used to control the verbosity of logging providing an # effective mechanism to filter less important information. # Note currently only "INFO" and higher level logs are emitted to the # Cloud Logger. This log message will not be visible in the Cloud Logger. logging.debug('Did not match %s', word) self.umatched_words.inc() class CountWords(beam.PTransform): """A transform to count the occurrences of each word. A PTransform that converts a PCollection containing lines of text into a PCollection of (word, count) tuples. """ def expand(self, pcoll): def count_ones(word_ones): (word, ones) = word_ones return (word, sum(ones)) return (pcoll | 'split' >> (beam.FlatMap(lambda x: re.findall(r'[A-Za-z\']+', x)) .with_output_types(unicode)) | 'pair_with_one' >> beam.Map(lambda x: (x, 1)) | 'group' >> beam.GroupByKey() | 'count' >> beam.Map(count_ones)) def run(argv=None): """Runs the debugging wordcount pipeline.""" parser = argparse.ArgumentParser() parser.add_argument('--input', dest='input', default='gs://dataflow-samples/shakespeare/kinglear.txt', help='Input file to process.') parser.add_argument('--output', dest='output', required=True, help='Output file to write results to.') known_args, pipeline_args = parser.parse_known_args(argv) # We use the save_main_session option because one or more DoFn's in this # workflow rely on global context (e.g., a module imported at module level). pipeline_options = PipelineOptions(pipeline_args) pipeline_options.view_as(SetupOptions).save_main_session = True with beam.Pipeline(options=pipeline_options) as p: # Read the text file[pattern] into a PCollection, count the occurrences of # each word and filter by a list of words. filtered_words = ( p | 'read' >> ReadFromText(known_args.input) | CountWords() | 'FilterText' >> beam.ParDo(FilterTextFn('Flourish|stomach'))) # assert_that is a convenient PTransform that checks a PCollection has an # expected value. Asserts are best used in unit tests with small data sets # but is demonstrated here as a teaching tool. # # Note assert_that does not provide any output and that successful # completion of the Pipeline implies that the expectations were met. Learn # more at https://cloud.google.com/dataflow/pipelines/testing-your-pipeline # on how to best test your pipeline. assert_that( filtered_words, equal_to([('Flourish', 3), ('stomach', 1)])) # Format the counts into a PCollection of strings and write the output using # a "Write" transform that has side effects. # pylint: disable=unused-variable def format_result(word_count): (word, count) = word_count return '%s: %s' % (word, count) output = (filtered_words | 'format' >> beam.Map(format_result) | 'write' >> WriteToText(known_args.output)) if __name__ == '__main__': # Cloud Logging would contain only logging.INFO and higher level logs logged # by the root logger. All log statements emitted by the root logger will be # visible in the Cloud Logging UI. Learn more at # https://cloud.google.com/logging about the Cloud Logging UI. # # You can set the default logging level to a different level when running # locally. logging.getLogger().setLevel(logging.INFO) run()
apache-2.0
[ 3, 199, 3, 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 503, 1655, 199, 3, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 1854, 543, 199, 3, 642, 1736, 367, 4722, 2556, 12602, 4248, 12715, 14, 199, 3, 710, 14857, 12378, 642, 570, 370, 2047, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 199, 3, 334, 1589, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 199, 3, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 259, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 199, 199, 624, 2493, 2893, 626, 22694, 314, 8242, 436, 6952, 5526, 20594, 7724, 14, 199, 199, 3314, 2746, 402, 314, 5678, 19834, 83, 315, 314, 4349, 835, 2893, 12, 642, 10431, 13318, 10569, 199, 4806, 370, 8142, 19928, 12, 436, 1808, 22835, 315, 282, 3918, 1659, 7679, 14, 199, 199, 1378, 5341, 642, 7679, 17738, 12, 4165, 282, 2257, 1072, 570, 503, 1072, 2403, 199, 265, 598, 3298, 447, 819, 1553, 1199, 359, 57, 11237, 63, 7486, 63, 3817, 1204, 8763, 921, 57, 11237, 63, 8414, 63, 6351, 61, 199, 199, 1378, 5341, 642, 7679, 1808, 314, 4475, 8142, 3918, 1659, 2435, 12, 4165, 199, 7379, 2897, 447, 819, 1553, 1715, 1488, 11237, 63, 10797, 63, 998, 523, 1553, 26840, 63, 1985, 8763, 921, 57, 11237, 63, 840, 1254, 1206, 63, 16436, 523, 1553, 808, 63, 1985, 8763, 921, 57, 11237, 63, 12510, 63, 16436, 523, 1553, 2423, 63, 354, 1488, 11237, 63, 14879, 63, 2339, 523, 1553, 5933, 3918, 1659, 7446, 199, 199, 460, 376, 1072, 2403, 641, 598, 3298, 447, 819, 1553, 1199, 8763, 921, 57, 11237, 63, 8414, 63, 6351, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 199, 646, 7534, 199, 646, 2050, 199, 646, 295, 199, 199, 646, 17098, 63, 14529, 465, 17453, 199, 504, 17098, 63, 14529, 14, 2308, 492, 5574, 2532, 1872, 199, 504, 17098, 63, 14529, 14, 2308, 492, 6990, 1378, 1872, 199, 504, 17098, 63, 14529, 14, 6759, 492, 10072, 11818, 199, 504, 17098, 63, 14529, 14, 1419, 14, 7379, 63, 1419, 492, 19090, 4558, 199, 504, 17098, 63, 14529, 14, 1419, 14, 7379, 63, 1419, 492, 12439, 4558, 199, 504, 17098, 63, 14529, 14, 4776, 14, 1974, 492, 702, 63, 9099, 199, 504, 17098, 63, 14529, 14, 4776, 14, 1974, 492, 4472, 63, 475, 421, 199, 533, 9388, 1872, 9656, 8, 14529, 14, 2585, 9656, 304, 523, 408, 33, 4226, 9656, 626, 4766, 367, 282, 2488, 790, 4079, 641, 282, 5578, 3965, 1041, 523, 347, 636, 826, 721, 277, 12, 3851, 304, 272, 1613, 8, 4131, 1872, 9656, 12, 291, 2843, 826, 4533, 272, 291, 14, 3401, 275, 3851, 272, 327, 437, 3537, 6370, 883, 4426, 1338, 315, 2195, 7679, 465, 652, 7858, 14, 18049, 261, 272, 327, 1338, 911, 506, 2808, 315, 314, 20391, 2656, 402, 314, 7876, 1202, 272, 327, 370, 1255, 314, 7679, 14, 5723, 7186, 5084, 4426, 314, 1329, 402, 272, 327, 7838, 436, 625, 10151, 5932, 14, 272, 291, 14, 10151, 63, 3148, 275, 10072, 11818, 14, 5337, 8, 277, 855, 533, 3108, 283, 10151, 63, 3148, 358, 272, 291, 14, 453, 693, 379, 63, 3148, 275, 10072, 11818, 14, 5337, 8, 277, 855, 533, 3108, 283, 453, 693, 379, 63, 3148, 358, 819, 347, 2112, 8, 277, 12, 1819, 304, 272, 4349, 12, 485, 275, 1819, 272, 340, 295, 14, 1431, 8, 277, 14, 3401, 12, 4349, 304, 489, 327, 5297, 737, 24008, 2166, 1924, 1819, 781, 1336, 14, 3979, 14043, 642, 7679, 489, 327, 1808, 314, 3918, 1659, 2435, 12, 3520, 943, 2385, 911, 7468, 315, 314, 8142, 489, 327, 19928, 14041, 14, 489, 2050, 14, 815, 360, 4486, 379, 450, 83, 297, 4349, 9, 489, 291, 14, 10151, 63, 3148, 14, 6559, 342, 489, 1995, 1819, 272, 587, 26, 489, 327, 5297, 737, 314, 298, 5287, 2, 2166, 1924, 1819, 626, 365, 440, 7838, 14, 18029, 640, 943, 489, 327, 11106, 883, 506, 1202, 370, 3304, 314, 8661, 402, 2050, 13070, 376, 489, 327, 15826, 14729, 370, 2457, 6656, 11012, 2556, 14, 489, 327, 3390, 5544, 1454, 298, 4531, 2, 436, 10948, 2166, 9610, 787, 19515, 370, 314, 489, 327, 8142, 15996, 14, 961, 943, 1245, 911, 440, 506, 8917, 315, 314, 8142, 15996, 14, 489, 2050, 14, 1757, 360, 17366, 440, 1336, 450, 83, 297, 4349, 9, 489, 291, 14, 453, 693, 379, 63, 3148, 14, 6559, 342, 421, 199, 533, 14826, 23759, 8, 14529, 14, 48, 6939, 304, 523, 408, 33, 5793, 370, 2338, 314, 22099, 402, 1924, 4349, 14, 819, 437, 510, 6939, 626, 15373, 282, 510, 7768, 3035, 2385, 402, 1318, 1901, 282, 523, 510, 7768, 402, 334, 1027, 12, 2338, 9, 6346, 14, 523, 408, 523, 347, 6544, 8, 277, 12, 299, 15772, 304, 272, 347, 2338, 63, 4548, 8, 1027, 63, 4548, 304, 489, 334, 1027, 12, 7869, 9, 275, 4349, 63, 4548, 489, 372, 334, 1027, 12, 3089, 8, 4548, 430, 339, 372, 334, 80, 15772, 288, 1204, 283, 1294, 7, 4331, 334, 14529, 14, 17271, 2956, 8, 2734, 671, 26, 295, 14, 6452, 8, 82, 3894, 33, 13, 13163, 13, 90, 26889, 7386, 671, 430, 2079, 1275, 1045, 63, 1199, 63, 1313, 8, 2975, 430, 288, 1204, 283, 3852, 63, 1045, 63, 368, 7, 4331, 17453, 14, 2956, 8, 2734, 671, 26, 334, 88, 12, 413, 430, 288, 1204, 283, 923, 7, 4331, 17453, 14, 2448, 2175, 1197, 342, 288, 1204, 283, 835, 7, 4331, 17453, 14, 2956, 8, 835, 63, 4548, 430, 421, 199, 318, 1255, 8, 3020, 29, 403, 304, 523, 408, 16291, 314, 10201, 4349, 835, 7679, 1041, 819, 1798, 275 ]
[ 199, 3, 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 503, 1655, 199, 3, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 1854, 543, 199, 3, 642, 1736, 367, 4722, 2556, 12602, 4248, 12715, 14, 199, 3, 710, 14857, 12378, 642, 570, 370, 2047, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 199, 3, 334, 1589, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 199, 3, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 259, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 3, 199, 199, 624, 2493, 2893, 626, 22694, 314, 8242, 436, 6952, 5526, 20594, 7724, 14, 199, 199, 3314, 2746, 402, 314, 5678, 19834, 83, 315, 314, 4349, 835, 2893, 12, 642, 10431, 13318, 10569, 199, 4806, 370, 8142, 19928, 12, 436, 1808, 22835, 315, 282, 3918, 1659, 7679, 14, 199, 199, 1378, 5341, 642, 7679, 17738, 12, 4165, 282, 2257, 1072, 570, 503, 1072, 2403, 199, 265, 598, 3298, 447, 819, 1553, 1199, 359, 57, 11237, 63, 7486, 63, 3817, 1204, 8763, 921, 57, 11237, 63, 8414, 63, 6351, 61, 199, 199, 1378, 5341, 642, 7679, 1808, 314, 4475, 8142, 3918, 1659, 2435, 12, 4165, 199, 7379, 2897, 447, 819, 1553, 1715, 1488, 11237, 63, 10797, 63, 998, 523, 1553, 26840, 63, 1985, 8763, 921, 57, 11237, 63, 840, 1254, 1206, 63, 16436, 523, 1553, 808, 63, 1985, 8763, 921, 57, 11237, 63, 12510, 63, 16436, 523, 1553, 2423, 63, 354, 1488, 11237, 63, 14879, 63, 2339, 523, 1553, 5933, 3918, 1659, 7446, 199, 199, 460, 376, 1072, 2403, 641, 598, 3298, 447, 819, 1553, 1199, 8763, 921, 57, 11237, 63, 8414, 63, 6351, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 199, 646, 7534, 199, 646, 2050, 199, 646, 295, 199, 199, 646, 17098, 63, 14529, 465, 17453, 199, 504, 17098, 63, 14529, 14, 2308, 492, 5574, 2532, 1872, 199, 504, 17098, 63, 14529, 14, 2308, 492, 6990, 1378, 1872, 199, 504, 17098, 63, 14529, 14, 6759, 492, 10072, 11818, 199, 504, 17098, 63, 14529, 14, 1419, 14, 7379, 63, 1419, 492, 19090, 4558, 199, 504, 17098, 63, 14529, 14, 1419, 14, 7379, 63, 1419, 492, 12439, 4558, 199, 504, 17098, 63, 14529, 14, 4776, 14, 1974, 492, 702, 63, 9099, 199, 504, 17098, 63, 14529, 14, 4776, 14, 1974, 492, 4472, 63, 475, 421, 199, 533, 9388, 1872, 9656, 8, 14529, 14, 2585, 9656, 304, 523, 408, 33, 4226, 9656, 626, 4766, 367, 282, 2488, 790, 4079, 641, 282, 5578, 3965, 1041, 523, 347, 636, 826, 721, 277, 12, 3851, 304, 272, 1613, 8, 4131, 1872, 9656, 12, 291, 2843, 826, 4533, 272, 291, 14, 3401, 275, 3851, 272, 327, 437, 3537, 6370, 883, 4426, 1338, 315, 2195, 7679, 465, 652, 7858, 14, 18049, 261, 272, 327, 1338, 911, 506, 2808, 315, 314, 20391, 2656, 402, 314, 7876, 1202, 272, 327, 370, 1255, 314, 7679, 14, 5723, 7186, 5084, 4426, 314, 1329, 402, 272, 327, 7838, 436, 625, 10151, 5932, 14, 272, 291, 14, 10151, 63, 3148, 275, 10072, 11818, 14, 5337, 8, 277, 855, 533, 3108, 283, 10151, 63, 3148, 358, 272, 291, 14, 453, 693, 379, 63, 3148, 275, 10072, 11818, 14, 5337, 8, 277, 855, 533, 3108, 283, 453, 693, 379, 63, 3148, 358, 819, 347, 2112, 8, 277, 12, 1819, 304, 272, 4349, 12, 485, 275, 1819, 272, 340, 295, 14, 1431, 8, 277, 14, 3401, 12, 4349, 304, 489, 327, 5297, 737, 24008, 2166, 1924, 1819, 781, 1336, 14, 3979, 14043, 642, 7679, 489, 327, 1808, 314, 3918, 1659, 2435, 12, 3520, 943, 2385, 911, 7468, 315, 314, 8142, 489, 327, 19928, 14041, 14, 489, 2050, 14, 815, 360, 4486, 379, 450, 83, 297, 4349, 9, 489, 291, 14, 10151, 63, 3148, 14, 6559, 342, 489, 1995, 1819, 272, 587, 26, 489, 327, 5297, 737, 314, 298, 5287, 2, 2166, 1924, 1819, 626, 365, 440, 7838, 14, 18029, 640, 943, 489, 327, 11106, 883, 506, 1202, 370, 3304, 314, 8661, 402, 2050, 13070, 376, 489, 327, 15826, 14729, 370, 2457, 6656, 11012, 2556, 14, 489, 327, 3390, 5544, 1454, 298, 4531, 2, 436, 10948, 2166, 9610, 787, 19515, 370, 314, 489, 327, 8142, 15996, 14, 961, 943, 1245, 911, 440, 506, 8917, 315, 314, 8142, 15996, 14, 489, 2050, 14, 1757, 360, 17366, 440, 1336, 450, 83, 297, 4349, 9, 489, 291, 14, 453, 693, 379, 63, 3148, 14, 6559, 342, 421, 199, 533, 14826, 23759, 8, 14529, 14, 48, 6939, 304, 523, 408, 33, 5793, 370, 2338, 314, 22099, 402, 1924, 4349, 14, 819, 437, 510, 6939, 626, 15373, 282, 510, 7768, 3035, 2385, 402, 1318, 1901, 282, 523, 510, 7768, 402, 334, 1027, 12, 2338, 9, 6346, 14, 523, 408, 523, 347, 6544, 8, 277, 12, 299, 15772, 304, 272, 347, 2338, 63, 4548, 8, 1027, 63, 4548, 304, 489, 334, 1027, 12, 7869, 9, 275, 4349, 63, 4548, 489, 372, 334, 1027, 12, 3089, 8, 4548, 430, 339, 372, 334, 80, 15772, 288, 1204, 283, 1294, 7, 4331, 334, 14529, 14, 17271, 2956, 8, 2734, 671, 26, 295, 14, 6452, 8, 82, 3894, 33, 13, 13163, 13, 90, 26889, 7386, 671, 430, 2079, 1275, 1045, 63, 1199, 63, 1313, 8, 2975, 430, 288, 1204, 283, 3852, 63, 1045, 63, 368, 7, 4331, 17453, 14, 2956, 8, 2734, 671, 26, 334, 88, 12, 413, 430, 288, 1204, 283, 923, 7, 4331, 17453, 14, 2448, 2175, 1197, 342, 288, 1204, 283, 835, 7, 4331, 17453, 14, 2956, 8, 835, 63, 4548, 430, 421, 199, 318, 1255, 8, 3020, 29, 403, 304, 523, 408, 16291, 314, 10201, 4349, 835, 7679, 1041, 819, 1798, 275, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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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 ]
project-generator/project_generator
tests/test_commands/test_list.py
6
2455
# Copyright 2015 0xc0170 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import argparse import os import yaml import shutil from unittest import TestCase from project_generator.commands import list_projects from .simple_project import project_1_yaml, projects_yaml, project_2_yaml class TestListCommand(TestCase): """test list command""" def setUp(self): # we produce some files, to check if list projects listing the projects we defined if not os.path.exists('test_workspace'): os.makedirs('test_workspace') # write projects file with open(os.path.join(os.getcwd(), 'test_workspace/projects.yaml'), 'wt') as f: f.write(yaml.dump(projects_yaml, default_flow_style=False)) self.parser = argparse.ArgumentParser() subparsers = self.parser.add_subparsers(help='commands') self.subparser = subparsers.add_parser('list', help=list_projects.help) def tearDown(self): # remove created directory shutil.rmtree('test_workspace', ignore_errors=True) def test_list_projects(self): # For now list projects should not fail, we should add checking stdout if projects match list_projects.setup(self.subparser) args = self.parser.parse_args(['list','projects']) result = list_projects.run(args) assert result == 0 def test_list_targets(self): # For now list projects should not fail, we should add checking stdout if targets match list_projects.setup(self.subparser) args = self.parser.parse_args(['list','targets']) result = list_projects.run(args) assert result == 0 def test_list_tools(self): # For now list projects should not fail, we should add checking stdout if tools match list_projects.setup(self.subparser) args = self.parser.parse_args(['list','tools']) result = list_projects.run(args) assert result == 0
apache-2.0
[ 3, 1898, 6900, 378, 1812, 614, 2760, 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, 7534, 199, 646, 747, 199, 646, 8864, 199, 646, 5145, 199, 199, 504, 2882, 492, 7640, 199, 199, 504, 2199, 63, 4679, 14, 4405, 492, 769, 63, 6776, 199, 504, 1275, 4129, 63, 1715, 492, 2199, 63, 17, 63, 5963, 12, 11336, 63, 5963, 12, 2199, 63, 18, 63, 5963, 199, 199, 533, 1379, 1296, 3110, 8, 1746, 304, 339, 408, 396, 769, 1414, 624, 339, 347, 3613, 8, 277, 304, 267, 327, 781, 7389, 2005, 1584, 12, 370, 1104, 340, 769, 11336, 13778, 314, 11336, 781, 3247, 267, 340, 440, 747, 14, 515, 14, 2444, 360, 396, 63, 13249, 735, 288, 747, 14, 8347, 360, 396, 63, 13249, 358, 267, 327, 2218, 11336, 570, 267, 543, 1551, 8, 736, 14, 515, 14, 904, 8, 736, 14, 9458, 1062, 283, 396, 63, 13249, 15, 6776, 14, 5963, 659, 283, 9115, 358, 465, 289, 26, 288, 289, 14, 952, 8, 5963, 14, 2724, 8, 6776, 63, 5963, 12, 849, 63, 1659, 63, 2487, 29, 797, 430, 398, 291, 14, 2087, 275, 7534, 14, 10730, 342, 267, 26763, 275, 291, 14, 2087, 14, 525, 63, 954, 11531, 8, 3437, 534, 4405, 358, 267, 291, 14, 954, 2087, 275, 26763, 14, 525, 63, 2087, 360, 513, 297, 1720, 29, 513, 63, 6776, 14, 3437, 9, 339, 347, 6766, 8, 277, 304, 267, 327, 2813, 2737, 2082, 267, 5145, 14, 9242, 360, 396, 63, 13249, 297, 3686, 63, 2550, 29, 549, 9, 339, 347, 511, 63, 513, 63, 6776, 8, 277, 304, 267, 327, 2104, 3063, 769, 11336, 1077, 440, 2449, 12, 781, 1077, 1050, 7907, 3839, 340, 11336, 1336, 267, 769, 63, 6776, 14, 2758, 8, 277, 14, 954, 2087, 9, 267, 1249, 275, 291, 14, 2087, 14, 1122, 63, 589, 2941, 513, 1673, 6776, 1105, 267, 754, 275, 769, 63, 6776, 14, 1065, 8, 589, 9, 398, 702, 754, 508, 378, 339, 347, 511, 63, 513, 63, 4684, 8, 277, 304, 267, 327, 2104, 3063, 769, 11336, 1077, 440, 2449, 12, 781, 1077, 1050, 7907, 3839, 340, 4545, 1336, 267, 769, 63, 6776, 14, 2758, 8, 277, 14, 954, 2087, 9, 267, 1249, 275, 291, 14, 2087, 14, 1122, 63, 589, 2941, 513, 1673, 4684, 1105, 267, 754, 275, 769, 63, 6776, 14, 1065, 8, 589, 9, 398, 702, 754, 508, 378, 339, 347, 511, 63, 513, 63, 2537, 8, 277, 304, 267, 327, 2104, 3063, 769, 11336, 1077, 440, 2449, 12, 781, 1077, 1050, 7907, 3839, 340, 7249, 1336, 267, 769, 63, 6776, 14, 2758, 8, 277, 14, 954, 2087, 9, 267, 1249, 275, 291, 14, 2087, 14, 1122, 63, 589, 2941, 513, 1673, 2537, 1105, 267, 754, 275, 769, 63, 6776, 14, 1065, 8, 589, 9, 398, 702, 754, 508, 378, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1898, 6900, 378, 1812, 614, 2760, 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, 7534, 199, 646, 747, 199, 646, 8864, 199, 646, 5145, 199, 199, 504, 2882, 492, 7640, 199, 199, 504, 2199, 63, 4679, 14, 4405, 492, 769, 63, 6776, 199, 504, 1275, 4129, 63, 1715, 492, 2199, 63, 17, 63, 5963, 12, 11336, 63, 5963, 12, 2199, 63, 18, 63, 5963, 199, 199, 533, 1379, 1296, 3110, 8, 1746, 304, 339, 408, 396, 769, 1414, 624, 339, 347, 3613, 8, 277, 304, 267, 327, 781, 7389, 2005, 1584, 12, 370, 1104, 340, 769, 11336, 13778, 314, 11336, 781, 3247, 267, 340, 440, 747, 14, 515, 14, 2444, 360, 396, 63, 13249, 735, 288, 747, 14, 8347, 360, 396, 63, 13249, 358, 267, 327, 2218, 11336, 570, 267, 543, 1551, 8, 736, 14, 515, 14, 904, 8, 736, 14, 9458, 1062, 283, 396, 63, 13249, 15, 6776, 14, 5963, 659, 283, 9115, 358, 465, 289, 26, 288, 289, 14, 952, 8, 5963, 14, 2724, 8, 6776, 63, 5963, 12, 849, 63, 1659, 63, 2487, 29, 797, 430, 398, 291, 14, 2087, 275, 7534, 14, 10730, 342, 267, 26763, 275, 291, 14, 2087, 14, 525, 63, 954, 11531, 8, 3437, 534, 4405, 358, 267, 291, 14, 954, 2087, 275, 26763, 14, 525, 63, 2087, 360, 513, 297, 1720, 29, 513, 63, 6776, 14, 3437, 9, 339, 347, 6766, 8, 277, 304, 267, 327, 2813, 2737, 2082, 267, 5145, 14, 9242, 360, 396, 63, 13249, 297, 3686, 63, 2550, 29, 549, 9, 339, 347, 511, 63, 513, 63, 6776, 8, 277, 304, 267, 327, 2104, 3063, 769, 11336, 1077, 440, 2449, 12, 781, 1077, 1050, 7907, 3839, 340, 11336, 1336, 267, 769, 63, 6776, 14, 2758, 8, 277, 14, 954, 2087, 9, 267, 1249, 275, 291, 14, 2087, 14, 1122, 63, 589, 2941, 513, 1673, 6776, 1105, 267, 754, 275, 769, 63, 6776, 14, 1065, 8, 589, 9, 398, 702, 754, 508, 378, 339, 347, 511, 63, 513, 63, 4684, 8, 277, 304, 267, 327, 2104, 3063, 769, 11336, 1077, 440, 2449, 12, 781, 1077, 1050, 7907, 3839, 340, 4545, 1336, 267, 769, 63, 6776, 14, 2758, 8, 277, 14, 954, 2087, 9, 267, 1249, 275, 291, 14, 2087, 14, 1122, 63, 589, 2941, 513, 1673, 4684, 1105, 267, 754, 275, 769, 63, 6776, 14, 1065, 8, 589, 9, 398, 702, 754, 508, 378, 339, 347, 511, 63, 513, 63, 2537, 8, 277, 304, 267, 327, 2104, 3063, 769, 11336, 1077, 440, 2449, 12, 781, 1077, 1050, 7907, 3839, 340, 7249, 1336, 267, 769, 63, 6776, 14, 2758, 8, 277, 14, 954, 2087, 9, 267, 1249, 275, 291, 14, 2087, 14, 1122, 63, 589, 2941, 513, 1673, 2537, 1105, 267, 754, 275, 769, 63, 6776, 14, 1065, 8, 589, 9, 398, 702, 754, 508, 378, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
JuliaLang/JuliaBox
engine/src/juliabox/plugins/usage_accounting/usage_accounting_tbl.py
3
5265
import datetime import pytz import json import random from boto.dynamodb2.fields import HashKey, RangeKey, AllIndex, IncludeIndex from boto.dynamodb2.types import NUMBER, STRING from juliabox.db import JBPluginDB from juliabox.db import JBoxDB class JBoxAccountingV2(JBPluginDB): provides = [JBPluginDB.JBP_TABLE_DYNAMODB, JBPluginDB.JBP_USAGE_ACCOUNTING] NAME = 'jbox_accounting_v2' SCHEMA = [ HashKey('stop_date', data_type=NUMBER), RangeKey('stop_time', data_type=NUMBER) ] INDEXES = [ AllIndex('container_id-stop_time-index', parts=[ HashKey('container_id', data_type=STRING), RangeKey('stop_time', data_type=NUMBER) ]), IncludeIndex('image_id-stop_time-index', parts=[ HashKey('image_id', data_type=STRING), RangeKey('stop_time', data_type=NUMBER) ], includes=['container_id']) ] KEYS = ['stop_date', 'stop_time'] ATTRIBUTES = ['image_id', 'container_id', 'start_date', 'start_time'] SQL_INDEXES = [ {'name': 'container_id-stop_time-index', 'cols': ['container_id', 'stop_time']}, {'name': 'image_id-stop_time-index', 'cols': ['image_id', 'stop_time']}, ] KEYS_TYPES = [JBoxDB.INT, JBoxDB.INT] TYPES = [JBoxDB.VCHAR, JBoxDB.VCHAR, JBoxDB.INT, JBoxDB.INT] TABLE = None _stats_cache = {} def __init__(self, container_id, image_id, start_time, stop_time=None): if None == stop_time: stop_datetime = datetime.datetime.now(pytz.utc) else: stop_datetime = stop_time stop_time = JBoxAccountingV2.datetime_to_epoch_secs(stop_datetime, allow_microsecs=True) stop_date = JBoxAccountingV2.datetime_to_yyyymmdd(stop_datetime) data = { 'stop_date': stop_date, 'stop_time': stop_time, 'image_id': image_id, 'container_id': container_id, 'start_time': JBoxAccountingV2.datetime_to_epoch_secs(start_time), 'start_date': JBoxAccountingV2.datetime_to_yyyymmdd(start_time) } self.create(data) self.item = self.fetch(stop_date=stop_date, stop_time=stop_time) self.is_new = True @staticmethod def _query_stats_date(date): # TODO: caching items is not a good idea. Should cache computed data instead. today = datetime.datetime.now() date_day = JBoxAccountingV2.datetime_to_yyyymmdd(date) today_day = JBoxAccountingV2.datetime_to_yyyymmdd(today) istoday = date_day == today_day if date_day in JBoxAccountingV2._stats_cache: return JBoxAccountingV2._stats_cache[date_day] res = JBoxAccountingV2.query(stop_date__eq=date_day, stop_time__gte=0) items = [] for item in res: items.append(item) if not istoday: JBoxAccountingV2._stats_cache[date_day] = items return items @staticmethod def get_stats(dates=(datetime.datetime.now(),)): sum_time = 0 item_count = 0 image_count = {} container_freq = {} for date in dates: items = JBoxAccountingV2._query_stats_date(date) for x in items: item_count += 1 if 'start_time' in x: sum_time += x['stop_time'] - int(x['start_time']) try: image_ids = json.loads(x['image_id']) except: image_ids = [] for image_id in image_ids: if image_id.startswith("juliabox/") and (not image_id.endswith(":latest")): image_count[image_id] = image_count.get(image_id, 0) + 1 cid = x['container_id'] container_freq[cid] = container_freq.get(cid, 0) + 1 def fmt(seconds): hrs = int(seconds / 3600) mins = int(seconds / 60) secs = int(seconds) return "%dh %dm %ds" % (hrs, mins % 60, secs % 60) active_users = 0 for container in container_freq: if container_freq[container] > 2: active_users += 1 return dict( session_count=item_count, avg_time=fmt(float(sum_time) / item_count) if item_count != 0 else 'NA', images_used=image_count, unique_users=len(container_freq), active_users=active_users) @staticmethod def record_session_time(container_name, images_used, time_created, time_finished): for retry in range(1, 10): try: start_time = time_created finish_time = time_finished if retry > 1: finish_time += datetime.timedelta(microseconds=random.randint(1, 100)) acct = JBoxAccountingV2(container_name, json.dumps(images_used), start_time, stop_time=finish_time) acct.save() break except: if retry == 10: JBoxAccountingV2.log_exception("error recording usage") else: JBoxAccountingV2.log_warn("error recording usage, shall retry.")
mit
[ 646, 2197, 199, 646, 15444, 199, 646, 2022, 199, 646, 2196, 199, 199, 504, 6055, 14, 30001, 18, 14, 955, 492, 16101, 1197, 12, 13114, 1197, 12, 2900, 2681, 12, 15783, 2681, 199, 504, 6055, 14, 30001, 18, 14, 1313, 492, 18122, 12, 18661, 199, 199, 504, 1335, 13987, 13113, 88, 14, 697, 492, 1603, 34, 5061, 2846, 199, 504, 1335, 13987, 13113, 88, 14, 697, 492, 1603, 3532, 2846, 421, 199, 533, 1603, 3532, 6009, 316, 54, 18, 8, 42, 34, 5061, 2846, 304, 272, 6571, 275, 359, 42, 34, 5061, 2846, 14, 42, 24408, 63, 8723, 63, 11446, 7335, 47, 2846, 12, 1603, 34, 5061, 2846, 14, 42, 24408, 63, 20274, 63, 18928, 1206, 61, 339, 13637, 275, 283, 74, 1977, 63, 21609, 63, 86, 18, 7, 339, 428, 10364, 275, 359, 267, 16101, 1197, 360, 2379, 63, 602, 297, 666, 63, 466, 29, 9190, 395, 267, 13114, 1197, 360, 2379, 63, 521, 297, 666, 63, 466, 29, 9190, 9, 272, 1622, 339, 17055, 654, 275, 359, 267, 2900, 2681, 360, 3600, 63, 344, 13, 2379, 63, 521, 13, 1080, 297, 4184, 1524, 288, 16101, 1197, 360, 3600, 63, 344, 297, 666, 63, 466, 29, 5353, 395, 288, 13114, 1197, 360, 2379, 63, 521, 297, 666, 63, 466, 29, 9190, 9, 267, 17318, 267, 15783, 2681, 360, 1569, 63, 344, 13, 2379, 63, 521, 13, 1080, 297, 4184, 1524, 288, 16101, 1197, 360, 1569, 63, 344, 297, 666, 63, 466, 29, 5353, 395, 288, 13114, 1197, 360, 2379, 63, 521, 297, 666, 63, 466, 29, 9190, 9, 267, 2156, 6952, 2968, 3600, 63, 344, 1105, 272, 1622, 339, 9301, 51, 275, 788, 2379, 63, 602, 297, 283, 2379, 63, 521, 418, 272, 10762, 16883, 275, 788, 1569, 63, 344, 297, 283, 3600, 63, 344, 297, 283, 928, 63, 602, 297, 283, 928, 63, 521, 418, 272, 5385, 63, 10215, 654, 275, 359, 267, 791, 354, 356, 283, 3600, 63, 344, 13, 2379, 63, 521, 13, 1080, 297, 268, 283, 4574, 356, 788, 3600, 63, 344, 297, 283, 2379, 63, 521, 14949, 267, 791, 354, 356, 283, 1569, 63, 344, 13, 2379, 63, 521, 13, 1080, 297, 268, 283, 4574, 356, 788, 1569, 63, 344, 297, 283, 2379, 63, 521, 14949, 272, 1622, 272, 9301, 51, 63, 7893, 275, 359, 42, 3532, 2846, 14, 2919, 12, 1603, 3532, 2846, 14, 2919, 61, 272, 32317, 275, 359, 42, 3532, 2846, 14, 54, 5901, 12, 1603, 3532, 2846, 14, 54, 5901, 12, 1603, 3532, 2846, 14, 2919, 12, 1603, 3532, 2846, 14, 2919, 61, 339, 9934, 275, 488, 272, 485, 3200, 63, 1637, 275, 1052, 339, 347, 636, 826, 721, 277, 12, 3970, 63, 344, 12, 1834, 63, 344, 12, 1343, 63, 521, 12, 3631, 63, 521, 29, 403, 304, 267, 340, 488, 508, 3631, 63, 521, 26, 288, 3631, 63, 2083, 275, 2197, 14, 2083, 14, 2131, 8, 21948, 14, 5834, 9, 267, 587, 26, 288, 3631, 63, 2083, 275, 3631, 63, 521, 398, 3631, 63, 521, 275, 1603, 3532, 6009, 316, 54, 18, 14, 2083, 63, 475, 63, 7367, 63, 4855, 8, 2379, 63, 2083, 12, 2040, 63, 6453, 4855, 29, 549, 9, 267, 3631, 63, 602, 275, 1603, 3532, 6009, 316, 54, 18, 14, 2083, 63, 475, 63, 18322, 596, 617, 8, 2379, 63, 2083, 9, 267, 666, 275, 469, 288, 283, 2379, 63, 602, 356, 3631, 63, 602, 12, 288, 283, 2379, 63, 521, 356, 3631, 63, 521, 12, 288, 283, 1569, 63, 344, 356, 1834, 63, 344, 12, 288, 283, 3600, 63, 344, 356, 3970, 63, 344, 12, 288, 283, 928, 63, 521, 356, 1603, 3532, 6009, 316, 54, 18, 14, 2083, 63, 475, 63, 7367, 63, 4855, 8, 928, 63, 521, 395, 288, 283, 928, 63, 602, 356, 1603, 3532, 6009, 316, 54, 18, 14, 2083, 63, 475, 63, 18322, 596, 617, 8, 928, 63, 521, 9, 267, 789, 267, 291, 14, 981, 8, 576, 9, 267, 291, 14, 1053, 275, 291, 14, 3535, 8, 2379, 63, 602, 29, 2379, 63, 602, 12, 3631, 63, 521, 29, 2379, 63, 521, 9, 267, 291, 14, 374, 63, 1222, 275, 715, 339, 768, 4639, 272, 347, 485, 1131, 63, 3200, 63, 602, 8, 602, 304, 267, 327, 3254, 26, 13627, 2974, 365, 440, 282, 6954, 16819, 14, 7719, 2581, 9235, 666, 3140, 14, 267, 11168, 275, 2197, 14, 2083, 14, 2131, 342, 267, 1434, 63, 2977, 275, 1603, 3532, 6009, 316, 54, 18, 14, 2083, 63, 475, 63, 18322, 596, 617, 8, 602, 9, 267, 11168, 63, 2977, 275, 1603, 3532, 6009, 316, 54, 18, 14, 2083, 63, 475, 63, 18322, 596, 617, 8, 8136, 9, 267, 284, 270, 26920, 275, 1434, 63, 2977, 508, 11168, 63, 2977, 398, 340, 1434, 63, 2977, 315, 1603, 3532, 6009, 316, 54, 18, 423, 3200, 63, 1637, 26, 288, 372, 1603, 3532, 6009, 316, 54, 18, 423, 3200, 63, 1637, 59, 602, 63, 2977, 61, 398, 522, 275, 1603, 3532, 6009, 316, 54, 18, 14, 1131, 8, 2379, 63, 602, 363, 4077, 29, 602, 63, 2977, 12, 3631, 63, 521, 363, 19586, 29, 16, 9, 398, 2974, 275, 942, 267, 367, 1242, 315, 522, 26, 288, 2974, 14, 740, 8, 1053, 9, 398, 340, 440, 284, 270, 26920, 26, 288, 1603, 3532, 6009, 316, 54, 18, 423, 3200, 63, 1637, 59, 602, 63, 2977, 61, 275, 2974, 398, 372, 2974, 339, 768, 4639, 272, 347, 664, 63, 3200, 8, 9356, 2687, 2083, 14, 2083, 14, 2131, 1062, 2298, 267, 3089, 63, 521, 275, 378, 267, 1242, 63, 835, 275, 378, 267, 1834, 63, 835, 275, 1052, 267, 3970, 63, 5646, 275, 1052, 267, 367, 1434, 315, 10831, 26, 288, 2974, 275, 1603, 3532, 6009, 316, 54, 18, 423, 1131, 63, 3200, 63, 602, 8, 602, 9, 288, 367, 671, 315, 2974, 26, 355, 1242, 63, 835, 847, 413, 355, 340, 283, 928, 63, 521, 7, 315, 671, 26, 490, 3089, 63, 521, 847, 671, 459, 2379, 63, 521, 418, 446, 1109, 8, 88, 459, 928, 63, 521, 1105, 355, 862, 26, 490, 1834, 63, 1580, 275, 2022, 14, 3640, 8, 88, 459, 1569, 63, 344, 1105, 355, 871, 26, 490, 1834, 63, 1580, 275 ]
[ 2197, 199, 646, 15444, 199, 646, 2022, 199, 646, 2196, 199, 199, 504, 6055, 14, 30001, 18, 14, 955, 492, 16101, 1197, 12, 13114, 1197, 12, 2900, 2681, 12, 15783, 2681, 199, 504, 6055, 14, 30001, 18, 14, 1313, 492, 18122, 12, 18661, 199, 199, 504, 1335, 13987, 13113, 88, 14, 697, 492, 1603, 34, 5061, 2846, 199, 504, 1335, 13987, 13113, 88, 14, 697, 492, 1603, 3532, 2846, 421, 199, 533, 1603, 3532, 6009, 316, 54, 18, 8, 42, 34, 5061, 2846, 304, 272, 6571, 275, 359, 42, 34, 5061, 2846, 14, 42, 24408, 63, 8723, 63, 11446, 7335, 47, 2846, 12, 1603, 34, 5061, 2846, 14, 42, 24408, 63, 20274, 63, 18928, 1206, 61, 339, 13637, 275, 283, 74, 1977, 63, 21609, 63, 86, 18, 7, 339, 428, 10364, 275, 359, 267, 16101, 1197, 360, 2379, 63, 602, 297, 666, 63, 466, 29, 9190, 395, 267, 13114, 1197, 360, 2379, 63, 521, 297, 666, 63, 466, 29, 9190, 9, 272, 1622, 339, 17055, 654, 275, 359, 267, 2900, 2681, 360, 3600, 63, 344, 13, 2379, 63, 521, 13, 1080, 297, 4184, 1524, 288, 16101, 1197, 360, 3600, 63, 344, 297, 666, 63, 466, 29, 5353, 395, 288, 13114, 1197, 360, 2379, 63, 521, 297, 666, 63, 466, 29, 9190, 9, 267, 17318, 267, 15783, 2681, 360, 1569, 63, 344, 13, 2379, 63, 521, 13, 1080, 297, 4184, 1524, 288, 16101, 1197, 360, 1569, 63, 344, 297, 666, 63, 466, 29, 5353, 395, 288, 13114, 1197, 360, 2379, 63, 521, 297, 666, 63, 466, 29, 9190, 9, 267, 2156, 6952, 2968, 3600, 63, 344, 1105, 272, 1622, 339, 9301, 51, 275, 788, 2379, 63, 602, 297, 283, 2379, 63, 521, 418, 272, 10762, 16883, 275, 788, 1569, 63, 344, 297, 283, 3600, 63, 344, 297, 283, 928, 63, 602, 297, 283, 928, 63, 521, 418, 272, 5385, 63, 10215, 654, 275, 359, 267, 791, 354, 356, 283, 3600, 63, 344, 13, 2379, 63, 521, 13, 1080, 297, 268, 283, 4574, 356, 788, 3600, 63, 344, 297, 283, 2379, 63, 521, 14949, 267, 791, 354, 356, 283, 1569, 63, 344, 13, 2379, 63, 521, 13, 1080, 297, 268, 283, 4574, 356, 788, 1569, 63, 344, 297, 283, 2379, 63, 521, 14949, 272, 1622, 272, 9301, 51, 63, 7893, 275, 359, 42, 3532, 2846, 14, 2919, 12, 1603, 3532, 2846, 14, 2919, 61, 272, 32317, 275, 359, 42, 3532, 2846, 14, 54, 5901, 12, 1603, 3532, 2846, 14, 54, 5901, 12, 1603, 3532, 2846, 14, 2919, 12, 1603, 3532, 2846, 14, 2919, 61, 339, 9934, 275, 488, 272, 485, 3200, 63, 1637, 275, 1052, 339, 347, 636, 826, 721, 277, 12, 3970, 63, 344, 12, 1834, 63, 344, 12, 1343, 63, 521, 12, 3631, 63, 521, 29, 403, 304, 267, 340, 488, 508, 3631, 63, 521, 26, 288, 3631, 63, 2083, 275, 2197, 14, 2083, 14, 2131, 8, 21948, 14, 5834, 9, 267, 587, 26, 288, 3631, 63, 2083, 275, 3631, 63, 521, 398, 3631, 63, 521, 275, 1603, 3532, 6009, 316, 54, 18, 14, 2083, 63, 475, 63, 7367, 63, 4855, 8, 2379, 63, 2083, 12, 2040, 63, 6453, 4855, 29, 549, 9, 267, 3631, 63, 602, 275, 1603, 3532, 6009, 316, 54, 18, 14, 2083, 63, 475, 63, 18322, 596, 617, 8, 2379, 63, 2083, 9, 267, 666, 275, 469, 288, 283, 2379, 63, 602, 356, 3631, 63, 602, 12, 288, 283, 2379, 63, 521, 356, 3631, 63, 521, 12, 288, 283, 1569, 63, 344, 356, 1834, 63, 344, 12, 288, 283, 3600, 63, 344, 356, 3970, 63, 344, 12, 288, 283, 928, 63, 521, 356, 1603, 3532, 6009, 316, 54, 18, 14, 2083, 63, 475, 63, 7367, 63, 4855, 8, 928, 63, 521, 395, 288, 283, 928, 63, 602, 356, 1603, 3532, 6009, 316, 54, 18, 14, 2083, 63, 475, 63, 18322, 596, 617, 8, 928, 63, 521, 9, 267, 789, 267, 291, 14, 981, 8, 576, 9, 267, 291, 14, 1053, 275, 291, 14, 3535, 8, 2379, 63, 602, 29, 2379, 63, 602, 12, 3631, 63, 521, 29, 2379, 63, 521, 9, 267, 291, 14, 374, 63, 1222, 275, 715, 339, 768, 4639, 272, 347, 485, 1131, 63, 3200, 63, 602, 8, 602, 304, 267, 327, 3254, 26, 13627, 2974, 365, 440, 282, 6954, 16819, 14, 7719, 2581, 9235, 666, 3140, 14, 267, 11168, 275, 2197, 14, 2083, 14, 2131, 342, 267, 1434, 63, 2977, 275, 1603, 3532, 6009, 316, 54, 18, 14, 2083, 63, 475, 63, 18322, 596, 617, 8, 602, 9, 267, 11168, 63, 2977, 275, 1603, 3532, 6009, 316, 54, 18, 14, 2083, 63, 475, 63, 18322, 596, 617, 8, 8136, 9, 267, 284, 270, 26920, 275, 1434, 63, 2977, 508, 11168, 63, 2977, 398, 340, 1434, 63, 2977, 315, 1603, 3532, 6009, 316, 54, 18, 423, 3200, 63, 1637, 26, 288, 372, 1603, 3532, 6009, 316, 54, 18, 423, 3200, 63, 1637, 59, 602, 63, 2977, 61, 398, 522, 275, 1603, 3532, 6009, 316, 54, 18, 14, 1131, 8, 2379, 63, 602, 363, 4077, 29, 602, 63, 2977, 12, 3631, 63, 521, 363, 19586, 29, 16, 9, 398, 2974, 275, 942, 267, 367, 1242, 315, 522, 26, 288, 2974, 14, 740, 8, 1053, 9, 398, 340, 440, 284, 270, 26920, 26, 288, 1603, 3532, 6009, 316, 54, 18, 423, 3200, 63, 1637, 59, 602, 63, 2977, 61, 275, 2974, 398, 372, 2974, 339, 768, 4639, 272, 347, 664, 63, 3200, 8, 9356, 2687, 2083, 14, 2083, 14, 2131, 1062, 2298, 267, 3089, 63, 521, 275, 378, 267, 1242, 63, 835, 275, 378, 267, 1834, 63, 835, 275, 1052, 267, 3970, 63, 5646, 275, 1052, 267, 367, 1434, 315, 10831, 26, 288, 2974, 275, 1603, 3532, 6009, 316, 54, 18, 423, 1131, 63, 3200, 63, 602, 8, 602, 9, 288, 367, 671, 315, 2974, 26, 355, 1242, 63, 835, 847, 413, 355, 340, 283, 928, 63, 521, 7, 315, 671, 26, 490, 3089, 63, 521, 847, 671, 459, 2379, 63, 521, 418, 446, 1109, 8, 88, 459, 928, 63, 521, 1105, 355, 862, 26, 490, 1834, 63, 1580, 275, 2022, 14, 3640, 8, 88, 459, 1569, 63, 344, 1105, 355, 871, 26, 490, 1834, 63, 1580, 275, 0 ]
[ 1, 1, 1, 1, 1, 1, 1,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p/addons/mail/wizard/__init__.py
438
1075
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> # ############################################################################## import invite import mail_compose_message # 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, 7129, 13, 31982, 7653, 13950, 8642, 1014, 921, 1544, 14, 11267, 14, 957, 18956, 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, 1696, 1684, 844, 465, 3267, 701, 199, 3, 259, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 259, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 259, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 3133, 199, 3, 199, 4605, 199, 199, 646, 24542, 199, 646, 6016, 63, 12607, 63, 1188, 199, 199, 3, 6695, 26, 10379, 26, 10558, 26, 6492, 29, 20, 26, 10503, 29, 20, 26, 10425, 29, 20, 26, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 259, 7653, 12, 3232, 5800, 8259, 9274, 199, 3, 259, 1898, 334, 35, 9, 7129, 13, 31982, 7653, 13950, 8642, 1014, 921, 1544, 14, 11267, 14, 957, 18956, 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, 1696, 1684, 844, 465, 3267, 701, 199, 3, 259, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 259, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 259, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 3133, 199, 3, 199, 4605, 199, 199, 646, 24542, 199, 646, 6016, 63, 12607, 63, 1188, 199, 199, 3, 6695, 26, 10379, 26, 10558, 26, 6492, 29, 20, 26, 10503, 29, 20, 26, 10425, 29, 20, 26, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
n1nj4sec/memorpy
memorpy/utils.py
4
3335
# Author: Nicolas VERDIER # This file is part of memorpy. # # memorpy 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. # # memorpy 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 memorpy. If not, see <http://www.gnu.org/licenses/>. import re import struct def re_to_unicode(s): newstring = '' for c in s: newstring += re.escape(c) + '\\x00' return newstring def type_unpack(type): """ return the struct and the len of a particular type """ type = type.lower() s = None l = None if type == 'short': s = 'h' l = 2 elif type == 'ushort': s = 'H' l = 2 elif type == 'int': s = 'i' l = 4 elif type == 'uint': s = 'I' l = 4 elif type == 'long': s = 'l' l = 4 elif type == 'ulong': s = 'L' l = 4 elif type == 'float': s = 'f' l = 4 elif type == 'double': s = 'd' l = 8 else: raise TypeError('Unknown type %s' % type) return ('<' + s, l) def hex_dump(data, addr = 0, prefix = '', ftype = 'bytes'): """ function originally from pydbg, modified to display other types """ dump = prefix slice = '' if ftype != 'bytes': structtype, structlen = type_unpack(ftype) for i in range(0, len(data), structlen): if addr % 16 == 0: dump += ' ' for char in slice: if ord(char) >= 32 and ord(char) <= 126: dump += char else: dump += '.' dump += '\n%s%08X: ' % (prefix, addr) slice = '' tmpval = 'NaN' try: packedval = data[i:i + structlen] tmpval = struct.unpack(structtype, packedval)[0] except Exception as e: print e if tmpval == 'NaN': dump += '{:<15} '.format(tmpval) elif ftype == 'float': dump += '{:<15.4f} '.format(tmpval) else: dump += '{:<15} '.format(tmpval) addr += structlen else: for byte in data: if addr % 16 == 0: dump += ' ' for char in slice: if ord(char) >= 32 and ord(char) <= 126: dump += char else: dump += '.' dump += '\n%s%08X: ' % (prefix, addr) slice = '' dump += '%02X ' % ord(byte) slice += byte addr += 1 remainder = addr % 16 if remainder != 0: dump += ' ' * (16 - remainder) + ' ' for char in slice: if ord(char) >= 32 and ord(char) <= 126: dump += char else: dump += '.' return dump + '\n'
gpl-3.0
[ 3, 6529, 26, 30650, 761, 305, 12348, 1914, 540, 199, 3, 961, 570, 365, 1777, 402, 7573, 269, 647, 14, 199, 3, 199, 3, 7573, 269, 647, 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, 7573, 269, 647, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 7573, 269, 647, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 646, 295, 199, 646, 2702, 199, 199, 318, 295, 63, 475, 63, 2975, 8, 83, 304, 272, 892, 875, 275, 2125, 272, 367, 286, 315, 308, 26, 267, 892, 875, 847, 295, 14, 3765, 8, 67, 9, 435, 6468, 88, 383, 7, 339, 372, 892, 875, 421, 199, 318, 730, 63, 5301, 8, 466, 304, 272, 408, 372, 314, 2702, 436, 314, 822, 402, 282, 6770, 730, 408, 272, 730, 275, 730, 14, 2325, 342, 272, 308, 275, 488, 272, 634, 275, 488, 272, 340, 730, 508, 283, 3612, 356, 267, 308, 275, 283, 72, 7, 267, 634, 275, 499, 272, 916, 730, 508, 283, 27170, 356, 267, 308, 275, 283, 40, 7, 267, 634, 275, 499, 272, 916, 730, 508, 283, 442, 356, 267, 308, 275, 283, 73, 7, 267, 634, 275, 841, 272, 916, 730, 508, 283, 1635, 356, 267, 308, 275, 283, 41, 7, 267, 634, 275, 841, 272, 916, 730, 508, 283, 2809, 356, 267, 308, 275, 283, 76, 7, 267, 634, 275, 841, 272, 916, 730, 508, 283, 15688, 356, 267, 308, 275, 283, 44, 7, 267, 634, 275, 841, 272, 916, 730, 508, 283, 1609, 356, 267, 308, 275, 283, 70, 7, 267, 634, 275, 841, 272, 916, 730, 508, 283, 3157, 356, 267, 308, 275, 283, 68, 7, 267, 634, 275, 1695, 272, 587, 26, 267, 746, 3146, 360, 5912, 730, 450, 83, 7, 450, 730, 9, 272, 372, 19990, 7, 435, 308, 12, 634, 9, 421, 199, 318, 6318, 63, 2724, 8, 576, 12, 5552, 275, 378, 12, 2403, 275, 3260, 8570, 275, 283, 2394, 735, 272, 408, 272, 805, 20657, 687, 1134, 16310, 12, 6042, 370, 2929, 1163, 2943, 272, 408, 272, 5461, 275, 2403, 272, 6014, 275, 2125, 272, 340, 8570, 1137, 283, 2394, 356, 267, 2702, 466, 12, 2702, 552, 275, 730, 63, 5301, 8, 10386, 9, 267, 367, 284, 315, 1425, 8, 16, 12, 822, 8, 576, 395, 2702, 552, 304, 288, 340, 5552, 450, 3193, 508, 378, 26, 355, 5461, 847, 283, 283, 355, 367, 1495, 315, 6014, 26, 490, 340, 6206, 8, 1560, 9, 2356, 4337, 436, 6206, 8, 1560, 9, 2695, 21572, 26, 717, 5461, 847, 1495, 490, 587, 26, 717, 5461, 847, 7815, 2234, 5461, 847, 1557, 78, 5, 83, 5, 2036, 56, 26, 283, 450, 334, 1861, 12, 5552, 9, 355, 6014, 275, 2125, 288, 3529, 637, 275, 283, 14300, 7, 288, 862, 26, 355, 13170, 637, 275, 666, 59, 73, 26, 73, 435, 2702, 552, 61, 355, 3529, 637, 275, 2702, 14, 5301, 8, 1820, 466, 12, 13170, 637, 2788, 16, 61, 288, 871, 2186, 465, 325, 26, 355, 870, 325, 953, 340, 3529, 637, 508, 283, 14300, 356, 355, 5461, 847, 5041, 16875, 1046, 93, 1987, 908, 8, 2791, 637, 9, 288, 916, 8570, 508, 283, 1609, 356, 355, 5461, 847, 5041, 16875, 1046, 14, 20, 70, 93, 1987, 908, 8, 2791, 637, 9, 288, 587, 26, 355, 5461, 847, 5041, 16875, 1046, 93, 1987, 908, 8, 2791, 637, 9, 288, 5552, 847, 2702, 552, 339, 587, 26, 267, 367, 3696, 315, 666, 26, 288, 340, 5552, 450, 3193, 508, 378, 26, 355, 5461, 847, 283, 283, 355, 367, 1495, 315, 6014, 26, 490, 340, 6206, 8, 1560, 9, 2356, 4337, 436, 6206, 8, 1560, 9, 2695, 21572, 26, 717, 5461, 847, 1495, 490, 587, 26, 717, 5461, 847, 7815, 2234, 5461, 847, 1557, 78, 5, 83, 5, 2036, 56, 26, 283, 450, 334, 1861, 12, 5552, 9, 355, 6014, 275, 2125, 288, 5461, 847, 1543, 996, 56, 283, 450, 6206, 8, 4414, 9, 288, 6014, 847, 3696, 288, 5552, 847, 413, 339, 15748, 275, 5552, 450, 3193, 272, 340, 15748, 1137, 378, 26, 267, 5461, 847, 283, 257, 283, 627, 334, 975, 446, 15748, 9, 435, 283, 283, 272, 367, 1495, 315, 6014, 26, 267, 340, 6206, 8, 1560, 9, 2356, 4337, 436, 6206, 8, 1560, 9, 2695, 21572, 26, 288, 5461, 847, 1495, 267, 587, 26, 288, 5461, 847, 7815, 339, 372, 5461, 435, 1557, 78, 7, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 6529, 26, 30650, 761, 305, 12348, 1914, 540, 199, 3, 961, 570, 365, 1777, 402, 7573, 269, 647, 14, 199, 3, 199, 3, 7573, 269, 647, 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, 7573, 269, 647, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 7573, 269, 647, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 646, 295, 199, 646, 2702, 199, 199, 318, 295, 63, 475, 63, 2975, 8, 83, 304, 272, 892, 875, 275, 2125, 272, 367, 286, 315, 308, 26, 267, 892, 875, 847, 295, 14, 3765, 8, 67, 9, 435, 6468, 88, 383, 7, 339, 372, 892, 875, 421, 199, 318, 730, 63, 5301, 8, 466, 304, 272, 408, 372, 314, 2702, 436, 314, 822, 402, 282, 6770, 730, 408, 272, 730, 275, 730, 14, 2325, 342, 272, 308, 275, 488, 272, 634, 275, 488, 272, 340, 730, 508, 283, 3612, 356, 267, 308, 275, 283, 72, 7, 267, 634, 275, 499, 272, 916, 730, 508, 283, 27170, 356, 267, 308, 275, 283, 40, 7, 267, 634, 275, 499, 272, 916, 730, 508, 283, 442, 356, 267, 308, 275, 283, 73, 7, 267, 634, 275, 841, 272, 916, 730, 508, 283, 1635, 356, 267, 308, 275, 283, 41, 7, 267, 634, 275, 841, 272, 916, 730, 508, 283, 2809, 356, 267, 308, 275, 283, 76, 7, 267, 634, 275, 841, 272, 916, 730, 508, 283, 15688, 356, 267, 308, 275, 283, 44, 7, 267, 634, 275, 841, 272, 916, 730, 508, 283, 1609, 356, 267, 308, 275, 283, 70, 7, 267, 634, 275, 841, 272, 916, 730, 508, 283, 3157, 356, 267, 308, 275, 283, 68, 7, 267, 634, 275, 1695, 272, 587, 26, 267, 746, 3146, 360, 5912, 730, 450, 83, 7, 450, 730, 9, 272, 372, 19990, 7, 435, 308, 12, 634, 9, 421, 199, 318, 6318, 63, 2724, 8, 576, 12, 5552, 275, 378, 12, 2403, 275, 3260, 8570, 275, 283, 2394, 735, 272, 408, 272, 805, 20657, 687, 1134, 16310, 12, 6042, 370, 2929, 1163, 2943, 272, 408, 272, 5461, 275, 2403, 272, 6014, 275, 2125, 272, 340, 8570, 1137, 283, 2394, 356, 267, 2702, 466, 12, 2702, 552, 275, 730, 63, 5301, 8, 10386, 9, 267, 367, 284, 315, 1425, 8, 16, 12, 822, 8, 576, 395, 2702, 552, 304, 288, 340, 5552, 450, 3193, 508, 378, 26, 355, 5461, 847, 283, 283, 355, 367, 1495, 315, 6014, 26, 490, 340, 6206, 8, 1560, 9, 2356, 4337, 436, 6206, 8, 1560, 9, 2695, 21572, 26, 717, 5461, 847, 1495, 490, 587, 26, 717, 5461, 847, 7815, 2234, 5461, 847, 1557, 78, 5, 83, 5, 2036, 56, 26, 283, 450, 334, 1861, 12, 5552, 9, 355, 6014, 275, 2125, 288, 3529, 637, 275, 283, 14300, 7, 288, 862, 26, 355, 13170, 637, 275, 666, 59, 73, 26, 73, 435, 2702, 552, 61, 355, 3529, 637, 275, 2702, 14, 5301, 8, 1820, 466, 12, 13170, 637, 2788, 16, 61, 288, 871, 2186, 465, 325, 26, 355, 870, 325, 953, 340, 3529, 637, 508, 283, 14300, 356, 355, 5461, 847, 5041, 16875, 1046, 93, 1987, 908, 8, 2791, 637, 9, 288, 916, 8570, 508, 283, 1609, 356, 355, 5461, 847, 5041, 16875, 1046, 14, 20, 70, 93, 1987, 908, 8, 2791, 637, 9, 288, 587, 26, 355, 5461, 847, 5041, 16875, 1046, 93, 1987, 908, 8, 2791, 637, 9, 288, 5552, 847, 2702, 552, 339, 587, 26, 267, 367, 3696, 315, 666, 26, 288, 340, 5552, 450, 3193, 508, 378, 26, 355, 5461, 847, 283, 283, 355, 367, 1495, 315, 6014, 26, 490, 340, 6206, 8, 1560, 9, 2356, 4337, 436, 6206, 8, 1560, 9, 2695, 21572, 26, 717, 5461, 847, 1495, 490, 587, 26, 717, 5461, 847, 7815, 2234, 5461, 847, 1557, 78, 5, 83, 5, 2036, 56, 26, 283, 450, 334, 1861, 12, 5552, 9, 355, 6014, 275, 2125, 288, 5461, 847, 1543, 996, 56, 283, 450, 6206, 8, 4414, 9, 288, 6014, 847, 3696, 288, 5552, 847, 413, 339, 15748, 275, 5552, 450, 3193, 272, 340, 15748, 1137, 378, 26, 267, 5461, 847, 283, 257, 283, 627, 334, 975, 446, 15748, 9, 435, 283, 283, 272, 367, 1495, 315, 6014, 26, 267, 340, 6206, 8, 1560, 9, 2356, 4337, 436, 6206, 8, 1560, 9, 2695, 21572, 26, 288, 5461, 847, 1495, 267, 587, 26, 288, 5461, 847, 7815, 339, 372, 5461, 435, 1557, 78, 7, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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gb_model.py
1
20288
# 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. # pylint: disable=invalid-name """Cost model based on xgboost""" import multiprocessing import logging from collections import defaultdict import numpy as np import xgboost as xgb from xgboost.core import EarlyStopException from xgboost.callback import _fmt_metric from xgboost.training import aggcv from tvm.autotvm.tuner.metric import max_curve from .cost_model import PythonBasedModel from ..feature import get_per_store_features_from_measure_pairs, get_per_store_features_from_states from ..measure_record import RecordReader logger = logging.getLogger("auto_scheduler") class XGBDMatrixContext: """A global context to hold additional attributes of xgb.DMatrix""" def __init__(self): self.context_dict = defaultdict(dict) def get(self, key, matrix, default=None): """ Get an attribute of a xgb.DMatrix Parameters ---------- key: str The name of the attribute matrix: xgb.DMatrix The matrix default: Optional[Any] The default value if the item does not exist """ return self.context_dict[key].get(matrix.handle.value, default) def set(self, key, matrix, value): """ Set an attribute for a xgb.DMatrix Parameters ---------- key: str The name of the attribute matrix: xgb.DMatrix The matrix value: Optional[Any] The new value """ self.context_dict[key][matrix.handle.value] = value dmatrix_context = XGBDMatrixContext() class XGBModel(PythonBasedModel): """Train a XGBoost model to predict the normalized throughputs of programs. Let the normalized throughput be the score of a program (higher is better). We predict the (approximiate) score of a program = the sum of the scores of all stages in this program. i.e. score(P) = score_s0 + score_s1 + ... + score_sn, where score_si is the score of Stage i in Program P. We extract feature for each stage and let the xgboost predict the score for each stage. We then sum up the predictions as the score of the whole program. We use RMSE as the loss function. i.e. loss(P, y) = 1/2 * (score(P) - y)^2, where P is the program and y is the normalized throughput according to the ground truth (measurement). XGBoost does not support this loss function because `score(P)` is a sum of the prediction of several samples, so we implemented a custom loss function and call it pack-sum-rmse. It is called "pack-sum" because we combine several samples into a "pack" and sum up their predictions. """ def __init__(self, verbose_eval=25, num_warmup_sample=100, seed=None): self.xgb_params = { "max_depth": 10, "gamma": 0.001, "min_child_weight": 0, "eta": 0.2, # todo(merrymercy): automatically decrease learning rate when the loss is too large "n_gpus": 0, "nthread": multiprocessing.cpu_count() // 2, "verbosity": 0, "seed": seed or 43, "disable_default_eval_metric": 1, } self.bst = None self.plan_size = 32 self.num_warmup_sample = num_warmup_sample self.verbose_eval = verbose_eval super().__init__() # cache measurement input/result pairs and extracted features self.inputs = [] self.results = [] self.inputs_feature_cache = [] def update(self, inputs, results): """Update the cost model according to new measurement results (training data). XGBoost does not support incremental training, so we re-train a new model every time. Parameters ---------- inputs : List[MeasureInput] The measurement inputs results : List[MeasureResult] The measurement results """ if len(inputs) <= 0: return assert len(inputs) == len(results) self.inputs.extend(inputs) self.results.extend(results) # extract feature n_cached = len(self.inputs_feature_cache) features, normalized_throughputs, task_ids = get_per_store_features_from_measure_pairs( self.inputs, self.results, skip_first_n_feature_extraction=n_cached ) if n_cached > 0: features = list(features) features[:n_cached] = self.inputs_feature_cache features = np.array(features, dtype=object) self.inputs_feature_cache = features dtrain = pack_sum_xgbmatrix( features, normalized_throughputs, task_ids, normalized_throughputs ) # train xgb model self.bst = xgb.train( self.xgb_params, dtrain, num_boost_round=10000, obj=pack_sum_square_error, callbacks=[ custom_callback( stopping_rounds=50, metric="tr-p-rmse", fevals=[ pack_sum_rmse, pack_sum_average_peak_score(self.plan_size), ], evals=[(dtrain, "tr")], maximize=False, verbose_eval=self.verbose_eval, ) ], ) def predict(self, task, states): """Predict the scores of states Parameters ---------- search_task : SearchTask The search task of states statse : List[State] The input states Returns ------- scores: List[float] The predicted scores for all states """ features = get_per_store_features_from_states(states, task) if self.bst is not None and len(self.inputs) > self.num_warmup_sample: dtest, pack_ids = feature_to_pack_sum_xgbmatrix(features) raw_preds = self.bst.predict(dtest) ret = predict_throughput_pack_sum(raw_preds, pack_ids) else: ret = np.random.uniform(0, 1, (len(states),)) # Predict 0 for invalid states that failed to be lowered. for idx, feature in enumerate(features): if feature.min() == feature.max() == 0: ret[idx] = float("-inf") return ret def predict_stages(self, task, states): """Predict the scores of all stages in states. This is the breakdown version of `predict`. Parameters ---------- search_task : SearchTask The search task of states statse : List[State] The input states Returns ------- scores: List[float] The predicted scores for all stages in all states in the packed format Note ---- For faster data copy between c++ and python, the python part returns scores in a single flatten array using a packed format. The c++ part then unpacks the flatten array. The packed format is: { float scores[N]; // scores[i] is the score for states[i]. int n_stage_0; // the number of stages in states[0] float stage_scores_0[[n_stage_0] // the scores for all stages in states[0] int n_stage_1; // the number of stages in states[1] float stage_scores_1[n_stage_1]; // the scores for all stages in states[1] ... int n_stage_i; // the number of stages in states[i] float stage_scores_1[n_stage_i]; // the scores for all stages in states[i] ... // untill i == N - 1 } To implement this format, we also store int as float, so we can store all numbers into a single float array. """ features = get_per_store_features_from_states(states, task) if self.bst is not None and len(self.inputs) > self.num_warmup_sample: dtest, pack_ids = feature_to_pack_sum_xgbmatrix(features) raw_preds = self.bst.predict(dtest) breakdown = predict_throughput_pack_sum(raw_preds, pack_ids) stage_scores = [[] for _ in range(len(states))] for pred, pack_id in zip(raw_preds, pack_ids): stage_scores[pack_id].append(pred) for idx, stage_score in enumerate(stage_scores): breakdown = np.append(breakdown, len(stage_score)) breakdown = np.concatenate((breakdown, np.array(stage_score))) else: breakdown = np.concatenate( ( np.random.uniform(0, 1, (len(states),)), np.zeros( len(states), ), ) ) # Predict 0 for invalid states that failed to be lowered. for idx, feature in enumerate(features): if feature.min() == feature.max() == 0: breakdown[idx] = float("-inf") return breakdown def update_from_file(self, file_name, n_lines=None): """Load measure records from a log file to update the cost model. This function can be used to pre-train the cost model with history log files. Parameters ---------- file_name: str The filename n_lines: Optional[int] Only load first n lines of the log file """ inputs, results = RecordReader(file_name).read_lines(n_lines) logger.info("XGBModel: Loaded %s measurement records from %s", len(inputs), file_name) self.update(inputs, results) def save(self, file_name: str): """Save the model to a file Parameters ---------- file_name: str The filename """ self.bst.save_model(file_name) def load(self, file_name: str): """Load the model from a file Parameters ---------- file_name: str The filename """ if self.bst is None: self.bst = xgb.Booster(self.xgb_params) self.bst.load_model(file_name) self.num_warmup_sample = -1 def feature_to_pack_sum_xgbmatrix(xs): """Convert an extracted multi-stage feature vector to a xgbmatrx in pack-sum format Parameters ---------- xs: np.ndarray The feature vector Returns ------- dmatrix: xgb.DMatrix The DMatrix pack_ids: List[int] pack ids information """ x_flatten = [] pack_ids = [] for ct, x in enumerate(xs): for row in x: x_flatten.append(row) pack_ids.append(ct) return xgb.DMatrix(np.array(x_flatten)), pack_ids def pack_sum_xgbmatrix(xs, ys, gids=None, weights=None): """Convert (feature, label) pairs into a xgb matrix with pack-sum format Parameters ---------- xs: np.ndarray The feature vector ys: np.ndarray The normaizlied throughput gids: Optional[List[int]] Group id (task id) weights: Optional[np.ndarray] The weight of samples Returns ------- dmatrix: xgb.DMatrix The DMatrix with pack-sum information """ if gids is not None: # sort by group indices = gids.argsort() xs, ys = xs[indices], ys[indices] group_sizes = np.bincount(gids) if weights is not None: weights = weights[indices] else: # assume it has only one group group_sizes = [len(xs)] x_flatten = [] y_flatten = [] weights_flatten = [] pack_ids = [] if weights is not None: for ct, (x, y, w) in enumerate(zip(xs, ys, weights)): for row in x: x_flatten.append(row) y_flatten.append(y) weights_flatten.append(w) pack_ids.append(ct) else: for ct, (x, y) in enumerate(zip(xs, ys)): for row in x: x_flatten.append(row) y_flatten.append(y) pack_ids.append(ct) ret = xgb.DMatrix(np.array(x_flatten), y_flatten) if weights is not None: ret.set_weight(weights_flatten) dmatrix_context.set("pack_ids", ret, np.array(pack_ids)) dmatrix_context.set("group_sizes", ret, group_sizes) return ret def predict_throughput_pack_sum(raw_preds, pack_ids): """Predict the throughputs for predictions in pack-sum format Parameters ---------- raw_preds: np.ndarray The raw predictions pack_ids: List[int] The pack id for predictions Returns ------- throughputs: np.ndarray The throughput """ sum_pred = np.bincount(pack_ids, weights=raw_preds) return sum_pred def pack_sum_square_error(preds, dtrain): """Implement square error loss on pack-sum format as a custom objective function for xgboost. Parameters ---------- preds: np.ndarray The predicitons dtrain: xgb.DMatrix The training set Returns ------- gradient: np.ndarray hessian: np.ndarray gradient and hessian according to the xgboost format """ pack_ids = dmatrix_context.get("pack_ids", dtrain) weight = dtrain.get_weight() sum_pred = np.bincount(pack_ids, weights=preds) x = sum_pred[pack_ids] y = dtrain.get_label() gradient = x - y hessian = np.ones_like(gradient) if len(weight) == 0: return gradient, hessian return gradient * weight, hessian * weight def pack_sum_rmse(raw_preds, labels): """Evaluate RMSE (rooted mean square error) in the pack-sum format Parameters ---------- raw_preds: np.ndarray The raw prediction labels: xgb.DMatrix The groud-truth label matrix Returns ------- name: str score: float The name and score of this metric """ pack_ids = dmatrix_context.get("pack_ids", labels) preds = predict_throughput_pack_sum(raw_preds, pack_ids)[pack_ids] return "p-rmse", np.sqrt(np.mean(np.square((preds - labels.get_label())))) def pack_sum_average_peak_score(N): """Return the evaluation function for average-peak-score@N Parameters ---------- N: int The "N" in "average-peak-score@N" Returns ------- The evaluation function """ def feval(preds, labels): """Evaluate average-peak-score@N in the pack-sum format Parameters ---------- raw_preds: np.ndarray The raw prediction labels: xgb.DMatrix The groud-truth label matrix Returns ------- name: str score: float The name and score of this metric """ group_sizes = dmatrix_context.get("group_sizes", labels, [len(preds)]) pack_ids = dmatrix_context.get("pack_ids", labels) preds = predict_throughput_pack_sum(preds, pack_ids) labels = ( np.bincount(pack_ids, weights=labels.get_label()) / np.unique(pack_ids, return_counts=True)[1] ) scores = [] offset = 0 for size in group_sizes: preds_group = preds[offset : offset + size] labels_group = labels[offset : offset + size] offset += size trials = np.argsort(preds_group)[::-1][:N] trial_scores = labels_group[trials] curve = max_curve(trial_scores) / np.max(labels_group) scores.append(np.mean(curve)) return "a-peak@%d" % N, np.mean(scores) return feval def custom_callback( stopping_rounds, metric, fevals, evals=(), log_file=None, maximize=False, verbose_eval=True, skip_every=2, ): """Callback function for xgboost to support multiple custom evaluation functions""" state = {} metric_shortname = metric.split("-")[1] def init(env): """internal function""" bst = env.model state["maximize_score"] = maximize state["best_iteration"] = 0 if maximize: state["best_score"] = float("-inf") else: state["best_score"] = float("inf") if bst is not None: if bst.attr("best_score") is not None: state["best_score"] = float(bst.attr("best_score")) state["best_iteration"] = int(bst.attr("best_iteration")) state["best_msg"] = bst.attr("best_msg") else: bst.set_attr(best_iteration=str(state["best_iteration"])) bst.set_attr(best_score=str(state["best_score"])) else: assert env.cvfolds is not None def callback(env): """internal function""" if not state: init(env) bst = env.model i = env.iteration cvfolds = env.cvfolds res_dict = {} if i % skip_every == 1: return ##### evaluation ##### if cvfolds is not None: for feval in fevals: tmp = aggcv([f.eval(i, feval) for f in cvfolds]) for k, mean, std in tmp: res_dict[k] = [mean, std] else: for feval in fevals: bst_eval = bst.eval_set(evals, i, feval) res = [x.split(":") for x in bst_eval.split()] for kv in res[1:]: res_dict[kv[0]] = [float(kv[1])] eval_res = [] keys = list(res_dict.keys()) keys.sort(key=lambda x: x if metric_shortname not in x else "a" + x) for key in keys: v = res_dict[key] eval_res.append([key] + v) ##### print eval result ##### if not isinstance(verbose_eval, bool) and verbose_eval and i % verbose_eval == 0: infos = ["XGB iter: %3d" % i] for item in eval_res: if "null" in item[0]: continue infos.append("%s: %.6f" % (item[0], item[1])) logger.debug("\t".join(infos)) if log_file: with open(log_file, "a") as fout: fout.write("\t".join(infos) + "\n") ##### choose score and do early stopping ##### score = None for item in eval_res: if item[0] == metric: score = item[1] break assert score is not None best_score = state["best_score"] best_iteration = state["best_iteration"] maximize_score = state["maximize_score"] if (maximize_score and score > best_score) or (not maximize_score and score < best_score): msg = "[%d] %s" % (env.iteration, "\t".join([_fmt_metric(x) for x in eval_res])) state["best_msg"] = msg state["best_score"] = score state["best_iteration"] = env.iteration # save the property to attributes, so they will occur in checkpoint. if env.model is not None: env.model.set_attr( best_score=str(state["best_score"]), best_iteration=str(state["best_iteration"]), best_msg=state["best_msg"], ) elif env.iteration - best_iteration >= stopping_rounds: best_msg = state["best_msg"] if verbose_eval and env.rank == 0: logger.debug("XGB stopped. Best iteration: %s ", best_msg) raise EarlyStopException(best_iteration) return callback
apache-2.0
[ 3, 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 199, 3, 503, 1655, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 199, 3, 1854, 543, 642, 1736, 367, 4722, 2556, 199, 3, 12602, 4248, 12715, 14, 221, 710, 14857, 12378, 642, 570, 199, 3, 370, 1265, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 199, 3, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 199, 3, 543, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 257, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 199, 3, 2032, 1854, 1334, 314, 844, 365, 1854, 641, 376, 199, 3, 298, 1179, 2281, 2, 4207, 12, 2428, 2990, 1549, 4217, 1634, 1821, 199, 3, 3826, 12, 1902, 4056, 503, 2478, 14, 221, 1666, 314, 844, 367, 314, 199, 3, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 1334, 314, 844, 14, 199, 3, 4287, 26, 3507, 29, 3197, 13, 354, 199, 199, 624, 15568, 1402, 4079, 641, 671, 71, 15589, 624, 199, 646, 12866, 199, 646, 2050, 199, 504, 5055, 492, 10018, 199, 199, 646, 2680, 465, 980, 199, 646, 671, 71, 15589, 465, 671, 4908, 199, 504, 671, 71, 15589, 14, 1018, 492, 662, 285, 590, 6293, 1726, 199, 504, 671, 71, 15589, 14, 3058, 492, 485, 5045, 63, 5165, 199, 504, 671, 71, 15589, 14, 7588, 492, 19408, 5107, 199, 199, 504, 31385, 14, 6898, 357, 2611, 14, 10032, 281, 14, 5165, 492, 1390, 63, 11895, 199, 504, 1275, 6336, 63, 1238, 492, 2018, 20409, 1685, 199, 504, 2508, 4445, 492, 664, 63, 529, 63, 1617, 63, 3179, 63, 504, 63, 9580, 63, 7322, 12, 664, 63, 529, 63, 1617, 63, 3179, 63, 504, 63, 4981, 199, 504, 2508, 9580, 63, 3059, 492, 12651, 5929, 199, 199, 2921, 275, 2050, 14, 5572, 480, 2495, 63, 8874, 531, 421, 199, 533, 1323, 6487, 36, 6443, 2998, 26, 272, 408, 33, 2288, 1067, 370, 10266, 4722, 3004, 402, 671, 4908, 14, 36, 6443, 624, 339, 347, 636, 826, 721, 277, 304, 267, 291, 14, 1100, 63, 807, 275, 10018, 8, 807, 9, 339, 347, 664, 8, 277, 12, 790, 12, 3634, 12, 849, 29, 403, 304, 267, 408, 267, 2372, 376, 2225, 402, 282, 671, 4908, 14, 36, 6443, 267, 3897, 267, 4143, 267, 790, 26, 620, 288, 710, 536, 402, 314, 2225, 267, 3634, 26, 671, 4908, 14, 36, 6443, 288, 710, 3634, 267, 849, 26, 4879, 59, 9874, 61, 288, 710, 849, 574, 340, 314, 1242, 1630, 440, 2187, 267, 408, 267, 372, 291, 14, 1100, 63, 807, 59, 498, 1055, 362, 8, 3642, 14, 2479, 14, 585, 12, 849, 9, 339, 347, 663, 8, 277, 12, 790, 12, 3634, 12, 574, 304, 267, 408, 267, 2494, 376, 2225, 367, 282, 671, 4908, 14, 36, 6443, 267, 3897, 267, 4143, 267, 790, 26, 620, 288, 710, 536, 402, 314, 2225, 267, 3634, 26, 671, 4908, 14, 36, 6443, 288, 710, 3634, 267, 574, 26, 4879, 59, 9874, 61, 288, 710, 892, 574, 267, 408, 267, 291, 14, 1100, 63, 807, 59, 498, 1527, 3642, 14, 2479, 14, 585, 61, 275, 574, 421, 199, 68, 3642, 63, 1100, 275, 1323, 6487, 36, 6443, 2998, 342, 421, 199, 533, 1323, 6487, 1685, 8, 4718, 20409, 1685, 304, 272, 408, 18591, 282, 1323, 39, 18814, 1402, 370, 12610, 314, 9657, 4012, 524, 83, 402, 18572, 14, 272, 12230, 314, 9657, 4012, 524, 506, 314, 5396, 402, 282, 2240, 334, 32357, 365, 8034, 680, 2136, 12610, 272, 314, 334, 16815, 1017, 73, 323, 9, 5396, 402, 282, 2240, 275, 314, 3089, 402, 314, 9342, 402, 1006, 24490, 315, 642, 2240, 14, 272, 284, 14, 69, 14, 5396, 8, 48, 9, 275, 5396, 63, 83, 16, 435, 5396, 63, 83, 17, 435, 2263, 435, 5396, 63, 5167, 12, 272, 2382, 5396, 63, 338, 365, 314, 5396, 402, 1933, 474, 284, 315, 18841, 510, 14, 272, 2136, 5536, 3878, 367, 1924, 9546, 436, 4691, 314, 671, 71, 15589, 12610, 314, 5396, 367, 1924, 9546, 14, 272, 2136, 2066, 3089, 1536, 314, 7914, 465, 314, 5396, 402, 314, 8852, 2240, 14, 272, 2136, 675, 820, 45, 899, 465, 314, 5621, 805, 14, 221, 284, 14, 69, 14, 5621, 8, 48, 12, 612, 9, 275, 413, 15, 18, 627, 334, 3397, 8, 48, 9, 446, 612, 18979, 18, 12, 272, 2382, 510, 365, 314, 2240, 436, 612, 365, 314, 9657, 4012, 524, 7182, 370, 272, 314, 19252, 16865, 334, 17912, 680, 272, 1323, 39, 18814, 1630, 440, 2291, 642, 5621, 805, 2952, 658, 3397, 8, 48, 12544, 365, 282, 3089, 402, 314, 12044, 272, 402, 9978, 5845, 12, 880, 781, 6366, 282, 3537, 5621, 805, 436, 1240, 652, 1706, 13, 1838, 13, 5682, 261, 14, 272, 2779, 365, 2797, 298, 1389, 13, 1838, 2, 2952, 781, 13323, 9978, 5845, 1901, 282, 298, 1389, 2, 436, 3089, 1536, 272, 3932, 7914, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 3376, 63, 2579, 29, 821, 12, 1967, 63, 10669, 384, 63, 3271, 29, 1960, 12, 6347, 29, 403, 304, 267, 291, 14, 88, 4908, 63, 1162, 275, 469, 288, 298, 988, 63, 4631, 582, 1616, 12, 288, 298, 7325, 582, 378, 14, 4587, 12, 288, 298, 827, 63, 1739, 63, 3463, 582, 378, 12, 288, 298, 1841, 582, 378, 14, 18, 12, 288, 327, 11386, 8, 2626, 651, 278, 1195, 89, 304, 5847, 477, 16772, 9328, 6634, 1380, 314, 5621, 365, 4634, 7031, 288, 298, 78, 63, 23652, 582, 378, 12, 288, 298, 78, 2671, 582, 12866, 14, 3541, 63, 835, 342, 5001, 499, 12, 288, 298, 9833, 582, 378, 12, 288, 298, 5176, 582, 6347, 503, 11851, 12, 288, 298, 5993, 63, 885, 63, 2579, 63, 5165, 582, 413, 12, 267, 789, 267, 291, 14, 66, 270, 275, 488, 267, 291, 14, 5140, 63, 890, 275, 4337, 267, 291, 14, 1507, 63, 10669, 384, 63, 3271, 275, 1967, 63, 10669, 384, 63, 3271, 267, 291, 14, 3832, 63, 2579, 275 ]
[ 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, 3, 4287, 26, 3507, 29, 3197, 13, 354, 199, 199, 624, 15568, 1402, 4079, 641, 671, 71, 15589, 624, 199, 646, 12866, 199, 646, 2050, 199, 504, 5055, 492, 10018, 199, 199, 646, 2680, 465, 980, 199, 646, 671, 71, 15589, 465, 671, 4908, 199, 504, 671, 71, 15589, 14, 1018, 492, 662, 285, 590, 6293, 1726, 199, 504, 671, 71, 15589, 14, 3058, 492, 485, 5045, 63, 5165, 199, 504, 671, 71, 15589, 14, 7588, 492, 19408, 5107, 199, 199, 504, 31385, 14, 6898, 357, 2611, 14, 10032, 281, 14, 5165, 492, 1390, 63, 11895, 199, 504, 1275, 6336, 63, 1238, 492, 2018, 20409, 1685, 199, 504, 2508, 4445, 492, 664, 63, 529, 63, 1617, 63, 3179, 63, 504, 63, 9580, 63, 7322, 12, 664, 63, 529, 63, 1617, 63, 3179, 63, 504, 63, 4981, 199, 504, 2508, 9580, 63, 3059, 492, 12651, 5929, 199, 199, 2921, 275, 2050, 14, 5572, 480, 2495, 63, 8874, 531, 421, 199, 533, 1323, 6487, 36, 6443, 2998, 26, 272, 408, 33, 2288, 1067, 370, 10266, 4722, 3004, 402, 671, 4908, 14, 36, 6443, 624, 339, 347, 636, 826, 721, 277, 304, 267, 291, 14, 1100, 63, 807, 275, 10018, 8, 807, 9, 339, 347, 664, 8, 277, 12, 790, 12, 3634, 12, 849, 29, 403, 304, 267, 408, 267, 2372, 376, 2225, 402, 282, 671, 4908, 14, 36, 6443, 267, 3897, 267, 4143, 267, 790, 26, 620, 288, 710, 536, 402, 314, 2225, 267, 3634, 26, 671, 4908, 14, 36, 6443, 288, 710, 3634, 267, 849, 26, 4879, 59, 9874, 61, 288, 710, 849, 574, 340, 314, 1242, 1630, 440, 2187, 267, 408, 267, 372, 291, 14, 1100, 63, 807, 59, 498, 1055, 362, 8, 3642, 14, 2479, 14, 585, 12, 849, 9, 339, 347, 663, 8, 277, 12, 790, 12, 3634, 12, 574, 304, 267, 408, 267, 2494, 376, 2225, 367, 282, 671, 4908, 14, 36, 6443, 267, 3897, 267, 4143, 267, 790, 26, 620, 288, 710, 536, 402, 314, 2225, 267, 3634, 26, 671, 4908, 14, 36, 6443, 288, 710, 3634, 267, 574, 26, 4879, 59, 9874, 61, 288, 710, 892, 574, 267, 408, 267, 291, 14, 1100, 63, 807, 59, 498, 1527, 3642, 14, 2479, 14, 585, 61, 275, 574, 421, 199, 68, 3642, 63, 1100, 275, 1323, 6487, 36, 6443, 2998, 342, 421, 199, 533, 1323, 6487, 1685, 8, 4718, 20409, 1685, 304, 272, 408, 18591, 282, 1323, 39, 18814, 1402, 370, 12610, 314, 9657, 4012, 524, 83, 402, 18572, 14, 272, 12230, 314, 9657, 4012, 524, 506, 314, 5396, 402, 282, 2240, 334, 32357, 365, 8034, 680, 2136, 12610, 272, 314, 334, 16815, 1017, 73, 323, 9, 5396, 402, 282, 2240, 275, 314, 3089, 402, 314, 9342, 402, 1006, 24490, 315, 642, 2240, 14, 272, 284, 14, 69, 14, 5396, 8, 48, 9, 275, 5396, 63, 83, 16, 435, 5396, 63, 83, 17, 435, 2263, 435, 5396, 63, 5167, 12, 272, 2382, 5396, 63, 338, 365, 314, 5396, 402, 1933, 474, 284, 315, 18841, 510, 14, 272, 2136, 5536, 3878, 367, 1924, 9546, 436, 4691, 314, 671, 71, 15589, 12610, 314, 5396, 367, 1924, 9546, 14, 272, 2136, 2066, 3089, 1536, 314, 7914, 465, 314, 5396, 402, 314, 8852, 2240, 14, 272, 2136, 675, 820, 45, 899, 465, 314, 5621, 805, 14, 221, 284, 14, 69, 14, 5621, 8, 48, 12, 612, 9, 275, 413, 15, 18, 627, 334, 3397, 8, 48, 9, 446, 612, 18979, 18, 12, 272, 2382, 510, 365, 314, 2240, 436, 612, 365, 314, 9657, 4012, 524, 7182, 370, 272, 314, 19252, 16865, 334, 17912, 680, 272, 1323, 39, 18814, 1630, 440, 2291, 642, 5621, 805, 2952, 658, 3397, 8, 48, 12544, 365, 282, 3089, 402, 314, 12044, 272, 402, 9978, 5845, 12, 880, 781, 6366, 282, 3537, 5621, 805, 436, 1240, 652, 1706, 13, 1838, 13, 5682, 261, 14, 272, 2779, 365, 2797, 298, 1389, 13, 1838, 2, 2952, 781, 13323, 9978, 5845, 1901, 282, 298, 1389, 2, 436, 3089, 1536, 272, 3932, 7914, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 3376, 63, 2579, 29, 821, 12, 1967, 63, 10669, 384, 63, 3271, 29, 1960, 12, 6347, 29, 403, 304, 267, 291, 14, 88, 4908, 63, 1162, 275, 469, 288, 298, 988, 63, 4631, 582, 1616, 12, 288, 298, 7325, 582, 378, 14, 4587, 12, 288, 298, 827, 63, 1739, 63, 3463, 582, 378, 12, 288, 298, 1841, 582, 378, 14, 18, 12, 288, 327, 11386, 8, 2626, 651, 278, 1195, 89, 304, 5847, 477, 16772, 9328, 6634, 1380, 314, 5621, 365, 4634, 7031, 288, 298, 78, 63, 23652, 582, 378, 12, 288, 298, 78, 2671, 582, 12866, 14, 3541, 63, 835, 342, 5001, 499, 12, 288, 298, 9833, 582, 378, 12, 288, 298, 5176, 582, 6347, 503, 11851, 12, 288, 298, 5993, 63, 885, 63, 2579, 63, 5165, 582, 413, 12, 267, 789, 267, 291, 14, 66, 270, 275, 488, 267, 291, 14, 5140, 63, 890, 275, 4337, 267, 291, 14, 1507, 63, 10669, 384, 63, 3271, 275, 1967, 63, 10669, 384, 63, 3271, 267, 291, 14, 3832, 63, 2579, 275, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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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 ]
Fusion-Rom/android_external_chromium_org
third_party/protobuf/python/google/protobuf/internal/descriptor_test.py
261
24195
#! /usr/bin/python # # Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # http://code.google.com/p/protobuf/ # # 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. """Unittest for google.protobuf.internal.descriptor.""" __author__ = 'robinson@google.com (Will Robinson)' import unittest from google.protobuf import unittest_custom_options_pb2 from google.protobuf import unittest_import_pb2 from google.protobuf import unittest_pb2 from google.protobuf import descriptor_pb2 from google.protobuf import descriptor from google.protobuf import text_format TEST_EMPTY_MESSAGE_DESCRIPTOR_ASCII = """ name: 'TestEmptyMessage' """ class DescriptorTest(unittest.TestCase): def setUp(self): self.my_file = descriptor.FileDescriptor( name='some/filename/some.proto', package='protobuf_unittest' ) self.my_enum = descriptor.EnumDescriptor( name='ForeignEnum', full_name='protobuf_unittest.ForeignEnum', filename=None, file=self.my_file, values=[ descriptor.EnumValueDescriptor(name='FOREIGN_FOO', index=0, number=4), descriptor.EnumValueDescriptor(name='FOREIGN_BAR', index=1, number=5), descriptor.EnumValueDescriptor(name='FOREIGN_BAZ', index=2, number=6), ]) self.my_message = descriptor.Descriptor( name='NestedMessage', full_name='protobuf_unittest.TestAllTypes.NestedMessage', filename=None, file=self.my_file, containing_type=None, fields=[ descriptor.FieldDescriptor( name='bb', full_name='protobuf_unittest.TestAllTypes.NestedMessage.bb', index=0, number=1, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None), ], nested_types=[], enum_types=[ self.my_enum, ], extensions=[]) self.my_method = descriptor.MethodDescriptor( name='Bar', full_name='protobuf_unittest.TestService.Bar', index=0, containing_service=None, input_type=None, output_type=None) self.my_service = descriptor.ServiceDescriptor( name='TestServiceWithOptions', full_name='protobuf_unittest.TestServiceWithOptions', file=self.my_file, index=0, methods=[ self.my_method ]) def testEnumValueName(self): self.assertEqual(self.my_message.EnumValueName('ForeignEnum', 4), 'FOREIGN_FOO') self.assertEqual( self.my_message.enum_types_by_name[ 'ForeignEnum'].values_by_number[4].name, self.my_message.EnumValueName('ForeignEnum', 4)) def testEnumFixups(self): self.assertEqual(self.my_enum, self.my_enum.values[0].type) def testContainingTypeFixups(self): self.assertEqual(self.my_message, self.my_message.fields[0].containing_type) self.assertEqual(self.my_message, self.my_enum.containing_type) def testContainingServiceFixups(self): self.assertEqual(self.my_service, self.my_method.containing_service) def testGetOptions(self): self.assertEqual(self.my_enum.GetOptions(), descriptor_pb2.EnumOptions()) self.assertEqual(self.my_enum.values[0].GetOptions(), descriptor_pb2.EnumValueOptions()) self.assertEqual(self.my_message.GetOptions(), descriptor_pb2.MessageOptions()) self.assertEqual(self.my_message.fields[0].GetOptions(), descriptor_pb2.FieldOptions()) self.assertEqual(self.my_method.GetOptions(), descriptor_pb2.MethodOptions()) self.assertEqual(self.my_service.GetOptions(), descriptor_pb2.ServiceOptions()) def testSimpleCustomOptions(self): file_descriptor = unittest_custom_options_pb2.DESCRIPTOR message_descriptor =\ unittest_custom_options_pb2.TestMessageWithCustomOptions.DESCRIPTOR field_descriptor = message_descriptor.fields_by_name["field1"] enum_descriptor = message_descriptor.enum_types_by_name["AnEnum"] enum_value_descriptor =\ message_descriptor.enum_values_by_name["ANENUM_VAL2"] service_descriptor =\ unittest_custom_options_pb2.TestServiceWithCustomOptions.DESCRIPTOR method_descriptor = service_descriptor.FindMethodByName("Foo") file_options = file_descriptor.GetOptions() file_opt1 = unittest_custom_options_pb2.file_opt1 self.assertEqual(9876543210, file_options.Extensions[file_opt1]) message_options = message_descriptor.GetOptions() message_opt1 = unittest_custom_options_pb2.message_opt1 self.assertEqual(-56, message_options.Extensions[message_opt1]) field_options = field_descriptor.GetOptions() field_opt1 = unittest_custom_options_pb2.field_opt1 self.assertEqual(8765432109, field_options.Extensions[field_opt1]) field_opt2 = unittest_custom_options_pb2.field_opt2 self.assertEqual(42, field_options.Extensions[field_opt2]) enum_options = enum_descriptor.GetOptions() enum_opt1 = unittest_custom_options_pb2.enum_opt1 self.assertEqual(-789, enum_options.Extensions[enum_opt1]) enum_value_options = enum_value_descriptor.GetOptions() enum_value_opt1 = unittest_custom_options_pb2.enum_value_opt1 self.assertEqual(123, enum_value_options.Extensions[enum_value_opt1]) service_options = service_descriptor.GetOptions() service_opt1 = unittest_custom_options_pb2.service_opt1 self.assertEqual(-9876543210, service_options.Extensions[service_opt1]) method_options = method_descriptor.GetOptions() method_opt1 = unittest_custom_options_pb2.method_opt1 self.assertEqual(unittest_custom_options_pb2.METHODOPT1_VAL2, method_options.Extensions[method_opt1]) def testDifferentCustomOptionTypes(self): kint32min = -2**31 kint64min = -2**63 kint32max = 2**31 - 1 kint64max = 2**63 - 1 kuint32max = 2**32 - 1 kuint64max = 2**64 - 1 message_descriptor =\ unittest_custom_options_pb2.CustomOptionMinIntegerValues.DESCRIPTOR message_options = message_descriptor.GetOptions() self.assertEqual(False, message_options.Extensions[ unittest_custom_options_pb2.bool_opt]) self.assertEqual(kint32min, message_options.Extensions[ unittest_custom_options_pb2.int32_opt]) self.assertEqual(kint64min, message_options.Extensions[ unittest_custom_options_pb2.int64_opt]) self.assertEqual(0, message_options.Extensions[ unittest_custom_options_pb2.uint32_opt]) self.assertEqual(0, message_options.Extensions[ unittest_custom_options_pb2.uint64_opt]) self.assertEqual(kint32min, message_options.Extensions[ unittest_custom_options_pb2.sint32_opt]) self.assertEqual(kint64min, message_options.Extensions[ unittest_custom_options_pb2.sint64_opt]) self.assertEqual(0, message_options.Extensions[ unittest_custom_options_pb2.fixed32_opt]) self.assertEqual(0, message_options.Extensions[ unittest_custom_options_pb2.fixed64_opt]) self.assertEqual(kint32min, message_options.Extensions[ unittest_custom_options_pb2.sfixed32_opt]) self.assertEqual(kint64min, message_options.Extensions[ unittest_custom_options_pb2.sfixed64_opt]) message_descriptor =\ unittest_custom_options_pb2.CustomOptionMaxIntegerValues.DESCRIPTOR message_options = message_descriptor.GetOptions() self.assertEqual(True, message_options.Extensions[ unittest_custom_options_pb2.bool_opt]) self.assertEqual(kint32max, message_options.Extensions[ unittest_custom_options_pb2.int32_opt]) self.assertEqual(kint64max, message_options.Extensions[ unittest_custom_options_pb2.int64_opt]) self.assertEqual(kuint32max, message_options.Extensions[ unittest_custom_options_pb2.uint32_opt]) self.assertEqual(kuint64max, message_options.Extensions[ unittest_custom_options_pb2.uint64_opt]) self.assertEqual(kint32max, message_options.Extensions[ unittest_custom_options_pb2.sint32_opt]) self.assertEqual(kint64max, message_options.Extensions[ unittest_custom_options_pb2.sint64_opt]) self.assertEqual(kuint32max, message_options.Extensions[ unittest_custom_options_pb2.fixed32_opt]) self.assertEqual(kuint64max, message_options.Extensions[ unittest_custom_options_pb2.fixed64_opt]) self.assertEqual(kint32max, message_options.Extensions[ unittest_custom_options_pb2.sfixed32_opt]) self.assertEqual(kint64max, message_options.Extensions[ unittest_custom_options_pb2.sfixed64_opt]) message_descriptor =\ unittest_custom_options_pb2.CustomOptionOtherValues.DESCRIPTOR message_options = message_descriptor.GetOptions() self.assertEqual(-100, message_options.Extensions[ unittest_custom_options_pb2.int32_opt]) self.assertAlmostEqual(12.3456789, message_options.Extensions[ unittest_custom_options_pb2.float_opt], 6) self.assertAlmostEqual(1.234567890123456789, message_options.Extensions[ unittest_custom_options_pb2.double_opt]) self.assertEqual("Hello, \"World\"", message_options.Extensions[ unittest_custom_options_pb2.string_opt]) self.assertEqual("Hello\0World", message_options.Extensions[ unittest_custom_options_pb2.bytes_opt]) dummy_enum = unittest_custom_options_pb2.DummyMessageContainingEnum self.assertEqual( dummy_enum.TEST_OPTION_ENUM_TYPE2, message_options.Extensions[unittest_custom_options_pb2.enum_opt]) message_descriptor =\ unittest_custom_options_pb2.SettingRealsFromPositiveInts.DESCRIPTOR message_options = message_descriptor.GetOptions() self.assertAlmostEqual(12, message_options.Extensions[ unittest_custom_options_pb2.float_opt], 6) self.assertAlmostEqual(154, message_options.Extensions[ unittest_custom_options_pb2.double_opt]) message_descriptor =\ unittest_custom_options_pb2.SettingRealsFromNegativeInts.DESCRIPTOR message_options = message_descriptor.GetOptions() self.assertAlmostEqual(-12, message_options.Extensions[ unittest_custom_options_pb2.float_opt], 6) self.assertAlmostEqual(-154, message_options.Extensions[ unittest_custom_options_pb2.double_opt]) def testComplexExtensionOptions(self): descriptor =\ unittest_custom_options_pb2.VariousComplexOptions.DESCRIPTOR options = descriptor.GetOptions() self.assertEqual(42, options.Extensions[ unittest_custom_options_pb2.complex_opt1].foo) self.assertEqual(324, options.Extensions[ unittest_custom_options_pb2.complex_opt1].Extensions[ unittest_custom_options_pb2.quux]) self.assertEqual(876, options.Extensions[ unittest_custom_options_pb2.complex_opt1].Extensions[ unittest_custom_options_pb2.corge].qux) self.assertEqual(987, options.Extensions[ unittest_custom_options_pb2.complex_opt2].baz) self.assertEqual(654, options.Extensions[ unittest_custom_options_pb2.complex_opt2].Extensions[ unittest_custom_options_pb2.grault]) self.assertEqual(743, options.Extensions[ unittest_custom_options_pb2.complex_opt2].bar.foo) self.assertEqual(1999, options.Extensions[ unittest_custom_options_pb2.complex_opt2].bar.Extensions[ unittest_custom_options_pb2.quux]) self.assertEqual(2008, options.Extensions[ unittest_custom_options_pb2.complex_opt2].bar.Extensions[ unittest_custom_options_pb2.corge].qux) self.assertEqual(741, options.Extensions[ unittest_custom_options_pb2.complex_opt2].Extensions[ unittest_custom_options_pb2.garply].foo) self.assertEqual(1998, options.Extensions[ unittest_custom_options_pb2.complex_opt2].Extensions[ unittest_custom_options_pb2.garply].Extensions[ unittest_custom_options_pb2.quux]) self.assertEqual(2121, options.Extensions[ unittest_custom_options_pb2.complex_opt2].Extensions[ unittest_custom_options_pb2.garply].Extensions[ unittest_custom_options_pb2.corge].qux) self.assertEqual(1971, options.Extensions[ unittest_custom_options_pb2.ComplexOptionType2 .ComplexOptionType4.complex_opt4].waldo) self.assertEqual(321, options.Extensions[ unittest_custom_options_pb2.complex_opt2].fred.waldo) self.assertEqual(9, options.Extensions[ unittest_custom_options_pb2.complex_opt3].qux) self.assertEqual(22, options.Extensions[ unittest_custom_options_pb2.complex_opt3].complexoptiontype5.plugh) self.assertEqual(24, options.Extensions[ unittest_custom_options_pb2.complexopt6].xyzzy) # Check that aggregate options were parsed and saved correctly in # the appropriate descriptors. def testAggregateOptions(self): file_descriptor = unittest_custom_options_pb2.DESCRIPTOR message_descriptor =\ unittest_custom_options_pb2.AggregateMessage.DESCRIPTOR field_descriptor = message_descriptor.fields_by_name["fieldname"] enum_descriptor = unittest_custom_options_pb2.AggregateEnum.DESCRIPTOR enum_value_descriptor = enum_descriptor.values_by_name["VALUE"] service_descriptor =\ unittest_custom_options_pb2.AggregateService.DESCRIPTOR method_descriptor = service_descriptor.FindMethodByName("Method") # Tests for the different types of data embedded in fileopt file_options = file_descriptor.GetOptions().Extensions[ unittest_custom_options_pb2.fileopt] self.assertEqual(100, file_options.i) self.assertEqual("FileAnnotation", file_options.s) self.assertEqual("NestedFileAnnotation", file_options.sub.s) self.assertEqual("FileExtensionAnnotation", file_options.file.Extensions[ unittest_custom_options_pb2.fileopt].s) self.assertEqual("EmbeddedMessageSetElement", file_options.mset.Extensions[ unittest_custom_options_pb2.AggregateMessageSetElement .message_set_extension].s) # Simple tests for all the other types of annotations self.assertEqual( "MessageAnnotation", message_descriptor.GetOptions().Extensions[ unittest_custom_options_pb2.msgopt].s) self.assertEqual( "FieldAnnotation", field_descriptor.GetOptions().Extensions[ unittest_custom_options_pb2.fieldopt].s) self.assertEqual( "EnumAnnotation", enum_descriptor.GetOptions().Extensions[ unittest_custom_options_pb2.enumopt].s) self.assertEqual( "EnumValueAnnotation", enum_value_descriptor.GetOptions().Extensions[ unittest_custom_options_pb2.enumvalopt].s) self.assertEqual( "ServiceAnnotation", service_descriptor.GetOptions().Extensions[ unittest_custom_options_pb2.serviceopt].s) self.assertEqual( "MethodAnnotation", method_descriptor.GetOptions().Extensions[ unittest_custom_options_pb2.methodopt].s) def testNestedOptions(self): nested_message =\ unittest_custom_options_pb2.NestedOptionType.NestedMessage.DESCRIPTOR self.assertEqual(1001, nested_message.GetOptions().Extensions[ unittest_custom_options_pb2.message_opt1]) nested_field = nested_message.fields_by_name["nested_field"] self.assertEqual(1002, nested_field.GetOptions().Extensions[ unittest_custom_options_pb2.field_opt1]) outer_message =\ unittest_custom_options_pb2.NestedOptionType.DESCRIPTOR nested_enum = outer_message.enum_types_by_name["NestedEnum"] self.assertEqual(1003, nested_enum.GetOptions().Extensions[ unittest_custom_options_pb2.enum_opt1]) nested_enum_value = outer_message.enum_values_by_name["NESTED_ENUM_VALUE"] self.assertEqual(1004, nested_enum_value.GetOptions().Extensions[ unittest_custom_options_pb2.enum_value_opt1]) nested_extension = outer_message.extensions_by_name["nested_extension"] self.assertEqual(1005, nested_extension.GetOptions().Extensions[ unittest_custom_options_pb2.field_opt2]) def testFileDescriptorReferences(self): self.assertEqual(self.my_enum.file, self.my_file) self.assertEqual(self.my_message.file, self.my_file) def testFileDescriptor(self): self.assertEqual(self.my_file.name, 'some/filename/some.proto') self.assertEqual(self.my_file.package, 'protobuf_unittest') class DescriptorCopyToProtoTest(unittest.TestCase): """Tests for CopyTo functions of Descriptor.""" def _AssertProtoEqual(self, actual_proto, expected_class, expected_ascii): expected_proto = expected_class() text_format.Merge(expected_ascii, expected_proto) self.assertEqual( actual_proto, expected_proto, 'Not equal,\nActual:\n%s\nExpected:\n%s\n' % (str(actual_proto), str(expected_proto))) def _InternalTestCopyToProto(self, desc, expected_proto_class, expected_proto_ascii): actual = expected_proto_class() desc.CopyToProto(actual) self._AssertProtoEqual( actual, expected_proto_class, expected_proto_ascii) def testCopyToProto_EmptyMessage(self): self._InternalTestCopyToProto( unittest_pb2.TestEmptyMessage.DESCRIPTOR, descriptor_pb2.DescriptorProto, TEST_EMPTY_MESSAGE_DESCRIPTOR_ASCII) def testCopyToProto_NestedMessage(self): TEST_NESTED_MESSAGE_ASCII = """ name: 'NestedMessage' field: < name: 'bb' number: 1 label: 1 # Optional type: 5 # TYPE_INT32 > """ self._InternalTestCopyToProto( unittest_pb2.TestAllTypes.NestedMessage.DESCRIPTOR, descriptor_pb2.DescriptorProto, TEST_NESTED_MESSAGE_ASCII) def testCopyToProto_ForeignNestedMessage(self): TEST_FOREIGN_NESTED_ASCII = """ name: 'TestForeignNested' field: < name: 'foreign_nested' number: 1 label: 1 # Optional type: 11 # TYPE_MESSAGE type_name: '.protobuf_unittest.TestAllTypes.NestedMessage' > """ self._InternalTestCopyToProto( unittest_pb2.TestForeignNested.DESCRIPTOR, descriptor_pb2.DescriptorProto, TEST_FOREIGN_NESTED_ASCII) def testCopyToProto_ForeignEnum(self): TEST_FOREIGN_ENUM_ASCII = """ name: 'ForeignEnum' value: < name: 'FOREIGN_FOO' number: 4 > value: < name: 'FOREIGN_BAR' number: 5 > value: < name: 'FOREIGN_BAZ' number: 6 > """ self._InternalTestCopyToProto( unittest_pb2._FOREIGNENUM, descriptor_pb2.EnumDescriptorProto, TEST_FOREIGN_ENUM_ASCII) def testCopyToProto_Options(self): TEST_DEPRECATED_FIELDS_ASCII = """ name: 'TestDeprecatedFields' field: < name: 'deprecated_int32' number: 1 label: 1 # Optional type: 5 # TYPE_INT32 options: < deprecated: true > > """ self._InternalTestCopyToProto( unittest_pb2.TestDeprecatedFields.DESCRIPTOR, descriptor_pb2.DescriptorProto, TEST_DEPRECATED_FIELDS_ASCII) def testCopyToProto_AllExtensions(self): TEST_EMPTY_MESSAGE_WITH_EXTENSIONS_ASCII = """ name: 'TestEmptyMessageWithExtensions' extension_range: < start: 1 end: 536870912 > """ self._InternalTestCopyToProto( unittest_pb2.TestEmptyMessageWithExtensions.DESCRIPTOR, descriptor_pb2.DescriptorProto, TEST_EMPTY_MESSAGE_WITH_EXTENSIONS_ASCII) def testCopyToProto_SeveralExtensions(self): TEST_MESSAGE_WITH_SEVERAL_EXTENSIONS_ASCII = """ name: 'TestMultipleExtensionRanges' extension_range: < start: 42 end: 43 > extension_range: < start: 4143 end: 4244 > extension_range: < start: 65536 end: 536870912 > """ self._InternalTestCopyToProto( unittest_pb2.TestMultipleExtensionRanges.DESCRIPTOR, descriptor_pb2.DescriptorProto, TEST_MESSAGE_WITH_SEVERAL_EXTENSIONS_ASCII) def testCopyToProto_FileDescriptor(self): UNITTEST_IMPORT_FILE_DESCRIPTOR_ASCII = (""" name: 'google/protobuf/unittest_import.proto' package: 'protobuf_unittest_import' dependency: 'google/protobuf/unittest_import_public.proto' message_type: < name: 'ImportMessage' field: < name: 'd' number: 1 label: 1 # Optional type: 5 # TYPE_INT32 > > """ + """enum_type: < name: 'ImportEnum' value: < name: 'IMPORT_FOO' number: 7 > value: < name: 'IMPORT_BAR' number: 8 > value: < name: 'IMPORT_BAZ' number: 9 > > options: < java_package: 'com.google.protobuf.test' optimize_for: 1 # SPEED > public_dependency: 0 """) self._InternalTestCopyToProto( unittest_import_pb2.DESCRIPTOR, descriptor_pb2.FileDescriptorProto, UNITTEST_IMPORT_FILE_DESCRIPTOR_ASCII) def testCopyToProto_ServiceDescriptor(self): TEST_SERVICE_ASCII = """ name: 'TestService' method: < name: 'Foo' input_type: '.protobuf_unittest.FooRequest' output_type: '.protobuf_unittest.FooResponse' > method: < name: 'Bar' input_type: '.protobuf_unittest.BarRequest' output_type: '.protobuf_unittest.BarResponse' > """ self._InternalTestCopyToProto( unittest_pb2.TestService.DESCRIPTOR, descriptor_pb2.ServiceDescriptorProto, TEST_SERVICE_ASCII) class MakeDescriptorTest(unittest.TestCase): def testMakeDescriptorWithUnsignedIntField(self): file_descriptor_proto = descriptor_pb2.FileDescriptorProto() file_descriptor_proto.name = 'Foo' message_type = file_descriptor_proto.message_type.add() message_type.name = file_descriptor_proto.name field = message_type.field.add() field.number = 1 field.name = 'uint64_field' field.label = descriptor.FieldDescriptor.LABEL_REQUIRED field.type = descriptor.FieldDescriptor.TYPE_UINT64 result = descriptor.MakeDescriptor(message_type) self.assertEqual(result.fields[0].cpp_type, descriptor.FieldDescriptor.CPPTYPE_UINT64) if __name__ == '__main__': unittest.main()
bsd-3-clause
[ 3168, 1182, 2647, 15, 1393, 15, 1548, 199, 3, 199, 3, 11557, 699, 3043, 1192, 446, 4475, 1159, 666, 1640, 1461, 1475, 199, 3, 1898, 9079, 4475, 3277, 14, 221, 2900, 4481, 4644, 14, 199, 3, 1455, 921, 600, 14, 3098, 14, 957, 15, 80, 15, 7204, 15, 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, 1358, 1770, 367, 6233, 14, 7204, 14, 4672, 14, 4120, 1041, 199, 199, 363, 2502, 363, 275, 283, 28191, 834, 32, 3098, 14, 957, 334, 20326, 6848, 1393, 834, 3171, 199, 199, 646, 2882, 199, 504, 6233, 14, 7204, 492, 2882, 63, 4229, 63, 1419, 63, 3317, 18, 199, 504, 6233, 14, 7204, 492, 2882, 63, 646, 63, 3317, 18, 199, 504, 6233, 14, 7204, 492, 2882, 63, 3317, 18, 199, 504, 6233, 14, 7204, 492, 5872, 63, 3317, 18, 199, 504, 6233, 14, 7204, 492, 5872, 199, 504, 6233, 14, 7204, 492, 1318, 63, 908, 421, 199, 2864, 63, 13993, 63, 8272, 63, 7580, 63, 12292, 275, 408, 199, 354, 26, 283, 774, 4699, 2209, 7, 199, 624, 421, 199, 533, 28131, 774, 8, 2796, 14, 1746, 304, 819, 347, 3613, 8, 277, 304, 272, 291, 14, 1662, 63, 493, 275, 5872, 14, 23859, 8, 267, 536, 534, 3972, 15, 1501, 15, 3972, 14, 2625, 297, 267, 2559, 534, 7204, 63, 2796, 7, 267, 776, 272, 291, 14, 1662, 63, 4869, 275, 5872, 14, 5081, 4311, 8, 267, 536, 534, 20931, 5081, 297, 267, 2615, 63, 354, 534, 7204, 63, 2796, 14, 20931, 5081, 297, 267, 1788, 29, 403, 12, 267, 570, 29, 277, 14, 1662, 63, 493, 12, 267, 1338, 1524, 881, 5872, 14, 19629, 8, 354, 534, 18155, 3203, 63, 13046, 297, 1478, 29, 16, 12, 1329, 29, 20, 395, 881, 5872, 14, 19629, 8, 354, 534, 18155, 3203, 63, 13895, 297, 1478, 29, 17, 12, 1329, 29, 21, 395, 881, 5872, 14, 19629, 8, 354, 534, 18155, 3203, 63, 4134, 58, 297, 1478, 29, 18, 12, 1329, 29, 22, 395, 267, 4794, 272, 291, 14, 1662, 63, 1188, 275, 5872, 14, 4311, 8, 267, 536, 534, 22808, 297, 267, 2615, 63, 354, 534, 7204, 63, 2796, 14, 14973, 14, 22808, 297, 267, 1788, 29, 403, 12, 267, 570, 29, 277, 14, 1662, 63, 493, 12, 267, 3035, 63, 466, 29, 403, 12, 267, 1504, 1524, 881, 5872, 14, 8510, 8, 288, 536, 534, 2501, 297, 288, 2615, 63, 354, 534, 7204, 63, 2796, 14, 14973, 14, 22808, 14, 2501, 297, 288, 1478, 29, 16, 12, 1329, 29, 17, 12, 288, 730, 29, 21, 12, 7246, 63, 466, 29, 17, 12, 1768, 29, 17, 12, 288, 965, 63, 885, 63, 585, 29, 797, 12, 849, 63, 585, 29, 16, 12, 288, 1245, 63, 466, 29, 403, 12, 4952, 63, 466, 29, 403, 12, 3035, 63, 466, 29, 403, 12, 288, 365, 63, 3435, 29, 797, 12, 3329, 63, 2645, 29, 403, 395, 267, 2156, 267, 6032, 63, 1313, 6034, 267, 4952, 63, 1313, 1524, 881, 291, 14, 1662, 63, 4869, 12, 267, 2156, 267, 5478, 14285, 272, 291, 14, 1662, 63, 765, 275, 5872, 14, 3767, 4311, 8, 267, 536, 534, 5281, 297, 267, 2615, 63, 354, 534, 7204, 63, 2796, 14, 774, 3167, 14, 5281, 297, 267, 1478, 29, 16, 12, 267, 3035, 63, 1364, 29, 403, 12, 267, 1324, 63, 466, 29, 403, 12, 267, 1072, 63, 466, 29, 403, 9, 272, 291, 14, 1662, 63, 1364, 275, 5872, 14, 3167, 4311, 8, 267, 536, 534, 774, 3167, 3007, 4558, 297, 267, 2615, 63, 354, 534, 7204, 63, 2796, 14, 774, 3167, 3007, 4558, 297, 267, 570, 29, 277, 14, 1662, 63, 493, 12, 267, 1478, 29, 16, 12, 267, 3102, 1524, 288, 291, 14, 1662, 63, 765, 267, 4794, 819, 347, 511, 14432, 985, 8, 277, 304, 272, 291, 14, 629, 8, 277, 14, 1662, 63, 1188, 14, 14432, 985, 360, 20931, 5081, 297, 841, 395, 2151, 283, 18155, 3203, 63, 13046, 358, 339, 291, 14, 629, 8, 267, 291, 14, 1662, 63, 1188, 14, 4869, 63, 1313, 63, 991, 63, 354, 59, 288, 283, 20931, 5081, 2278, 1459, 63, 991, 63, 1955, 59, 20, 1055, 354, 12, 267, 291, 14, 1662, 63, 1188, 14, 14432, 985, 360, 20931, 5081, 297, 841, 430, 819, 347, 511, 5081, 11985, 15203, 8, 277, 304, 272, 291, 14, 629, 8, 277, 14, 1662 ]
[ 1182, 2647, 15, 1393, 15, 1548, 199, 3, 199, 3, 11557, 699, 3043, 1192, 446, 4475, 1159, 666, 1640, 1461, 1475, 199, 3, 1898, 9079, 4475, 3277, 14, 221, 2900, 4481, 4644, 14, 199, 3, 1455, 921, 600, 14, 3098, 14, 957, 15, 80, 15, 7204, 15, 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, 1358, 1770, 367, 6233, 14, 7204, 14, 4672, 14, 4120, 1041, 199, 199, 363, 2502, 363, 275, 283, 28191, 834, 32, 3098, 14, 957, 334, 20326, 6848, 1393, 834, 3171, 199, 199, 646, 2882, 199, 504, 6233, 14, 7204, 492, 2882, 63, 4229, 63, 1419, 63, 3317, 18, 199, 504, 6233, 14, 7204, 492, 2882, 63, 646, 63, 3317, 18, 199, 504, 6233, 14, 7204, 492, 2882, 63, 3317, 18, 199, 504, 6233, 14, 7204, 492, 5872, 63, 3317, 18, 199, 504, 6233, 14, 7204, 492, 5872, 199, 504, 6233, 14, 7204, 492, 1318, 63, 908, 421, 199, 2864, 63, 13993, 63, 8272, 63, 7580, 63, 12292, 275, 408, 199, 354, 26, 283, 774, 4699, 2209, 7, 199, 624, 421, 199, 533, 28131, 774, 8, 2796, 14, 1746, 304, 819, 347, 3613, 8, 277, 304, 272, 291, 14, 1662, 63, 493, 275, 5872, 14, 23859, 8, 267, 536, 534, 3972, 15, 1501, 15, 3972, 14, 2625, 297, 267, 2559, 534, 7204, 63, 2796, 7, 267, 776, 272, 291, 14, 1662, 63, 4869, 275, 5872, 14, 5081, 4311, 8, 267, 536, 534, 20931, 5081, 297, 267, 2615, 63, 354, 534, 7204, 63, 2796, 14, 20931, 5081, 297, 267, 1788, 29, 403, 12, 267, 570, 29, 277, 14, 1662, 63, 493, 12, 267, 1338, 1524, 881, 5872, 14, 19629, 8, 354, 534, 18155, 3203, 63, 13046, 297, 1478, 29, 16, 12, 1329, 29, 20, 395, 881, 5872, 14, 19629, 8, 354, 534, 18155, 3203, 63, 13895, 297, 1478, 29, 17, 12, 1329, 29, 21, 395, 881, 5872, 14, 19629, 8, 354, 534, 18155, 3203, 63, 4134, 58, 297, 1478, 29, 18, 12, 1329, 29, 22, 395, 267, 4794, 272, 291, 14, 1662, 63, 1188, 275, 5872, 14, 4311, 8, 267, 536, 534, 22808, 297, 267, 2615, 63, 354, 534, 7204, 63, 2796, 14, 14973, 14, 22808, 297, 267, 1788, 29, 403, 12, 267, 570, 29, 277, 14, 1662, 63, 493, 12, 267, 3035, 63, 466, 29, 403, 12, 267, 1504, 1524, 881, 5872, 14, 8510, 8, 288, 536, 534, 2501, 297, 288, 2615, 63, 354, 534, 7204, 63, 2796, 14, 14973, 14, 22808, 14, 2501, 297, 288, 1478, 29, 16, 12, 1329, 29, 17, 12, 288, 730, 29, 21, 12, 7246, 63, 466, 29, 17, 12, 1768, 29, 17, 12, 288, 965, 63, 885, 63, 585, 29, 797, 12, 849, 63, 585, 29, 16, 12, 288, 1245, 63, 466, 29, 403, 12, 4952, 63, 466, 29, 403, 12, 3035, 63, 466, 29, 403, 12, 288, 365, 63, 3435, 29, 797, 12, 3329, 63, 2645, 29, 403, 395, 267, 2156, 267, 6032, 63, 1313, 6034, 267, 4952, 63, 1313, 1524, 881, 291, 14, 1662, 63, 4869, 12, 267, 2156, 267, 5478, 14285, 272, 291, 14, 1662, 63, 765, 275, 5872, 14, 3767, 4311, 8, 267, 536, 534, 5281, 297, 267, 2615, 63, 354, 534, 7204, 63, 2796, 14, 774, 3167, 14, 5281, 297, 267, 1478, 29, 16, 12, 267, 3035, 63, 1364, 29, 403, 12, 267, 1324, 63, 466, 29, 403, 12, 267, 1072, 63, 466, 29, 403, 9, 272, 291, 14, 1662, 63, 1364, 275, 5872, 14, 3167, 4311, 8, 267, 536, 534, 774, 3167, 3007, 4558, 297, 267, 2615, 63, 354, 534, 7204, 63, 2796, 14, 774, 3167, 3007, 4558, 297, 267, 570, 29, 277, 14, 1662, 63, 493, 12, 267, 1478, 29, 16, 12, 267, 3102, 1524, 288, 291, 14, 1662, 63, 765, 267, 4794, 819, 347, 511, 14432, 985, 8, 277, 304, 272, 291, 14, 629, 8, 277, 14, 1662, 63, 1188, 14, 14432, 985, 360, 20931, 5081, 297, 841, 395, 2151, 283, 18155, 3203, 63, 13046, 358, 339, 291, 14, 629, 8, 267, 291, 14, 1662, 63, 1188, 14, 4869, 63, 1313, 63, 991, 63, 354, 59, 288, 283, 20931, 5081, 2278, 1459, 63, 991, 63, 1955, 59, 20, 1055, 354, 12, 267, 291, 14, 1662, 63, 1188, 14, 14432, 985, 360, 20931, 5081, 297, 841, 430, 819, 347, 511, 5081, 11985, 15203, 8, 277, 304, 272, 291, 14, 629, 8, 277, 14, 1662, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
Pablo126/SSBW
Tarea4/tarea4/lib/python3.5/site-packages/django/template/smartif.py
63
6389
""" Parser and utilities for the smart 'if' tag """ # Using a simple top down parser, as described here: # http://effbot.org/zone/simple-top-down-parsing.htm. # 'led' = left denotation # 'nud' = null denotation # 'bp' = binding power (left = lbp, right = rbp) class TokenBase(object): """ Base class for operators and literals, mainly for debugging and for throwing syntax errors. """ id = None # node/token type name value = None # used by literals first = second = None # used by tree nodes def nud(self, parser): # Null denotation - called in prefix context raise parser.error_class( "Not expecting '%s' in this position in if tag." % self.id ) def led(self, left, parser): # Left denotation - called in infix context raise parser.error_class( "Not expecting '%s' as infix operator in if tag." % self.id ) def display(self): """ Returns what to display in error messages for this node """ return self.id def __repr__(self): out = [str(x) for x in [self.id, self.first, self.second] if x is not None] return "(" + " ".join(out) + ")" def infix(bp, func): """ Creates an infix operator, given a binding power and a function that evaluates the node """ class Operator(TokenBase): lbp = bp def led(self, left, parser): self.first = left self.second = parser.expression(bp) return self def eval(self, context): try: return func(context, self.first, self.second) except Exception: # Templates shouldn't throw exceptions when rendering. We are # most likely to get exceptions for things like {% if foo in bar # %} where 'bar' does not support 'in', so default to False return False return Operator def prefix(bp, func): """ Creates a prefix operator, given a binding power and a function that evaluates the node. """ class Operator(TokenBase): lbp = bp def nud(self, parser): self.first = parser.expression(bp) self.second = None return self def eval(self, context): try: return func(context, self.first) except Exception: return False return Operator # Operator precedence follows Python. # We defer variable evaluation to the lambda to ensure that terms are # lazily evaluated using Python's boolean parsing logic. OPERATORS = { 'or': infix(6, lambda context, x, y: x.eval(context) or y.eval(context)), 'and': infix(7, lambda context, x, y: x.eval(context) and y.eval(context)), 'not': prefix(8, lambda context, x: not x.eval(context)), 'in': infix(9, lambda context, x, y: x.eval(context) in y.eval(context)), 'not in': infix(9, lambda context, x, y: x.eval(context) not in y.eval(context)), 'is': infix(10, lambda context, x, y: x.eval(context) is y.eval(context)), 'is not': infix(10, lambda context, x, y: x.eval(context) is not y.eval(context)), '==': infix(10, lambda context, x, y: x.eval(context) == y.eval(context)), '!=': infix(10, lambda context, x, y: x.eval(context) != y.eval(context)), '>': infix(10, lambda context, x, y: x.eval(context) > y.eval(context)), '>=': infix(10, lambda context, x, y: x.eval(context) >= y.eval(context)), '<': infix(10, lambda context, x, y: x.eval(context) < y.eval(context)), '<=': infix(10, lambda context, x, y: x.eval(context) <= y.eval(context)), } # Assign 'id' to each: for key, op in OPERATORS.items(): op.id = key class Literal(TokenBase): """ A basic self-resolvable object similar to a Django template variable. """ # IfParser uses Literal in create_var, but TemplateIfParser overrides # create_var so that a proper implementation that actually resolves # variables, filters etc. is used. id = "literal" lbp = 0 def __init__(self, value): self.value = value def display(self): return repr(self.value) def nud(self, parser): return self def eval(self, context): return self.value def __repr__(self): return "(%s %r)" % (self.id, self.value) class EndToken(TokenBase): lbp = 0 def nud(self, parser): raise parser.error_class("Unexpected end of expression in if tag.") EndToken = EndToken() class IfParser(object): error_class = ValueError def __init__(self, tokens): # Turn 'is','not' and 'not','in' into single tokens. l = len(tokens) mapped_tokens = [] i = 0 while i < l: token = tokens[i] if token == "is" and i + 1 < l and tokens[i + 1] == "not": token = "is not" i += 1 # skip 'not' elif token == "not" and i + 1 < l and tokens[i + 1] == "in": token = "not in" i += 1 # skip 'in' mapped_tokens.append(self.translate_token(token)) i += 1 self.tokens = mapped_tokens self.pos = 0 self.current_token = self.next_token() def translate_token(self, token): try: op = OPERATORS[token] except (KeyError, TypeError): return self.create_var(token) else: return op() def next_token(self): if self.pos >= len(self.tokens): return EndToken else: retval = self.tokens[self.pos] self.pos += 1 return retval def parse(self): retval = self.expression() # Check that we have exhausted all the tokens if self.current_token is not EndToken: raise self.error_class("Unused '%s' at end of if expression." % self.current_token.display()) return retval def expression(self, rbp=0): t = self.current_token self.current_token = self.next_token() left = t.nud(self) while rbp < self.current_token.lbp: t = self.current_token self.current_token = self.next_token() left = t.led(left, self) return left def create_var(self, value): return Literal(value)
gpl-3.0
[ 624, 199, 2842, 436, 15841, 367, 314, 11179, 283, 692, 7, 1947, 199, 624, 199, 3, 11719, 282, 3486, 2746, 3224, 1798, 12, 465, 11736, 2348, 26, 199, 3, 259, 1455, 921, 3609, 3018, 14, 1308, 15, 2619, 15, 4129, 13, 2119, 13, 2110, 13, 11059, 14, 15575, 14, 199, 3, 283, 1146, 7, 275, 3602, 477, 12251, 199, 3, 283, 78, 1181, 7, 275, 2973, 477, 12251, 199, 3, 283, 10913, 7, 275, 11696, 7074, 334, 3039, 275, 634, 10913, 12, 2451, 275, 519, 10913, 9, 421, 199, 533, 8767, 1563, 8, 785, 304, 272, 408, 272, 3523, 1021, 367, 10211, 436, 18041, 12, 27580, 367, 10201, 436, 367, 7978, 316, 272, 6302, 2552, 14, 272, 408, 272, 1305, 275, 488, 221, 327, 1031, 15, 1418, 730, 536, 272, 574, 275, 488, 221, 327, 1202, 701, 18041, 272, 1642, 275, 3499, 275, 488, 221, 327, 1202, 701, 3123, 3380, 339, 347, 302, 1181, 8, 277, 12, 1798, 304, 267, 327, 12119, 477, 12251, 446, 2797, 315, 2403, 1067, 267, 746, 1798, 14, 705, 63, 533, 8, 288, 298, 1763, 21055, 1543, 83, 7, 315, 642, 3421, 315, 340, 1947, 2122, 450, 291, 14, 344, 267, 776, 339, 347, 29239, 8, 277, 12, 3602, 12, 1798, 304, 267, 327, 29350, 477, 12251, 446, 2797, 315, 315, 970, 1067, 267, 746, 1798, 14, 705, 63, 533, 8, 288, 298, 1763, 21055, 1543, 83, 7, 465, 315, 970, 4182, 315, 340, 1947, 2122, 450, 291, 14, 344, 267, 776, 339, 347, 2929, 8, 277, 304, 267, 408, 267, 1803, 4052, 370, 2929, 315, 1125, 3788, 367, 642, 1031, 267, 408, 267, 372, 291, 14, 344, 339, 347, 636, 2722, 721, 277, 304, 267, 734, 275, 359, 495, 8, 88, 9, 367, 671, 315, 359, 277, 14, 344, 12, 291, 14, 2246, 12, 291, 14, 4375, 61, 340, 671, 365, 440, 488, 61, 267, 372, 26054, 435, 298, 3680, 904, 8, 548, 9, 435, 19607, 421, 199, 318, 315, 970, 8, 10913, 12, 2562, 304, 272, 408, 272, 10560, 376, 315, 970, 4182, 12, 1627, 282, 11696, 7074, 436, 282, 805, 626, 272, 22014, 314, 1031, 272, 408, 272, 1021, 11013, 8, 3264, 1563, 304, 267, 634, 10913, 275, 13292, 398, 347, 29239, 8, 277, 12, 3602, 12, 1798, 304, 288, 291, 14, 2246, 275, 3602, 288, 291, 14, 4375, 275, 1798, 14, 5599, 8, 10913, 9, 288, 372, 291, 398, 347, 3468, 8, 277, 12, 1067, 304, 288, 862, 26, 355, 372, 2562, 8, 1100, 12, 291, 14, 2246, 12, 291, 14, 4375, 9, 288, 871, 2186, 26, 355, 327, 31273, 9296, 1133, 7978, 4967, 1380, 14066, 14, 221, 2136, 787, 355, 327, 4750, 12060, 370, 664, 4967, 367, 7645, 2839, 7749, 340, 3925, 315, 4681, 355, 327, 3674, 2382, 283, 1700, 7, 1630, 440, 2291, 283, 262, 297, 880, 849, 370, 756, 355, 372, 756, 339, 372, 11013, 421, 199, 318, 2403, 8, 10913, 12, 2562, 304, 272, 408, 272, 10560, 282, 2403, 4182, 12, 1627, 282, 11696, 7074, 436, 282, 805, 626, 272, 22014, 314, 1031, 14, 272, 408, 272, 1021, 11013, 8, 3264, 1563, 304, 267, 634, 10913, 275, 13292, 398, 347, 302, 1181, 8, 277, 12, 1798, 304, 288, 291, 14, 2246, 275, 1798, 14, 5599, 8, 10913, 9, 288, 291, 14, 4375, 275, 488, 288, 372, 291, 398, 347, 3468, 8, 277, 12, 1067, 304, 288, 862, 26, 355, 372, 2562, 8, 1100, 12, 291, 14, 2246, 9, 288, 871, 2186, 26, 355, 372, 756, 339, 372, 11013, 421, 199, 3, 11013, 13823, 11924, 2018, 14, 199, 3, 2136, 10133, 1750, 11735, 370, 314, 2400, 370, 4868, 626, 2895, 787, 199, 3, 29667, 3444, 13006, 1808, 2018, 1159, 5046, 6057, 9661, 14, 199, 15598, 19033, 275, 469, 272, 283, 269, 356, 315, 970, 8, 22, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 503, 612, 14, 2579, 8, 1100, 1826, 272, 283, 460, 356, 315, 970, 8, 23, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 436, 612, 14, 2579, 8, 1100, 1826, 272, 283, 1397, 356, 2403, 8, 24, 12, 2400, 1067, 12, 671, 26, 440, 671, 14, 2579, 8, 1100, 1826, 272, 283, 262, 356, 315, 970, 8, 25, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 315, 612, 14, 2579, 8, 1100, 1826, 272, 283, 1397, 315, 356, 315, 970, 8, 25, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 440, 315, 612, 14, 2579, 8, 1100, 1826, 272, 283, 374, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 365, 612, 14, 2579, 8, 1100, 1826, 272, 283, 374, 440, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 365, 440, 612, 14, 2579, 8, 1100, 1826, 272, 283, 389, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 508, 612, 14, 2579, 8, 1100, 1826, 272, 26656, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 1137, 612, 14, 2579, 8, 1100, 1826, 272, 12696, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 690, 612, 14, 2579, 8, 1100, 1826, 272, 283, 8119, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 2356, 612, 14, 2579, 8, 1100, 1826, 272, 2650, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 665, 612, 14, 2579, 8, 1100, 1826, 272, 2650, 18749, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 2695, 612, 14, 2579, 8, 1100, 1826, 199, 93, 199, 199, 3, 16927, 283, 344, 7, 370, 1924, 26, 199, 509, 790, 12, 1687, 315, 29771, 19033, 14, 1744, 837, 272, 1687, 14, 344, 275, 790, 421, 199, 533, 18271, 8, 3264, 1563 ]
[ 199, 2842, 436, 15841, 367, 314, 11179, 283, 692, 7, 1947, 199, 624, 199, 3, 11719, 282, 3486, 2746, 3224, 1798, 12, 465, 11736, 2348, 26, 199, 3, 259, 1455, 921, 3609, 3018, 14, 1308, 15, 2619, 15, 4129, 13, 2119, 13, 2110, 13, 11059, 14, 15575, 14, 199, 3, 283, 1146, 7, 275, 3602, 477, 12251, 199, 3, 283, 78, 1181, 7, 275, 2973, 477, 12251, 199, 3, 283, 10913, 7, 275, 11696, 7074, 334, 3039, 275, 634, 10913, 12, 2451, 275, 519, 10913, 9, 421, 199, 533, 8767, 1563, 8, 785, 304, 272, 408, 272, 3523, 1021, 367, 10211, 436, 18041, 12, 27580, 367, 10201, 436, 367, 7978, 316, 272, 6302, 2552, 14, 272, 408, 272, 1305, 275, 488, 221, 327, 1031, 15, 1418, 730, 536, 272, 574, 275, 488, 221, 327, 1202, 701, 18041, 272, 1642, 275, 3499, 275, 488, 221, 327, 1202, 701, 3123, 3380, 339, 347, 302, 1181, 8, 277, 12, 1798, 304, 267, 327, 12119, 477, 12251, 446, 2797, 315, 2403, 1067, 267, 746, 1798, 14, 705, 63, 533, 8, 288, 298, 1763, 21055, 1543, 83, 7, 315, 642, 3421, 315, 340, 1947, 2122, 450, 291, 14, 344, 267, 776, 339, 347, 29239, 8, 277, 12, 3602, 12, 1798, 304, 267, 327, 29350, 477, 12251, 446, 2797, 315, 315, 970, 1067, 267, 746, 1798, 14, 705, 63, 533, 8, 288, 298, 1763, 21055, 1543, 83, 7, 465, 315, 970, 4182, 315, 340, 1947, 2122, 450, 291, 14, 344, 267, 776, 339, 347, 2929, 8, 277, 304, 267, 408, 267, 1803, 4052, 370, 2929, 315, 1125, 3788, 367, 642, 1031, 267, 408, 267, 372, 291, 14, 344, 339, 347, 636, 2722, 721, 277, 304, 267, 734, 275, 359, 495, 8, 88, 9, 367, 671, 315, 359, 277, 14, 344, 12, 291, 14, 2246, 12, 291, 14, 4375, 61, 340, 671, 365, 440, 488, 61, 267, 372, 26054, 435, 298, 3680, 904, 8, 548, 9, 435, 19607, 421, 199, 318, 315, 970, 8, 10913, 12, 2562, 304, 272, 408, 272, 10560, 376, 315, 970, 4182, 12, 1627, 282, 11696, 7074, 436, 282, 805, 626, 272, 22014, 314, 1031, 272, 408, 272, 1021, 11013, 8, 3264, 1563, 304, 267, 634, 10913, 275, 13292, 398, 347, 29239, 8, 277, 12, 3602, 12, 1798, 304, 288, 291, 14, 2246, 275, 3602, 288, 291, 14, 4375, 275, 1798, 14, 5599, 8, 10913, 9, 288, 372, 291, 398, 347, 3468, 8, 277, 12, 1067, 304, 288, 862, 26, 355, 372, 2562, 8, 1100, 12, 291, 14, 2246, 12, 291, 14, 4375, 9, 288, 871, 2186, 26, 355, 327, 31273, 9296, 1133, 7978, 4967, 1380, 14066, 14, 221, 2136, 787, 355, 327, 4750, 12060, 370, 664, 4967, 367, 7645, 2839, 7749, 340, 3925, 315, 4681, 355, 327, 3674, 2382, 283, 1700, 7, 1630, 440, 2291, 283, 262, 297, 880, 849, 370, 756, 355, 372, 756, 339, 372, 11013, 421, 199, 318, 2403, 8, 10913, 12, 2562, 304, 272, 408, 272, 10560, 282, 2403, 4182, 12, 1627, 282, 11696, 7074, 436, 282, 805, 626, 272, 22014, 314, 1031, 14, 272, 408, 272, 1021, 11013, 8, 3264, 1563, 304, 267, 634, 10913, 275, 13292, 398, 347, 302, 1181, 8, 277, 12, 1798, 304, 288, 291, 14, 2246, 275, 1798, 14, 5599, 8, 10913, 9, 288, 291, 14, 4375, 275, 488, 288, 372, 291, 398, 347, 3468, 8, 277, 12, 1067, 304, 288, 862, 26, 355, 372, 2562, 8, 1100, 12, 291, 14, 2246, 9, 288, 871, 2186, 26, 355, 372, 756, 339, 372, 11013, 421, 199, 3, 11013, 13823, 11924, 2018, 14, 199, 3, 2136, 10133, 1750, 11735, 370, 314, 2400, 370, 4868, 626, 2895, 787, 199, 3, 29667, 3444, 13006, 1808, 2018, 1159, 5046, 6057, 9661, 14, 199, 15598, 19033, 275, 469, 272, 283, 269, 356, 315, 970, 8, 22, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 503, 612, 14, 2579, 8, 1100, 1826, 272, 283, 460, 356, 315, 970, 8, 23, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 436, 612, 14, 2579, 8, 1100, 1826, 272, 283, 1397, 356, 2403, 8, 24, 12, 2400, 1067, 12, 671, 26, 440, 671, 14, 2579, 8, 1100, 1826, 272, 283, 262, 356, 315, 970, 8, 25, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 315, 612, 14, 2579, 8, 1100, 1826, 272, 283, 1397, 315, 356, 315, 970, 8, 25, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 440, 315, 612, 14, 2579, 8, 1100, 1826, 272, 283, 374, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 365, 612, 14, 2579, 8, 1100, 1826, 272, 283, 374, 440, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 365, 440, 612, 14, 2579, 8, 1100, 1826, 272, 283, 389, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 508, 612, 14, 2579, 8, 1100, 1826, 272, 26656, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 1137, 612, 14, 2579, 8, 1100, 1826, 272, 12696, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 690, 612, 14, 2579, 8, 1100, 1826, 272, 283, 8119, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 2356, 612, 14, 2579, 8, 1100, 1826, 272, 2650, 356, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 665, 612, 14, 2579, 8, 1100, 1826, 272, 2650, 18749, 315, 970, 8, 709, 12, 2400, 1067, 12, 671, 12, 612, 26, 671, 14, 2579, 8, 1100, 9, 2695, 612, 14, 2579, 8, 1100, 1826, 199, 93, 199, 199, 3, 16927, 283, 344, 7, 370, 1924, 26, 199, 509, 790, 12, 1687, 315, 29771, 19033, 14, 1744, 837, 272, 1687, 14, 344, 275, 790, 421, 199, 533, 18271, 8, 3264, 1563, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
vganapath/rally
rally/common/fileutils.py
18
3855
# Copyright 2013: Mirantis Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import os import tempfile import zipfile def _read_env_file(path, except_env=None): """Read the environment variable file. :param path: the path of the file :param except_env: the environment variable to avoid in the output :returns: the content of the original file except the line starting with the except_env parameter """ output = [] if os.path.exists(path): with open(path, "r") as env_file: content = env_file.readlines() for line in content: if except_env is None or not line.startswith("%s=" % except_env): output.append(line) return output def load_env_file(path): """Load the environment variable file into os.environ. :param path: the path of the file """ if os.path.exists(path): content = _read_env_file(path) for line in content: (key, sep, value) = line.partition("=") os.environ[key] = value.rstrip() def _rewrite_env_file(path, initial_content): """Rewrite the environment variable file. :param path: the path of the file :param initial_content: the original content of the file """ with open(path, "w+") as env_file: for line in initial_content: env_file.write(line) def update_env_file(path, env_key, env_value): """Update the environment variable file. :param path: the path of the file :param env_key: the key to update :param env_value: the value of the property to update """ output = _read_env_file(path, env_key) output.append("%s=%s" % (env_key, env_value)) _rewrite_env_file(path, output) def update_globals_file(key, value): """Update the globals variables file. :param key: the key to update :param value: the value to update """ dir = os.path.expanduser("~/.rally/") if not os.path.exists(dir): os.makedirs(dir) expanded_path = os.path.join(dir, "globals") update_env_file(expanded_path, key, "%s\n" % value) def pack_dir(source_directory, zip_name=None): """Archive content of the directory into .zip Zip content of the source folder excluding root directory into zip archive. When zip_name is specified it would be used as a destination for the archive otherwise method would try to use temporary file as a destination for the archive. :param source_directory: root of the newly created archive. Directory is added recursively. :param zip_name: destination zip file name. :raises IOError: whenever there is IO issues. :returns: path to the newly created zip archive either specified via zip_name or a temporary one. """ if not zip_name: fp = tempfile.NamedTemporaryFile(delete=False) zip_name = fp.name zipf = zipfile.ZipFile(zip_name, mode="w") try: for root, dirs, files in os.walk(source_directory): for f in files: abspath = os.path.join(root, f) relpath = os.path.relpath(abspath, source_directory) zipf.write(abspath, relpath) finally: zipf.close() return zip_name
apache-2.0
[ 3, 1898, 6171, 26, 603, 723, 4466, 83, 3277, 14, 199, 3, 2900, 5924, 5702, 14, 199, 3, 199, 3, 259, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 259, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 259, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 260, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 259, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 259, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 259, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 259, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 259, 1334, 314, 844, 14, 199, 199, 646, 747, 199, 646, 5549, 199, 646, 10392, 421, 199, 318, 485, 739, 63, 1813, 63, 493, 8, 515, 12, 871, 63, 1813, 29, 403, 304, 272, 408, 3284, 314, 3734, 1750, 570, 14, 339, 520, 635, 931, 26, 314, 931, 402, 314, 570, 272, 520, 635, 871, 63, 1813, 26, 314, 3734, 1750, 370, 5126, 315, 314, 1072, 339, 520, 5808, 26, 314, 1564, 402, 314, 3379, 570, 871, 314, 1004, 6617, 543, 272, 314, 871, 63, 1813, 2725, 272, 408, 272, 1072, 275, 942, 272, 340, 747, 14, 515, 14, 2444, 8, 515, 304, 267, 543, 1551, 8, 515, 12, 298, 82, 531, 465, 2589, 63, 493, 26, 288, 1564, 275, 2589, 63, 493, 14, 9684, 342, 288, 367, 1004, 315, 1564, 26, 355, 340, 871, 63, 1813, 365, 488, 503, 440, 1004, 14, 2460, 3647, 83, 628, 450, 18193, 871, 63, 1813, 304, 490, 1072, 14, 740, 8, 604, 9, 272, 372, 1072, 421, 199, 318, 2248, 63, 1813, 63, 493, 8, 515, 304, 272, 408, 6200, 314, 3734, 1750, 570, 1901, 747, 14, 2314, 14, 339, 520, 635, 931, 26, 314, 931, 402, 314, 570, 272, 408, 272, 340, 747, 14, 515, 14, 2444, 8, 515, 304, 267, 1564, 275, 485, 739, 63, 1813, 63, 493, 8, 515, 9, 267, 367, 1004, 315, 1564, 26, 288, 334, 498, 12, 7375, 12, 574, 9, 275, 1004, 14, 5312, 480, 23758, 288, 747, 14, 2314, 59, 498, 61, 275, 574, 14, 6735, 342, 421, 199, 318, 485, 14366, 63, 1813, 63, 493, 8, 515, 12, 2536, 63, 1317, 304, 272, 408, 497, 952, 314, 3734, 1750, 570, 14, 339, 520, 635, 931, 26, 314, 931, 402, 314, 570, 272, 520, 635, 2536, 63, 1317, 26, 314, 3379, 1564, 402, 314, 570, 272, 408, 272, 543, 1551, 8, 515, 12, 298, 87, 21425, 465, 2589, 63, 493, 26, 267, 367, 1004, 315, 2536, 63, 1317, 26, 288, 2589, 63, 493, 14, 952, 8, 604, 9, 421, 199, 318, 1678, 63, 1813, 63, 493, 8, 515, 12, 2589, 63, 498, 12, 2589, 63, 585, 304, 272, 408, 4152, 314, 3734, 1750, 570, 14, 339, 520, 635, 931, 26, 314, 931, 402, 314, 570, 272, 520, 635, 2589, 63, 498, 26, 314, 790, 370, 1678, 272, 520, 635, 2589, 63, 585, 26, 314, 574, 402, 314, 3324, 370, 1678, 272, 408, 272, 1072, 275, 485, 739, 63, 1813, 63, 493, 8, 515, 12, 2589, 63, 498, 9, 272, 1072, 14, 740, 3647, 83, 2458, 83, 2, 450, 334, 1813, 63, 498, 12, 2589, 63, 585, 430, 272, 485, 14366, 63, 1813, 63, 493, 8, 515, 12, 1072, 9, 421, 199, 318, 1678, 63, 8473, 63, 493, 8, 498, 12, 574, 304, 272, 408, 4152, 314, 7992, 2860, 570, 14, 339, 520, 635, 790, 26, 314, 790, 370, 1678, 272, 520, 635, 574, 26, 314, 574, 370, 1678, 272, 408, 272, 2935, 275, 747, 14, 515, 14, 12131, 20793, 8083, 82, 1183, 13589, 272, 340, 440, 747, 14, 515, 14, 2444, 8, 694, 304, 267, 747, 14, 8347, 8, 694, 9, 272, 11507, 63, 515, 275, 747, 14, 515, 14, 904, 8, 694, 12, 298, 8473, 531, 272, 1678, 63, 1813, 63, 493, 8, 15645, 63, 515, 12, 790, 12, 2071, 83, 60, 78, 2, 450, 574, 9, 421, 199, 318, 1706, 63, 694, 8, 1365, 63, 3619, 12, 3482, 63, 354, 29, 403, 304, 272, 408, 13042, 1564, 402, 314, 2082, 1901, 1275, 3065, 339, 16688, 1564, 402, 314, 1350, 4922, 28529, 1738, 2082, 272, 1901, 3482, 6359, 14, 3979, 3482, 63, 354, 365, 2013, 652, 3955, 506, 1202, 272, 465, 282, 5724, 367, 314, 6359, 4257, 1083, 3955, 272, 862, 370, 675, 7937, 570, 465, 282, 5724, 367, 314, 6359, 14, 339, 520, 635, 1350, 63, 3619, 26, 1738, 402, 314, 13903, 2737, 6359, 14, 267, 15191, 365, 3483, 15035, 14, 272, 520, 635, 3482, 63, 354, 26, 5724, 3482, 570, 536, 14, 272, 520, 3536, 5925, 26, 18119, 2337, 365, 5004, 10876, 14, 272, 520, 5808, 26, 931, 370, 314, 13903, 2737, 3482, 6359, 1902, 2013, 4799, 267, 3482, 63, 354, 503, 282, 7937, 1373, 14, 272, 408, 339, 340, 440, 3482, 63, 354, 26, 267, 4090, 275, 5549, 14, 19320, 8, 1807, 29, 797, 9, 267, 3482, 63, 354, 275, 4090, 14, 354, 272, 3482, 70, 275, 10392, 14, 15016, 8, 3065, 63, 354, 12, 818, 628, 87, 531, 272, 862, 26, 267, 367, 1738, 12, 7606, 12, 1584, 315, 747, 14, 7757, 8, 1365, 63, 3619, 304, 288, 367, 289, 315, 1584, 26, 355, 19529, 275, 747, 14, 515, 14, 904, 8, 1231, 12, 289, 9, 355, 20700, 275, 747, 14, 515, 14, 12405, 8, 4832, 12, 1350, 63, 3619, 9, 355, 3482, 70, 14, 952, 8, 4832, 12, 20700, 9, 272, 3753, 26, 267, 3482, 70, 14, 1600, 342, 272, 372, 3482, 63, 354, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1898, 6171, 26, 603, 723, 4466, 83, 3277, 14, 199, 3, 2900, 5924, 5702, 14, 199, 3, 199, 3, 259, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 1265, 1443, 199, 3, 259, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 2047, 1443, 3332, 199, 3, 259, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 260, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 259, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 259, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 2428, 199, 3, 259, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 1666, 314, 199, 3, 259, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 4204, 199, 3, 259, 1334, 314, 844, 14, 199, 199, 646, 747, 199, 646, 5549, 199, 646, 10392, 421, 199, 318, 485, 739, 63, 1813, 63, 493, 8, 515, 12, 871, 63, 1813, 29, 403, 304, 272, 408, 3284, 314, 3734, 1750, 570, 14, 339, 520, 635, 931, 26, 314, 931, 402, 314, 570, 272, 520, 635, 871, 63, 1813, 26, 314, 3734, 1750, 370, 5126, 315, 314, 1072, 339, 520, 5808, 26, 314, 1564, 402, 314, 3379, 570, 871, 314, 1004, 6617, 543, 272, 314, 871, 63, 1813, 2725, 272, 408, 272, 1072, 275, 942, 272, 340, 747, 14, 515, 14, 2444, 8, 515, 304, 267, 543, 1551, 8, 515, 12, 298, 82, 531, 465, 2589, 63, 493, 26, 288, 1564, 275, 2589, 63, 493, 14, 9684, 342, 288, 367, 1004, 315, 1564, 26, 355, 340, 871, 63, 1813, 365, 488, 503, 440, 1004, 14, 2460, 3647, 83, 628, 450, 18193, 871, 63, 1813, 304, 490, 1072, 14, 740, 8, 604, 9, 272, 372, 1072, 421, 199, 318, 2248, 63, 1813, 63, 493, 8, 515, 304, 272, 408, 6200, 314, 3734, 1750, 570, 1901, 747, 14, 2314, 14, 339, 520, 635, 931, 26, 314, 931, 402, 314, 570, 272, 408, 272, 340, 747, 14, 515, 14, 2444, 8, 515, 304, 267, 1564, 275, 485, 739, 63, 1813, 63, 493, 8, 515, 9, 267, 367, 1004, 315, 1564, 26, 288, 334, 498, 12, 7375, 12, 574, 9, 275, 1004, 14, 5312, 480, 23758, 288, 747, 14, 2314, 59, 498, 61, 275, 574, 14, 6735, 342, 421, 199, 318, 485, 14366, 63, 1813, 63, 493, 8, 515, 12, 2536, 63, 1317, 304, 272, 408, 497, 952, 314, 3734, 1750, 570, 14, 339, 520, 635, 931, 26, 314, 931, 402, 314, 570, 272, 520, 635, 2536, 63, 1317, 26, 314, 3379, 1564, 402, 314, 570, 272, 408, 272, 543, 1551, 8, 515, 12, 298, 87, 21425, 465, 2589, 63, 493, 26, 267, 367, 1004, 315, 2536, 63, 1317, 26, 288, 2589, 63, 493, 14, 952, 8, 604, 9, 421, 199, 318, 1678, 63, 1813, 63, 493, 8, 515, 12, 2589, 63, 498, 12, 2589, 63, 585, 304, 272, 408, 4152, 314, 3734, 1750, 570, 14, 339, 520, 635, 931, 26, 314, 931, 402, 314, 570, 272, 520, 635, 2589, 63, 498, 26, 314, 790, 370, 1678, 272, 520, 635, 2589, 63, 585, 26, 314, 574, 402, 314, 3324, 370, 1678, 272, 408, 272, 1072, 275, 485, 739, 63, 1813, 63, 493, 8, 515, 12, 2589, 63, 498, 9, 272, 1072, 14, 740, 3647, 83, 2458, 83, 2, 450, 334, 1813, 63, 498, 12, 2589, 63, 585, 430, 272, 485, 14366, 63, 1813, 63, 493, 8, 515, 12, 1072, 9, 421, 199, 318, 1678, 63, 8473, 63, 493, 8, 498, 12, 574, 304, 272, 408, 4152, 314, 7992, 2860, 570, 14, 339, 520, 635, 790, 26, 314, 790, 370, 1678, 272, 520, 635, 574, 26, 314, 574, 370, 1678, 272, 408, 272, 2935, 275, 747, 14, 515, 14, 12131, 20793, 8083, 82, 1183, 13589, 272, 340, 440, 747, 14, 515, 14, 2444, 8, 694, 304, 267, 747, 14, 8347, 8, 694, 9, 272, 11507, 63, 515, 275, 747, 14, 515, 14, 904, 8, 694, 12, 298, 8473, 531, 272, 1678, 63, 1813, 63, 493, 8, 15645, 63, 515, 12, 790, 12, 2071, 83, 60, 78, 2, 450, 574, 9, 421, 199, 318, 1706, 63, 694, 8, 1365, 63, 3619, 12, 3482, 63, 354, 29, 403, 304, 272, 408, 13042, 1564, 402, 314, 2082, 1901, 1275, 3065, 339, 16688, 1564, 402, 314, 1350, 4922, 28529, 1738, 2082, 272, 1901, 3482, 6359, 14, 3979, 3482, 63, 354, 365, 2013, 652, 3955, 506, 1202, 272, 465, 282, 5724, 367, 314, 6359, 4257, 1083, 3955, 272, 862, 370, 675, 7937, 570, 465, 282, 5724, 367, 314, 6359, 14, 339, 520, 635, 1350, 63, 3619, 26, 1738, 402, 314, 13903, 2737, 6359, 14, 267, 15191, 365, 3483, 15035, 14, 272, 520, 635, 3482, 63, 354, 26, 5724, 3482, 570, 536, 14, 272, 520, 3536, 5925, 26, 18119, 2337, 365, 5004, 10876, 14, 272, 520, 5808, 26, 931, 370, 314, 13903, 2737, 3482, 6359, 1902, 2013, 4799, 267, 3482, 63, 354, 503, 282, 7937, 1373, 14, 272, 408, 339, 340, 440, 3482, 63, 354, 26, 267, 4090, 275, 5549, 14, 19320, 8, 1807, 29, 797, 9, 267, 3482, 63, 354, 275, 4090, 14, 354, 272, 3482, 70, 275, 10392, 14, 15016, 8, 3065, 63, 354, 12, 818, 628, 87, 531, 272, 862, 26, 267, 367, 1738, 12, 7606, 12, 1584, 315, 747, 14, 7757, 8, 1365, 63, 3619, 304, 288, 367, 289, 315, 1584, 26, 355, 19529, 275, 747, 14, 515, 14, 904, 8, 1231, 12, 289, 9, 355, 20700, 275, 747, 14, 515, 14, 12405, 8, 4832, 12, 1350, 63, 3619, 9, 355, 3482, 70, 14, 952, 8, 4832, 12, 20700, 9, 272, 3753, 26, 267, 3482, 70, 14, 1600, 342, 272, 372, 3482, 63, 354, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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,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